/** * function do_debit * @params : $array : array. the array keys are : * contractNumber, pares, md * @return : Array. Array from a payline server response object. * @description : verify an authentication **/ public function do_debit($array) { try { $doDebitRequest = array('payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privates, 'buyer' => $this->buyer($array['buyer'], $array['address']), 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'authorization' => $this->authorization($array['authorization'])); $client = new SoapClient($this->WSDL_DIRECT_SOAP, $this->header_soap); $doDebitResponse = $client->doDebit($doDebitRequest); return util::responseToArray($doDebitResponse); } catch (Exception $e) { echo '<strong>ERROR : ' . $e->getMessage() . '</strong><br/>'; } }
private function webServiceRequest($array, $WSRequest, $PaylineAPI, $Method) { $reqTrace = "webServiceRequest - Location : " . $this->webServicesEndpoint . $PaylineAPI . " - {$Method}"; $resTrace = ''; try { $client = new SoapClient(dirname(__FILE__) . '/' . paylineSDK::WSDL, $this->header_soap); $client->__setLocation($this->webServicesEndpoint . $PaylineAPI); if (isset($array['version']) && strlen($array['version'])) { $WSRequest['version'] = $array['version']; } else { $WSRequest['version'] = ''; } if (isset($array['media']) && strlen($array['media'])) { $WSRequest['media'] = $array['media']; } else { $WSRequest['media'] = ''; } switch ($Method) { case 'createMerchant': $WSresponse = $client->createMerchant($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'createWallet': $WSresponse = $client->createWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'createWebWallet': $WSresponse = $client->createWebWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'updatePaymentRecord': $WSresponse = $client->updatePaymentRecord($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getBillingRecord': $WSresponse = $client->getBillingRecord($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'updateBillingRecord': $WSresponse = $client->updateBillingRecord($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'disablePaymentRecord': $WSresponse = $client->disablePaymentRecord($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'disableWallet': $WSresponse = $client->disableWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doAuthorization': $WSresponse = $client->doAuthorization($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doCapture': $WSresponse = $client->doCapture($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doCredit': $WSresponse = $client->doCredit($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doDebit': $WSresponse = $client->doDebit($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doImmediateWalletPayment': $WSresponse = $client->doImmediateWalletPayment($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doReAuthorization': $WSresponse = $client->doReAuthorization($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doRecurrentWalletPayment': $WSresponse = $client->doRecurrentWalletPayment($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doRefund': $WSresponse = $client->doRefund($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doReset': $WSresponse = $client->doReset($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doScheduledWalletPayment': $WSresponse = $client->doScheduledWalletPayment($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doScoringCheque': $WSresponse = $client->doScoringCheque($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'doWebPayment': $reqTrace .= '(order.ref = ' . $array['order']['ref'] . ')'; $WSresponse = $client->doWebPayment($WSRequest); $response = paylineUtil::responseToArray($WSresponse); if ($response['result']['code'] == '00000') { $resTrace = ' - token = ' . $response['token']; } break; case 'enableWallet': $WSresponse = $client->enableWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getAlertDetails': $WSresponse = $client->getAlertDetails($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getBalance': $WSresponse = $client->getBalance($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getCards': $WSresponse = $client->getCards($WSRequest); $response = paylineUtil::responseToArrayForGetCards($WSresponse); break; case 'getEncryptionKey': $WSresponse = $client->getEncryptionKey($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getMerchantSettings': $WSresponse = $client->getMerchantSettings($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getPaymentRecord': $WSresponse = $client->getPaymentRecord($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getToken': $WSresponse = $client->getToken($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getTransactionDetails': $WSresponse = $client->getTransactionDetails($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getWallet': $WSresponse = $client->getWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'getWebPaymentDetails': $reqTrace .= '(token = ' . $array['token'] . ')'; $WSresponse = $client->getWebPaymentDetails($WSRequest); $response = paylineUtil::responseToArray($WSresponse); if (isset($response['transaction']['id'])) { $resTrace = ' - transactionId = ' . $response['transaction']['id']; } break; case 'getWebWallet': $WSresponse = $client->getWebWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'manageWebWallet': $WSresponse = $client->manageWebWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'transactionsSearch': $WSresponse = $client->transactionsSearch($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'unBlock': $WSresponse = $client->unBlock($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'updateWallet': $WSresponse = $client->updateWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'updateWebWallet': $WSresponse = $client->updateWebWallet($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'verifyAuthentication': $WSresponse = $client->verifyAuthentication($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; case 'verifyEnrollment': $WSresponse = $client->verifyEnrollment($WSRequest); $response = paylineUtil::responseToArray($WSresponse); break; } $this->writeTrace($reqTrace); $this->writeTrace('Response : code = ' . $response['result']['code'] . $resTrace); return $response; } catch (Exception $e) { $this->writeTrace($reqTrace); $this->writeTrace("Exception : " . $e->getMessage()); $ERROR = array(); $ERROR['result']['code'] = paylineSDK::ERR_CODE; $ERROR['result']['longMessage'] = $e->getMessage(); $ERROR['result']['shortMessage'] = $e->getMessage(); return $ERROR; } }