Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Stripe Import
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe Import
Commits
30fe27e1
Commit
30fe27e1
authored
1 year ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Add StartImport event
parent
096bff37
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Civi/StripeImport/Event/StartImportEvent.php
+56
-0
56 additions, 0 deletions
Civi/StripeImport/Event/StartImportEvent.php
Civi/StripeImport/Subscription.php
+10
-0
10 additions, 0 deletions
Civi/StripeImport/Subscription.php
with
66 additions
and
0 deletions
Civi/StripeImport/Event/StartImportEvent.php
0 → 100644
+
56
−
0
View file @
30fe27e1
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
namespace
Civi\StripeImport\Event
;
/**
* This event is fired whenever an import for a stripe object is started.
*/
class
StartImportEvent
extends
\Civi\Core\Event\GenericHookEvent
{
/**
* The CiviCRM payment processor ID
*
* @var int
*/
public
int
$paymentProcessorID
;
/**
* The Stripe Object ID. Eg. if $importType='subscription' then ObjectID = Stripe SubscriptionID.
* @var string
*/
public
string
$stripeObjectID
;
/**
* One of: 'subscription', ... to be confirmed.
* @var string
*/
public
string
$importType
;
/**
* The membership ID to use
*
* @var int
*/
public
int
$membershipID
;
/**
* @param int $paymentProcessorID
* @param string $stripeObjectID
* @param string $importType
*/
public
function
__construct
(
int
$paymentProcessorID
,
string
$stripeObjectID
,
string
$importType
)
{
$this
->
paymentProcessorID
=
$paymentProcessorID
;
$this
->
stripeObjectID
=
$stripeObjectID
;
$this
->
importType
=
$importType
;
}
}
This diff is collapsed.
Click to expand it.
Civi/StripeImport/Subscription.php
+
10
−
0
View file @
30fe27e1
...
@@ -9,6 +9,7 @@ use Civi\Api4\Membership;
...
@@ -9,6 +9,7 @@ use Civi\Api4\Membership;
use
Civi\Api4\PriceField
;
use
Civi\Api4\PriceField
;
use
Civi\Api4\PriceFieldValue
;
use
Civi\Api4\PriceFieldValue
;
use
Civi\StripeImport\Event\MembershipAutoEvent
;
use
Civi\StripeImport\Event\MembershipAutoEvent
;
use
Civi\StripeImport\Event\StartImportEvent
;
use
CRM_StripeImport_ExtensionUtil
as
E
;
use
CRM_StripeImport_ExtensionUtil
as
E
;
class
Subscription
extends
Base
{
class
Subscription
extends
Base
{
...
@@ -113,6 +114,15 @@ class Subscription extends Base {
...
@@ -113,6 +114,15 @@ class Subscription extends Base {
* @throws \Stripe\Exception\ApiErrorException
* @throws \Stripe\Exception\ApiErrorException
*/
*/
public
function
importOne
():
array
{
public
function
importOne
():
array
{
\Civi
::
dispatcher
()
->
dispatch
(
'civi.stripeimport.startimport'
,
new
StartImportEvent
(
$this
->
getPaymentProcessorID
(),
$this
->
getStripeSubscriptionID
(),
'subscription'
,
)
);
// Get the subscription from Stripe
// Get the subscription from Stripe
$stripeSubscription
=
$this
->
paymentProcessor
->
stripeClient
->
subscriptions
->
retrieve
(
$stripeSubscription
=
$this
->
paymentProcessor
->
stripeClient
->
subscriptions
->
retrieve
(
$this
->
getStripeSubscriptionID
(),
$this
->
getStripeSubscriptionID
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment