Skip to content

Commit f2e14ea

Browse files
authored
Merge pull request #1 from craftcms/develop
Syncing upstream
2 parents 838d68e + 60ceaea commit f2e14ea

File tree

5 files changed

+37
-41
lines changed

5 files changed

+37
-41
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "craftcms/commerce-stripe",
3-
"description": "Stripe integration for Craft Commerce 2",
3+
"description": "Stripe integration for Craft Commerce 2 & 3",
44
"version": "2.2.3",
55
"type": "craft-plugin",
66
"keywords": [

src/base/SubscriptionGateway.php

+27-29
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,33 @@ public function previewSwitchCost(Subscription $subscription, BasePlan $plan): f
462462
return $currency ? $invoice->total / (10 ** $currency->minorUnit) : $invoice->total;
463463
}
464464

465+
/**
466+
* @inheritdoc
467+
*/
468+
public function handleWebhook(array $data)
469+
{
470+
switch ($data['type']) {
471+
case 'plan.deleted':
472+
case 'plan.updated':
473+
$this->handlePlanEvent($data);
474+
break;
475+
case 'invoice.payment_succeeded':
476+
$this->handleInvoiceSucceededEvent($data);
477+
break;
478+
case 'invoice.created':
479+
$this->handleInvoiceCreated($data);
480+
break;
481+
case 'customer.subscription.deleted':
482+
$this->handleSubscriptionExpired($data);
483+
break;
484+
case 'customer.subscription.updated':
485+
$this->handleSubscriptionUpdated($data);
486+
break;
487+
}
488+
489+
parent::handleWebhook($data);
490+
}
491+
465492
// Protected methods
466493
// =========================================================================
467494

@@ -715,33 +742,4 @@ protected function saveSubscriptionInvoice(array $stripeInvoice, Subscription $s
715742

716743
return $invoice;
717744
}
718-
719-
/**
720-
* @inheritdoc
721-
*/
722-
protected function handleWebhook(array $data)
723-
{
724-
switch ($data['type']) {
725-
case 'plan.deleted':
726-
case 'plan.updated':
727-
$this->handlePlanEvent($data);
728-
break;
729-
case 'invoice.payment_succeeded':
730-
$this->handleInvoiceSucceededEvent($data);
731-
break;
732-
case 'invoice.created':
733-
$this->handleInvoiceCreated($data);
734-
break;
735-
case 'customer.subscription.deleted':
736-
$this->handleSubscriptionExpired($data);
737-
break;
738-
case 'customer.subscription.updated':
739-
$this->handleSubscriptionUpdated($data);
740-
break;
741-
}
742-
743-
parent::handleWebhook($data);
744-
}
745-
746-
747745
}

src/gateways/Gateway.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,20 @@ public function getHasBillingIssues(Subscription $subscription): bool
259259
throw new NotImplementedException('This gateway does not support that functionality');
260260
}
261261

262-
263-
// Protected methods
264-
// =========================================================================
265-
266262
/**
267263
* @inheritdoc
268264
*/
269-
protected function handleWebhook(array $data) {
265+
public function handleWebhook(array $data) {
270266
if (!empty($data['data']['object']['metadata']['three_d_secure_flow'])) {
271267
$this->handle3DSecureFlowEvent($data);
272268
}
273269

274270
parent::handleWebhook($data);
275271
}
276272

273+
// Protected methods
274+
// =========================================================================
275+
277276
/**
278277
* Handle a 3D Secure related event.
279278
*

src/gateways/PaymentIntents.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,10 @@ public function getHasBillingIssues(Subscription $subscription): bool
398398
return in_array($subscriptionData['status'], ['incomplete', 'past_due', 'unpaid']) && in_array($intentData['status'], ['requires_payment_method', 'requires_confirmation', 'requires_action']);
399399
}
400400

401-
402-
// Protected methods
403-
// =========================================================================
404-
405401
/**
406402
* @inheritdoc
407403
*/
408-
protected function handleWebhook(array $data)
404+
public function handleWebhook(array $data)
409405
{
410406
switch ($data['type']) {
411407
case 'invoice.payment_failed':
@@ -416,6 +412,9 @@ protected function handleWebhook(array $data)
416412
parent::handleWebhook($data);
417413
}
418414

415+
// Protected methods
416+
// =========================================================================
417+
419418
/**
420419
* Handle a failed invoice by updating the subscription data for the subscription it failed.
421420
* @param $data

src/web/assets/intentsform/js/paymentForm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function PaymentIntents(publishableKey, container) {
4040
var style = {
4141
base: {
4242
// Add your base input styles here. For example:
43-
fontSize: '14px',
43+
fontSize: '16px',
4444
lineHeight: '21px'
4545
}
4646
};

0 commit comments

Comments
 (0)