Skip to content

Commit

Permalink
Stripe wallet - fixed int values for special amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaj committed Nov 17, 2021
1 parent cdf2ac9 commit 9cf8699
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/models/StripeWalletClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function createIntent(ActiveRow $payment): PaymentIntent
$this->initStripe();

return PaymentIntent::create([
'amount' => $payment->amount * 100,
'amount' => intval($payment->amount * 100),
'currency' => $this->applicationConfig->get('currency'),
'metadata' => [
"source" => "crm",
Expand Down
3 changes: 2 additions & 1 deletion src/presenters/StripeWalletPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function renderDefault($id)
foreach ($payment->related('payment_items') as $item) {
$displayItems[] = [
"label" => $item->name,
"amount" => $item->amount * 100,
"amount" => intval($item->amount * 100),
];
}

Expand All @@ -41,6 +41,7 @@ public function renderDefault($id)
'paymentIntentSecret' => $intent->client_secret,
'stripePublishableKey' => $this->applicationConfig->get('stripe_publishable'),
'payment' => $payment,
'totalAmount' => intval($payment->amount * 100),
'displayName' => $this->applicationConfig->get('stripe_wallet_display_name'),
'displayItems' => $displayItems,
'confirmUrl' => $this->link("confirm", $payment->variable_symbol, $intent->id),
Expand Down
2 changes: 1 addition & 1 deletion src/templates/StripeWallet/default.latte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
currency: {$currencyCode|lower},
total: {
label: {$displayName},
amount: {$payment->amount * 100},
amount: {$totalAmount},
},
displayItems: {$displayItems},
customer: {$payment->user_id},
Expand Down

0 comments on commit 9cf8699

Please sign in to comment.