Skip to content

Commit

Permalink
#82 Update pending refunds to be marked as processing
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Sep 25, 2024
1 parent 89b11ef commit 0ff1418
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for PayPal Checkout for Craft Commerce

## Unreleased

- Fixed a bug where refunds could be incorrectly marked as failed. ([#82](https://github.com/craftcms/commerce-paypal-checkout/issues/82))

## 2.1.3 - 2023-06-27 [CRITICAL]

- Added `craft\commerce\paypalcheckout\gateways\Gateway::showPaymentFormSubmitButton()`.
Expand Down
6 changes: 5 additions & 1 deletion src/responses/RefundResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function isSuccessful(): bool
*/
public function isProcessing(): bool
{
return false;
return $this->data && isset($this->data->result->status) && $this->data->result->status == 'PENDING';
}

/**
Expand Down Expand Up @@ -132,6 +132,10 @@ public function getMessage(): string
return $this->data->result['message'];
}

if (is_array($this->data->result) && isset($this->data->result['status_details']['reason'])) {
return $this->data->result['status_details']['reason'];
}

if (isset($this->data->result->message)) {
return $this->data->result->message ?? '';
}
Expand Down

0 comments on commit 0ff1418

Please sign in to comment.