Mepps has uploaded a new change for review. (
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, 37 insertions(+), 55 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig
refs/changes/98/389998/1
diff --git a/PaymentProviders/Adyen/WSDL/Payment.php
b/PaymentProviders/Adyen/WSDL/Payment.php
index 4b58df8..b1b3eb4 100644
--- a/PaymentProviders/Adyen/WSDL/Payment.php
+++ b/PaymentProviders/Adyen/WSDL/Payment.php
@@ -1,5 +1,7 @@
<?php namespace SmashPig\PaymentProviders\Adyen\WSDL;
+use SmashPig\Core\Http\OutboundRequest;
+
class BalanceCheckRequest {
public $additionalAmount; // Amount
public $additionalData; // anyType2anyTypeMap
@@ -496,11 +498,17 @@
'Type' => 'Type',
);
+ protected $count = 1;
+ protected $uri = 'http://payment.services.adyen.com';
+
public function Payment( $wsdl =
"https://pal-live.adyen.com/pal/Payment.wsdl", $options = array() ) {
foreach ( self::$classmap as $key => $value ) {
if ( !isset( $options['classmap'][$key] ) ) {
$options['classmap'][$key] = $value;
}
+ $options['connection_timeout'] = 30;
+ $options['exception'] = true;
+
}
parent::__construct( $wsdl, $options );
}
@@ -512,11 +520,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 +530,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 +540,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 +550,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 +560,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 +570,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 +580,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 +590,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 +600,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 +610,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 +620,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 );
+
}
/**
@@ -673,4 +638,21 @@
);
}
+ protected function makeApiCall ( $path, $parameters ) {
+ while ( $this->count < 3 ) {
+ try {
+ $this->__soapCall($path, array($parameters),
array(
+ 'uri' => $this->uri,
+ 'soapaction' => ''
+ )
+ );
+ } catch (\SoapFault $e) {
+ $this->count += 1;
+ Logger::error( "Exception caught in Soap call
$path: {$e->getMessage()}", $e->getTrace(), $e);
+ }
+ break;
+ }
+
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/389998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If382163a310f0dc2e774daf5d286319e16de66c7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Mepps <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits