Payline - Version 1.6.1

Version Notes

Bug fixes

Download this release

Release Info

Developer Magento Core Team
Extension Payline
Version 1.6.1
Comparing to
See all releases


Code changes from version 1.6.0 to 1.6.1

app/code/community/Monext/Payline/Model/Cpt.php CHANGED
@@ -36,6 +36,7 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
36
  $result=$paylineSDK->get_TransactionDetails(array('transactionId'=>$transactionId, 'orderRef'=>$orderRef));
37
  if (isset($result['result']) && $result['result']['code']!='0000' && $result['result']['code']!='2500' ){
38
  //Back to default
 
39
  return Mage::getStoreConfig('payment/PaylineCPT/contract_number');
40
  }else{
41
  return $result['payment']['contractNumber'];
@@ -49,12 +50,12 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
49
  * @param float $amount
50
  * @return Monext_Payline_Model_Cpt
51
  */
52
- public function refund(Varien_Object $payment, $amount)
53
  {
54
  $order = $payment->getOrder();
55
  $orderRef = $order->getRealOrderId();
56
  $array = array();
57
- $paylineSDK = Mage::helper('payline')->initPayline('CPT',Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
58
 
59
  // PAYMENT
60
  $array['payment']['amount'] = $amount*100;
@@ -102,12 +103,12 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
102
  * @param Varien_Object $orderPayment
103
  * @return Monext_Payline_Model_Cpt
104
  */
105
- public function capture(Varien_Object $payment, $amount)
106
  {
107
  $order = $payment->getOrder();
108
  $orderRef = $order->getRealOrderId();
109
  $array = array();
110
- $paylineSDK = Mage::helper('payline')->initPayline('CPT',Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
111
 
112
  // PAYMENT
113
  $array['payment']['amount'] = $amount*100;
@@ -154,12 +155,12 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
154
  * @param Varien_Object $payment
155
  * @return Monext_Payline_Model_Cpt
156
  */
157
- public function void(Varien_Object $payment)
158
  {
159
  $order = $payment->getOrder();
160
  $orderRef = $order->getRealOrderId();
161
  $array = array();
162
- $paylineSDK = Mage::helper('payline')->initPayline('CPT',Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
163
 
164
  // TRANSACTION INFO
165
  $array['transactionID'] = $payment->getCcTransId();
36
  $result=$paylineSDK->get_TransactionDetails(array('transactionId'=>$transactionId, 'orderRef'=>$orderRef));
37
  if (isset($result['result']) && $result['result']['code']!='0000' && $result['result']['code']!='2500' ){
38
  //Back to default
39
+ Mage::helper('payline/logger')->log('Error while retrieving transaction contract number for transactionId'.' '.$transactionId.' and order '.$orderRef.' error : '.$result['result']['shortMessage']);
40
  return Mage::getStoreConfig('payment/PaylineCPT/contract_number');
41
  }else{
42
  return $result['payment']['contractNumber'];
50
  * @param float $amount
51
  * @return Monext_Payline_Model_Cpt
52
  */
53
+ public function refund(Varien_Object $payment, $amount, $useConfig='CPT')
54
  {
55
  $order = $payment->getOrder();
56
  $orderRef = $order->getRealOrderId();
57
  $array = array();
58
+ $paylineSDK = Mage::helper('payline')->initPayline($useConfig,Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
59
 
60
  // PAYMENT
61
  $array['payment']['amount'] = $amount*100;
103
  * @param Varien_Object $orderPayment
104
  * @return Monext_Payline_Model_Cpt
105
  */
106
+ public function capture(Varien_Object $payment, $amount, $useConfig='CPT')
107
  {
108
  $order = $payment->getOrder();
109
  $orderRef = $order->getRealOrderId();
110
  $array = array();
111
+ $paylineSDK = Mage::helper('payline')->initPayline($useConfig,Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
112
 
113
  // PAYMENT
114
  $array['payment']['amount'] = $amount*100;
155
  * @param Varien_Object $payment
156
  * @return Monext_Payline_Model_Cpt
157
  */
158
+ public function void(Varien_Object $payment, $useConfig='CPT')
159
  {
160
  $order = $payment->getOrder();
161
  $orderRef = $order->getRealOrderId();
162
  $array = array();
163
+ $paylineSDK = Mage::helper('payline')->initPayline($useConfig,Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
164
 
165
  // TRANSACTION INFO
166
  $array['transactionID'] = $payment->getCcTransId();
app/code/community/Monext/Payline/Model/Direct.php CHANGED
@@ -37,7 +37,7 @@ class Monext_Payline_Model_Direct extends Mage_Payment_Model_Method_Abstract
37
  */
38
  public function capture(Varien_Object $payment, $amount)
39
  {
40
- Mage::getModel('payline/cpt')->capture($payment,$amount);
41
  return $this;
42
  }
43
 
@@ -49,7 +49,7 @@ class Monext_Payline_Model_Direct extends Mage_Payment_Model_Method_Abstract
49
  */
50
  public function refund(Varien_Object $payment, $amount)
51
  {
52
- Mage::getModel('payline/cpt')->refund($payment,$amount);
53
  return $this;
54
  }
55
 
@@ -61,7 +61,7 @@ class Monext_Payline_Model_Direct extends Mage_Payment_Model_Method_Abstract
61
  */
62
  public function void(Varien_Object $payment)
63
  {
64
- Mage::getModel('payline/cpt')->void($payment);
65
  return $this;
66
  }
67
  }
37
  */
38
  public function capture(Varien_Object $payment, $amount)
39
  {
40
+ Mage::getModel('payline/cpt')->capture($payment,$amount,'DIRECT');
41
  return $this;
42
  }
43
 
49
  */
50
  public function refund(Varien_Object $payment, $amount)
51
  {
52
+ Mage::getModel('payline/cpt')->refund($payment,$amount, 'DIRECT');
53
  return $this;
54
  }
55
 
61
  */
62
  public function void(Varien_Object $payment)
63
  {
64
+ Mage::getModel('payline/cpt')->void($payment, 'DIRECT');
65
  return $this;
66
  }
67
  }
app/code/community/Monext/Payline/Model/Wallet.php CHANGED
@@ -166,7 +166,7 @@ class Monext_Payline_Model_Wallet extends Mage_Payment_Model_Method_Abstract
166
  */
167
  public function capture(Varien_Object $payment, $amount)
168
  {
169
- Mage::getModel('payline/cpt')->capture($payment,$amount);
170
  return $this;
171
  }
172
 
@@ -178,7 +178,7 @@ class Monext_Payline_Model_Wallet extends Mage_Payment_Model_Method_Abstract
178
  */
179
  public function refund(Varien_Object $payment, $amount)
180
  {
181
- Mage::getModel('payline/cpt')->refund($payment,$amount);
182
  return $this;
183
  }
184
 
@@ -190,7 +190,7 @@ class Monext_Payline_Model_Wallet extends Mage_Payment_Model_Method_Abstract
190
  */
191
  public function void(Varien_Object $payment)
192
  {
193
- Mage::getModel('payline/cpt')->void($payment);
194
  return $this;
195
  }
196
  }
166
  */
167
  public function capture(Varien_Object $payment, $amount)
168
  {
169
+ Mage::getModel('payline/cpt')->capture($payment,$amount, 'WALLET');
170
  return $this;
171
  }
172
 
178
  */
179
  public function refund(Varien_Object $payment, $amount)
180
  {
181
+ Mage::getModel('payline/cpt')->refund($payment,$amount, 'WALLET');
182
  return $this;
183
  }
184
 
190
  */
191
  public function void(Varien_Object $payment)
192
  {
193
+ Mage::getModel('payline/cpt')->void($payment, 'WALLET');
194
  return $this;
195
  }
196
  }
app/code/community/Monext/Payline/PaylinePHPKit/lib/paylineSDK.php CHANGED
@@ -936,7 +936,7 @@ public function create_WebWallet($array){
936
  if(!isset($array['contractNumber'])||!strlen($array['contractNumber'])) $array['contractNumber'] = Mage::helper('payline')->contractNumber;
937
  $createWebWalletRequest = array (
938
  'contractNumber' => $array['contractNumber'],
939
- 'selectedContractList' => '',//$this->contracts($array['contracts']),
940
  'updatePersonalDetails' => $array['updatePersonalDetails'],
941
  'buyer' => $this->buyer($array['buyer'],$array['address']),
942
  'returnURL' => $this->returnURL,
936
  if(!isset($array['contractNumber'])||!strlen($array['contractNumber'])) $array['contractNumber'] = Mage::helper('payline')->contractNumber;
937
  $createWebWalletRequest = array (
938
  'contractNumber' => $array['contractNumber'],
939
+ 'selectedContractList' => $this->contracts($array['contracts']),
940
  'updatePersonalDetails' => $array['updatePersonalDetails'],
941
  'buyer' => $this->buyer($array['buyer'],$array['address']),
942
  'returnURL' => $this->returnURL,
app/code/community/Monext/Payline/controllers/CheckoutonepageController.php CHANGED
@@ -82,15 +82,27 @@ class Monext_Payline_CheckoutonepageController extends Mage_Core_Controller_Fron
82
 
83
 
84
  //Get rid of a few problems if order not completed
85
- $onepage->getQuote()->removeAllAddresses();
86
  $shippingAddressId = $this->getRequest()->getPost('shipping_address_id', false);
87
  $billingAddressId = $this->getRequest()->getPost('billing_address_id', false);
88
  /* PATCH for 1clic btn on checkout/cart */
89
  if (empty($shippingAddressId)){
90
- $shippingAddressId = $customer->getPrimaryShippingAddress()->getId();
 
 
 
 
 
 
91
  }
92
  if (empty($billingAddressId)){
93
- $billingAddressId = $customer->getPrimaryBillingAddress()->getId();
 
 
 
 
 
 
94
  }
95
  /* PATCH end */
96
  $billingAddress=Mage::getModel('customer/address')->load($billingAddressId)->getData();
82
 
83
 
84
  //Get rid of a few problems if order not completed
85
+ //$onepage->getQuote()->re//moveAllAddresses();
86
  $shippingAddressId = $this->getRequest()->getPost('shipping_address_id', false);
87
  $billingAddressId = $this->getRequest()->getPost('billing_address_id', false);
88
  /* PATCH for 1clic btn on checkout/cart */
89
  if (empty($shippingAddressId)){
90
+ if($customer->getPrimaryShippingAddress()){
91
+ $shippingAddressId = $customer->getPrimaryShippingAddress()->getId();
92
+ }else{
93
+ Mage::getSingleton('checkout/session')->addError($this->__('You must add an address to your account to be able to checkout in one clic.'));
94
+ $this->_redirect('checkout/cart');
95
+ return;
96
+ }
97
  }
98
  if (empty($billingAddressId)){
99
+ if ($customer->getPrimaryBillingAddress()){
100
+ $billingAddressId = $customer->getPrimaryBillingAddress()->getId();
101
+ }else{
102
+ Mage::getSingleton('checkout/session')->addError($this->__('You must add an address to your account to be able to checkout in one clic.'));
103
+ $this->_redirect('checkout/cart');
104
+ return;
105
+ }
106
  }
107
  /* PATCH end */
108
  $billingAddress=Mage::getModel('customer/address')->load($billingAddressId)->getData();
app/code/community/Monext/Payline/controllers/IndexController.php CHANGED
@@ -142,16 +142,22 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
142
  * @param $transactionId
143
  * @return boolean (true=>valid payment, false => invalid payment)
144
  */
145
- private function updateOrder($res,$transactionId){
146
  $orderOk = false;
147
-
148
  if($res['result']['code']){
149
 
150
  if($res['result']['code'] == '00000' || $res['result']['code'] == '02500'){ // transaction OK
151
  $orderOk = true;
152
 
153
  $this->order->getPayment()->setCcTransId($transactionId);
154
- $this->addTransaction($transactionId,$res['payment']['action']);
 
 
 
 
 
 
155
  }else{
156
  $this->updateStock();
157
  }
@@ -328,7 +334,7 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
328
  $array_details['transactionId'] = $author_result['transaction']['id'];
329
  $detail_result = $paylineSDK->get_TransactionDetails($array_details);
330
 
331
- if($this->updateOrder($detail_result,$detail_result['transaction']['id'])){
332
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
333
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineDIRECT/new_order_status');
334
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
@@ -336,7 +342,7 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
336
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
337
  $this->order->setState(Mage_Sales_Model_Order::STATE_CANCELED,$failedOrderStatus,'',false);
338
 
339
- $msgLog='Error during order update (#'.$this->order->getIncrementId().')';
340
  $msg=Mage::helper('payline')->__('Error during payment');
341
  Mage::getSingleton('core/session')->addError($msg);
342
  Mage::helper('payline/logger')->log($msgLog);
@@ -360,7 +366,6 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
360
  return;
361
  }
362
  }
363
-
364
 
365
  /** Initialisize a WALLET payment request
366
  *
@@ -435,7 +440,7 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
435
  $array_details['transactionId'] = $author_result['transaction']['id'];
436
  $detail_result = $paylineSDK->get_TransactionDetails($array_details);
437
 
438
- if($this->updateOrder($detail_result,$detail_result['transaction']['id'])){
439
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
440
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineWALLET/new_order_status');
441
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
@@ -599,19 +604,28 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
599
  */
600
  public function cptNotifAction(){
601
  $res = Mage::helper('payline')->initPayline('CPT')->get_webPaymentDetails($_GET['token']);
602
-
603
- if (isset($res['privateDataList']['privateData'][0])){
604
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData'][0]->value);
605
  }else{
606
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData']['value']);
 
 
 
 
 
 
 
 
 
607
  }
 
608
 
609
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineCPT/new_order_status');
610
  $failedOrderStatus = Mage::getStoreConfig('payment/PaylineCPT/failed_order_status');
611
- if($this->updateOrder($res,$res['transaction']['id'])){
612
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
613
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
614
- if (isset($res['privateDataList']['privateData'][1]) && $res['privateDataList']['privateData'][1]->value!=''){
615
  $this->saveWallet($res['privateDataList']['privateData'][1]->value);
616
  }
617
  }else{
@@ -635,11 +649,22 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
635
 
636
  $res = Mage::helper('payline')->initPayline('NX')->get_webPaymentDetails($_GET['token']);
637
 
638
- if (isset($res['privateDataList']['privateData'][0])){
639
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData'][0]->value);
640
  }else{
641
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData']['value']);
 
 
 
 
642
  }
 
 
 
 
 
 
 
643
 
644
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineNX/new_order_status');
645
  $failedOrderStatus = Mage::getStoreConfig('payment/PaylineNX/failed_order_status');
@@ -654,10 +679,10 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
654
  }
655
  }
656
 
657
- if($this->updateOrder($res,$billingRecord->transaction->id)){
658
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
659
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
660
- if (isset($res['privateDataList']['privateData'][1]) && $res['privateDataList']['privateData'][1]->value!=''){
661
  $this->saveWallet($res['privateDataList']['privateData'][1]->value);
662
  }
663
  }else{
@@ -680,7 +705,21 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
680
  */
681
  public function cptCancelAction(){
682
  $res = Mage::helper('payline')->initPayline('CPT')->get_webPaymentDetails($_GET['token']);
683
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData']['value']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  if (substr($res['result']['code'], 0, 2)=='01' || substr($res['result']['code'],0,3)=='021'){
685
  //Invalid transaction or error during the process on Payline side
686
  //No error display, the customer is already told on the Payline side
@@ -699,7 +738,21 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
699
  */
700
  public function nxCancelAction(){
701
  $res = Mage::helper('payline')->initPayline('NX')->get_webPaymentDetails($_GET['token']);
702
- $this->order = Mage::getModel('sales/order')->loadByIncrementId($res['privateDataList']['privateData']['value']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
 
704
  if (substr($res['result']['code'], 0, 2)=='01' || substr($res['result']['code'],0,3)=='021'){
705
  //Invalid transaction or error during the process on Payline side
142
  * @param $transactionId
143
  * @return boolean (true=>valid payment, false => invalid payment)
144
  */
145
+ private function updateOrder($res,$transactionId, $paymentType='CPT'){
146
  $orderOk = false;
147
+
148
  if($res['result']['code']){
149
 
150
  if($res['result']['code'] == '00000' || $res['result']['code'] == '02500'){ // transaction OK
151
  $orderOk = true;
152
 
153
  $this->order->getPayment()->setCcTransId($transactionId);
154
+ if (isset($res['payment']) && isset($res['payment']['action'])){
155
+ $paymentAction=$res['payment']['action'];
156
+
157
+ }else{
158
+ $paymentAction= Mage::getStoreConfig('payment/Payline'.$paymentType.'/payline_payment_action');
159
+ }
160
+ $this->addTransaction($transactionId, $paymentAction);
161
  }else{
162
  $this->updateStock();
163
  }
334
  $array_details['transactionId'] = $author_result['transaction']['id'];
335
  $detail_result = $paylineSDK->get_TransactionDetails($array_details);
336
 
337
+ if($this->updateOrder($detail_result,$detail_result['transaction']['id'], 'DIRECT')){
338
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
339
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineDIRECT/new_order_status');
340
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
342
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
343
  $this->order->setState(Mage_Sales_Model_Order::STATE_CANCELED,$failedOrderStatus,'',false);
344
 
345
+ $msgLog='Error during order update (#'.$this->order->getIncrementId().')'."\n";
346
  $msg=Mage::helper('payline')->__('Error during payment');
347
  Mage::getSingleton('core/session')->addError($msg);
348
  Mage::helper('payline/logger')->log($msgLog);
366
  return;
367
  }
368
  }
 
369
 
370
  /** Initialisize a WALLET payment request
371
  *
440
  $array_details['transactionId'] = $author_result['transaction']['id'];
441
  $detail_result = $paylineSDK->get_TransactionDetails($array_details);
442
 
443
+ if($this->updateOrder($detail_result,$detail_result['transaction']['id'], 'WALLET')){
444
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
445
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineWALLET/new_order_status');
446
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
604
  */
605
  public function cptNotifAction(){
606
  $res = Mage::helper('payline')->initPayline('CPT')->get_webPaymentDetails($_GET['token']);
607
+ if (isset($res['privateDataList']['privateData']['value'])){
608
+ $orderRef=$res['privateDataList']['privateData']['value'];
 
609
  }else{
610
+ foreach ($res['privateDataList']['privateData'] as $privateDataList){
611
+ if($privateDataList->key == 'orderRef'){
612
+ $orderRef = $privateDataList->value;
613
+ }
614
+ }
615
+ }
616
+ if (!isset($orderRef)){
617
+ $msgLog='Couldn\'t find order increment id in cpt payment result';
618
+ Mage::helper('payline/logger')->log($msgLog);
619
+ $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
620
  }
621
+ $this->order = Mage::getModel('sales/order')->loadByIncrementId($orderRef);
622
 
623
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineCPT/new_order_status');
624
  $failedOrderStatus = Mage::getStoreConfig('payment/PaylineCPT/failed_order_status');
625
+ if($this->updateOrder($res,$res['transaction']['id'], 'CPT')){
626
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
627
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
628
+ if (isset($res['privateDataList']['privateData'][1]) && $res['privateDataList']['privateData'][1]->key=="newWalletId" && $res['privateDataList']['privateData'][1]->value!=''){
629
  $this->saveWallet($res['privateDataList']['privateData'][1]->value);
630
  }
631
  }else{
649
 
650
  $res = Mage::helper('payline')->initPayline('NX')->get_webPaymentDetails($_GET['token']);
651
 
652
+ if (isset($res['privateDataList']['privateData']['value'])){
653
+ $orderRef=$res['privateDataList']['privateData']['value'];
654
  }else{
655
+ foreach ($res['privateDataList']['privateData'] as $privateDataList){
656
+ if($privateDataList->key == 'orderRef'){
657
+ $orderRef = $privateDataList->value;
658
+ }
659
+ }
660
  }
661
+ if (!isset($orderRef)){
662
+ $msgLog='Couldn\'t find order increment id in cpt payment result';
663
+ Mage::helper('payline/logger')->log($msgLog);
664
+ $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
665
+ }
666
+ $this->order = Mage::getModel('sales/order')->loadByIncrementId($orderRef);
667
+
668
 
669
  $newOrderStatus = Mage::getStoreConfig('payment/PaylineNX/new_order_status');
670
  $failedOrderStatus = Mage::getStoreConfig('payment/PaylineNX/failed_order_status');
679
  }
680
  }
681
 
682
+ if($this->updateOrder($res,$billingRecord->transaction->id,'NX')){
683
  $redirectUrl = Mage::getBaseUrl()."checkout/onepage/success/";
684
  $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,$newOrderStatus,'',false);
685
+ if (isset($res['privateDataList']['privateData'][1]) && $res['privateDataList']['privateData'][1]->key=="newWalletId" && $res['privateDataList']['privateData'][1]->value!=''){
686
  $this->saveWallet($res['privateDataList']['privateData'][1]->value);
687
  }
688
  }else{
705
  */
706
  public function cptCancelAction(){
707
  $res = Mage::helper('payline')->initPayline('CPT')->get_webPaymentDetails($_GET['token']);
708
+ if (isset($res['privateDataList']['privateData']['value'])){
709
+ $orderRef=$res['privateDataList']['privateData']['value'];
710
+ }else{
711
+ foreach ($res['privateDataList']['privateData'] as $privateDataList){
712
+ if($privateDataList->key == 'orderRef'){
713
+ $orderRef = $privateDataList->value;
714
+ }
715
+ }
716
+ }
717
+ if (!isset($orderRef)){
718
+ $msgLog='Couldn\'t find order increment id in cpt payment cancel result';
719
+ Mage::helper('payline/logger')->log($msgLog);
720
+ $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
721
+ }
722
+ $this->order = Mage::getModel('sales/order')->loadByIncrementId($orderRef);
723
  if (substr($res['result']['code'], 0, 2)=='01' || substr($res['result']['code'],0,3)=='021'){
724
  //Invalid transaction or error during the process on Payline side
725
  //No error display, the customer is already told on the Payline side
738
  */
739
  public function nxCancelAction(){
740
  $res = Mage::helper('payline')->initPayline('NX')->get_webPaymentDetails($_GET['token']);
741
+ if (isset($res['privateDataList']['privateData']['value'])){
742
+ $orderRef=$res['privateDataList']['privateData']['value'];
743
+ }else{
744
+ foreach ($res['privateDataList']['privateData'] as $privateDataList){
745
+ if($privateDataList->key == 'orderRef'){
746
+ $orderRef = $privateDataList->value;
747
+ }
748
+ }
749
+ }
750
+ if (!isset($orderRef)){
751
+ $msgLog='Couldn\'t find order increment id in nx payment cancel result';
752
+ Mage::helper('payline/logger')->log($msgLog);
753
+ $redirectUrl = Mage::getBaseUrl()."checkout/onepage/";
754
+ }
755
+ $this->order = Mage::getModel('sales/order')->loadByIncrementId($orderRef);
756
 
757
  if (substr($res['result']['code'], 0, 2)=='01' || substr($res['result']['code'],0,3)=='021'){
758
  //Invalid transaction or error during the process on Payline side
app/code/community/Monext/Payline/controllers/WalletController.php CHANGED
@@ -81,12 +81,25 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
81
  'buyer'=>array(
82
  'lastName'=>substr($customer->getLastname(),0,100),
83
  'firstName'=>substr($customer->getFirstname(),0,100),
84
- 'email'=>substr($customer->getEmail(),0,150),
85
  'walletId'=>Mage::getModel('payline/wallet')->generateWalletId()
86
  ),
87
  'address'=>array(),
88
  );
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  try{
91
  $resultCreateWebWallet=$paylineSDK->create_WebWallet($array);
92
  }catch (Exception $e){
@@ -102,7 +115,7 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
102
  $msgLog='Unknown PAYLINE ERROR on createWebWallet';
103
  }
104
  $msg=Mage::helper('payline')->__('Error during subscription');
105
- Mage::helper('payline/logger')->log($msg);
106
  Mage::getSingleton('customer/session')->addError($msg);
107
  $this->_redirect('customer/account');
108
  return;
81
  'buyer'=>array(
82
  'lastName'=>substr($customer->getLastname(),0,100),
83
  'firstName'=>substr($customer->getFirstname(),0,100),
 
84
  'walletId'=>Mage::getModel('payline/wallet')->generateWalletId()
85
  ),
86
  'address'=>array(),
87
  );
88
 
89
+ $email=$customer->getEmail();
90
+ if (strlen($email)<=50 && Zend_Validate::is($email, 'EmailAddress')) {
91
+ $array['buyer']['email']=$email;
92
+ }else{
93
+ $array['buyer']['email'] = '';
94
+ }
95
+
96
+ $array['contracts']=array();
97
+ if (Mage::getStoreConfig('payment/PaylineWALLET/contract_number_CB')){
98
+ $array['contracts'][]=Mage::getStoreConfig('payment/PaylineWALLET/contract_number_CB');
99
+ }
100
+ if (Mage::getStoreConfig('payment/PaylineWALLET/contract_number_AMEX')){
101
+ $array['contracts'][]=Mage::getStoreConfig('payment/PaylineWALLET/contract_number_AMEX');
102
+ }
103
  try{
104
  $resultCreateWebWallet=$paylineSDK->create_WebWallet($array);
105
  }catch (Exception $e){
115
  $msgLog='Unknown PAYLINE ERROR on createWebWallet';
116
  }
117
  $msg=Mage::helper('payline')->__('Error during subscription');
118
+ Mage::helper('payline/logger')->log($msgLog);
119
  Mage::getSingleton('customer/session')->addError($msg);
120
  $this->_redirect('customer/account');
121
  return;
app/code/community/Monext/Payline/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Monext_Payline>
5
- <version>1.6.0</version>
6
  </Monext_Payline>
7
  </modules>
8
  <global>
@@ -28,7 +28,7 @@
28
  </payline>
29
  </helpers>
30
 
31
- <resources>
32
  <payline_setup>
33
  <setup>
34
  <module>Monext_Payline</module>
2
  <config>
3
  <modules>
4
  <Monext_Payline>
5
+ <version>1.6.1</version>
6
  </Monext_Payline>
7
  </modules>
8
  <global>
28
  </payline>
29
  </helpers>
30
 
31
+ <resources>
32
  <payline_setup>
33
  <setup>
34
  <module>Monext_Payline</module>
app/design/frontend/default/default/template/payline/checkout/onepage.phtml CHANGED
@@ -65,6 +65,14 @@ if (!empty($shippingMethod)):?>
65
  }else{
66
  checkout.reloadProgressBlock();
67
  showPopin($('wait-txt'), false);
 
 
 
 
 
 
 
 
68
  //checkout.gotoSection('review');
69
  }
70
  }
@@ -97,5 +105,7 @@ if (!empty($shippingMethod)):?>
97
  }
98
 
99
  saveStepFromActionPile();
 
 
100
  //]]>
101
  </script>
65
  }else{
66
  checkout.reloadProgressBlock();
67
  showPopin($('wait-txt'), false);
68
+ //hide checkout button to avoid any second click
69
+ if ($$('.btn-checkout')){
70
+ $$('.btn-checkout').each(function(elem){
71
+ Event.observe(elem, 'click', function(event){
72
+ this.setStyle({'display':'none'});
73
+ });}
74
+ );
75
+ }
76
  //checkout.gotoSection('review');
77
  }
78
  }
105
  }
106
 
107
  saveStepFromActionPile();
108
+
109
+
110
  //]]>
111
  </script>
app/locale/en_US/Monext_Payline.csv CHANGED
@@ -110,4 +110,5 @@
110
  "Phone and e-mail address","Phone and e-mail address"
111
  "1-click checkout","1-click checkout"
112
  "Secured by Payline","Secured by Payline"
113
- "Edit my data","Edit my data"
 
110
  "Phone and e-mail address","Phone and e-mail address"
111
  "1-click checkout","1-click checkout"
112
  "Secured by Payline","Secured by Payline"
113
+ "Edit my data","Edit my data"
114
+ "You must add an address to your account to be able to checkout in one clic.","You must add an address to your account to be able to checkout in one clic."
app/locale/fr_FR/Monext_Payline.csv CHANGED
@@ -110,4 +110,5 @@
110
  "Phone and e-mail address","Téléphone et adresse email"
111
  "1-click checkout","Commander en un clic"
112
  "Secured by Payline","Securisé par Payline"
113
- "Edit my data","Modifier mes informations"
 
110
  "Phone and e-mail address","Téléphone et adresse email"
111
  "1-click checkout","Commander en un clic"
112
  "Secured by Payline","Securisé par Payline"
113
+ "Edit my data","Modifier mes informations"
114
+ "You must add an address to your account to be able to checkout in one clic.","Vous devez enregistrer une addresse à votre compte pour pouvoir faire du paiement en un clic."
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payline</name>
4
- <version>1.6.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payline payment module</summary>
10
  <description>Payline payment module</description>
11
- <notes>Add the wallet paiement method and 1 clic checkout</notes>
12
  <authors><author><name>payline</name><user>auto-converted</user><email>support@payline.com</email></author></authors>
13
- <date>2011-02-09</date>
14
- <time>16:52:24</time>
15
- <contents><target name="magelocale"><dir name="en_US"><file name="Monext_Payline.csv" hash="e5e2e60581347c07e687bd7daf803c4e"/></dir><dir name="fr_FR"><file name="Monext_Payline.csv" hash="4f3a410d5433b929d9e69b88dc407a24"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payline.css" hash="36cb9692fb85c57f5c1430a20cbfe7ec"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="83a061dd99daa4e48c4411ea8ea28391"/></dir><dir name="template"><dir name="payline"><dir name="checkout"><dir name="onepage"><file name="shipping-method.phtml" hash="c6ffe910d812e68d7a737944cf5e567f"/></dir><file name="onepage.phtml" hash="c7abb66eecc1f0e2903cad81f77e2249"/></dir><dir name="page"><file name="empty.phtml" hash="02134361869217c7445f46af028a050a"/></dir><dir name="wallet"><dir name="sidebar"><file name="form.phtml" hash="0fc6234cc29bf056252bb40c8b9f3f2b"/><file name="notlogged.phtml" hash="bf184e04f9648cf8c4671662896b99b1"/></dir><file name="checkoutbtn.phtml" hash="a1bbb577e4b2cb85bec079f315d22c15"/><file name="details.phtml" hash="b8d7e336b994261f66f1a9af5841661e"/><file name="form.phtml" hash="7358f21e31266c65982afb15239e659f"/><file name="manage.phtml" hash="994c98abd9b4f2f68f76eefe20c637d1"/><file name="sidebar.phtml" hash="011f01957ec5f5015941f59bc6c3b61b"/><file name="subscribe.phtml" hash="a737e95240e262e91ec01a02e2ce97a2"/><file name="update.phtml" hash="1b7048c9a839b0b0994beaf5e72b755c"/></dir><file name="Direct.phtml" hash="b731469e615d30fa604f143822eaa8ad"/><file name="iframe.phtml" hash="255f2ad6c09019f7e403cff3aadb9c72"/><file name="iframeleaver.phtml" hash="b617751653aa68ada738385a3959e863"/><file name="logo.phtml" hash="c22e80c9afabaaec0a7e936b15f8a219"/><file name="Payline.phtml" hash="dc264172e5a6c5ae627b697208dff65d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Monext_Payline.xml" hash="59980c5c4127dc2a7ca46a894efeb94f"/></dir></target><target name="magecommunity"><dir name="Monext"><dir name="Payline"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Items.php" hash="c7cd82866d8788ff32d42df8fcdc11f8"/></dir></dir></dir></dir></dir><dir name="Wallet"><file name="Checkoutbtn.php" hash="2574357df9378d0d25ec0d970750f0a5"/><file name="Details.php" hash="03cb96bd76d2265b842677b2a6825303"/><file name="Infos.php" hash="15d4731c490b2dcbc3f7b480608e9b1b"/><file name="Sidebar.php" hash="08293c0348e8c59c1a72041a0ca59d5b"/></dir><file name="Cpt.php" hash="32c8a04035fd4fb05fefe3bff0162663"/><file name="Direct.php" hash="6d84f0363fb7eb5a967319c7cccc72fb"/><file name="Logo.php" hash="2b7784f040f04489448fbc13b05ffe74"/><file name="Nx.php" hash="c4f40f23a346e0ba67e6a7096de620ba"/><file name="Wallet.php" hash="6326c9e76c84777597f30a89d718ccb4"/></dir><dir name="controllers"><file name="CheckoutonepageController.php" hash="9a95809b771ac9f4cd08fea69108a9a9"/><file name="IndexController.php" hash="fe05b9366eae7310655f17937533826c"/><file name="UnloggedwalletController.php" hash="ec8f49526c713ce9904eadf2abb8bb4c"/><file name="WalletController.php" hash="fae482a7e7c0e3d4a0f3ea78231abe16"/></dir><dir name="etc"><file name="config.xml" hash="5924a3cbd17dce42d102a584c5618370"/><file name="system.xml" hash="6476454539be3e1ce460ccb9086fa587"/></dir><dir name="Helper"><file name="Data.php" hash="eb4ac048e57ce80e8051aed963f2ad14"/><file name="Logger.php" hash="45a2b9e6d583adc7a816af29af16c430"/></dir><dir name="Model"><dir name="Datasource"><dir name="Status"><file name="Canceled.php" hash="c4e799efcb052536081339520c7b72c2"/></dir><file name="Actions.php" hash="2152344a8bd5fbf7dbe711c58f97356c"/><file name="Billingcycles.php" hash="bef244e6d9e744fbbc3afed9cc2050f9"/><file name="Billingoccurrences.php" hash="581ce23ec626ed71791b13c7b11fe6db"/><file name="Languages.php" hash="17053eec4880c5c5b1f233a3ca9f0bda"/><file name="Paymentactions.php" hash="6c4aae3b1b4e8b987a4da7393a3a92eb"/><file name="Securitymodes.php" hash="06c55b65e9254d96fa87595322839932"/><file name="Shippingmethods.php" hash="1c67f2af87583aae049c86cb4dcdf881"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="f0cb886cd65e23ec397e651d7913ea9e"/></dir></dir></dir><file name="Cpt.php" hash="55cc8025101a7e6efdde8f347eddd771"/><file name="Direct.php" hash="f8dfb2e707a68eaddacf54225bfb1b83"/><file name="Nx.php" hash="830433cc06e92665fd554fe0030070f0"/><file name="Wallet.php" hash="c8cb9ce833f667374d036f3e15b60222"/></dir><dir name="PaylinePHPKit"><dir name="lib"><file name="paylineSDK.php" hash="6d810f5039c636c02c93c32c3226fab0"/></dir><dir name="wsdl"><dir name="homologation"><file name="DirectPaymentAPI.wsdl" hash="ff2c4e078d4b1ed81054faa3ed6f0d00"/><file name="ExtendedAPI.wsdl" hash="ee799a667945cf7eb96e8b900497287c"/><file name="WebPaymentAPI.wsdl" hash="e579a258bd082e291359eea3355c6e26"/></dir><dir name="production"><file name="DirectPaymentAPI.wsdl" hash="bca9e74419fee1c7e55112fffd4331ee"/><file name="ExtendedAPI.wsdl" hash="021f0c11e8b17ca017b00170d6a47b5b"/><file name="WebPaymentAPI.wsdl" hash="090b55eac01074b96323482d07b2d5ed"/></dir></dir></dir><dir name="sql"><dir name="payline_setup"><file name="mysql4-install-1.6.0.php" hash="ed5013f743ba36a7b2884fc432f97e16"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payline</name>
4
+ <version>1.6.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payline payment module</summary>
10
  <description>Payline payment module</description>
11
+ <notes>Bug fixes</notes>
12
  <authors><author><name>payline</name><user>auto-converted</user><email>support@payline.com</email></author></authors>
13
+ <date>2011-04-07</date>
14
+ <time>14:44:58</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Monext_Payline.csv" hash="9c542c5c27fe4f9d46b8fd9efeb7101b"/></dir><dir name="fr_FR"><file name="Monext_Payline.csv" hash="87fc0407a9a8a3f44ea61c830d6b0aad"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payline.css" hash="47c71ad9397c496e7f54c77411c7e421"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="83a061dd99daa4e48c4411ea8ea28391"/></dir><dir name="template"><dir name="payline"><dir name="checkout"><dir name="onepage"><file name="shipping-method.phtml" hash="c6ffe910d812e68d7a737944cf5e567f"/></dir><file name="onepage.phtml" hash="773b34b3e2f33d9f6c1e3c4388a69b1b"/></dir><dir name="page"><file name="empty.phtml" hash="02134361869217c7445f46af028a050a"/></dir><dir name="wallet"><dir name="sidebar"><file name="form.phtml" hash="0fc6234cc29bf056252bb40c8b9f3f2b"/><file name="notlogged.phtml" hash="bf184e04f9648cf8c4671662896b99b1"/></dir><file name="checkoutbtn.phtml" hash="a1bbb577e4b2cb85bec079f315d22c15"/><file name="details.phtml" hash="b8d7e336b994261f66f1a9af5841661e"/><file name="form.phtml" hash="7358f21e31266c65982afb15239e659f"/><file name="manage.phtml" hash="994c98abd9b4f2f68f76eefe20c637d1"/><file name="sidebar.phtml" hash="011f01957ec5f5015941f59bc6c3b61b"/><file name="subscribe.phtml" hash="a737e95240e262e91ec01a02e2ce97a2"/><file name="update.phtml" hash="1b7048c9a839b0b0994beaf5e72b755c"/></dir><file name="Direct.phtml" hash="b731469e615d30fa604f143822eaa8ad"/><file name="iframe.phtml" hash="255f2ad6c09019f7e403cff3aadb9c72"/><file name="iframeleaver.phtml" hash="b617751653aa68ada738385a3959e863"/><file name="logo.phtml" hash="c22e80c9afabaaec0a7e936b15f8a219"/><file name="Payline.phtml" hash="dc264172e5a6c5ae627b697208dff65d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Monext_Payline.xml" hash="59980c5c4127dc2a7ca46a894efeb94f"/></dir></target><target name="magecommunity"><dir name="Monext"><dir name="Payline"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Items.php" hash="c7cd82866d8788ff32d42df8fcdc11f8"/></dir></dir></dir></dir></dir><dir name="Wallet"><file name="Checkoutbtn.php" hash="2574357df9378d0d25ec0d970750f0a5"/><file name="Details.php" hash="03cb96bd76d2265b842677b2a6825303"/><file name="Infos.php" hash="15d4731c490b2dcbc3f7b480608e9b1b"/><file name="Sidebar.php" hash="08293c0348e8c59c1a72041a0ca59d5b"/></dir><file name="Cpt.php" hash="32c8a04035fd4fb05fefe3bff0162663"/><file name="Direct.php" hash="6d84f0363fb7eb5a967319c7cccc72fb"/><file name="Logo.php" hash="2b7784f040f04489448fbc13b05ffe74"/><file name="Nx.php" hash="c4f40f23a346e0ba67e6a7096de620ba"/><file name="Wallet.php" hash="6326c9e76c84777597f30a89d718ccb4"/></dir><dir name="controllers"><file name="CheckoutonepageController.php" hash="fde6d741825482164bd3b094db2bc7b0"/><file name="IndexController.php" hash="c535fa7e8e8a92e4eeeda45c23ac1847"/><file name="UnloggedwalletController.php" hash="ec8f49526c713ce9904eadf2abb8bb4c"/><file name="WalletController.php" hash="5b014b80551906525d4239bc851ef36f"/></dir><dir name="etc"><file name="config.xml" hash="4bd835189ea1105d3c1ab36359284220"/><file name="system.xml" hash="6476454539be3e1ce460ccb9086fa587"/></dir><dir name="Helper"><file name="Data.php" hash="eb4ac048e57ce80e8051aed963f2ad14"/><file name="Logger.php" hash="45a2b9e6d583adc7a816af29af16c430"/></dir><dir name="Model"><dir name="Datasource"><dir name="Status"><file name="Canceled.php" hash="c4e799efcb052536081339520c7b72c2"/></dir><file name="Actions.php" hash="2152344a8bd5fbf7dbe711c58f97356c"/><file name="Billingcycles.php" hash="bef244e6d9e744fbbc3afed9cc2050f9"/><file name="Billingoccurrences.php" hash="581ce23ec626ed71791b13c7b11fe6db"/><file name="Languages.php" hash="17053eec4880c5c5b1f233a3ca9f0bda"/><file name="Paymentactions.php" hash="6c4aae3b1b4e8b987a4da7393a3a92eb"/><file name="Securitymodes.php" hash="06c55b65e9254d96fa87595322839932"/><file name="Shippingmethods.php" hash="1c67f2af87583aae049c86cb4dcdf881"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="f0cb886cd65e23ec397e651d7913ea9e"/></dir></dir></dir><file name="Cpt.php" hash="bc9a0f2a285aeaea8fa6f1a2710bad5b"/><file name="Direct.php" hash="da279f1d37f549f8f2ba6069102b6871"/><file name="Nx.php" hash="830433cc06e92665fd554fe0030070f0"/><file name="Wallet.php" hash="142521827776337b90c25e908d9af9d6"/></dir><dir name="PaylinePHPKit"><dir name="lib"><file name="paylineSDK.php" hash="c00837dd8ed5075bc0ba9fbc82a5b32a"/></dir><dir name="wsdl"><dir name="homologation"><file name="DirectPaymentAPI.wsdl" hash="ff2c4e078d4b1ed81054faa3ed6f0d00"/><file name="ExtendedAPI.wsdl" hash="ee799a667945cf7eb96e8b900497287c"/><file name="WebPaymentAPI.wsdl" hash="e579a258bd082e291359eea3355c6e26"/></dir><dir name="production"><file name="DirectPaymentAPI.wsdl" hash="bca9e74419fee1c7e55112fffd4331ee"/><file name="ExtendedAPI.wsdl" hash="021f0c11e8b17ca017b00170d6a47b5b"/><file name="WebPaymentAPI.wsdl" hash="090b55eac01074b96323482d07b2d5ed"/></dir></dir></dir><dir name="sql"><dir name="payline_setup"><file name="mysql4-install-1.6.0.php" hash="ed5013f743ba36a7b2884fc432f97e16"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
skin/frontend/default/default/css/payline.css CHANGED
@@ -69,4 +69,5 @@ form#wallet-checkout p{
69
  #wallet-checkout .secured-by{
70
  padding:0 5px;
71
  text-align:right;
 
72
  }
69
  #wallet-checkout .secured-by{
70
  padding:0 5px;
71
  text-align:right;
72
+ font-size:0.8em;
73
  }