Mepps has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382513 )
Change subject: Handle payment not initiated
......................................................................
Handle payment not initiated
Change-Id: I36571d680a508a9e9acf1f993dd14409813eec6b
---
M paypal_gateway/express_checkout/paypal_express.adapter.php
1 file changed, 24 insertions(+), 16 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/13/382513/1
diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index a509b37..723d105 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -440,6 +440,12 @@
case 'GetExpressCheckoutDetails':
$this->checkResponseAck( $response );
+ if
(response['CHECKOUT_STATUS']==='PaymentActionNotInitiated') {
+
$this->finalizeInternalStatus(FinalStatus::CANCELLED);
+ break;
+ }
+
+
// Merge response into our transaction data.
// TODO: Use getFormattedData instead.
// FIXME: We don't want to allow overwriting of
ctid, need a
@@ -555,22 +561,24 @@
ResponseCodes::UNKNOWN );
}
- if ( $this->getData_Unstaged_Escaped( 'recurring' ) ) {
- // Set up recurring billing agreement.
- $this->addRequestData( array(
- 'date' => time()
- ) );
- $resultData = $this->do_transaction(
'CreateRecurringPaymentsProfile' );
- if ( !$resultData->getCommunicationStatus() ) {
- throw new ResponseProcessingException(
- 'Failed to create a recurring profile',
ResponseCodes::UNKNOWN );
- }
- } else {
- // One-time payment, or initial payment in a
subscription.
- $resultData = $this->do_transaction(
'DoExpressCheckoutPayment' );
- if ( !$resultData->getCommunicationStatus() ) {
- $this->finalizeInternalStatus(
FinalStatus::FAILED );
- return PaymentResult::newFailure();
+ if ( !$this->getFinalStatus() ) {
+ if ($this->getData_Unstaged_Escaped('recurring')) {
+ // Set up recurring billing agreement.
+ $this->addRequestData(array(
+ 'date' => time()
+ ));
+ $resultData =
$this->do_transaction('CreateRecurringPaymentsProfile');
+ if (!$resultData->getCommunicationStatus()) {
+ throw new ResponseProcessingException(
+ 'Failed to create a recurring
profile', ResponseCodes::UNKNOWN);
+ }
+ } else {
+ // One-time payment, or initial payment in a
subscription.
+ $resultData =
$this->do_transaction('DoExpressCheckoutPayment');
+ if (!$resultData->getCommunicationStatus()) {
+
$this->finalizeInternalStatus(FinalStatus::FAILED);
+ return PaymentResult::newFailure();
+ }
}
}
return PaymentResult::fromResults(
--
To view, visit https://gerrit.wikimedia.org/r/382513
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36571d680a508a9e9acf1f993dd14409813eec6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Mepps <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits