Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
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
Model registry
Operate
Environments
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
Commits
6a324107
Commit
6a324107
authored
4 years ago
by
Jamie McClelland
Committed by
mattwire
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
new api method to retry all charges that are not updated in Civi
parent
bf2c6e90
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!152
6.6 to master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/v3/Stripe/Retryall.php
+70
-0
70 additions, 0 deletions
api/v3/Stripe/Retryall.php
docs/api.md
+4
-0
4 additions, 0 deletions
docs/api.md
with
74 additions
and
0 deletions
api/v3/Stripe/Retryall.php
0 → 100644
+
70
−
0
View file @
6a324107
<?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 |
+--------------------------------------------------------------------+
*/
/**
* This api retries all non-processed webhooks for a given payment processor.
*
/**
* Stripe.Ipn API specification
*
* @param array $spec description of fields supported by this API call
*/
function
_civicrm_api3_stripe_Retryall_spec
(
&
$spec
)
{
$spec
[
'ppid'
][
'title'
]
=
ts
(
"The payment processor to use."
);
$spec
[
'ppid'
][
'required'
]
=
TRUE
;
$spec
[
'limit'
][
'title'
]
=
ts
(
"Limit the number of unprocessed events to retry."
);
$spec
[
'limit'
][
'api.default'
]
=
25
;
}
/**
* Stripe.Retryall API
*
* @param array $params
*
* @return array
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
*/
function
civicrm_api3_stripe_Retryall
(
$params
)
{
$limit
=
$params
[
'limit'
];
$ppid
=
$params
[
'ppid'
];
$params
=
[
'ppid'
=>
$ppid
,
'limit'
=>
$limit
,
'filter_processed'
=>
1
,
'source'
=>
'systemlog'
];
$values
=
[];
$results
=
civicrm_api3
(
'Stripe'
,
'ListEvents'
,
$params
);
foreach
(
$results
[
'values'
]
as
$value
)
{
if
(
!
isset
(
$value
[
'system_log_id'
]))
{
$values
[]
=
'system_log_id is not set for charge: '
.
$value
[
'charge'
];
}
else
{
$params
=
[
'ppid'
=>
$ppid
,
'id'
=>
$value
[
'system_log_id'
],
'suppressreceipt'
=>
1
,
];
$ipn_results
=
civicrm_api3
(
'Stripe'
,
'Ipn'
,
$params
);
if
(
$ipn_results
[
'is_error'
]
==
0
)
{
$values
[]
=
'Successfully processed charge: '
.
$value
[
'charge'
];
}
else
{
$values
[]
=
'Failed to process charge: '
.
$value
[
'charge'
]
.
'Results follows. '
.
print_r
(
$ipn_results
,
TRUE
);
}
}
}
return
civicrm_api3_create_success
(
$values
);
}
This diff is collapsed.
Click to expand it.
docs/api.md
+
4
−
0
View file @
6a324107
...
...
@@ -25,6 +25,10 @@ The api commands are:
*
`ppid`
- Use the given Payment Processor ID. By default, uses the saved, live Stripe payment processor and throws an error if there is more than one.
*
`noreceipt`
- Set to 1 if you want to suppress the generation of receipts or set to 0 or leave out to send receipts normally.
*
`Stripe.Retryall`
: Attempt to replay all charges for a given payment processor that are completed in Stripe but not completed in CiviCRM.
*
`ppid`
- Use the given Payment Processor ID. By default, uses the saved, live Stripe payment processor and throws an error if there is more than one.
*
`limit`
- Limit number of results (25 is default).
*
`Stripe.Cleanup`
: Cleanup and remove old database tables/fields that are no longer required.
### Import related.
...
...
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