jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/389998 )
Change subject: On exception, increase count and log error
......................................................................
On exception, increase count and log error
Bug: T177893
Change-Id: If382163a310f0dc2e774daf5d286319e16de66c7
---
M PaymentProviders/Adyen/WSDL/Payment.php
1 file changed, 40 insertions(+), 60 deletions(-)
Approvals:
jenkins-bot: Verified
Ejegg: Looks good to me, approved
diff --git a/PaymentProviders/Adyen/WSDL/Payment.php
b/PaymentProviders/Adyen/WSDL/Payment.php
index 4b58df8..ae62e79 100644
--- a/PaymentProviders/Adyen/WSDL/Payment.php
+++ b/PaymentProviders/Adyen/WSDL/Payment.php
@@ -1,5 +1,8 @@
<?php namespace SmashPig\PaymentProviders\Adyen\WSDL;
+use SmashPig\Core\Logging\Logger;
+use SmashPig\Core\Context;
+
class BalanceCheckRequest {
public $additionalAmount; // Amount
public $additionalData; // anyType2anyTypeMap
@@ -496,11 +499,19 @@
'Type' => 'Type',
);
+ protected $count;
+ protected $retries;
+ protected $uri = 'http://payment.services.adyen.com';
+
public function Payment( $wsdl =
"https://pal-live.adyen.com/pal/Payment.wsdl", $options = array() ) {
+ $this->retries =
Context::get()->getProviderConfiguration()->val('curl/retries');
foreach ( self::$classmap as $key => $value ) {
if ( !isset( $options['classmap'][$key] ) ) {
$options['classmap'][$key] = $value;
}
+ $options['connection_timeout'] =
Context::get()->getProviderConfiguration()->val('curl/timeout');
+ $options['exceptions'] = true;
+
}
parent::__construct( $wsdl, $options );
}
@@ -512,11 +523,7 @@
* @return authoriseResponse
*/
public function authorise( authorise $parameters ) {
- return $this->__soapCall( 'authorise', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'authorise', $parameters );
}
/**
@@ -526,11 +533,7 @@
* @return authorise3dResponse
*/
public function authorise3d( authorise3d $parameters ) {
- return $this->__soapCall( 'authorise3d', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'authorise3d', $parameters );
}
/**
@@ -540,11 +543,7 @@
* @return authoriseReferralResponse
*/
public function authoriseReferral( authoriseReferral $parameters ) {
- return $this->__soapCall( 'authoriseReferral', array(
$parameters ), array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'authoriseReferral', $parameters );
}
/**
@@ -554,11 +553,7 @@
* @return balanceCheckResponse
*/
public function balanceCheck( balanceCheck $parameters ) {
- return $this->__soapCall( 'balanceCheck', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'balanceCheck', $parameters );
}
/**
@@ -568,11 +563,7 @@
* @return cancelResponse
*/
public function cancel( cancel $parameters ) {
- return $this->__soapCall( 'cancel', array( $parameters ), array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'canel', $parameters );
}
/**
@@ -582,11 +573,7 @@
* @return cancelOrRefundResponse
*/
public function cancelOrRefund( cancelOrRefund $parameters ) {
- return $this->__soapCall( 'cancelOrRefund', array( $parameters
), array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'cancelOrRefund', $parameters );
}
/**
@@ -596,11 +583,7 @@
* @return captureResponse
*/
public function capture( capture $parameters ) {
- return $this->__soapCall( 'capture', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'capture', $parameters );
}
/**
@@ -610,11 +593,7 @@
* @return checkFraudResponse
*/
public function checkFraud( checkFraud $parameters ) {
- return $this->__soapCall( 'checkFraud', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'checkFraud', $parameters );
}
/**
@@ -624,11 +603,7 @@
* @return directdebitFuncResponse
*/
public function directdebit( directdebit $parameters ) {
- return $this->__soapCall( 'directdebit', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'directdebit', $parameters );
}
/**
@@ -638,11 +613,7 @@
* @return fundTransferResponse
*/
public function fundTransfer( fundTransfer $parameters ) {
- return $this->__soapCall( 'fundTransfer', array( $parameters ),
array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'fundTransfer', $parameters );
}
/**
@@ -652,11 +623,8 @@
* @return refundResponse
*/
public function refund( refund $parameters ) {
- return $this->__soapCall( 'refund', array( $parameters ), array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'refund', $parameters );
+
}
/**
@@ -666,11 +634,23 @@
* @return refundWithDataResponse
*/
public function refundWithData( refundWithData $parameters ) {
- return $this->__soapCall( 'refundWithData', array( $parameters
), array(
- 'uri' => 'http://payment.services.adyen.com',
- 'soapaction' => ''
- )
- );
+ return $this->makeApiCall( 'refundWithData', $parameters );
+ }
+
+ protected function makeApiCall ( $path, $parameters ) {
+ $this->count = 0;
+ while ( $this->count < $this->retries ) {
+ try {
+ return $this->__soapCall( $path,
array($parameters), array('uri' => $this->uri, 'soapaction' => '') );
+ } catch (\SoapFault $e) {
+ $this->count += 1;
+ if ($this->count == $this->retries) {
+ throw $e;
+ }
+ Logger::error( "Exception caught in Soap call
$path: {$e->getMessage()}", $e->getTrace(), $e );
+ }
+ }
+
}
}
--
To view, visit https://gerrit.wikimedia.org/r/389998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If382163a310f0dc2e774daf5d286319e16de66c7
Gerrit-PatchSet: 8
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Mepps <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Mepps <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits