mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
support stripe currency
This commit is contained in:
parent
e73eaea66c
commit
a3837f83cb
@ -50,6 +50,7 @@ class ConfigController extends Controller
|
||||
'stripe_alipay_enable' => (int)config('v2board.stripe_alipay_enable'),
|
||||
'stripe_wepay_enable' => (int)config('v2board.stripe_wepay_enable'),
|
||||
'stripe_webhook_key' => config('v2board.stripe_webhook_key'),
|
||||
'stripe_currency' => config('v2board.stripe_currency', 'hkd'),
|
||||
// bitpayx
|
||||
'bitpayx_enable' => config('v2board.bitpayx_enable'),
|
||||
'bitpayx_appsecret' => config('v2board.bitpayx_appsecret'),
|
||||
|
@ -406,14 +406,15 @@ class OrderController extends Controller
|
||||
|
||||
private function stripeAlipay($order)
|
||||
{
|
||||
$exchange = Helper::exchange('CNY', 'HKD');
|
||||
$currency = config('stripe_currency', 'hkd');
|
||||
$exchange = Helper::exchange('CNY', strtoupper($currency));
|
||||
if (!$exchange) {
|
||||
abort(500, '货币转换超时,请稍后再试');
|
||||
}
|
||||
Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||
$source = Source::create([
|
||||
'amount' => floor($order->total_amount * $exchange),
|
||||
'currency' => 'hkd',
|
||||
'currency' => $currency,
|
||||
'type' => 'alipay',
|
||||
'redirect' => [
|
||||
'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order'
|
||||
@ -431,14 +432,15 @@ class OrderController extends Controller
|
||||
|
||||
private function stripeWepay($order)
|
||||
{
|
||||
$exchange = Helper::exchange('CNY', 'HKD');
|
||||
$currency = config('stripe_currency', 'hkd');
|
||||
$exchange = Helper::exchange('CNY', strtoupper($currency));
|
||||
if (!$exchange) {
|
||||
abort(500, '货币转换超时,请稍后再试');
|
||||
}
|
||||
Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||
$source = Source::create([
|
||||
'amount' => floor($order->total_amount * $exchange),
|
||||
'currency' => 'hkd',
|
||||
'currency' => $currency,
|
||||
'type' => 'wechat',
|
||||
'redirect' => [
|
||||
'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order'
|
||||
|
@ -41,6 +41,7 @@ class ConfigSave extends FormRequest
|
||||
'stripe_sk_live' => '',
|
||||
'stripe_pk_live' => '',
|
||||
'stripe_webhook_key' => '',
|
||||
'stripe_currency' => 'in:hkd,usd,sgd',
|
||||
// bitpayx
|
||||
'bitpayx_enable' => 'in:0,1',
|
||||
'bitpayx_appsecret' => '',
|
||||
|
Loading…
Reference in New Issue
Block a user