Skip to content

Commit

Permalink
PHP SDK 4.46.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien SUAREZ committed Jun 13, 2016
1 parent 36c2cfb commit c7166ef
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 55 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,28 @@
* 4.46.1 (2016-06-06)
* contractNumberWalletList can have 99 contractNumberWallet elements

* 4.46 (2016-05-10)

* add of PaResStatus and VeResStatus (Authentication3DSecure class)
* response format : child nodes of cardinality higher to 1 are sent in an integer-indexed array, in any cases (1 element of index 0 if node has only 1 child).
This applies to nodes :
- cards (son of cardsList)
- billingRecord (son of billingRecordList)
- walletId (son of walletIdList)
- transaction (son of transactionList)
- pointOfSell (son of listPointOfSell)
- contract (son of contracts)
- customPaymentPageCode (son of customPaymentPageCodeList)
- function (son of functions)
- details (son of details)
- privateData (son of privateDataList)
- associatedTransactions (son of associatedTransactionsList)
- statusHistory (son of statusHistoryList)
- paymentAdditional (son of paymentAdditionalList)
- CustomerTrans (son of CustomerTransHist)
- PaymentMeansTrans (son of PaymentMeansTransHist)
- AlertsTrans (son of AlertsTransHist)

* 4.45.1 (2016-03-10)

* add of Recurring class
Expand Down
4 changes: 4 additions & 0 deletions src/Payline/Authentication3DSecure.class.php
Expand Up @@ -27,4 +27,8 @@ class Authentication3DSecure
public $vadsResult;

public $typeSecurisation;

public $PaResStatus;

public $VeResStatus;
}
98 changes: 75 additions & 23 deletions src/Payline/PaylineSDK.php
Expand Up @@ -41,12 +41,12 @@ class PaylineSDK
/**
* Payline release corresponding to this version of the package
*/
const SDK_RELEASE = 'PHP SDK 4.45.1';
const SDK_RELEASE = 'PHP SDK 4.46.1';

/**
* WSDL file name
*/
const WSDL = 'v4.45.1.wsdl';
const WSDL = 'v4.46.1.wsdl';

/**
* development environment flag
Expand Down Expand Up @@ -272,7 +272,29 @@ class PaylineSDK
* array containing private data
*/
private $privateData;


/**
* array containing parent-child nodes associations
*/
private $parentNode = array(
'cards' => 'cardsList',
'billingRecord' => 'billingRecordList',
'walletId' => 'walletIdList',
'transaction' => 'transactionList',
'pointOfSell' => 'listPointOfSell',
'contract' => 'contracts',
'customPaymentPageCode' => 'customPaymentPageCodeList',
'function' => 'functions',
'details' => 'details',
'privateData' => 'privateDataList',
'associatedTransactions' => 'associatedTransactionsList',
'statusHistory' => 'statusHistoryList',
'paymentAdditional' => 'paymentAdditionalList',
'CustomerTrans' => 'CustomerTransHist',
'PaymentMeansTrans' => 'PaymentMeansTransHist',
'AlertsTrans' => 'AlertsTransHist'
);

/**
* PaylineSDK class constructor
*
Expand Down Expand Up @@ -314,14 +336,14 @@ function __construct($merchant_id, $access_key, $proxy_host, $proxy_port, $proxy
'proxy_password' => $this->hideChars($proxy_password, 1, 1),
'environment' => $environment
));
$this->header_soap = array();
$this->header_soap['login'] = $merchant_id;
$this->header_soap['password'] = $access_key;
$this->soapclient_options = array();
$this->soapclient_options['login'] = $merchant_id;
$this->soapclient_options['password'] = $access_key;
if ($proxy_host != '') {
$this->header_soap['proxy_host'] = $proxy_host;
$this->header_soap['proxy_port'] = $proxy_port;
$this->header_soap['proxy_login'] = $proxy_login;
$this->header_soap['proxy_password'] = $proxy_password;
$this->soapclient_options['proxy_host'] = $proxy_host;
$this->soapclient_options['proxy_port'] = $proxy_port;
$this->soapclient_options['proxy_login'] = $proxy_login;
$this->soapclient_options['proxy_password'] = $proxy_password;
}
if (strcmp($environment, PaylineSDK::ENV_HOMO) == 0) {
$this->webServicesEndpoint = PaylineSDK::HOMO_ENDPOINT;
Expand All @@ -332,8 +354,9 @@ function __construct($merchant_id, $access_key, $proxy_host, $proxy_port, $proxy
} elseif (strcmp($environment, PaylineSDK::ENV_INT) == 0) {
$this->webServicesEndpoint = PaylineSDK::INT_ENDPOINT;
}
$this->header_soap['style'] = SOAP_DOCUMENT;
$this->header_soap['use'] = SOAP_LITERAL;
$this->soapclient_options['style'] = defined(SOAP_DOCUMENT) ? SOAP_DOCUMENT : 2;
$this->soapclient_options['use'] = defined(SOAP_LITERAL) ? SOAP_LITERAL : 2;
$this->soapclient_options['connection_timeout'] = 5;
$this->orderDetails = array();
$this->privateData = array();

Expand Down Expand Up @@ -679,27 +702,54 @@ private function hideChars($inString, $n1, $n2)
$outString .= substr($inString, - ($n2));
return $outString;
}


/**
*
* @param String $nodeName name of a node in a web service response
* @param String $parentName name of its parent
* @return boolean whether $nodeName is child from a list or not
*/
private function isChildFromList($nodeName,$parentName){
if(array_key_exists($nodeName, $this->parentNode)){
if(strcmp($this->parentNode[$nodeName],$parentName) == 0){
return true;
}
}
return false;
}

/**
* make an array from a payline server response object.
*
* @param object $response
* response from payline
* @param object $node
* response node from payline web service
* @param string $parent
* name of the node's parent
* @return array representation of the object
*/
private static function responseToArray($response)
private function responseToArray($node,$parent=null)
{
$array = array();
foreach ($response as $k => $v) {
if (is_object($v) || is_array($v)) {
$array[$k] = PaylineSDK::responseToArray($v);
foreach ($node as $k => $v) {
if ($this->isChildFromList($k, $parent)) { // current value is a list
if(count($v) == 1 && $k != '0'){ // a list with 1 element. It's returned with a 0-index
$array[$k][0] = PaylineSDK::responseToArray($v,$k);
}elseif(is_object($v) || is_array($v)){ // a list with more than 1 element
$array[$k] = PaylineSDK::responseToArray($v,$k);
}else{
$array[$k] = $v;
}
} else {
$array[$k] = $v;
if(is_object($v) || is_array($v)){
$array[$k] = PaylineSDK::responseToArray($v,$k);
}else{
$array[$k] = $v;
}
}
}
return $array;
}

/**
* Adds indexes with null values to the web services request array, in order to prevent SOAP format exception
*
Expand Down Expand Up @@ -775,7 +825,7 @@ private function webServiceRequest($array, $WSRequest, $PaylineAPI, $Method)
'result.code' => null
);
try {
$client = new SoapClient(dirname(__FILE__) . '/' . PaylineSDK::WSDL, $this->header_soap);
$client = new SoapClient(dirname(__FILE__) . '/' . PaylineSDK::WSDL, $this->soapclient_options);
$client->__setLocation($this->webServicesEndpoint . $PaylineAPI);

$WSRequest['version'] = isset($array['version']) && strlen($array['version']) ? $array['version'] : '';
Expand Down Expand Up @@ -1098,11 +1148,13 @@ private function webServiceRequest($array, $WSRequest, $PaylineAPI, $Method)
'code' => $e->getCode(),
'message' => $e->getMessage(),
'endpoint' => $this->webServicesEndpoint . $PaylineAPI
));
));
$ERROR = array();
$ERROR['result']['code'] = PaylineSDK::ERR_CODE;
$ERROR['result']['longMessage'] = $e->getMessage();
$ERROR['result']['shortMessage'] = $e->getMessage();
$ERROR['result']['partnerCode'] = null;
$ERROR['result']['partnerCodeLabel'] = null;
return $ERROR;
}
}
Expand Down
39 changes: 7 additions & 32 deletions src/Payline/v4.45.1.wsdl → src/Payline/v4.46.1.wsdl
Expand Up @@ -1498,6 +1498,8 @@
<element name="code" nillable="false" type="xsd:string"/>
<element minOccurs="0" name="shortMessage" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="longMessage" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="partnerCode" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="partnerCodeLabel" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="cardOut">
Expand Down Expand Up @@ -1620,7 +1622,8 @@
<element minOccurs="0" name="softDescriptor" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="score" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="externalWalletType" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="externalWalletContractNumber" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="externalWalletContractNumber" nillable="true" type="xsd:string"/>


</sequence>
</complexType>
Expand Down Expand Up @@ -1821,7 +1824,7 @@
</documentation>
</annotation>
<sequence>
<element maxOccurs="10" minOccurs="0" name="contractNumberWallet" type="xsd:string"/>
<element maxOccurs="99" minOccurs="0" name="contractNumberWallet" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="cardsList">
Expand All @@ -1834,36 +1837,6 @@
<element maxOccurs="99" minOccurs="0" name="cards" type="tns1:cards"/>
</sequence>
</complexType>
<complexType name="captureAuthorizationList">
<annotation>
<documentation>
An array of authorization to capture
</documentation>
</annotation>
<sequence>
<element maxOccurs="5000" minOccurs="1" name="capture" type="tns1:capture"/>
</sequence>
</complexType>
<complexType name="refundAuthorizationList">
<annotation>
<documentation>
An array of authorization to refund
</documentation>
</annotation>
<sequence>
<element maxOccurs="5000" minOccurs="1" name="refund" type="tns1:refund"/>
</sequence>
</complexType>
<complexType name="resetAuthorizationList">
<annotation>
<documentation>
An array of authorization to reset
</documentation>
</annotation>
<sequence>
<element maxOccurs="5000" minOccurs="1" name="transactionID" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="recurring">
<annotation>
<documentation>
Expand Down Expand Up @@ -2017,6 +1990,8 @@
<element minOccurs="0" name="cavvAlgorithm" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="vadsResult" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="typeSecurisation" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="PaResStatus" nillable="true" type="xsd:string"/>
<element minOccurs="0" name="VeResStatus" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="connectionData">
Expand Down

0 comments on commit c7166ef

Please sign in to comment.