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