Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
Expand on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Lott / Artful Robot committed Feb 4, 2020
1 parent adef75d commit 72b0a30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions CRM/GoCardless/Page/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,26 @@ public function doPaymentsConfirmed($event) {

// Now call Payment.create. This will call Contribution.completetransaction internally
civicrm_api3('Payment', 'create', [
'contribution_id' => $contribution['id'],
'total_amount' => $contribution['total_amount'],
'trxn_date' => $payment->charge_date,
'trxn_id' => $payment->id,
'is_send_contribution_notification' => 0,
'contribution_id' => $contribution['id'],
'total_amount' => $contribution['total_amount'],
'trxn_date' => $payment->charge_date,
'trxn_id' => $payment->id,
'is_send_contribution_notification' => $contribution['is_email_receipt'],
]);
// @todo: At this point we want to save the trxn_id and receive_date to the contribution.
// But Payment.create only passes contribution ID, is_send_contribution_notification and is_post_payment_create
// Of these params for Payment.create, only contribution_id and
// is_send_contribution_notification are passed on to the
// Contribution.completetranscation API.
//
// We want to save the trxn_id and receive_date to the contribution, so
// we do this directly now. It would be more efficient if the core API
// allowed passing in this data to avoid a 2nd call.
$fixContributionParams = [
'id' => $contribution['id'],
'trxn_id' => $payment->id,
'id' => $contribution['id'],
'trxn_id' => $payment->id,
'receive_date' => $payment->charge_date,
];
civicrm_api3('Contribution', 'create', $fixContributionParams);

// We're done here.
return;
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ to build a tool for their own needs from that.

### 1.9.2

- Move to `Payment.create` API instead of older (and deprecated) `Contribution.completetransaction` API. #70 (Thanks @mattwire) xxx not yet merged xxx
- Move to `Payment.create` API instead of older (and deprecated) `Contribution.completetransaction` API. #70 (Thanks @mattwire). This fixes [issue #63](https://github.com/artfulrobot/uk.artfulrobot.civicrm.gocardless/issues/63) on some sites where the first contribution never gets completed.

- Fix some issues with the system checks (#69 thanks @mattwire)

Expand Down

0 comments on commit 72b0a30

Please sign in to comment.