Skip to content

Commit

Permalink
Add option to configure the locale used for stripe elements
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jun 30, 2022
1 parent 8200995 commit 96d9544
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions language/en/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@
'label_test_publishable_key' => 'Test Publishable Key',
'label_live_secret_key' => 'Live Secret Key',
'label_live_publishable_key' => 'Live Publishable Key',
'label_locale_code' => 'Locale Code',
'label_priority' => 'Priority',
'label_status' => 'Status',

'help_locale_code' => 'See <a href="https://stripe.com/docs/js/appendix/supported_locales">Stripe.js supported locales</a',
],

'mollie' => [
Expand Down
2 changes: 1 addition & 1 deletion payments/Stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function completesPaymentOnClient()
public function getStripeJsOptions($order)
{
$options = [
'locale' => app()->getLocale(),
'locale' => $this->model->locale ?? app()->getLocale(),
];

$eventResult = $this->fireSystemEvent('payregister.stripe.extendJsOptions', [$options, $order], false);
Expand Down
9 changes: 8 additions & 1 deletion payments/stripe/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@
'condition' => 'value[test]',
],
],
'locale_code' => [
'label' => 'lang:igniter.payregister::default.stripe.label_locale_code',
'type' => 'text',
'span' => 'left',
],
'order_fee_type' => [
'label' => 'lang:igniter.payregister::default.label_order_fee_type',
'type' => 'radiotoggle',
'span' => 'left',
'span' => 'right',
'cssClass' => 'flex-width',
'default' => 1,
'options' => [
1 => 'lang:admin::lang.menus.text_fixed_amount',
Expand All @@ -80,6 +86,7 @@
'label' => 'lang:igniter.payregister::default.label_order_fee',
'type' => 'currency',
'span' => 'right',
'cssClass' => 'flex-width',
'default' => 0,
'comment' => 'lang:igniter.payregister::default.help_order_fee',
],
Expand Down

0 comments on commit 96d9544

Please sign in to comment.