Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Add Trace params + getLastRequest (and variations) #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neopheus
Copy link
Contributor

  • Add trace params in construct
  • Add new functions : getLastRequestHeaders, getLastResponse, getLastResponseHeaders and getLastRequest

example of use :


use Payline\PaylineSDK;
use Monolog\Logger;

$merchant_id = 'xxxxx';
$access_key = 'xxxxx';
$proxy_host= '';
$proxy_port= '';
$proxy_login= '';
$proxy_password= '';
$environment = 'HOMO';
$pathLog = null;
$logLevel = Logger::INFO;
$externalLogger = null;
$defaultTimezone = "Europe/Paris";
$trace = true;

// create an instance
$paylineSDK = new PaylineSDK($merchant_id,$access_key, $proxy_host, $proxy_port, $proxy_login, $proxy_password, $environment, $pathLog, $logLevel, $externalLogger, $defaultTimezone, $trace);
/*
$merchant_id, the merchant identifier, has to be a string.
$environment determines in which Payline environment your request are targeted.
It should be filled with either PaylineSDK::ENV_HOMO (for testing purpose) or PaylineSDK::ENV_PROD (real life)
If $pathLog is null, log files will be written under default logs directory. Fill with your custom log files path
*/

// call a web service, for example doWebPayment
$doWebPaymentRequest = array();

$doWebPaymentRequest['cancelURL'] = 'https://Demo_Shop.com/cancelURL.php'; 
$doWebPaymentRequest['returnURL'] = 'https://Demo_Shop.com/returnURL.php';
$doWebPaymentRequest['notificationURL'] = 'https://Demo_Shop.com/notificationURL.php';


// PAYMENT
$doWebPaymentRequest['payment']['amount'] = 1000; // this value has to be an integer amount is sent in cents
$doWebPaymentRequest['payment']['currency'] = 978; // ISO 4217 code for euro
$doWebPaymentRequest['payment']['action'] = 101; // 101 stand for "authorization+capture"
$doWebPaymentRequest['payment']['mode'] = 'CPT'; // one shot payment

// ORDER
$doWebPaymentRequest['order']['ref'] = 'myOrderRef_35656'; // the reference of your order
$doWebPaymentRequest['order']['amount'] = 1000; // may differ from payment.amount if currency is different
$doWebPaymentRequest['order']['currency'] = 978; // ISO 4217 code for euro
$doWebPaymentRequest['order']['date'] = date('d/m/Y H:i'); // ISO 4217 code for euro

// CONTRACT NUMBERS
$doWebPaymentRequest['payment']['contractNumber'] = '1234567';

$doWebPaymentResponse = $paylineSDK->doWebPayment($doWebPaymentRequest);

var_dump($paylineSDK->getLastRequest());

`

@neopheus
Copy link
Contributor Author

  • Beautifuler XML

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant