Skip to content

Commit

Permalink
Mise en conformité Cetelem 3X / 4X
Browse files Browse the repository at this point in the history
  • Loading branch information
PaylineGitHub committed Apr 4, 2017
1 parent ba27851 commit f9d39e0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions class-wc-gateway-payline.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

class WC_Gateway_Payline extends WC_Payment_Gateway {
private $extensionVersion = '1.3.4';
private $extensionVersion = '1.3.5';
private $SDK;
private $posData;
private $disp_errors = "";
Expand Down Expand Up @@ -323,7 +323,7 @@ public function admin_options() {
$this->settings['proxy_password'],
$this->settings['environment']
);
$this->SDK->usedBy('wooCommerce '.$this->extensionVersion);
$this->SDK->usedBy('wooComm '.$this->extensionVersion);
$res = $this->SDK->getEncryptionKey(null);
if($res['result']['code'] == '00000'){
echo "<div class='inline updated'>";
Expand Down Expand Up @@ -570,6 +570,7 @@ function generate_payline_form($order_id) {
$this->settings['proxy_password'],
$this->settings['environment']
);
$this->SDK->usedBy('wooComm '.$this->extensionVersion);

$doWebPaymentRequest = array();
$doWebPaymentRequest['payment']['amount'] = round($order->get_total()*100);
Expand All @@ -587,29 +588,35 @@ function generate_payline_form($order_id) {
$doWebPaymentRequest['order']['currency'] = $doWebPaymentRequest['payment']['currency'];

// BUYER
$doWebPaymentRequest['buyer']['title'] = 'M';
$doWebPaymentRequest['buyer']['lastName'] = $order->billing_last_name;
$doWebPaymentRequest['buyer']['firstName'] = $order->billing_first_name;
$doWebPaymentRequest['buyer']['customerId'] = $order->billing_email;
$doWebPaymentRequest['buyer']['email'] = $doWebPaymentRequest['buyer']['customerId'];
$doWebPaymentRequest['buyer']['ip'] = $_SERVER['REMOTE_ADDR'];
$doWebPaymentRequest['buyer']['mobilePhone'] = $order->billing_phone;

// BILLING ADDRESS
$doWebPaymentRequest['billingAddress']['name'] = $order->billing_first_name." ".$order->billing_last_name;
if($order->billing_company != null && strlen($order->billing_company) > 0){
$doWebPaymentRequest['billingAddress']['name'] .= ' ('.$order->billing_company.')';
}
$doWebPaymentRequest['billingAddress']['firstName'] = $order->billing_first_name;
$doWebPaymentRequest['billingAddress']['lastName'] = $order->billing_last_name;
$doWebPaymentRequest['billingAddress']['street1'] = $order->billing_address_1;
$doWebPaymentRequest['billingAddress']['street2'] = $order->billing_address_2;
$doWebPaymentRequest['billingAddress']['cityName'] = $order->billing_city;
$doWebPaymentRequest['billingAddress']['zipCode'] = $order->billing_postcode;
$doWebPaymentRequest['billingAddress']['country'] = $order->billing_country;
$doWebPaymentRequest['billingAddress']['phone'] = $order->billing_phone;

// ADDRESS (optional)
// SHIPPING ADDRESS
$doWebPaymentRequest['shippingAddress']['name'] = $order->shipping_first_name ." ".$order->shipping_last_name;
if($order->shipping_company != null && strlen($order->shipping_company) > 0){
$doWebPaymentRequest['shippingAddress']['name'] .= ' ('.$order->shipping_company.')';
}
$doWebPaymentRequest['shippingAddress']['firstName'] = $order->shipping_first_name;
$doWebPaymentRequest['shippingAddress']['lastName'] = $order->shipping_last_name;
$doWebPaymentRequest['shippingAddress']['street1'] = $order->shipping_address_1;
$doWebPaymentRequest['shippingAddress']['street2'] = $order->shipping_address_2;
$doWebPaymentRequest['shippingAddress']['cityName'] = $order->shipping_city;
Expand Down Expand Up @@ -673,6 +680,7 @@ function payline_callback() {
$this->settings['proxy_password'],
$this->settings['environment']
);
$this->SDK->usedBy('wooComm '.$this->extensionVersion);
$res = $this->SDK->getWebPaymentDetails(array('token'=>$_GET['token'],'version'=>'2'));
if($res['result']['code'] == PaylineSDK::ERR_CODE){
$this->SDK->getLogger()->addError('Unable to call Payline for token '.$_GET['token']);
Expand Down

0 comments on commit f9d39e0

Please sign in to comment.