Skip to content

Commit 3e16e85

Browse files
committed
Reorder code to read a little more logically
1 parent d2dce6c commit 3e16e85

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gateways/PaymentIntents.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ public function getPaymentFormHtml(array $params): ?string
171171

172172
$view->registerScript('', View::POS_END, ['src' => 'https://js.stripe.com/v3/']); // we need this to load at end of body
173173

174-
$templatePath = ($params['paymentFormType'] == self::PAYMENT_FORM_TYPE_CHECKOUT)
175-
? 'commerce-stripe/paymentForms/checkoutForm'
176-
: 'commerce-stripe/paymentForms/elementsForm';
177-
178174
if ($params['paymentFormType'] == self::PAYMENT_FORM_TYPE_ELEMENTS) {
179175
$view->registerAssetBundle(ElementsFormAsset::class);
180176
}
181177

182178
// Template mode needs to be CP for the payment form to work
183179
$view->setTemplateMode(View::TEMPLATE_MODE_CP);
184180

181+
$templatePath = ($params['paymentFormType'] == self::PAYMENT_FORM_TYPE_CHECKOUT)
182+
? 'commerce-stripe/paymentForms/checkoutForm'
183+
: 'commerce-stripe/paymentForms/elementsForm';
184+
185185
$html = $view->renderTemplate($templatePath, $params);
186186

187187
$view->setTemplateMode($previousMode);
@@ -227,7 +227,7 @@ public function completePurchase(Transaction $transaction): RequestResponseInter
227227
$paymentIntentOptions = [
228228
'expand' => ['payment_method'],
229229
];
230-
230+
231231
if ($data['object'] == 'payment_intent') {
232232
$paymentIntent = $this->getStripeClient()->paymentIntents->retrieve($data['id'], $paymentIntentOptions);
233233
} else {

0 commit comments

Comments
 (0)