mirror of
https://github.com/v2board/v2board.git
synced 2025-01-25 15:39:10 +08:00
update
This commit is contained in:
parent
db9743a67f
commit
9fc4a6129c
@ -52,7 +52,11 @@ class ConfigController extends Controller
|
|||||||
'stripe_webhook_key' => config('v2board.stripe_webhook_key'),
|
'stripe_webhook_key' => config('v2board.stripe_webhook_key'),
|
||||||
// bitpayx
|
// bitpayx
|
||||||
'bitpayx_enable' => config('v2board.bitpayx_enable'),
|
'bitpayx_enable' => config('v2board.bitpayx_enable'),
|
||||||
'bitpayx_appsecret' => config('v2board.bitpayx_appsecret')
|
'bitpayx_appsecret' => config('v2board.bitpayx_appsecret'),
|
||||||
|
// paytaro
|
||||||
|
'paytaro_enable' => config('v2board.paytaro_enable'),
|
||||||
|
'paytaro_app_id' => config('v2board.paytaro_app_id'),
|
||||||
|
'paytaro_app_secret' => config('v2board.paytaro_app_secret')
|
||||||
],
|
],
|
||||||
'server' => [
|
'server' => [
|
||||||
'server_token' => config('v2board.server_token')
|
'server_token' => config('v2board.server_token')
|
||||||
|
@ -17,6 +17,7 @@ use Omnipay\Omnipay;
|
|||||||
use Stripe\Stripe;
|
use Stripe\Stripe;
|
||||||
use Stripe\Source;
|
use Stripe\Source;
|
||||||
use Library\BitpayX;
|
use Library\BitpayX;
|
||||||
|
use Library\PayTaro;
|
||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
@ -220,6 +221,14 @@ class OrderController extends Controller
|
|||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => $this->bitpayX($order)
|
'data' => $this->bitpayX($order)
|
||||||
]);
|
]);
|
||||||
|
case 5:
|
||||||
|
if (!(int)config('v2board.paytaro_enable')) {
|
||||||
|
abort(500, '支付方式不可用');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'type' => 1,
|
||||||
|
'data' => $this->payTaro($order)
|
||||||
|
]);
|
||||||
default:
|
default:
|
||||||
abort(500, '支付方式不存在');
|
abort(500, '支付方式不存在');
|
||||||
}
|
}
|
||||||
@ -274,6 +283,14 @@ class OrderController extends Controller
|
|||||||
array_push($data, $bitpayX);
|
array_push($data, $bitpayX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((int)config('v2board.paytaro_enable')) {
|
||||||
|
$obj = new \StdClass();
|
||||||
|
$obj->name = '支付宝';
|
||||||
|
$obj->method = 5;
|
||||||
|
$obj->icon = 'alipay';
|
||||||
|
array_push($data, $obj);
|
||||||
|
}
|
||||||
|
|
||||||
return response([
|
return response([
|
||||||
'data' => $data
|
'data' => $data
|
||||||
]);
|
]);
|
||||||
@ -394,4 +411,17 @@ class OrderController extends Controller
|
|||||||
Log::info('bitpayXSubmit: ' . json_encode($result));
|
Log::info('bitpayXSubmit: ' . json_encode($result));
|
||||||
return isset($result['payment_url']) ? $result['payment_url'] : false;
|
return isset($result['payment_url']) ? $result['payment_url'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function payTaro($order)
|
||||||
|
{
|
||||||
|
$payTaro = new PayTaro(config('v2board.paytaro_app_id'), config('v2board.paytaro_app_secret'));
|
||||||
|
$result = $payTaro->pay([
|
||||||
|
'app_id' => config('v2board.paytaro_app_id'),
|
||||||
|
'out_trade_no' => $order->trade_no,
|
||||||
|
'total_amount' => $order->total_amount,
|
||||||
|
'notify_url' => url('/api/v1/guest/order/payTaroNotify'),
|
||||||
|
'return_url' => url('/api/v1/guest/order/payTaroReturn')
|
||||||
|
]);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ class ConfigSave extends FormRequest
|
|||||||
// bitpayx
|
// bitpayx
|
||||||
'bitpayx_enable' => 'in:0,1',
|
'bitpayx_enable' => 'in:0,1',
|
||||||
'bitpayx_appsecret' => '',
|
'bitpayx_appsecret' => '',
|
||||||
|
// paytaro
|
||||||
|
'paytaro_enable' => 'in:0,1',
|
||||||
|
'paytaro_app_id' => '',
|
||||||
|
'paytaro_app_secret' => '',
|
||||||
// tutorial
|
// tutorial
|
||||||
'apple_id' => 'email',
|
'apple_id' => 'email',
|
||||||
'apple_id_password' => ''
|
'apple_id_password' => ''
|
||||||
|
@ -22,16 +22,15 @@ class PayTaro
|
|||||||
$params['sign'] = md5($str);
|
$params['sign'] = md5($str);
|
||||||
$curl = new Curl();
|
$curl = new Curl();
|
||||||
$curl->post('http://api.paytaro.com/v1/gateway/fetch', http_build_query($params));
|
$curl->post('http://api.paytaro.com/v1/gateway/fetch', http_build_query($params));
|
||||||
var_dump($str, $params, $curl->response);exit;
|
|
||||||
if ($curl->error) {
|
if ($curl->error) {
|
||||||
abort(500, '接口请求失败');
|
abort(500, '接口请求失败');
|
||||||
}
|
}
|
||||||
$result = json_decode($curl->response);
|
$result = $curl->response;
|
||||||
$curl->close();
|
$curl->close();
|
||||||
if ($result->code !== 1) {
|
if (!isset($result->data->trade_no)) {
|
||||||
abort(500, '接口请求失败');
|
abort(500, '接口请求失败');
|
||||||
}
|
}
|
||||||
return $result->code_url;
|
return $result->data->pay_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verify($params)
|
public function verify($params)
|
||||||
|
Loading…
Reference in New Issue
Block a user