Payline - Version 1.7.9.0

Version Notes

Amélioration des performances globales du module et mise en place d'URLs sécurisées pour toutes les pages de callback de l'API Payline.

Download this release

Release Info

Developer Payline
Extension Payline
Version 1.7.9.0
Comparing to
See all releases


Code changes from version 1.7.8.1 to 1.7.9.0

Files changed (40) hide show
  1. app/code/community/Monext/Payline/Block/Adminhtml/Managecontracts/Edit.php +1 -1
  2. app/code/community/Monext/Payline/Block/Cpt.php +95 -152
  3. app/code/community/Monext/Payline/Block/Direct.php +43 -33
  4. app/code/community/Monext/Payline/Helper/Data.php +524 -483
  5. app/code/community/Monext/Payline/Model/Contract.php +0 -1
  6. app/code/community/Monext/Payline/Model/Contract/Status.php +0 -1
  7. app/code/community/Monext/Payline/Model/Cpt.php +8 -7
  8. app/code/community/Monext/Payline/Model/Datasource/Capturepaymentoptions.php +29 -22
  9. app/code/community/Monext/Payline/Model/Datasource/Status.php +32 -26
  10. app/code/community/Monext/Payline/Model/Datasource/Status/Invoice.php +32 -27
  11. app/code/community/Monext/Payline/Model/Datasource/Statusrowempty.php +36 -30
  12. app/code/community/Monext/Payline/Model/Fees.php +0 -1
  13. app/code/community/Monext/Payline/Model/Mysql4/Contract.php +2 -4
  14. app/code/community/Monext/Payline/Model/Mysql4/Contract/Status.php +2 -4
  15. app/code/community/Monext/Payline/Model/Mysql4/Contract/Status/Collection.php +0 -1
  16. app/code/community/Monext/Payline/Model/Mysql4/Fees.php +0 -1
  17. app/code/community/Monext/Payline/Model/Observer.php +205 -169
  18. app/code/community/Monext/Payline/Model/Order/Invoice.php +6 -0
  19. app/code/community/Monext/Payline/Model/Order/Payment.php +6 -0
  20. app/code/community/Monext/Payline/Model/Total/Nx/Quote.php +0 -1
  21. app/code/community/Monext/Payline/Model/Wallet.php +3 -4
  22. app/code/community/Monext/Payline/PaylinePHPKit/lib/lib_debug.php +0 -1
  23. app/code/community/Monext/Payline/PaylinePHPKit/lib/paylineSDK.php +1 -2
  24. app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-12.log +66 -0
  25. app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-13.log +8 -0
  26. app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-15.log +82 -0
  27. app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-22.log +46 -0
  28. app/code/community/Monext/Payline/PaylinePHPKit/logs/remove.me +0 -0
  29. app/code/community/Monext/Payline/controllers/Adminhtml/ManagecontractsController.php +0 -224
  30. app/code/community/Monext/Payline/controllers/Adminhtml/Payline/ManagecontractsController.php +223 -0
  31. app/code/community/Monext/Payline/controllers/IndexController.php +10 -12
  32. app/code/community/Monext/Payline/controllers/WalletController.php +152 -146
  33. app/code/community/Monext/Payline/etc/config.xml +80 -80
  34. app/code/community/Monext/Payline/etc/system.xml +156 -150
  35. app/design/adminhtml/default/default/layout/payline.xml +31 -29
  36. app/design/frontend/default/default/template/payline/wallet/manage.phtml +2 -2
  37. app/design/frontend/default/default/template/payline/wallet/sidebar/form.phtml +1 -1
  38. app/design/frontend/default/default/template/payline/wallet/sidebar/notlogged.phtml +1 -1
  39. app/etc/modules/Monext_Payline.xml +11 -11
  40. package.xml +7 -7
app/code/community/Monext/Payline/Block/Adminhtml/Managecontracts/Edit.php CHANGED
@@ -10,7 +10,7 @@ class Monext_Payline_Block_Adminhtml_Managecontracts_Edit extends Mage_Adminhtml
10
 
11
  parent::__construct();
12
 
13
- $this->setData('form_action_url', Mage::getUrl('*/adminhtml_managecontracts/save'));
14
 
15
  $this->_updateButton('save', 'label', Mage::helper('payline')->__('Save contract'));
16
  $this->_removeButton('delete');
10
 
11
  parent::__construct();
12
 
13
+ $this->setData('form_action_url', Mage::getUrl('*/payline_managecontracts/save'));
14
 
15
  $this->_updateButton('save', 'label', Mage::helper('payline')->__('Save contract'));
16
  $this->_removeButton('delete');
app/code/community/Monext/Payline/Block/Cpt.php CHANGED
@@ -1,158 +1,101 @@
1
  <?php
2
- class Monext_Payline_Block_Cpt extends Mage_Payment_Block_Form {
3
- protected function _construct() {
 
 
 
 
 
 
 
 
 
 
4
  parent::_construct();
5
-
6
  $this->setTemplate('payline/Cpt.phtml');
7
- $redirectMsg=Mage::getStoreConfig('payment/PaylineCPT/redirect_message');
8
  $this->setRedirectMessage($redirectMsg);
9
- $this->setBannerSrc($this->getSkinUrl('images/payline-logo.png'));
10
  }
11
-
12
- /**
13
- * Return payment methods = primary contracts
14
- *
15
- * @return array
16
- */
17
- public function getPaymentMethods()
18
- {
19
- $contracts = Mage::getModel('payline/contract')
20
- ->getCollection()
21
- ->addFilterStatus(true,Mage::app()->getStore()->getId());
22
- $contractList = array();
23
- foreach ($contracts as $contract) {
24
- $contractList[] = array('number' => $contract->getNumber(),
25
- 'type' => $contract->getContractType(),
26
- 'name' => $contract->getName());
27
- }
28
- return $contractList;
29
- }
30
-
31
- /**
32
- * Return logo url depending on the type of card
33
- *
34
- * @param string $cardType
35
- * @return string
36
- */
37
- public function getLogoUrl($cardType)
38
- {
39
- switch($cardType) {
40
- case 'CB' :
41
- return $this->getSkinUrl('images/payline_moyens_paiement/cb.png');
42
- break;
43
- case 'AMEX' :
44
- return $this->getSkinUrl('images/payline_moyens_paiement/amex.png');
45
- break;
46
- case 'VISA' :
47
- return $this->getSkinUrl('images/payline_moyens_paiement/visa.png');
48
- break;
49
- case 'MASTERCARD' :
50
- return $this->getSkinUrl('images/payline_moyens_paiement/mastercard.png');
51
- break;
52
- case 'SOFINCO' :
53
- return $this->getSkinUrl('images/payline_moyens_paiement/sofinco.png');
54
- break;
55
- case 'DINERS' :
56
- return $this->getSkinUrl('images/payline_moyens_paiement/diners.png');
57
- break;
58
- case 'AURORE' :
59
- return $this->getSkinUrl('images/payline_moyens_paiement/aurore.png');
60
- break;
61
- case 'PASS' :
62
- return $this->getSkinUrl('images/payline_moyens_paiement/pass.png');
63
- break;
64
- case 'CBPASS' :
65
- return $this->getSkinUrl('images/payline_moyens_paiement/passvisa.png');
66
- break;
67
- case 'COFINOGA' :
68
- return $this->getSkinUrl('images/payline_moyens_paiement/cofinoga.png');
69
- break;
70
- case 'PRINTEMPS' :
71
- return $this->getSkinUrl('images/payline_moyens_paiement/printemps.png');
72
- break;
73
- case 'KANGOUROU' :
74
- return $this->getSkinUrl('images/payline_moyens_paiement/kangourou.png');
75
- break;
76
- case 'SURCOUF' :
77
- return $this->getSkinUrl('images/payline_moyens_paiement/surcouf.png');
78
- break;
79
- case 'CYRILLUS' :
80
- return $this->getSkinUrl('images/payline_moyens_paiement/cyrillus.png');
81
- break;
82
- case 'FNAC' :
83
- return $this->getSkinUrl('images/payline_moyens_paiement/fnac.png');
84
- break;
85
- case 'JCB' :
86
- return $this->getSkinUrl('images/payline_moyens_paiement/jcb.png');
87
- break;
88
- case 'MAESTRO' :
89
- return $this->getSkinUrl('images/payline_moyens_paiement/maestro.png');
90
- break;
91
- case 'MCVISA' :
92
- return $this->getSkinUrl('images/payline_moyens_paiement/mcvisa.png');
93
- break;
94
- case 'ELV' :
95
- return $this->getSkinUrl('images/payline_moyens_paiement/elv.png');
96
- break;
97
- case 'MONEO' :
98
- return $this->getSkinUrl('images/payline_moyens_paiement/moneo.png');
99
- break;
100
- case 'IDEAL' :
101
- return $this->getSkinUrl('images/payline_moyens_paiement/ideal.png');
102
- break;
103
- case 'INTERNET+' :
104
- return $this->getSkinUrl('images/payline_moyens_paiement/internetplus.png');
105
- break;
106
- case 'LEETCHI' :
107
- return $this->getSkinUrl('images/payline_moyens_paiement/leetchi.png');
108
- break;
109
- case 'MAXICHEQUE' :
110
- return $this->getSkinUrl('images/payline_moyens_paiement/maxicheque.png');
111
- break;
112
- case 'NEOSURF' :
113
- return $this->getSkinUrl('images/payline_moyens_paiement/neosurf.png');
114
- break;
115
- case 'PAYFAIR' :
116
- return $this->getSkinUrl('images/payline_moyens_paiement/payfair.png');
117
- break;
118
- case 'PAYSAFECARD' :
119
- return $this->getSkinUrl('images/payline_moyens_paiement/paysafecard.png');
120
- break;
121
- case 'TICKETSURF' :
122
- return $this->getSkinUrl('images/payline_moyens_paiement/ticketsurf.png');
123
- break;
124
- case 'OKSHOPPING' :
125
- return $this->getSkinUrl('images/payline_moyens_paiement/okshopping.png');
126
- break;
127
- case 'MANDARINE' :
128
- return $this->getSkinUrl('images/payline_moyens_paiement/mandarine.png');
129
- break;
130
- case 'PAYPAL' :
131
- return $this->getSkinUrl('images/payline_moyens_paiement/paypal.png');
132
- break;
133
- case 'CASINO' :
134
- return $this->getSkinUrl('images/payline_moyens_paiement/casino.png');
135
- break;
136
- case 'SWITCH' :
137
- return $this->getSkinUrl('images/payline_moyens_paiement/switch.png');
138
- break;
139
- case 'AMEX-ONE CLICK' :
140
- return $this->getSkinUrl('images/payline_moyens_paiement/amexoneclick.png');
141
- break;
142
- case '1EURO.COM' :
143
- return $this->getSkinUrl('images/payline_moyens_paiement/1euro.png');
144
- break;
145
- case 'SKRILL(MONEYBOOKERS)' :
146
- return $this->getSkinUrl('images/payline_moyens_paiement/skrill.png');
147
- break;
148
- case 'WEXPAY' :
149
- return $this->getSkinUrl('images/payline_moyens_paiement/wexpay.png');
150
- break;
151
- case '3XCB' :
152
- return $this->getSkinUrl('images/payline_moyens_paiement/3xcb.png');
153
- break;
154
- default :
155
- return $this->getSkinUrl('images/payline_moyens_paiement/default.png');
156
- }
157
- }
158
  }
1
  <?php
2
+
3
+ class Monext_Payline_Block_Cpt extends Mage_Payment_Block_Form
4
+ {
5
+
6
+ /**
7
+ * Payment methods
8
+ * @var array
9
+ */
10
+ protected $_paymentMethods = null;
11
+
12
+ protected function _construct()
13
+ {
14
  parent::_construct();
15
+
16
  $this->setTemplate('payline/Cpt.phtml');
17
+ $redirectMsg = Mage::getStoreConfig('payment/PaylineCPT/redirect_message');
18
  $this->setRedirectMessage($redirectMsg);
19
+ $this->setBannerSrc($this->getSkinUrl('images/payline-logo.png'));
20
  }
21
+
22
+ /**
23
+ * Return payment methods = primary contracts
24
+ *
25
+ * @return array
26
+ */
27
+ public function getPaymentMethods()
28
+ {
29
+ if ($this->_paymentMethods === null) {
30
+ $contracts = Mage::getModel('payline/contract')
31
+ ->getCollection()
32
+ ->addFilterStatus(true, Mage::app()->getStore()->getId());
33
+ $contractList = array();
34
+ foreach ($contracts as $contract) {
35
+ $contractList[] = array('number' => $contract->getNumber(),
36
+ 'type' => $contract->getContractType(),
37
+ 'name' => $contract->getName());
38
+ }
39
+ $this->_paymentMethods = $contractList;
40
+ }
41
+ return $this->_paymentMethods;
42
+ }
43
+
44
+ /**
45
+ * Return logo url depending on the type of card
46
+ *
47
+ * @param string $cardType
48
+ * @return string
49
+ */
50
+ public function getLogoUrl($cardType)
51
+ {
52
+ switch ($cardType) {
53
+ case 'CB' :
54
+ case 'AMEX' :
55
+ case 'VISA' :
56
+ case 'MASTERCARD' :
57
+ case 'SOFINCO' :
58
+ case 'DINERS' :
59
+ case 'AURORE' :
60
+ case 'PASS' :
61
+ case 'COFINOGA' :
62
+ case 'PRINTEMPS' :
63
+ case 'KANGOUROU' :
64
+ case 'SURCOUF' :
65
+ case 'CYRILLUS' :
66
+ case 'FNAC' :
67
+ case 'JCB' :
68
+ case 'MAESTRO' :
69
+ case 'MCVISA' :
70
+ case 'ELV' :
71
+ case 'MONEO' :
72
+ case 'IDEAL' :
73
+ case 'LEETCHI' :
74
+ case 'MAXICHEQUE' :
75
+ case 'NEOSURF' :
76
+ case 'PAYFAIR' :
77
+ case 'PAYSAFECARD' :
78
+ case 'TICKETSURF' :
79
+ case 'OKSHOPPING' :
80
+ case 'MANDARINE' :
81
+ case 'PAYPAL' :
82
+ case 'CASINO' :
83
+ case 'SWITCH' :
84
+ case '1EURO.COM' :
85
+ case 'WEXPAY' :
86
+ case '3XCB' :
87
+ return $this->getSkinUrl('images/payline_moyens_paiement/' . strtolower($cardType) . '.png');
88
+ case 'CBPASS' :
89
+ return $this->getSkinUrl('images/payline_moyens_paiement/passvisa.png');
90
+ case 'INTERNET+' :
91
+ return $this->getSkinUrl('images/payline_moyens_paiement/internetplus.png');
92
+ case 'AMEX-ONE CLICK' :
93
+ return $this->getSkinUrl('images/payline_moyens_paiement/amexoneclick.png');
94
+ case 'SKRILL(MONEYBOOKERS)' :
95
+ return $this->getSkinUrl('images/payline_moyens_paiement/skrill.png');
96
+ default :
97
+ return $this->getSkinUrl('images/payline_moyens_paiement/default.png');
98
+ }
99
+ }
100
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
app/code/community/Monext/Payline/Block/Direct.php CHANGED
@@ -1,34 +1,43 @@
1
  <?php
2
- class Monext_Payline_Block_Direct extends Mage_Payment_Block_Form {
3
- protected $_canUseForMultishipping = false;
4
-
5
- protected function _construct() {
 
 
 
 
 
 
 
 
 
 
6
  parent::_construct();
7
-
8
  $this->setTemplate('payline/Direct.phtml');
9
- $redirectMsg=Mage::getStoreConfig('payment/PaylineNX/redirect_message');
10
  $this->setRedirectMessage($redirectMsg);
11
  $this->setBannerSrc($this->getSkinUrl('images/payline-logo.png'));
12
  }
13
-
14
  public function getCcAvailableTypes()
15
- {
16
- $types = array();
17
- $contracts = Mage::getModel('payline/contract')->getCollection()
18
- ->addFilterStatus(true,Mage::app()->getStore()->getId())
19
- ->addFieldToFilter('contract_type',array('CB','AMEX','MCVISA'));
20
-
21
- foreach($contracts as $contract) {
22
- $types[$contract->getId()] = $contract->getName();
23
- }
24
-
25
- return $types;
26
  }
27
-
28
  public function getCcMonths()
29
  {
30
- $months = array();
31
- $months[0] = Mage::helper('payline')->__('Month');
32
  $months['01'] = '01';
33
  $months['02'] = '02';
34
  $months['03'] = '03';
@@ -43,23 +52,24 @@ class Monext_Payline_Block_Direct extends Mage_Payment_Block_Form {
43
  $months['12'] = '12';
44
  return $months;
45
  }
46
-
47
  public function getCcYears()
48
  {
49
- $years = array();
50
- $today = getdate();
51
- $years[0] = Mage::helper('payline')->__('Year');
52
- $index1 = substr($today['year'],2);
53
-
54
- $years[$index1] = $today['year'];
55
- $years[$index1+1] = $years[$index1]+1;
56
- $years[$index1+2] = $years[$index1]+2;
57
- $years[$index1+3] = $years[$index1]+3;
58
  return $years;
59
  }
60
-
61
- public function hasVerification()
62
  {
63
  return true;
64
  }
 
65
  }
1
  <?php
2
+
3
+ class Monext_Payline_Block_Direct extends Mage_Payment_Block_Form
4
+ {
5
+
6
+ protected $_canUseForMultishipping = false;
7
+
8
+ /**
9
+ * Cc available types
10
+ * @var array
11
+ */
12
+ protected $_ccAvailableTypes = null;
13
+
14
+ protected function _construct()
15
+ {
16
  parent::_construct();
17
+
18
  $this->setTemplate('payline/Direct.phtml');
19
+ $redirectMsg = Mage::getStoreConfig('payment/PaylineNX/redirect_message');
20
  $this->setRedirectMessage($redirectMsg);
21
  $this->setBannerSrc($this->getSkinUrl('images/payline-logo.png'));
22
  }
23
+
24
  public function getCcAvailableTypes()
25
+ {
26
+ if ($this->_ccAvailableTypes === null) {
27
+ $contracts = Mage::getModel('payline/contract')->getCollection()
28
+ ->addFilterStatus(true, Mage::app()->getStore()->getId())
29
+ ->addFieldToFilter('contract_type', array('CB', 'AMEX', 'MCVISA'));
30
+
31
+ $this->_ccAvailableTypes = $contracts->toOptionHash();
32
+ }
33
+
34
+ return $this->_ccAvailableTypes;
 
35
  }
36
+
37
  public function getCcMonths()
38
  {
39
+ $months = array();
40
+ $months[0] = Mage::helper('payline')->__('Month');
41
  $months['01'] = '01';
42
  $months['02'] = '02';
43
  $months['03'] = '03';
52
  $months['12'] = '12';
53
  return $months;
54
  }
55
+
56
  public function getCcYears()
57
  {
58
+ $years = array();
59
+ $today = getdate();
60
+ $years[0] = Mage::helper('payline')->__('Year');
61
+ $index1 = substr($today['year'], 2);
62
+
63
+ $years[$index1] = $today['year'];
64
+ $years[$index1 + 1] = $years[$index1] + 1;
65
+ $years[$index1 + 2] = $years[$index1] + 2;
66
+ $years[$index1 + 3] = $years[$index1] + 3;
67
  return $years;
68
  }
69
+
70
+ public function hasVerification()
71
  {
72
  return true;
73
  }
74
+
75
  }
app/code/community/Monext/Payline/Helper/Data.php CHANGED
@@ -1,252 +1,272 @@
1
  <?php
2
- class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
3
 
4
- const SECURITY_MODE = 'SSL';
5
- const CREATE_INVOICE_SHOP_RETURN = 'return';
6
- const VERSION = 4;
 
 
 
 
7
  /**
8
  * Currency codes (ISO 4217) supported by Payline
9
  * @var array
10
  */
11
- protected $_supportedCurrencyCodes = array(
12
- 'ALL' => '8', // Lek
13
- 'DZD' => '12', // Algerian Dinar
14
- 'ARS' => '32', // Argentine Peso
15
- 'AUD' => '36', // Australian Dollar
16
- 'BSD' => '44', // Bahamian Dollar
17
- 'BHD' => '48', // Bahraini Dinar
18
- 'BDT' => '50', // Taka
19
- 'AMD' => '51', // Armenian Dram
20
- 'BBD' => '52', // Barbados Dollar
21
- 'BMD' => '60', // Bermudian Dollar (customarily known as Bermuda Dollar)
22
- 'BTN' => '64', // Ngultrum
23
- 'BOB' => '68', // Boliviano
24
- 'BWP' => '72', // Pula
25
- 'BZD' => '84', // Belize Dollar
26
- 'SBD' => '90', // Solomon Islands Dollar
27
- 'BND' => '96', // Brunei Dollar
28
- 'MMK' => '104', // Kyat
29
- 'BIF' => '108', // Burundi Franc
30
- 'KHR' => '116', // Riel
31
- 'CAD' => '124', // Canadian Dollar
32
- 'CVE' => '132', // Cape Verde Escudo
33
- 'KYD' => '136', // Cayman Islands Dollar
34
- 'LKR' => '144', // Sri Lanka Rupee
35
- 'CLP' => '152', // Chilean Peso
36
- 'CNY' => '156', // Yuan Renminbi
37
- 'COP' => '170', // Colombian Peso
38
- 'KMF' => '174', // Comoro Franc
39
- 'CRC' => '188', // Costa Rican Colon
40
- 'HRK' => '191', // Croatian Kuna
41
- 'CUP' => '192', // Cuban Peso
42
- 'CYP' => '196', // Cyprus Pound
43
- 'CZK' => '203', // Czech Koruna
44
- 'DKK' => '208', // Danish Krone
45
- 'DOP' => '214', // Dominican Peso
46
- 'SVC' => '222', // El Salvador Colon
47
- 'ETB' => '230', // Ethiopian Birr
48
- 'ERN' => '232', // Nakfa
49
- 'EEK' => '233', // Kroon
50
- 'FKP' => '238', // Falkland Islands Pound
51
- 'FJD' => '242', // Fiji Dollar
52
- 'DJF' => '262', // Djibouti Franc
53
- 'GMD' => '270', // Dalasi
54
- 'GHC' => '288', // Cedi
55
- 'GIP' => '292', // Gibraltar Pound
56
- 'GTQ' => '320', // Quetzal
57
- 'GNF' => '324', // Guinea Franc
58
- 'GYD' => '328', // Guyana Dollar
59
- 'HTG' => '332', // Gourde
60
- 'HNL' => '340', // Lempira
61
- 'HKD' => '344', // Hong Kong Dollar
62
- 'HUF' => '348', // Forint
63
- 'ISK' => '352', // Iceland Krona
64
- 'INR' => '356', // Indian Rupee
65
- 'IDR' => '360', // Rupiah
66
- 'IRR' => '364', // Iranian Rial
67
- 'IQD' => '368', // Iraqi Dinar
68
- 'ILS' => '376', // New Israeli Sheqel
69
- 'JMD' => '388', // Jamaican Dollar
70
- 'JPY' => '392', // Yen
71
- 'KZT' => '398', // Tenge
72
- 'JOD' => '400', // Jordanian Dinar
73
- 'KES' => '404', // Kenyan Shilling
74
- 'KPW' => '408', // North Korean Won
75
- 'KRW' => '410', // Won
76
- 'KWD' => '414', // Kuwaiti Dinar
77
- 'KGS' => '417', // Som
78
- 'LAK' => '418', // Kip
79
- 'LBP' => '422', // Lebanese Pound
80
- 'LSL' => '426', // Loti
81
- 'LVL' => '428', // Latvian Lats
82
- 'LRD' => '430', // Liberian Dollar
83
- 'LYD' => '434', // Libyan Dinar
84
- 'LTL' => '440', // Lithuanian Litas
85
- 'MOP' => '446', // Pataca
86
- 'MWK' => '454', // Kwacha
87
- 'MYR' => '458', // Malaysian Ringgit
88
- 'MVR' => '462', // Rufiyaa
89
- 'MTL' => '470', // Maltese Lira
90
- 'MRO' => '478', // Ouguiya
91
- 'MUR' => '480', // Mauritius Rupee
92
- 'MXN' => '484', // Mexican Peso
93
- 'MNT' => '496', // Tugrik
94
- 'MDL' => '498', // Moldovan Leu
95
- 'MAD' => '504', // Moroccan Dirham
96
- 'OMR' => '512', // Rial Omani
97
- 'NAD' => '516', // Namibian Dollar
98
- 'NPR' => '524', // Nepalese Rupee
99
- 'ANG' => '532', // Netherlands Antillian Guilder
100
- 'AWG' => '533', // Aruban Guilder
101
- 'VUV' => '548', // Vatu
102
- 'NZD' => '554', // New Zealand Dollar
103
- 'NIO' => '558', // Cordoba Oro
104
- 'NGN' => '566', // Naira
105
- 'NOK' => '578', // Norwegian Krone
106
- 'PKR' => '586', // Pakistan Rupee
107
- 'PAB' => '590', // Balboa
108
- 'PGK' => '598', // Kina
109
- 'PYG' => '600', // Guarani
110
- 'PEN' => '604', // Nuevo Sol
111
- 'PHP' => '608', // Philippine Peso
112
- 'GWP' => '624', // Guinea-Bissau Peso
113
- 'QAR' => '634', // Qatari Rial
114
- 'ROL' => '642', // Old Leu
115
- 'RUB' => '643', // Russian Ruble
116
- 'RWF' => '646', // Rwanda Franc
117
- 'SHP' => '654', // Saint Helena Pound
118
- 'STD' => '678', // Dobra
119
- 'SAR' => '682', // Saudi Riyal
120
- 'SCR' => '690', // Seychelles Rupee
121
- 'SLL' => '694', // Leone
122
- 'SGD' => '702', // Singapore Dollar
123
- 'SKK' => '703', // Slovak Koruna
124
- 'VND' => '704', // Dong
125
- 'SIT' => '705', // Tolar
126
- 'SOS' => '706', // Somali Shilling
127
- 'ZAR' => '710', // Rand
128
- 'ZWD' => '716', // Zimbabwe Dollar
129
- 'SZL' => '748', // Lilangeni
130
- 'SEK' => '752', // Swedish Krona
131
- 'CHF' => '756', // Swiss Franc
132
- 'SYP' => '760', // Syrian Pound
133
- 'THB' => '764', // Baht
134
- 'TOP' => '776', // Pa'anga
135
- 'TTD' => '780', // Trinidad and Tobago Dollar
136
- 'AED' => '784', // UAE Dirham
137
- 'TND' => '788', // Tunisian Dinar
138
- 'TMM' => '795', // Manat
139
- 'UGX' => '800', // Uganda Shilling
140
- 'MKD' => '807', // Denar
141
- 'EGP' => '818', // Egyptian Pound
142
- 'GBP' => '826', // Pound Sterling
143
- 'TZS' => '834', // Tanzanian Shilling
144
- 'USD' => '840', // US Dollar
145
- 'UYU' => '858', // Peso Uruguayo
146
- 'UZS' => '860', // Uzbekistan Sum
147
- 'VEB' => '862', // Bolivar
148
- 'WST' => '882', // Tala
149
- 'YER' => '886', // Yemeni Rial
150
- 'ZMK' => '894', // Kwacha
151
- 'TWD' => '901', // New Taiwan Dollar
152
- 'SDG' => '938', // Sudanese Dinar
153
- 'UYI' => '940', // Uruguay Peso en Unidades Indexadas
154
- 'RSD' => '941', // Serbian Dinar
155
- 'MZN' => '943', // Metical
156
- 'AZN' => '944', // Azerbaijanian Manat
157
- 'RON' => '946', // New Leu
158
- 'CHE' => '947', // WIR Euro
159
- 'CHW' => '948', // WIR Franc
160
- 'TRY' => '949', // New Turkish Lira
161
- 'XAF' => '950', // CFA Franc BEAC
162
- 'XCD' => '951', // East Caribbean Dollar
163
- 'XOF' => '952', // CFA Franc BCEAO
164
- 'XPF' => '953', // CFP Franc
165
- 'XBA' => '955', // Bond Markets Units European Composite Unit (EURCO)
166
- 'XBB' => '956', // European Monetary Unit (E.M.U.-6)
167
- 'XBC' => '957', // European Unit of Account 9(E.U.A.-9)
168
- 'XBD' => '958', // European Unit of Account 17(E.U.A.-17)
169
- 'XAU' => '959', // Gold
170
- 'XDR' => '960', // SDR
171
- 'XAG' => '961', // Silver
172
- 'XPT' => '962', // Platinum
173
- 'XTS' => '963', // Codes specifically reserved for testing purposes
174
- 'XPD' => '964', // Palladium
175
- 'SRD' => '968', // Surinam Dollar
176
- 'MGA' => '969', // Malagascy Ariary
177
- 'COU' => '970', // Unidad de Valor Real
178
- 'AFN' => '971', // Afghani
179
- 'TJS' => '972', // Somoni
180
- 'AOA' => '973', // Kwanza
181
- 'BYR' => '974', // Belarussian Ruble
182
- 'BGN' => '975', // Bulgarian Lev
183
- 'CDF' => '976', // Franc Congolais
184
- 'BAM' => '977', // Convertible Marks
185
- 'EUR' => '978', // Euro
186
- 'MXV' => '979', // Mexican Unidad de Inversion (UID)
187
- 'UAH' => '980', // Hryvnia
188
- 'GEL' => '981', // Lari
189
- 'BOV' => '984', // Mvdol
190
- 'PLN' => '985', // Zloty
191
- 'BRL' => '986', // Brazilian Real
192
- 'CLF' => '990', // Unidades de formento
193
- 'USN' => '997', // (Next day)
194
- 'USS' => '998', // (Same day)
195
- 'XXX' => '999' // The codes assigned for transactions where no currency is involved
196
  );
197
-
198
- protected $_correspCCType = array(
199
- 'AMEX' => 'AMEX', // American Express
200
- 'CB' => 'VISA', // Visa
201
- 'MCVISA' => 'MASTERCARD' // MasterCard
202
  );
203
-
204
- protected $_availablePaymentMethods=array(
205
  'DIRECT', 'CPT', 'NX', 'WALLET'
206
  );
207
-
208
- public $merchantId ='';
209
- public $accessKey ='';
210
- public $proxyHost ='';
211
- public $proxyPort ='';
212
- public $proxyLogin ='';
213
- public $proxyPassword='' ;
214
- public $production ='';
215
- public $securityMode ='';
216
- public $languageCode='';
217
- public $paymentAction ='';
218
- public $paymentMode ='';
219
- public $paymentMethod = '';
220
- public $cancelUrl ='';
221
- public $notificationUrl ='';
222
- public $returnUrl ='';
223
- public $customPaymentTemplateUrl ='';
224
- public $contractNumber ='';
225
- public $contractNumberList ='';
226
- public $secondaryContractNumberList ='';
227
- public $customPaymentPageCode='' ;
228
- public $paymentCurrency ='';
229
- public $orderCurrency ='';
230
- public $walletId='';
231
- public $isNewWallet=false;
232
- public $primaryMaxfailRetry='';
233
- public $primaryCallTimeout='';
234
- public $secondaryMaxfailRetry='';
235
- public $secondaryCallTimeout='';
236
- public $switchBackTimer = '';
237
- public $paylineWsSwitchEnable = '';
238
- public $ini_file = '';
239
- public $paylineErrCode = '';
240
- public $paylineErrToken = '';
241
- public $primaryTokenPrefix = '';
242
- public $secondaryTokenPrefix = '';
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  /**
245
  * Check whether specified currency code is supported
246
  * @param string $code
247
  * @return bool
248
  */
249
- private function isCurrencyCodeSupported($code){
 
250
  return array_key_exists($code, $this->_supportedCurrencyCodes);
251
  }
252
 
@@ -255,25 +275,28 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
255
  * @param string $currencyCode
256
  * @return string
257
  */
258
- public function getNumericCurrencyCode($alphaCurrencyCode){
 
259
 
260
- if($this->isCurrencyCodeSupported($alphaCurrencyCode)){
261
  return $this->_supportedCurrencyCodes[$alphaCurrencyCode];
262
- }else{
263
  return '0000';
264
  }
265
  }
266
-
267
  protected function _hasToSentWalletId()
268
  {
269
- return (Mage::getStoreConfig('payment/PaylineWALLET/active')
270
- && (Mage::getStoreConfig('payment/PaylineCPT/send_wallet_id')
 
 
271
  || Mage::getStoreConfig('payment/PaylineNX/send_wallet_id')
272
  || Mage::getStoreConfig('payment/PaylineDirect/send_wallet_id')
273
  )
274
  );
275
  }
276
-
277
  /**
278
  *
279
  * Test if we can create a new Wallet
@@ -281,21 +304,21 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
281
  public function canSubscribeWallet()
282
  {
283
  $automateSubscriptionEnable = Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription');
284
- $customer = Mage::getSingleton('customer/session')->getCustomer();
285
  return $automateSubscriptionEnable && $customer->getWalletId() == '';
286
  }
287
-
288
  public function createWalletForCurrentCustomer($paylineSDK, $array)
289
  {
290
  if ($this->canSubscribeWallet()) {
291
- $array['contractNumber'] = $array['payment']['contractNumber'];
292
  $array['wallet']['walletId'] = Mage::getModel('payline/wallet')->generateWalletId();
293
- $walletResult = $paylineSDK->createWallet($array);
294
  if (isset($walletResult['result']['code']) && $walletResult['result']['code'] == '02500') {
295
  try {
296
  $customer = Mage::getSingleton('customer/session')->getCustomer();
297
  $customer->setWalletId($array['wallet']['walletId'])
298
- ->setWalletContractNumber($array['contractNumber'])
299
  ->save();
300
  } catch (Mage_Core_Exception $e) {
301
  Mage::logException($e);
@@ -310,178 +333,179 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
310
  * @param string $paymentMethod (CPT, NX or DIRECT)
311
  * @param $_numericCurrencyCode If provided, will also initialize currency
312
  */
313
- public function initPayline($paymentMethod, $_numericCurrencyCode=null){
314
- if (!in_array($paymentMethod, $this->_availablePaymentMethods)){
 
315
  return false;
316
  }
317
  $this->paymentMethod = $paymentMethod;
318
- if ($_numericCurrencyCode){
319
  $this->paymentCurrency = $_numericCurrencyCode;
320
- $this->orderCurrency = $this->paymentCurrency;
321
  }
322
- $xmlConfigPath='payment/Payline'.$paymentMethod;
323
  $commonConfigPath = 'payment/payline_common';
324
- $paylineFolder = Mage::getBaseDir().'/app/code/community/Monext/Payline/PaylinePHPKit/';
325
- $this->merchantId=Mage::getStoreConfig($commonConfigPath.'/merchant_id');
326
- $this->accessKey= Mage::getStoreConfig($commonConfigPath.'/access_key');
327
- if(Mage::getStoreConfig($commonConfigPath.'/proxy_host') == ''){
328
- $this->proxyHost=null;
329
- }else{
330
- $this->proxyHost=Mage::getStoreConfig($commonConfigPath.'/proxy_host');
331
- }
332
- if(Mage::getStoreConfig($commonConfigPath.'/proxy_port') == ''){
333
- $this->proxyPort=null;
334
- }else{
335
- $this->proxyPort=Mage::getStoreConfig($commonConfigPath.'/proxy_port');
336
- }
337
- $this->proxyLogin = Mage::getStoreConfig($commonConfigPath.'/proxy_login');
338
- $this->proxyPassword = Mage::getStoreConfig($commonConfigPath.'/proxy_password');
339
- $this->production = Mage::getStoreConfig($commonConfigPath.'/production');
340
- $this->securityMode = self::SECURITY_MODE;
341
- $this->languageCode = Mage::getStoreConfig($commonConfigPath.'/language');
342
-
343
- //Wallet :
344
  //If wallet_id is sent & registered, Payline will offer a checkbox "use previous payment information"
345
- $customerSession=Mage::getSingleton('customer/session');
346
- $hasToSendWalletId = Mage::getStoreConfig($xmlConfigPath.'/send_wallet_id');
347
  if ($hasToSendWalletId) {
348
- if ($customerSession->isLoggedIn()){
349
- $customer=Mage::getModel('customer/customer')->load($customerSession->getId());
350
- if ($walletId=$customer->getWalletId()){
351
- $this->walletId=$walletId;
352
  }
353
  }
354
  }
355
  //If wallet_id is sent & NOT registered, Payline will save the wallet
356
  // if isNewWallet walletId will be sent in privateData, so we'll be able to save it in notifyAction (if payment is OK)
357
- if (Mage::getStoreConfig('payment/PaylineWALLET/active') && Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription')){
358
- if ($customerSession->isLoggedIn()){
359
- $customer=Mage::getModel('customer/customer')->load($customerSession->getId());
360
- if (!$customer->getWalletId()){
361
- $this->walletId=Mage::getModel('payline/wallet')->generateWalletId();
362
- $this->isNewWallet=true;
363
  }
364
  }
365
  }
366
-
367
- if ($paymentMethod=='NX'){
368
- $this->paymentMode = 'NX';
369
- $this->paymentAction=101;
370
- $this->cancelUrl = Mage::getBaseUrl()."payline/index/nxcancel";
371
- $this->notificationUrl = Mage::getBaseUrl()."payline/index/nxnotif";
372
- $this->returnUrl = Mage::getBaseUrl()."payline/index/nxreturn";
373
- $this->contractNumberList = $this->_prepareContractList(true,true);
374
- }elseif ($paymentMethod=='CPT'){
375
- $this->paymentMode = 'CPT';
376
- $this->paymentAction = Mage::getStoreConfig($xmlConfigPath.'/payline_payment_action');
377
- $this->cancelUrl = Mage::getBaseUrl()."payline/index/cptcancel";
378
- $this->notificationUrl = Mage::getBaseUrl()."payline/index/cptnotif";
379
- $this->returnUrl = Mage::getBaseUrl()."payline/index/cptreturn";
380
- $this->contractNumberList = $this->_prepareContractList(true,false);
381
- }elseif($paymentMethod=='WALLET'){//1 clic payment
382
- $this->paymentMode = 'CPT';
383
- $this->paymentAction = Mage::getStoreConfig($xmlConfigPath.'/payline_payment_action');
384
- $this->updatePersonalDetails = Mage::getStoreConfig($xmlConfigPath.'/update_personal_details');
385
- $this->updatePaymentDetails = Mage::getStoreConfig($xmlConfigPath.'/update_payment_details');
386
- $this->contractNumberList = $this->_prepareContractList(true,true);
387
- }else{//direct
388
- $this->paymentMode = 'CPT';
389
- $this->paymentAction = Mage::getStoreConfig($xmlConfigPath.'/payline_payment_action');
390
- $this->cancelUrl = "";
391
- $this->notificationUrl = "";
392
- $this->returnUrl = "";
393
- $this->contractNumberList = $this->_prepareContractList(true,true);
394
- }
395
- $this->customPaymentTemplateUrl = Mage::getStoreConfig($xmlConfigPath.'/template_url');
396
-
397
- //primary and secondary contracts number
398
- $cNumber = explode(';',$this->contractNumberList);
399
- if (isset($cNumber[0])) {
400
- $this->contractNumber = $cNumber[0];
401
- }
402
- $this->secondaryContractNumberList = $this->_prepareContractList(false,false);
403
-
404
  // default template
405
- $this->customPaymentPageCode = Mage::getStoreConfig($xmlConfigPath.'/custom_payment_page_code');
406
-
407
  // "responsive" template
408
- $customTheme = $this->_checkUserAgentAgainstRegexps($xmlConfigPath.'/custom_payment_page_code_ua_regexp');
409
  if ($customTheme) {
410
  $this->customPaymentPageCode = $customTheme;
411
  }
412
-
413
- $this->primaryMaxfailRetry = Mage::getStoreConfig($commonConfigPath.'/primary_max_fail_retry');
414
- $this->primaryCallTimeout = Mage::getStoreConfig($commonConfigPath.'/primary_call_timeout');
415
- $this->primaryReplayTimer = Mage::getStoreConfig($commonConfigPath.'/primary_replay_timer');
416
- $this->secondaryMaxfailRetry = Mage::getStoreConfig($commonConfigPath.'/secondary_max_fail_retry');
417
- $this->secondaryCallTimeout = Mage::getStoreConfig($commonConfigPath.'/secondary_call_timeout');
418
- $this->secondaryReplayTimer = Mage::getStoreConfig($commonConfigPath.'/secondary_replay_timer');
419
-
420
- $this->switchBackTimer = Mage::getStoreConfig($commonConfigPath.'/switch_back_timer');
421
-
422
- $this->paylineWsSwitchEnable = Mage::getStoreConfig($commonConfigPath.'/payline_ws_switch_enable');
423
-
424
- $this->ini_file = $paylineFolder.'configuration/HighDefinition.ini';
425
-
426
- $this->paylineErrCode = Mage::getStoreConfig($commonConfigPath.'/payline_err_code');
427
- $this->paylineErrToken = Mage::getStoreConfig($commonConfigPath.'/payline_err_token');
428
-
429
- $this->primaryTokenPrefix = Mage::getStoreConfig($commonConfigPath.'/primary_token_prefix');
430
- $this->secondaryTokenPrefix = Mage::getStoreConfig($commonConfigPath.'/secondary_token_prefix');
431
-
432
- require_once($paylineFolder.'lib/paylineSDK.php');
433
- $payline = new paylineSDK($this->merchantId,$this->accessKey,$this->proxyHost,$this->proxyPort,$this->proxyLogin,$this->proxyPassword,$this->production);
434
- $payline->returnURL = $this->returnUrl;
435
- $payline->cancelURL = $this->cancelUrl;
436
- $payline->notificationURL = $this->notificationUrl;
437
- $payline->customPaymentTemplateURL = $this->customPaymentTemplateUrl;
438
- $payline->languageCode = $this->languageCode;
439
- $payline->customPaymentPageCode = $this->customPaymentPageCode;
440
- $payline->securityMode = $this->securityMode;
441
- $payline->paymentAction = $this->paymentAction;
442
- return $payline;
443
-
444
- }
445
-
446
- protected function _prepareContractList($primary = true,$filterCB = false)
447
  {
448
- $contractList = array();
449
-
450
- $currentStoreId = Mage::app()->getStore()->getId();
451
-
452
- $contracts = Mage::getModel('payline/contract')->getCollection();
453
- if($primary) {
454
- $contracts->addFilterStatus(true,$currentStoreId);
455
- } else {
456
- $contracts->addFilterStatus(false,$currentStoreId);
457
- }
458
-
459
- if($filterCB) {
460
- $contracts->addFieldToFilter('contract_type',array('in' => array('CB','AMEX','MCVISA')));
461
- }
462
-
463
- foreach ($contracts as $contract) {
464
- $contractList[] = $contract->getNumber();
465
- }
466
 
467
  return implode(';', $contractList);
468
  }
469
-
470
  /**
471
  * Translate a credit card type from Mage to Payline
472
  * @param string $MageCCType
473
  */
474
- public function transcoCCType($MageCCType){
 
475
  return $this->_correspCCType[$MageCCType];
476
  }
477
-
478
  /**
479
  * Create the invoice when the customer is redirected to the shop
480
  */
481
  public function automateCreateInvoiceAtShopReturn($mode, $order)
482
  {
483
- $action = Mage::getStoreConfig('payment/Payline'.$mode.'/payline_payment_action');
484
- $canCreateInvoice = Mage::getStoreConfig('payment/Payline'.$mode.'/automate_invoice_creation');
485
  if ($mode == 'NX') {
486
  $action = Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE;
487
  }
@@ -489,7 +513,7 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
489
  $this->createInvoice($action, $order);
490
  }
491
  }
492
-
493
  public function createInvoice($action, $order)
494
  {
495
  $invoice = $order->prepareInvoice();
@@ -507,82 +531,86 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
507
  ->save();
508
  } catch (Mage_Core_Exception $e) {
509
  Mage::logException($e);
510
- Mage::helper('payline/logger')->log('[automateCreateInvoiceAtShopReturn] '
511
- .$order->getIncrementId()
512
- .' unable to save the invoice'
513
  );
514
  }
515
  }
516
-
517
- /**
518
  *
519
  * Get the contract number from a transaction (needen if defautl contract number!= of the one trully used - fore instance in a web payment & card AMEX)
520
  * @param PaylineSDK $paylineSDK
521
  * @param string $transactionId
522
  * @param string $orderRef
523
  */
524
- public function getTransactionContractNumber($paylineSDK, $transactionId, $orderRef){
 
525
  $arrayTransDetails = array(
526
- 'archiveSearch' => '',
527
- 'transactionId'=>$transactionId,
528
- 'orderRef'=>$orderRef,
529
- 'startDate' => '',
530
- 'endDate' => '',
531
  'transactionHistory' => '',
532
- 'version' => Monext_Payline_Helper_Data::VERSION
533
  );
534
- $result=$paylineSDK->getTransactionDetails( $arrayTransDetails );
535
  if (is_string($result)) {
536
- Mage::helper('payline/logger')->log('[getTransactionContractNumber] ' . $result);
537
- return '';
538
- } elseif (isset($result['result']) && $result['result']['code']!='0000' && $result['result']['code']!='2500' && $result['result']['code']!='04003'){
539
  //Back to default
540
  Mage::helper('payline/logger')->log('[getTransactionContractNumber] ' .
541
- 'Error while retrieving transaction contract number for transactionId'.' '.$transactionId.' and order '.$orderRef.' error : '.$result['result']['shortMessage']);
542
  return '';
543
- }else{
544
  return $result['payment']['contractNumber'];
545
  }
546
  }
547
-
548
  public function doReauthorization($orderIncId)
549
  {
 
 
 
550
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncId);
551
  if ($order->getId()) {
552
- $payment = $order->getPayment();
553
  $paymentMethod = $payment->getMethod();
554
  if (stripos($paymentMethod, 'payline') !== false) {
555
- $mode = explode('Payline', $paymentMethod);
556
- $array = array();
557
  $paylineSDK = Mage::helper('payline')->initPayline($mode[1], Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
558
-
559
  // PAYMENT
560
- $array['payment']['amount'] = round($order->getBaseGrandTotal()*100);
561
- $array['payment']['currency'] = Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode());
562
- $array['payment']['action'] = Monext_Payline_Model_Cpt::ACTION_AUTH;
563
- $array['payment']['mode'] = 'CPT';
564
- $array['payment']['contractNumber']=$this->getTransactionContractNumber($paylineSDK, $payment->getCcTransId(), $orderIncId);
565
  // TRANSACTION INFO
566
- $array['transactionID'] = $payment->getCcTransId();
567
  // ORDER
568
- $array['order']['ref'] = substr($orderIncId,0,50);
569
- $array['order']['amount'] = $array['payment']['amount'];
570
- $array['order']['currency'] = $array['payment']['currency'];
571
-
572
  // PRIVATE DATA
573
- $privateData = array();
574
- $privateData['key'] = "orderRef";
575
  $privateData['value'] = $orderIncId;
576
  $paylineSDK->setPrivate($privateData);
577
  try {
578
  $response = $paylineSDK->doReAuthorization($array);
579
- if(isset($response['result']) && isset($response['result']['code']) && $response['result']['code'] != '00000'){
580
- $errorMessage = Mage::helper('payline')->__("PAYLINE - Capture error").": ";
581
- $errorMessage .= isset($response['result']['longMessage'])?$response['result']['longMessage']:'';
582
- $errorMessage .= isset($response['result']['code'])?" (code ".$response['result']['code'].")<br/>":'';
583
- Mage::helper('payline/Logger')->log('[doReauthorization] ['.$orderIncId.'] ' .$errorMessage);
584
  Mage::throwException($errorMessage);
585
- }else{
586
  $payment->setCcTransId($response['transaction']['id']);
587
  $transaction = Mage::getModel('sales/order_payment_transaction');
588
  $transaction->setOrder($order);
@@ -601,13 +629,13 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
601
  Mage::throwException($this->__("The order #%s doesn't exist", $orderIncId));
602
  }
603
  }
604
-
605
  public function encodeString($string)
606
  {
607
  $string = iconv('UTF-8', "ASCII//TRANSLIT", $string);
608
  return $string;
609
  }
610
-
611
  public function setOrderStatus($order, $status)
612
  {
613
  $state = Mage::getModel('sales/order_status')->getCollection()
@@ -615,13 +643,13 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
615
  ->addFieldToFilter('state_table.status', $status)
616
  ->getFirstItem()
617
  ->getState();
618
-
619
  if (empty($state)) {
620
  $state = Mage_Sales_Model_Order::STATE_PROCESSING;
621
  }
622
  $order->setState($state, $status);
623
  }
624
-
625
  protected function _checkUserAgentAgainstRegexps($regexpsConfigPath)
626
  {
627
  if (empty($_SERVER['HTTP_USER_AGENT'])) {
@@ -657,25 +685,34 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
657
  return false;
658
  }
659
 
660
- public function getPaymentContractType($methodCode, $selector) {
661
- if( empty( $methodCode ) ) {
 
662
  return '';
663
  }
664
 
665
- $name = '';
666
- switch ( $methodCode ) {
667
- case 'PaylineDIRECT':
668
- $paymentContract = Mage::getModel('payline/contract')
669
- ->load( $selector );
670
- $name = $paymentContract->getName();
671
- break;
672
-
673
- default:
674
- $paymentContract = Mage::getModel('payline/contract')
675
- ->getCollection()
676
- ->addFieldToFilter('number', $selector)
677
- ->getFirstItem();
 
 
 
 
678
  $name = $paymentContract->getContractType();
 
 
 
 
679
  }
680
  return $name;
681
  }
@@ -687,46 +724,46 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
687
  */
688
  public function setOrderStatusAccordingToPaymentMode($order, $paymentMode, $isReAuth = false)
689
  {
690
- $paymentMethod = $order->getPayment()->getMethod();
691
- $reauthOrderStatus = Mage::getStoreConfig('payment/payline_common/reauthorized_order_status');
692
- $capturedOrderStatus = Mage::getStoreConfig('payment/payline_common/captured_order_status');
693
- $authOrderStatus = Mage::getStoreConfig('payment/payline_common/authorized_order_status');
694
 
695
  /* Monext_Payline_Model_Cpt::ACTION_RE_AUTH stand for reauth and reauth+capture.
696
  * So set the exact transaction type in order to set the right order status. */
697
- if( $paymentMode == Monext_Payline_Model_Cpt::ACTION_RE_AUTH ) {
698
- $reauthAction = Mage::getStoreConfig('payment/'.$paymentMethod.'/action_when_order_seven_day_old');
699
- $paymentMode = $reauthAction;
700
- }
701
- $arrayReAuth = array(
702
- Monext_Payline_Model_Cpt::ACTION_AUTH => $reauthOrderStatus,
703
- Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE => $capturedOrderStatus,
704
- Monext_Payline_Model_Cpt::ACTION_CAPTURE => $capturedOrderStatus,
705
  );
706
- $arrayAuth = array(
707
- Monext_Payline_Model_Cpt::ACTION_AUTH => $authOrderStatus,
708
- Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE => $capturedOrderStatus,
709
- Monext_Payline_Model_Cpt::ACTION_CAPTURE => $capturedOrderStatus
710
  );
711
 
712
  $errorTxt = '[Monext_Payline_Helper_Data#setOrderStatusAccordingToPaymentMode]'
713
- .' ERROR payment '.$paymentMode.' action not found. Unable to set order status';
714
- if( $isReAuth ) {
715
- if( isset( $arrayReAuth[ $paymentMode ] ) ) {
716
- $conf = $arrayReAuth[ $paymentMode ];
717
  } else {
718
- Mage::log( $errorTxt );
719
  return;
720
  }
721
  } else {
722
- if( isset( $arrayAuth[ $paymentMode ] ) ) {
723
- $conf = $arrayAuth[ $paymentMode ];
724
  } else {
725
- Mage::log( $errorTxt );
726
  return;
727
  }
728
  }
729
- $this->setOrderStatus( $order, $conf );
730
  }
731
 
732
  /**
@@ -736,16 +773,15 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
736
  */
737
  public function transactionExist($params)
738
  {
739
- if( isset( $params['transaction_id'] ) ) {
740
- $transaction = Mage::getModel('sales/order_payment_transaction')->load( $params['transaction_id'] );
741
- }
742
- if( isset( $params['txn_id'] ) ) {
743
  $transaction = Mage::getModel('sales/order_payment_transaction')
744
- ->getCollection()
745
- ->addFieldToFilter( 'txn_id', $params['txn_id'] )
746
- ->getFirstItem();
 
 
747
  }
748
- if( $transaction->getId() ) {
749
  return $transaction;
750
  }
751
  return false;
@@ -760,14 +796,18 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
760
  */
761
  public function getContractWalletList($store_id = null, $website_id = null, $isDefaultLevel = false)
762
  {
763
- if( $isDefaultLevel ) {
764
  $collection = Mage::getModel('payline/contract')->getCollection()->addFieldToFilter('is_included_wallet_list', 1);
765
  } else {
766
  $collection = Mage::getModel('payline/contract')->getCollection();
767
- if( isset( $store_id ) ) { $collection->addStoreFilter( $store_id ); }
768
- if( isset( $website_id ) ) { $collection->addWebsiteFilter( $website_id ); }
 
 
 
 
769
  $collection->getSelect()->where(
770
- new Zend_Db_Expr('IFNULL(status.is_included_wallet_list,main_table.is_included_wallet_list)').'=1' );
771
  }
772
  return $collection;
773
  }
@@ -779,13 +819,14 @@ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data {
779
  public function buildContractNumberWalletList()
780
  {
781
  $storeId = Mage::app()->getStore()->getStoreId();
782
- $contractCollection = $this->getContractWalletList( $storeId );
783
  $contractsNumber = array();
784
- foreach( $contractCollection as $contract ) {
785
  $contractsNumber[] = $contract['number'];
786
  }
787
- return sizeof( $contractsNumber ) > 0 ? $contractsNumber : null;
788
  }
789
 
 
790
 
791
- } // end class
1
  <?php
 
2
 
3
+ class Monext_Payline_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+
6
+ const SECURITY_MODE = 'SSL';
7
+ const CREATE_INVOICE_SHOP_RETURN = 'return';
8
+ const VERSION = 4;
9
+
10
  /**
11
  * Currency codes (ISO 4217) supported by Payline
12
  * @var array
13
  */
14
+ protected $_supportedCurrencyCodes = array(
15
+ 'ALL' => '8', // Lek
16
+ 'DZD' => '12', // Algerian Dinar
17
+ 'ARS' => '32', // Argentine Peso
18
+ 'AUD' => '36', // Australian Dollar
19
+ 'BSD' => '44', // Bahamian Dollar
20
+ 'BHD' => '48', // Bahraini Dinar
21
+ 'BDT' => '50', // Taka
22
+ 'AMD' => '51', // Armenian Dram
23
+ 'BBD' => '52', // Barbados Dollar
24
+ 'BMD' => '60', // Bermudian Dollar (customarily known as Bermuda Dollar)
25
+ 'BTN' => '64', // Ngultrum
26
+ 'BOB' => '68', // Boliviano
27
+ 'BWP' => '72', // Pula
28
+ 'BZD' => '84', // Belize Dollar
29
+ 'SBD' => '90', // Solomon Islands Dollar
30
+ 'BND' => '96', // Brunei Dollar
31
+ 'MMK' => '104', // Kyat
32
+ 'BIF' => '108', // Burundi Franc
33
+ 'KHR' => '116', // Riel
34
+ 'CAD' => '124', // Canadian Dollar
35
+ 'CVE' => '132', // Cape Verde Escudo
36
+ 'KYD' => '136', // Cayman Islands Dollar
37
+ 'LKR' => '144', // Sri Lanka Rupee
38
+ 'CLP' => '152', // Chilean Peso
39
+ 'CNY' => '156', // Yuan Renminbi
40
+ 'COP' => '170', // Colombian Peso
41
+ 'KMF' => '174', // Comoro Franc
42
+ 'CRC' => '188', // Costa Rican Colon
43
+ 'HRK' => '191', // Croatian Kuna
44
+ 'CUP' => '192', // Cuban Peso
45
+ 'CYP' => '196', // Cyprus Pound
46
+ 'CZK' => '203', // Czech Koruna
47
+ 'DKK' => '208', // Danish Krone
48
+ 'DOP' => '214', // Dominican Peso
49
+ 'SVC' => '222', // El Salvador Colon
50
+ 'ETB' => '230', // Ethiopian Birr
51
+ 'ERN' => '232', // Nakfa
52
+ 'EEK' => '233', // Kroon
53
+ 'FKP' => '238', // Falkland Islands Pound
54
+ 'FJD' => '242', // Fiji Dollar
55
+ 'DJF' => '262', // Djibouti Franc
56
+ 'GMD' => '270', // Dalasi
57
+ 'GHC' => '288', // Cedi
58
+ 'GIP' => '292', // Gibraltar Pound
59
+ 'GTQ' => '320', // Quetzal
60
+ 'GNF' => '324', // Guinea Franc
61
+ 'GYD' => '328', // Guyana Dollar
62
+ 'HTG' => '332', // Gourde
63
+ 'HNL' => '340', // Lempira
64
+ 'HKD' => '344', // Hong Kong Dollar
65
+ 'HUF' => '348', // Forint
66
+ 'ISK' => '352', // Iceland Krona
67
+ 'INR' => '356', // Indian Rupee
68
+ 'IDR' => '360', // Rupiah
69
+ 'IRR' => '364', // Iranian Rial
70
+ 'IQD' => '368', // Iraqi Dinar
71
+ 'ILS' => '376', // New Israeli Sheqel
72
+ 'JMD' => '388', // Jamaican Dollar
73
+ 'JPY' => '392', // Yen
74
+ 'KZT' => '398', // Tenge
75
+ 'JOD' => '400', // Jordanian Dinar
76
+ 'KES' => '404', // Kenyan Shilling
77
+ 'KPW' => '408', // North Korean Won
78
+ 'KRW' => '410', // Won
79
+ 'KWD' => '414', // Kuwaiti Dinar
80
+ 'KGS' => '417', // Som
81
+ 'LAK' => '418', // Kip
82
+ 'LBP' => '422', // Lebanese Pound
83
+ 'LSL' => '426', // Loti
84
+ 'LVL' => '428', // Latvian Lats
85
+ 'LRD' => '430', // Liberian Dollar
86
+ 'LYD' => '434', // Libyan Dinar
87
+ 'LTL' => '440', // Lithuanian Litas
88
+ 'MOP' => '446', // Pataca
89
+ 'MWK' => '454', // Kwacha
90
+ 'MYR' => '458', // Malaysian Ringgit
91
+ 'MVR' => '462', // Rufiyaa
92
+ 'MTL' => '470', // Maltese Lira
93
+ 'MRO' => '478', // Ouguiya
94
+ 'MUR' => '480', // Mauritius Rupee
95
+ 'MXN' => '484', // Mexican Peso
96
+ 'MNT' => '496', // Tugrik
97
+ 'MDL' => '498', // Moldovan Leu
98
+ 'MAD' => '504', // Moroccan Dirham
99
+ 'OMR' => '512', // Rial Omani
100
+ 'NAD' => '516', // Namibian Dollar
101
+ 'NPR' => '524', // Nepalese Rupee
102
+ 'ANG' => '532', // Netherlands Antillian Guilder
103
+ 'AWG' => '533', // Aruban Guilder
104
+ 'VUV' => '548', // Vatu
105
+ 'NZD' => '554', // New Zealand Dollar
106
+ 'NIO' => '558', // Cordoba Oro
107
+ 'NGN' => '566', // Naira
108
+ 'NOK' => '578', // Norwegian Krone
109
+ 'PKR' => '586', // Pakistan Rupee
110
+ 'PAB' => '590', // Balboa
111
+ 'PGK' => '598', // Kina
112
+ 'PYG' => '600', // Guarani
113
+ 'PEN' => '604', // Nuevo Sol
114
+ 'PHP' => '608', // Philippine Peso
115
+ 'GWP' => '624', // Guinea-Bissau Peso
116
+ 'QAR' => '634', // Qatari Rial
117
+ 'ROL' => '642', // Old Leu
118
+ 'RUB' => '643', // Russian Ruble
119
+ 'RWF' => '646', // Rwanda Franc
120
+ 'SHP' => '654', // Saint Helena Pound
121
+ 'STD' => '678', // Dobra
122
+ 'SAR' => '682', // Saudi Riyal
123
+ 'SCR' => '690', // Seychelles Rupee
124
+ 'SLL' => '694', // Leone
125
+ 'SGD' => '702', // Singapore Dollar
126
+ 'SKK' => '703', // Slovak Koruna
127
+ 'VND' => '704', // Dong
128
+ 'SIT' => '705', // Tolar
129
+ 'SOS' => '706', // Somali Shilling
130
+ 'ZAR' => '710', // Rand
131
+ 'ZWD' => '716', // Zimbabwe Dollar
132
+ 'SZL' => '748', // Lilangeni
133
+ 'SEK' => '752', // Swedish Krona
134
+ 'CHF' => '756', // Swiss Franc
135
+ 'SYP' => '760', // Syrian Pound
136
+ 'THB' => '764', // Baht
137
+ 'TOP' => '776', // Pa'anga
138
+ 'TTD' => '780', // Trinidad and Tobago Dollar
139
+ 'AED' => '784', // UAE Dirham
140
+ 'TND' => '788', // Tunisian Dinar
141
+ 'TMM' => '795', // Manat
142
+ 'UGX' => '800', // Uganda Shilling
143
+ 'MKD' => '807', // Denar
144
+ 'EGP' => '818', // Egyptian Pound
145
+ 'GBP' => '826', // Pound Sterling
146
+ 'TZS' => '834', // Tanzanian Shilling
147
+ 'USD' => '840', // US Dollar
148
+ 'UYU' => '858', // Peso Uruguayo
149
+ 'UZS' => '860', // Uzbekistan Sum
150
+ 'VEB' => '862', // Bolivar
151
+ 'WST' => '882', // Tala
152
+ 'YER' => '886', // Yemeni Rial
153
+ 'ZMK' => '894', // Kwacha
154
+ 'TWD' => '901', // New Taiwan Dollar
155
+ 'SDG' => '938', // Sudanese Dinar
156
+ 'UYI' => '940', // Uruguay Peso en Unidades Indexadas
157
+ 'RSD' => '941', // Serbian Dinar
158
+ 'MZN' => '943', // Metical
159
+ 'AZN' => '944', // Azerbaijanian Manat
160
+ 'RON' => '946', // New Leu
161
+ 'CHE' => '947', // WIR Euro
162
+ 'CHW' => '948', // WIR Franc
163
+ 'TRY' => '949', // New Turkish Lira
164
+ 'XAF' => '950', // CFA Franc BEAC
165
+ 'XCD' => '951', // East Caribbean Dollar
166
+ 'XOF' => '952', // CFA Franc BCEAO
167
+ 'XPF' => '953', // CFP Franc
168
+ 'XBA' => '955', // Bond Markets Units European Composite Unit (EURCO)
169
+ 'XBB' => '956', // European Monetary Unit (E.M.U.-6)
170
+ 'XBC' => '957', // European Unit of Account 9(E.U.A.-9)
171
+ 'XBD' => '958', // European Unit of Account 17(E.U.A.-17)
172
+ 'XAU' => '959', // Gold
173
+ 'XDR' => '960', // SDR
174
+ 'XAG' => '961', // Silver
175
+ 'XPT' => '962', // Platinum
176
+ 'XTS' => '963', // Codes specifically reserved for testing purposes
177
+ 'XPD' => '964', // Palladium
178
+ 'SRD' => '968', // Surinam Dollar
179
+ 'MGA' => '969', // Malagascy Ariary
180
+ 'COU' => '970', // Unidad de Valor Real
181
+ 'AFN' => '971', // Afghani
182
+ 'TJS' => '972', // Somoni
183
+ 'AOA' => '973', // Kwanza
184
+ 'BYR' => '974', // Belarussian Ruble
185
+ 'BGN' => '975', // Bulgarian Lev
186
+ 'CDF' => '976', // Franc Congolais
187
+ 'BAM' => '977', // Convertible Marks
188
+ 'EUR' => '978', // Euro
189
+ 'MXV' => '979', // Mexican Unidad de Inversion (UID)
190
+ 'UAH' => '980', // Hryvnia
191
+ 'GEL' => '981', // Lari
192
+ 'BOV' => '984', // Mvdol
193
+ 'PLN' => '985', // Zloty
194
+ 'BRL' => '986', // Brazilian Real
195
+ 'CLF' => '990', // Unidades de formento
196
+ 'USN' => '997', // (Next day)
197
+ 'USS' => '998', // (Same day)
198
+ 'XXX' => '999' // The codes assigned for transactions where no currency is involved
199
  );
200
+
201
+ protected $_correspCCType = array(
202
+ 'AMEX' => 'AMEX', // American Express
203
+ 'CB' => 'VISA', // Visa
204
+ 'MCVISA' => 'MASTERCARD' // MasterCard
205
  );
206
+
207
+ protected $_availablePaymentMethods = array(
208
  'DIRECT', 'CPT', 'NX', 'WALLET'
209
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
+ public $merchantId = '';
212
+ public $accessKey = '';
213
+ public $proxyHost = '';
214
+ public $proxyPort = '';
215
+ public $proxyLogin = '';
216
+ public $proxyPassword = '';
217
+ public $production = '';
218
+ public $securityMode = '';
219
+ public $languageCode = '';
220
+ public $paymentAction = '';
221
+ public $paymentMode = '';
222
+ public $paymentMethod = '';
223
+ public $cancelUrl = '';
224
+ public $notificationUrl = '';
225
+ public $returnUrl = '';
226
+ public $customPaymentTemplateUrl = '';
227
+ public $contractNumber = '';
228
+ public $contractNumberList = '';
229
+ public $secondaryContractNumberList = '';
230
+ public $customPaymentPageCode = '';
231
+ public $paymentCurrency = '';
232
+ public $orderCurrency = '';
233
+ public $walletId = '';
234
+ public $isNewWallet = false;
235
+ public $primaryMaxfailRetry = '';
236
+ public $primaryCallTimeout = '';
237
+ public $secondaryMaxfailRetry = '';
238
+ public $secondaryCallTimeout = '';
239
+ public $switchBackTimer = '';
240
+ public $paylineWsSwitchEnable = '';
241
+ public $ini_file = '';
242
+ public $paylineErrCode = '';
243
+ public $paylineErrToken = '';
244
+ public $primaryTokenPrefix = '';
245
+ public $secondaryTokenPrefix = '';
246
+
247
+ /**
248
+ * Loaded payment contract types
249
+ * @var array
250
+ */
251
+ protected $_paymentContractType = array();
252
+
253
+ /**
254
+ * Is the method code used by Payline?
255
+ * @param string $methodCode Method code
256
+ * @return bool
257
+ */
258
+ public function isPayline($methodCode)
259
+ {
260
+ return strpos(strtolower($methodCode), 'payline') !== false;
261
+ }
262
+
263
  /**
264
  * Check whether specified currency code is supported
265
  * @param string $code
266
  * @return bool
267
  */
268
+ private function isCurrencyCodeSupported($code)
269
+ {
270
  return array_key_exists($code, $this->_supportedCurrencyCodes);
271
  }
272
 
275
  * @param string $currencyCode
276
  * @return string
277
  */
278
+ public function getNumericCurrencyCode($alphaCurrencyCode)
279
+ {
280
 
281
+ if ($this->isCurrencyCodeSupported($alphaCurrencyCode)) {
282
  return $this->_supportedCurrencyCodes[$alphaCurrencyCode];
283
+ } else {
284
  return '0000';
285
  }
286
  }
287
+
288
  protected function _hasToSentWalletId()
289
  {
290
+ return (
291
+ Mage::getStoreConfig('payment/PaylineWALLET/active')
292
+ && (
293
+ Mage::getStoreConfig('payment/PaylineCPT/send_wallet_id')
294
  || Mage::getStoreConfig('payment/PaylineNX/send_wallet_id')
295
  || Mage::getStoreConfig('payment/PaylineDirect/send_wallet_id')
296
  )
297
  );
298
  }
299
+
300
  /**
301
  *
302
  * Test if we can create a new Wallet
304
  public function canSubscribeWallet()
305
  {
306
  $automateSubscriptionEnable = Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription');
307
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
308
  return $automateSubscriptionEnable && $customer->getWalletId() == '';
309
  }
310
+
311
  public function createWalletForCurrentCustomer($paylineSDK, $array)
312
  {
313
  if ($this->canSubscribeWallet()) {
314
+ $array['contractNumber'] = $array['payment']['contractNumber'];
315
  $array['wallet']['walletId'] = Mage::getModel('payline/wallet')->generateWalletId();
316
+ $walletResult = $paylineSDK->createWallet($array);
317
  if (isset($walletResult['result']['code']) && $walletResult['result']['code'] == '02500') {
318
  try {
319
  $customer = Mage::getSingleton('customer/session')->getCustomer();
320
  $customer->setWalletId($array['wallet']['walletId'])
321
+ ->setWalletContractNumber($array['contractNumber'])
322
  ->save();
323
  } catch (Mage_Core_Exception $e) {
324
  Mage::logException($e);
333
  * @param string $paymentMethod (CPT, NX or DIRECT)
334
  * @param $_numericCurrencyCode If provided, will also initialize currency
335
  */
336
+ public function initPayline($paymentMethod, $_numericCurrencyCode = null)
337
+ {
338
+ if (!in_array($paymentMethod, $this->_availablePaymentMethods)) {
339
  return false;
340
  }
341
  $this->paymentMethod = $paymentMethod;
342
+ if ($_numericCurrencyCode) {
343
  $this->paymentCurrency = $_numericCurrencyCode;
344
+ $this->orderCurrency = $this->paymentCurrency;
345
  }
346
+ $xmlConfigPath = 'payment/Payline' . $paymentMethod;
347
  $commonConfigPath = 'payment/payline_common';
348
+ $paylineFolder = Mage::getBaseDir() . '/app/code/community/Monext/Payline/PaylinePHPKit/';
349
+ $this->merchantId = Mage::getStoreConfig($commonConfigPath . '/merchant_id');
350
+ $this->accessKey = Mage::getStoreConfig($commonConfigPath . '/access_key');
351
+ if (Mage::getStoreConfig($commonConfigPath . '/proxy_host') == '') {
352
+ $this->proxyHost = null;
353
+ } else {
354
+ $this->proxyHost = Mage::getStoreConfig($commonConfigPath . '/proxy_host');
355
+ }
356
+ if (Mage::getStoreConfig($commonConfigPath . '/proxy_port') == '') {
357
+ $this->proxyPort = null;
358
+ } else {
359
+ $this->proxyPort = Mage::getStoreConfig($commonConfigPath . '/proxy_port');
360
+ }
361
+ $this->proxyLogin = Mage::getStoreConfig($commonConfigPath . '/proxy_login');
362
+ $this->proxyPassword = Mage::getStoreConfig($commonConfigPath . '/proxy_password');
363
+ $this->production = Mage::getStoreConfig($commonConfigPath . '/production');
364
+ $this->securityMode = self::SECURITY_MODE;
365
+ $this->languageCode = Mage::getStoreConfig($commonConfigPath . '/language');
366
+
367
+ //Wallet :
368
  //If wallet_id is sent & registered, Payline will offer a checkbox "use previous payment information"
369
+ $customerSession = Mage::getSingleton('customer/session');
370
+ $hasToSendWalletId = Mage::getStoreConfig($xmlConfigPath . '/send_wallet_id');
371
  if ($hasToSendWalletId) {
372
+ if ($customerSession->isLoggedIn()) {
373
+ $customer = $customerSession->getCustomer();
374
+ if ($walletId = $customer->getWalletId()) {
375
+ $this->walletId = $walletId;
376
  }
377
  }
378
  }
379
  //If wallet_id is sent & NOT registered, Payline will save the wallet
380
  // if isNewWallet walletId will be sent in privateData, so we'll be able to save it in notifyAction (if payment is OK)
381
+ if (Mage::getStoreConfig('payment/PaylineWALLET/active') && Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription')) {
382
+ if ($customerSession->isLoggedIn()) {
383
+ $customer = $customerSession->getCustomer();
384
+ if (!$customer->getWalletId()) {
385
+ $this->walletId = Mage::getModel('payline/wallet')->generateWalletId();
386
+ $this->isNewWallet = true;
387
  }
388
  }
389
  }
390
+
391
+ if ($paymentMethod == 'NX') {
392
+ $this->paymentMode = 'NX';
393
+ $this->paymentAction = 101;
394
+ $this->cancelUrl = Mage::getUrl('payline/index/nxcancel');
395
+ $this->notificationUrl = Mage::getUrl('payline/index/nxnotif');
396
+ $this->returnUrl = Mage::getUrl('payline/index/nxreturn');
397
+ $this->contractNumberList = $this->_prepareContractList(true, true);
398
+ } elseif ($paymentMethod == 'CPT') {
399
+ $this->paymentMode = 'CPT';
400
+ $this->paymentAction = Mage::getStoreConfig($xmlConfigPath . '/payline_payment_action');
401
+ $this->cancelUrl = Mage::getUrl('payline/index/cptcancel');
402
+ $this->notificationUrl = Mage::getUrl('payline/index/cptnotif');
403
+ $this->returnUrl = Mage::getUrl('payline/index/cptreturn');
404
+ $this->contractNumberList = $this->_prepareContractList(true, false);
405
+ } elseif ($paymentMethod == 'WALLET') {//1 clic payment
406
+ $this->paymentMode = 'CPT';
407
+ $this->paymentAction = Mage::getStoreConfig($xmlConfigPath . '/payline_payment_action');
408
+ $this->updatePersonalDetails = Mage::getStoreConfig($xmlConfigPath . '/update_personal_details');
409
+ $this->updatePaymentDetails = Mage::getStoreConfig($xmlConfigPath . '/update_payment_details');
410
+ $this->contractNumberList = $this->_prepareContractList(true, true);
411
+ } else {//direct
412
+ $this->paymentMode = 'CPT';
413
+ $this->paymentAction = Mage::getStoreConfig($xmlConfigPath . '/payline_payment_action');
414
+ $this->cancelUrl = "";
415
+ $this->notificationUrl = "";
416
+ $this->returnUrl = "";
417
+ $this->contractNumberList = $this->_prepareContractList(true, true);
418
+ }
419
+ $this->customPaymentTemplateUrl = Mage::getStoreConfig($xmlConfigPath . '/template_url');
420
+
421
+ //primary and secondary contracts number
422
+ $cNumber = explode(';', $this->contractNumberList);
423
+ if (isset($cNumber[0])) {
424
+ $this->contractNumber = $cNumber[0];
425
+ }
426
+ $this->secondaryContractNumberList = $this->_prepareContractList(false, false);
427
+
428
  // default template
429
+ $this->customPaymentPageCode = Mage::getStoreConfig($xmlConfigPath . '/custom_payment_page_code');
430
+
431
  // "responsive" template
432
+ $customTheme = $this->_checkUserAgentAgainstRegexps($xmlConfigPath . '/custom_payment_page_code_ua_regexp');
433
  if ($customTheme) {
434
  $this->customPaymentPageCode = $customTheme;
435
  }
436
+
437
+ $this->primaryMaxfailRetry = Mage::getStoreConfig($commonConfigPath . '/primary_max_fail_retry');
438
+ $this->primaryCallTimeout = Mage::getStoreConfig($commonConfigPath . '/primary_call_timeout');
439
+ $this->primaryReplayTimer = Mage::getStoreConfig($commonConfigPath . '/primary_replay_timer');
440
+ $this->secondaryMaxfailRetry = Mage::getStoreConfig($commonConfigPath . '/secondary_max_fail_retry');
441
+ $this->secondaryCallTimeout = Mage::getStoreConfig($commonConfigPath . '/secondary_call_timeout');
442
+ $this->secondaryReplayTimer = Mage::getStoreConfig($commonConfigPath . '/secondary_replay_timer');
443
+
444
+ $this->switchBackTimer = Mage::getStoreConfig($commonConfigPath . '/switch_back_timer');
445
+
446
+ $this->paylineWsSwitchEnable = Mage::getStoreConfig($commonConfigPath . '/payline_ws_switch_enable');
447
+
448
+ $this->ini_file = $paylineFolder . 'configuration/HighDefinition.ini';
449
+
450
+ $this->paylineErrCode = Mage::getStoreConfig($commonConfigPath . '/payline_err_code');
451
+ $this->paylineErrToken = Mage::getStoreConfig($commonConfigPath . '/payline_err_token');
452
+
453
+ $this->primaryTokenPrefix = Mage::getStoreConfig($commonConfigPath . '/primary_token_prefix');
454
+ $this->secondaryTokenPrefix = Mage::getStoreConfig($commonConfigPath . '/secondary_token_prefix');
455
+
456
+ require_once($paylineFolder . 'lib/paylineSDK.php');
457
+ $payline = new paylineSDK($this->merchantId, $this->accessKey, $this->proxyHost, $this->proxyPort, $this->proxyLogin, $this->proxyPassword, $this->production);
458
+ $payline->returnURL = $this->returnUrl;
459
+ $payline->cancelURL = $this->cancelUrl;
460
+ $payline->notificationURL = $this->notificationUrl;
461
+ $payline->customPaymentTemplateURL = $this->customPaymentTemplateUrl;
462
+ $payline->languageCode = $this->languageCode;
463
+ $payline->customPaymentPageCode = $this->customPaymentPageCode;
464
+ $payline->securityMode = $this->securityMode;
465
+ $payline->paymentAction = $this->paymentAction;
466
+ return $payline;
467
+ }
468
+
469
+ protected function _prepareContractList($primary = true, $filterCB = false)
 
470
  {
471
+ $contractList = array();
472
+
473
+ $currentStoreId = Mage::app()->getStore()->getId();
474
+
475
+ $contracts = Mage::getModel('payline/contract')->getCollection();
476
+ if ($primary) {
477
+ $contracts->addFilterStatus(true, $currentStoreId);
478
+ } else {
479
+ $contracts->addFilterStatus(false, $currentStoreId);
480
+ }
481
+
482
+ if ($filterCB) {
483
+ $contracts->addFieldToFilter('contract_type', array('in' => array('CB', 'AMEX', 'MCVISA')));
484
+ }
485
+
486
+ foreach ($contracts as $contract) {
487
+ $contractList[] = $contract->getNumber();
488
+ }
489
 
490
  return implode(';', $contractList);
491
  }
492
+
493
  /**
494
  * Translate a credit card type from Mage to Payline
495
  * @param string $MageCCType
496
  */
497
+ public function transcoCCType($MageCCType)
498
+ {
499
  return $this->_correspCCType[$MageCCType];
500
  }
501
+
502
  /**
503
  * Create the invoice when the customer is redirected to the shop
504
  */
505
  public function automateCreateInvoiceAtShopReturn($mode, $order)
506
  {
507
+ $action = Mage::getStoreConfig('payment/Payline' . $mode . '/payline_payment_action');
508
+ $canCreateInvoice = Mage::getStoreConfig('payment/Payline' . $mode . '/automate_invoice_creation');
509
  if ($mode == 'NX') {
510
  $action = Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE;
511
  }
513
  $this->createInvoice($action, $order);
514
  }
515
  }
516
+
517
  public function createInvoice($action, $order)
518
  {
519
  $invoice = $order->prepareInvoice();
531
  ->save();
532
  } catch (Mage_Core_Exception $e) {
533
  Mage::logException($e);
534
+ Mage::helper('payline/logger')->log('[automateCreateInvoiceAtShopReturn] '
535
+ . $order->getIncrementId()
536
+ . ' unable to save the invoice'
537
  );
538
  }
539
  }
540
+
541
+ /**
542
  *
543
  * Get the contract number from a transaction (needen if defautl contract number!= of the one trully used - fore instance in a web payment & card AMEX)
544
  * @param PaylineSDK $paylineSDK
545
  * @param string $transactionId
546
  * @param string $orderRef
547
  */
548
+ public function getTransactionContractNumber($paylineSDK, $transactionId, $orderRef)
549
+ {
550
  $arrayTransDetails = array(
551
+ 'archiveSearch' => '',
552
+ 'transactionId' => $transactionId,
553
+ 'orderRef' => $orderRef,
554
+ 'startDate' => '',
555
+ 'endDate' => '',
556
  'transactionHistory' => '',
557
+ 'version' => Monext_Payline_Helper_Data::VERSION
558
  );
559
+ $result = $paylineSDK->getTransactionDetails($arrayTransDetails);
560
  if (is_string($result)) {
561
+ Mage::helper('payline/logger')->log('[getTransactionContractNumber] ' . $result);
562
+ return '';
563
+ } elseif (isset($result['result']) && $result['result']['code'] != '0000' && $result['result']['code'] != '2500' && $result['result']['code'] != '04003') {
564
  //Back to default
565
  Mage::helper('payline/logger')->log('[getTransactionContractNumber] ' .
566
+ 'Error while retrieving transaction contract number for transactionId' . ' ' . $transactionId . ' and order ' . $orderRef . ' error : ' . $result['result']['shortMessage']);
567
  return '';
568
+ } else {
569
  return $result['payment']['contractNumber'];
570
  }
571
  }
572
+
573
  public function doReauthorization($orderIncId)
574
  {
575
+ // Is this method used?? @jacquesbh
576
+ mail('jab@monsieurbiz.com', 'debug payline', mageDebugBacktrace(true));
577
+
578
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncId);
579
  if ($order->getId()) {
580
+ $payment = $order->getPayment();
581
  $paymentMethod = $payment->getMethod();
582
  if (stripos($paymentMethod, 'payline') !== false) {
583
+ $mode = explode('Payline', $paymentMethod);
584
+ $array = array();
585
  $paylineSDK = Mage::helper('payline')->initPayline($mode[1], Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode()));
586
+
587
  // PAYMENT
588
+ $array['payment']['amount'] = round($order->getBaseGrandTotal() * 100);
589
+ $array['payment']['currency'] = Mage::helper('payline')->getNumericCurrencyCode($order->getBaseCurrencyCode());
590
+ $array['payment']['action'] = Monext_Payline_Model_Cpt::ACTION_AUTH;
591
+ $array['payment']['mode'] = 'CPT';
592
+ $array['payment']['contractNumber'] = $this->getTransactionContractNumber($paylineSDK, $payment->getCcTransId(), $orderIncId);
593
  // TRANSACTION INFO
594
+ $array['transactionID'] = $payment->getCcTransId();
595
  // ORDER
596
+ $array['order']['ref'] = substr($orderIncId, 0, 50);
597
+ $array['order']['amount'] = $array['payment']['amount'];
598
+ $array['order']['currency'] = $array['payment']['currency'];
599
+
600
  // PRIVATE DATA
601
+ $privateData = array();
602
+ $privateData['key'] = "orderRef";
603
  $privateData['value'] = $orderIncId;
604
  $paylineSDK->setPrivate($privateData);
605
  try {
606
  $response = $paylineSDK->doReAuthorization($array);
607
+ if (isset($response['result']) && isset($response['result']['code']) && $response['result']['code'] != '00000') {
608
+ $errorMessage = Mage::helper('payline')->__("PAYLINE - Capture error") . ": ";
609
+ $errorMessage .= isset($response['result']['longMessage']) ? $response['result']['longMessage'] : '';
610
+ $errorMessage .= isset($response['result']['code']) ? " (code " . $response['result']['code'] . ")<br/>" : '';
611
+ Mage::helper('payline/Logger')->log('[doReauthorization] [' . $orderIncId . '] ' . $errorMessage);
612
  Mage::throwException($errorMessage);
613
+ } else {
614
  $payment->setCcTransId($response['transaction']['id']);
615
  $transaction = Mage::getModel('sales/order_payment_transaction');
616
  $transaction->setOrder($order);
629
  Mage::throwException($this->__("The order #%s doesn't exist", $orderIncId));
630
  }
631
  }
632
+
633
  public function encodeString($string)
634
  {
635
  $string = iconv('UTF-8', "ASCII//TRANSLIT", $string);
636
  return $string;
637
  }
638
+
639
  public function setOrderStatus($order, $status)
640
  {
641
  $state = Mage::getModel('sales/order_status')->getCollection()
643
  ->addFieldToFilter('state_table.status', $status)
644
  ->getFirstItem()
645
  ->getState();
646
+
647
  if (empty($state)) {
648
  $state = Mage_Sales_Model_Order::STATE_PROCESSING;
649
  }
650
  $order->setState($state, $status);
651
  }
652
+
653
  protected function _checkUserAgentAgainstRegexps($regexpsConfigPath)
654
  {
655
  if (empty($_SERVER['HTTP_USER_AGENT'])) {
685
  return false;
686
  }
687
 
688
+ public function getPaymentContractType($methodCode, $selector)
689
+ {
690
+ if (empty($methodCode)) {
691
  return '';
692
  }
693
 
694
+ if (!isset($this->_paymentContractType[$methodCode])) {
695
+ $this->_paymentContractType[$methodCode] = array();
696
+ }
697
+ if (!isset($this->_paymentContractType[$methodCode][$selector])) {
698
+ $name = '';
699
+ switch ($methodCode) {
700
+ case 'PaylineDIRECT':
701
+ $paymentContract = Mage::getModel('payline/contract')
702
+ ->load($selector);
703
+ $name = $paymentContract->getName();
704
+ break;
705
+
706
+ default:
707
+ $paymentContract = Mage::getModel('payline/contract')
708
+ ->getCollection()
709
+ ->addFieldToFilter('number', $selector)
710
+ ->getFirstItem();
711
  $name = $paymentContract->getContractType();
712
+ }
713
+ $this->_paymentContractType[$methodCode][$selector] = $name;
714
+ } else {
715
+ $name = $this->_paymentContractType[$methodCode][$selector];
716
  }
717
  return $name;
718
  }
724
  */
725
  public function setOrderStatusAccordingToPaymentMode($order, $paymentMode, $isReAuth = false)
726
  {
727
+ $paymentMethod = $order->getPayment()->getMethod();
728
+ $reauthOrderStatus = Mage::getStoreConfig('payment/payline_common/reauthorized_order_status');
729
+ $capturedOrderStatus = Mage::getStoreConfig('payment/payline_common/captured_order_status');
730
+ $authOrderStatus = Mage::getStoreConfig('payment/payline_common/authorized_order_status');
731
 
732
  /* Monext_Payline_Model_Cpt::ACTION_RE_AUTH stand for reauth and reauth+capture.
733
  * So set the exact transaction type in order to set the right order status. */
734
+ if ($paymentMode == Monext_Payline_Model_Cpt::ACTION_RE_AUTH) {
735
+ $reauthAction = Mage::getStoreConfig('payment/' . $paymentMethod . '/action_when_order_seven_day_old');
736
+ $paymentMode = $reauthAction;
737
+ }
738
+ $arrayReAuth = array(
739
+ Monext_Payline_Model_Cpt::ACTION_AUTH => $reauthOrderStatus,
740
+ Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE => $capturedOrderStatus,
741
+ Monext_Payline_Model_Cpt::ACTION_CAPTURE => $capturedOrderStatus,
742
  );
743
+ $arrayAuth = array(
744
+ Monext_Payline_Model_Cpt::ACTION_AUTH => $authOrderStatus,
745
+ Monext_Payline_Model_Cpt::ACTION_AUTH_CAPTURE => $capturedOrderStatus,
746
+ Monext_Payline_Model_Cpt::ACTION_CAPTURE => $capturedOrderStatus
747
  );
748
 
749
  $errorTxt = '[Monext_Payline_Helper_Data#setOrderStatusAccordingToPaymentMode]'
750
+ . ' ERROR payment ' . $paymentMode . ' action not found. Unable to set order status';
751
+ if ($isReAuth) {
752
+ if (isset($arrayReAuth[$paymentMode])) {
753
+ $conf = $arrayReAuth[$paymentMode];
754
  } else {
755
+ Mage::log($errorTxt);
756
  return;
757
  }
758
  } else {
759
+ if (isset($arrayAuth[$paymentMode])) {
760
+ $conf = $arrayAuth[$paymentMode];
761
  } else {
762
+ Mage::log($errorTxt);
763
  return;
764
  }
765
  }
766
+ $this->setOrderStatus($order, $conf);
767
  }
768
 
769
  /**
773
  */
774
  public function transactionExist($params)
775
  {
776
+ if (isset($params['txn_id'])) {
 
 
 
777
  $transaction = Mage::getModel('sales/order_payment_transaction')
778
+ ->getCollection()
779
+ ->addFieldToFilter('txn_id', $params['txn_id'])
780
+ ->getFirstItem();
781
+ } elseif (isset($params['transaction_id'])) {
782
+ $transaction = Mage::getModel('sales/order_payment_transaction')->load($params['transaction_id']);
783
  }
784
+ if ($transaction->getId()) {
785
  return $transaction;
786
  }
787
  return false;
796
  */
797
  public function getContractWalletList($store_id = null, $website_id = null, $isDefaultLevel = false)
798
  {
799
+ if ($isDefaultLevel) {
800
  $collection = Mage::getModel('payline/contract')->getCollection()->addFieldToFilter('is_included_wallet_list', 1);
801
  } else {
802
  $collection = Mage::getModel('payline/contract')->getCollection();
803
+ if (isset($store_id)) {
804
+ $collection->addStoreFilter($store_id);
805
+ }
806
+ if (isset($website_id)) {
807
+ $collection->addWebsiteFilter($website_id);
808
+ }
809
  $collection->getSelect()->where(
810
+ new Zend_Db_Expr('IFNULL(status.is_included_wallet_list,main_table.is_included_wallet_list)') . '=1');
811
  }
812
  return $collection;
813
  }
819
  public function buildContractNumberWalletList()
820
  {
821
  $storeId = Mage::app()->getStore()->getStoreId();
822
+ $contractCollection = $this->getContractWalletList($storeId);
823
  $contractsNumber = array();
824
+ foreach ($contractCollection as $contract) {
825
  $contractsNumber[] = $contract['number'];
826
  }
827
+ return sizeof($contractsNumber) > 0 ? $contractsNumber : null;
828
  }
829
 
830
+ }
831
 
832
+ // end class
app/code/community/Monext/Payline/Model/Contract.php CHANGED
@@ -12,4 +12,3 @@ class Monext_Payline_Model_Contract extends Mage_Core_Model_Abstract
12
  $this->_init('payline/contract');
13
  }
14
  }
15
- ?>
12
  $this->_init('payline/contract');
13
  }
14
  }
 
app/code/community/Monext/Payline/Model/Contract/Status.php CHANGED
@@ -12,4 +12,3 @@ class Monext_Payline_Model_Contract_Status extends Mage_Core_Model_Abstract
12
  $this->_init('payline/contract_status');
13
  }
14
  }
15
- ?>
12
  $this->_init('payline/contract_status');
13
  }
14
  }
 
app/code/community/Monext/Payline/Model/Cpt.php CHANGED
@@ -43,13 +43,11 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
43
  $order = $payment->getOrder();
44
  $orderRef = $order->getRealOrderId();
45
  $transactionId = $payment->getCcTransId();
46
-
47
- $invoiceId = Mage::app()->getRequest()->getParam('invoice_id');
48
- if($invoiceId) {
49
- $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
50
- if($invoice->getTransactionId()) {
51
- $transactionId = $invoice->getTransactionId();
52
- }
53
  }
54
 
55
  $array = array();
@@ -72,6 +70,9 @@ class Monext_Payline_Model_Cpt extends Mage_Payment_Model_Method_Abstract
72
  $privateData['value'] = $orderRef;
73
  $paylineSDK->setPrivate($privateData);
74
 
 
 
 
75
  // RESPONSE
76
  $response = $paylineSDK->doRefund($array);
77
  if(is_string($response)) {
43
  $order = $payment->getOrder();
44
  $orderRef = $order->getRealOrderId();
45
  $transactionId = $payment->getCcTransId();
46
+
47
+ if ($invoice = $payment->getCreditmemo()->getInvoice()) {
48
+ if($invoice->getTransactionId()) {
49
+ $transactionId = $invoice->getTransactionId();
50
+ }
 
 
51
  }
52
 
53
  $array = array();
70
  $privateData['value'] = $orderRef;
71
  $paylineSDK->setPrivate($privateData);
72
 
73
+ // Magento version
74
+ $array['version'] = Monext_Payline_Helper_Data::VERSION;
75
+
76
  // RESPONSE
77
  $response = $paylineSDK->doRefund($array);
78
  if(is_string($response)) {
app/code/community/Monext/Payline/Model/Datasource/Capturepaymentoptions.php CHANGED
@@ -5,32 +5,39 @@
5
  class Monext_Payline_Model_Datasource_Capturepaymentoptions extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
6
  {
7
 
 
 
8
  public function toOptionArray()
9
  {
10
- $options = array();
11
- $options[] = array(
12
- 'value' => 'invoice',
13
- 'label' => 'When Invoice is created'
14
- );
 
15
 
16
- if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
17
- $collection = Mage::getResourceModel('sales/order_status_collection')
18
- ->orderByLabel();
19
- foreach ($collection as $status) {
20
- $options[] = array(
21
- 'value' => $status->getStatus(),
22
- 'label' => Mage::helper('payline')->__("When order status is '%s'", $status->getStoreLabel())
23
- );
24
- }
25
- } else {
26
- $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
27
- foreach ($statuses as $code=>$label) {
28
- $options[] = array(
29
- 'value' => $code,
30
- 'label' => Mage::helper('payline')->__("When order status is '%s'", $label)
31
- );
 
32
  }
 
 
33
  }
34
- return $options;
 
35
  }
36
  }
5
  class Monext_Payline_Model_Datasource_Capturepaymentoptions extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
6
  {
7
 
8
+ protected $_options;
9
+
10
  public function toOptionArray()
11
  {
12
+ if ($this->_options === null) {
13
+ $options = array();
14
+ $options[] = array(
15
+ 'value' => 'invoice',
16
+ 'label' => 'When Invoice is created'
17
+ );
18
 
19
+ if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
20
+ $collection = Mage::getResourceModel('sales/order_status_collection')
21
+ ->orderByLabel();
22
+ foreach ($collection as $status) {
23
+ $options[] = array(
24
+ 'value' => $status->getStatus(),
25
+ 'label' => Mage::helper('payline')->__("When order status is '%s'", $status->getStoreLabel())
26
+ );
27
+ }
28
+ } else {
29
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
30
+ foreach ($statuses as $code=>$label) {
31
+ $options[] = array(
32
+ 'value' => $code,
33
+ 'label' => Mage::helper('payline')->__("When order status is '%s'", $label)
34
+ );
35
+ }
36
  }
37
+
38
+ $this->_options = $options;
39
  }
40
+
41
+ return $this->_options;
42
  }
43
  }
app/code/community/Monext/Payline/Model/Datasource/Status.php CHANGED
@@ -1,35 +1,41 @@
1
  <?php
2
  class Monext_Payline_Model_Datasource_Status extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
3
  {
 
 
4
  public function toOptionArray()
5
  {
6
- $options = array();
7
- if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
8
- $collection = Mage::getResourceModel('sales/order_status_collection')
9
- ->orderByLabel();
10
- $statusValue = '';
11
- foreach ($collection as $status) {
12
- $statusValue = $status->getStatus();
13
- if( $statusValue === 'complete' || $statusValue === 'closed' ) {
14
- continue;
15
- }
16
- $options[] = array(
17
- 'value' => $statusValue,
18
- 'label' => $status->getStoreLabel()
19
- );
20
- }
21
- } else {
22
- $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
23
- foreach ($statuses as $code=>$label) {
24
- if( $code === 'complete' || $code === 'closed' ) {
25
- continue;
26
- }
27
- $options[] = array(
28
- 'value' => $code,
29
- 'label' => $label
30
- );
 
 
31
  }
 
32
  }
33
- return $options;
 
34
  }
35
  }
1
  <?php
2
  class Monext_Payline_Model_Datasource_Status extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
3
  {
4
+ protected $_options;
5
+
6
  public function toOptionArray()
7
  {
8
+ if ($this->_options === null) {
9
+ $options = array();
10
+ if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
11
+ $collection = Mage::getResourceModel('sales/order_status_collection')
12
+ ->orderByLabel();
13
+ $statusValue = '';
14
+ foreach ($collection as $status) {
15
+ $statusValue = $status->getStatus();
16
+ if( $statusValue === 'complete' || $statusValue === 'closed' ) {
17
+ continue;
18
+ }
19
+ $options[] = array(
20
+ 'value' => $statusValue,
21
+ 'label' => $status->getStoreLabel()
22
+ );
23
+ }
24
+ } else {
25
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
26
+ foreach ($statuses as $code=>$label) {
27
+ if( $code === 'complete' || $code === 'closed' ) {
28
+ continue;
29
+ }
30
+ $options[] = array(
31
+ 'value' => $code,
32
+ 'label' => $label
33
+ );
34
+ }
35
  }
36
+ $this->_options = $options;
37
  }
38
+
39
+ return $this->_options;
40
  }
41
  }
app/code/community/Monext/Payline/Model/Datasource/Status/Invoice.php CHANGED
@@ -3,34 +3,39 @@ class Monext_Payline_Model_Datasource_Status_Invoice extends Monext_Payline_Mode
3
  {
4
  public function toOptionArray()
5
  {
6
- $options = array();
7
- $options[] = array(
8
- 'value' => '',
9
- 'label' => Mage::helper('adminhtml')->__('No')
10
- );
11
- $options[] = array(
12
- 'value' => 'return',
13
- 'label' => Mage::helper('payline')->__('Back to the shop')
14
- );
15
- if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
16
- $collection = Mage::getResourceModel('sales/order_status_collection')
17
- ->orderByLabel();
18
- foreach ($collection as $status) {
19
- $options[] = array(
20
- 'value' => $status->getStatus(),
21
- 'label' => Mage::helper('payline')->__("When order status is '%s'", $status->getStoreLabel())
22
- );
23
- }
24
- } else {
25
- $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
26
- foreach ($statuses as $code=>$label) {
27
- $options[] = array(
28
- 'value' => $code,
29
- 'label' => Mage::helper('payline')->__("When order status is '%s'", $label)
30
- );
 
 
 
31
  }
 
 
32
  }
33
-
34
- return $options;
35
  }
36
  }
3
  {
4
  public function toOptionArray()
5
  {
6
+
7
+ if ($this->_options === null) {
8
+ $options = array();
9
+ $options[] = array(
10
+ 'value' => '',
11
+ 'label' => Mage::helper('adminhtml')->__('No')
12
+ );
13
+ $options[] = array(
14
+ 'value' => 'return',
15
+ 'label' => Mage::helper('payline')->__('Back to the shop')
16
+ );
17
+ if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
18
+ $collection = Mage::getResourceModel('sales/order_status_collection')
19
+ ->orderByLabel();
20
+ foreach ($collection as $status) {
21
+ $options[] = array(
22
+ 'value' => $status->getStatus(),
23
+ 'label' => Mage::helper('payline')->__("When order status is '%s'", $status->getStoreLabel())
24
+ );
25
+ }
26
+ } else {
27
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
28
+ foreach ($statuses as $code=>$label) {
29
+ $options[] = array(
30
+ 'value' => $code,
31
+ 'label' => Mage::helper('payline')->__("When order status is '%s'", $label)
32
+ );
33
+ }
34
  }
35
+
36
+ $this->_options = $options;
37
  }
38
+
39
+ return $this->_options;
40
  }
41
  }
app/code/community/Monext/Payline/Model/Datasource/Statusrowempty.php CHANGED
@@ -1,40 +1,46 @@
1
  <?php
2
  class Monext_Payline_Model_Datasource_Statusrowempty extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
3
  {
 
 
4
  public function toOptionArray()
5
  {
6
- $options = array();
7
- $options[] = array(
8
- 'value' => '',
9
- 'label' => 'None'
10
- );
11
- if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
12
- $collection = Mage::getResourceModel('sales/order_status_collection')
13
- ->orderByLabel();
14
- $statusValue = '';
15
- foreach ($collection as $status) {
16
- $statusValue = $status->getStatus();
17
- if( $statusValue === 'complete' || $statusValue === 'closed' ) {
18
- continue;
19
- }
20
- $options[] = array(
21
- 'value' => $statusValue,
22
- 'label' => $status->getStoreLabel()
23
- );
24
- }
25
- } else {
26
- $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
27
- foreach ($statuses as $code=>$label) {
28
- if( $code === 'complete' || $code === 'closed' ) {
29
- continue;
30
- }
31
- $options[] = array(
32
- 'value' => $code,
33
- 'label' => $label
34
- );
 
 
35
  }
 
 
36
  }
37
 
38
- return $options;
39
  }
40
  }
1
  <?php
2
  class Monext_Payline_Model_Datasource_Statusrowempty extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
3
  {
4
+ protected $_options;
5
+
6
  public function toOptionArray()
7
  {
8
+ if ($this->_options === null) {
9
+ $options = array();
10
+ $options[] = array(
11
+ 'value' => '',
12
+ 'label' => 'None'
13
+ );
14
+ if (class_exists('Mage_Sales_Model_Mysql4_Order_Status_Collection')) {
15
+ $collection = Mage::getResourceModel('sales/order_status_collection')
16
+ ->orderByLabel();
17
+ $statusValue = '';
18
+ foreach ($collection as $status) {
19
+ $statusValue = $status->getStatus();
20
+ if( $statusValue === 'complete' || $statusValue === 'closed' ) {
21
+ continue;
22
+ }
23
+ $options[] = array(
24
+ 'value' => $statusValue,
25
+ 'label' => $status->getStoreLabel()
26
+ );
27
+ }
28
+ } else {
29
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
30
+ foreach ($statuses as $code=>$label) {
31
+ if( $code === 'complete' || $code === 'closed' ) {
32
+ continue;
33
+ }
34
+ $options[] = array(
35
+ 'value' => $code,
36
+ 'label' => $label
37
+ );
38
+ }
39
  }
40
+
41
+ $this->_options = $options;
42
  }
43
 
44
+ return $this->_options;
45
  }
46
  }
app/code/community/Monext/Payline/Model/Fees.php CHANGED
@@ -12,4 +12,3 @@ class Monext_Payline_Model_Fees extends Mage_Core_Model_Abstract
12
  $this->_init('payline/fees');
13
  }
14
  }
15
- ?>
12
  $this->_init('payline/fees');
13
  }
14
  }
 
app/code/community/Monext/Payline/Model/Mysql4/Contract.php CHANGED
@@ -47,7 +47,7 @@ class Monext_Payline_Model_Mysql4_Contract extends Mage_Core_Model_Mysql4_Abstra
47
  if(!$store_code) {
48
  if($website_code) {
49
  $isWebsiteLevel = true;
50
- $website = Mage::getModel('core/website')->load($website_code);
51
  $websiteId = $website->getId();
52
  $storeIds = $website->getStoreIds();
53
  } else {
@@ -55,8 +55,7 @@ class Monext_Payline_Model_Mysql4_Contract extends Mage_Core_Model_Mysql4_Abstra
55
  }
56
  } else {
57
  $isStoreViewLevel = true;
58
- $storeIds = Mage::getModel('core/store')->load($store_code)->getId();
59
- $storeIds = array($storeIds);
60
  }
61
 
62
  $connection->beginTransaction();
@@ -238,4 +237,3 @@ class Monext_Payline_Model_Mysql4_Contract extends Mage_Core_Model_Mysql4_Abstra
238
  }
239
 
240
  } //end class
241
- ?>
47
  if(!$store_code) {
48
  if($website_code) {
49
  $isWebsiteLevel = true;
50
+ $website = Mage::app()->getWebsite($website_code);
51
  $websiteId = $website->getId();
52
  $storeIds = $website->getStoreIds();
53
  } else {
55
  }
56
  } else {
57
  $isStoreViewLevel = true;
58
+ $storeIds = array(Mage::app()->getStore($store_code)->getId());
 
59
  }
60
 
61
  $connection->beginTransaction();
237
  }
238
 
239
  } //end class
 
app/code/community/Monext/Payline/Model/Mysql4/Contract/Status.php CHANGED
@@ -36,7 +36,7 @@ class Monext_Payline_Model_Mysql4_Contract_Status extends Mage_Core_Model_Mysql4
36
  if(!$store_code) {
37
  if($website_code) {
38
  $isWebsiteLevel = true;
39
- $website = Mage::getModel('core/website')->load($website_code);
40
  $websiteId = $website->getId();
41
  $storeIds = $website->getStoreIds();
42
  } else {
@@ -44,8 +44,7 @@ class Monext_Payline_Model_Mysql4_Contract_Status extends Mage_Core_Model_Mysql4
44
  }
45
  } else {
46
  $isStoreViewLevel = true;
47
- $storeIds = Mage::getModel('core/store')->load($store_code)->getId();
48
- $storeIds = array($storeIds);
49
  }
50
  $connection = $this->_getWriteAdapter();
51
  $connection->beginTransaction();
@@ -268,4 +267,3 @@ class Monext_Payline_Model_Mysql4_Contract_Status extends Mage_Core_Model_Mysql4
268
  }
269
 
270
  }
271
- ?>
36
  if(!$store_code) {
37
  if($website_code) {
38
  $isWebsiteLevel = true;
39
+ $website = Mage::app()->getWebsite($website_code);
40
  $websiteId = $website->getId();
41
  $storeIds = $website->getStoreIds();
42
  } else {
44
  }
45
  } else {
46
  $isStoreViewLevel = true;
47
+ $storeIds = array(Mage::app()->getStore($store_code)->getId());
 
48
  }
49
  $connection = $this->_getWriteAdapter();
50
  $connection->beginTransaction();
267
  }
268
 
269
  }
 
app/code/community/Monext/Payline/Model/Mysql4/Contract/Status/Collection.php CHANGED
@@ -11,4 +11,3 @@ class Monext_Payline_Model_Mysql4_Contract_Status_Collection extends Mage_Core_M
11
  }
12
  }
13
 
14
- ?>
11
  }
12
  }
13
 
 
app/code/community/Monext/Payline/Model/Mysql4/Fees.php CHANGED
@@ -11,4 +11,3 @@ class Monext_Payline_Model_Mysql4_Fees extends Mage_Core_Model_Mysql4_Abstract
11
  $this->_init('payline/fees', 'id');
12
  }
13
  }
14
- ?>
11
  $this->_init('payline/fees', 'id');
12
  }
13
  }
 
app/code/community/Monext/Payline/Model/Observer.php CHANGED
@@ -1,27 +1,37 @@
1
  <?php
 
2
  class Monext_Payline_Model_Observer
3
  {
 
4
  protected $_mode;
5
-
6
  public function createInvoiceWhenStatusChange(Varien_Event_Observer $observer)
7
  {
 
 
 
 
 
 
8
  // infinite loop protection
9
- if( is_null( Mage::registry('payline_create_invoice') ) ) {
10
  $order = $observer->getEvent()->getOrder();
11
- if ( $this->_canCreateInvoice( $order ) ) {
12
- $this->_createInvoice( $order );
13
  }
14
  // capture or not, that is the question
15
- $paymentMethod = $order->getPayment()->getMethod();
16
- $paymentActionConf = Mage::getStoreConfig('payment/'.$paymentMethod.'/payline_payment_action');
17
  // if payment action user conf == authorization => need to capture
18
- if( $paymentActionConf == "100" ) {
19
- $fireCaptureOption = Mage::getStoreConfig('payment/'.$paymentMethod.'/capture_payment_when_i_said');
20
  // if status match w/ user conf && !PaylineNX
21
- if( $order->getStatus() == $fireCaptureOption && $paymentMethod != 'PaylineNX' ) {
22
- $invoice = $this->_getInvoiceFromOrder( $order );
23
- if( $invoice ) { $invoice->setState( Mage_Sales_Model_Order_Invoice::STATE_OPEN ); }
24
- if( $invoice && $invoice->parentCanCapture() ) { // invoice present && ok => capture
 
 
25
  Mage::register('payline_create_invoice', true);
26
  $invoice->capture();
27
  Mage::unregister('payline_create_invoice');
@@ -29,41 +39,42 @@ class Monext_Payline_Model_Observer
29
  } // end if status matches
30
  } // end if( $paymentActionConf == 100 )
31
  }
 
32
 
33
- } // end createInvoiceWhenStatusChange()
34
 
35
  /**
36
  * Return the invoice's order data or false if not exist or NX payment
37
  */
38
  protected function _getInvoiceFromOrder($order)
39
  {
40
- $invoice = $order->getInvoiceCollection();
41
- $invoice = sizeof($invoice) == 1 ? $invoice->getFirstItem() : false;
42
  return $invoice;
43
  }
44
-
45
  protected function _getMode($order)
46
  {
47
  if ($this->_mode === null) {
48
  $paymentMethod = $order->getPayment()->getMethod();
49
- $mode = explode('Payline', $paymentMethod);
50
  if (isset($mode[1])) {
51
- $mode = $mode[1];
52
  $this->_mode = $mode;
53
  }
54
  }
55
  return $this->_mode;
56
  }
57
-
58
  protected function _canCreateInvoice($order)
59
  {
60
  $result = false;
61
- if ( $order->canInvoice() ) {
62
  $paymentMethod = $order->getPayment()->getMethod();
63
  if (strstr($paymentMethod, 'Payline') !== false) {
64
  $mode = $this->_getMode($order);
65
  if (!empty($mode)) {
66
- $statusToCreateInvoice = Mage::getStoreConfig('payment/'.$paymentMethod.'/automate_invoice_creation');
67
  if ($order->getStatus() == $statusToCreateInvoice && !empty($statusToCreateInvoice)) {
68
  if ($order->getData('status') !== $order->getOrigData('status')) {
69
  $result = true;
@@ -90,7 +101,7 @@ class Monext_Payline_Model_Observer
90
  );
91
  try {
92
  $mode = $this->_getMode($order);
93
- $res = Mage::helper('payline')->initPayline($mode)->getTransactionDetails($array);
94
  if (isset($res['payment']['action'])) {
95
  $order->setCreateInvoice(true);
96
  $action = $res['payment']['action'];
@@ -102,179 +113,204 @@ class Monext_Payline_Model_Observer
102
  } catch (Exception $e) {
103
  Mage::logException($e);
104
  Mage::helper('payline/logger')->log(
105
- '[createInvoiceWhenStatusChange] '
106
- .'['.$order->getIncrementId().'] '
107
- .'['.$transId.'] '
108
- .$e->getMessage()
109
  );
110
  }
111
  }
112
  }
113
-
114
- public function saveQuoteNxFees(Varien_Event_Observer $observer)
115
- {
116
- $applyCosts = (int)Mage::getStoreConfig('payment/PaylineNX/cost_type');
117
- if(!$applyCosts) {
118
- return;
119
- }
120
-
121
- $quote = $observer->getEvent()->getQuote();
122
-
123
- $payment = $quote->getPayment();
124
- if($payment) {
125
- $paymentMethod = $payment->getMethod();
126
- $fee = Mage::getModel('payline/fees')->getCollection()
127
- ->addFieldtoFilter('quote_id',$quote->getId())->getFirstItem();
128
- if($paymentMethod == 'PaylineNX') {
129
- $amount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
130
- $baseamount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
131
-
132
- if($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
133
- $amount = round(($quote->getSubtotal()*$amount)/100,2);
134
- $baseamount = round(($quote->getBaseSubtotal()*$baseamount)/100,2);
135
- }
136
-
137
- //save fees
138
- if($fee->getId()) {
139
- $fee->setAmount($amount)->setBaseAmount($baseamount)->save();
140
- } else {
141
- Mage::getModel('payline/fees')->setQuoteId($quote->getId())
142
- ->setAmount($amount)
143
- ->setBaseAmount($baseamount)
144
- ->save();
145
- }
146
- } elseif($fee->getId()) {
147
- $fee->delete();
148
- }
149
- }
150
- }
151
-
152
- public function saveOrderNxFees(Varien_Event_Observer $observer)
153
- {
154
- $applyCosts = (int)Mage::getStoreConfig('payment/PaylineNX/cost_type');
155
- if(!$applyCosts) {
156
- return;
157
- }
158
-
159
- $order = $observer->getEvent()->getOrder();
160
- $quoteId = $order->getQuoteId();
161
- $payment = $order->getPayment();
162
- if($quoteId && $payment) {
163
- $paymentMethod = $payment->getMethod();
164
- $fee = Mage::getModel('payline/fees')->getCollection()
165
- ->addFieldtoFilter('quote_id',$quoteId)->getFirstItem();
166
- if($paymentMethod == 'PaylineNX') {
167
- $amount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
168
- $baseamount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
169
-
170
- if($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
171
- $amount = round(($order->getSubtotal()*$amount)/100,2);
172
- $baseamount = round(($order->getBaseSubtotal()*$baseamount)/100,2);
173
- }
174
-
175
- //save fees
176
- if($fee->getId()) {
177
- $fee->setOrderId($order->getId())->setAmount($amount)->setBaseAmount($baseamount)->save();
178
- }
179
- } elseif($fee->getId()) {
180
- $fee->delete();
181
- }
182
- }
183
- }
184
-
185
- public function saveInvoiceNxFees(Varien_Event_Observer $observer)
186
- {
187
- $applyCosts = (int)Mage::getStoreConfig('payment/PaylineNX/cost_type');
188
- if(!$applyCosts) {
189
- return;
190
- }
191
-
192
- $invoice = $observer->getEvent()->getInvoice();
193
- $order = $invoice->getOrder();
194
- $payment = $order->getPayment();
195
- if($payment) {
196
- $paymentMethod = $payment->getMethod();
197
- if($paymentMethod == 'PaylineNX') {
198
- $fee = Mage::getModel('payline/fees')->getCollection()
199
- ->addFieldtoFilter('order_id',$order->getId())->getFirstItem();
200
-
201
- $amount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
202
- $baseamount = (float)Mage::getStoreConfig('payment/PaylineNX/cost_amount');
203
-
204
- if($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
205
- $amount = round(($order->getSubtotal()*$amount)/100,2);
206
- $baseamount = round(($order->getBaseSubtotal()*$baseamount)/100,2);
207
- }
208
-
209
- //save fees
210
- if($fee->getId() && !$fee->getInvoiceId()) {
211
- $fee->setInvoiceId($invoice->getId())->save();
212
- }
213
- }
214
- }
215
- }
216
-
217
- public function afterSaveShippingAction(Varien_Event_Observer $observer)
218
- {
219
- $controller = $observer->getControllerAction();
220
-
221
- $paymentMethodsBlock = $controller->getLayout()->createBlock('checkout/onepage_payment_methods');
222
- $methods = $paymentMethodsBlock->getMethods();
223
-
224
- // check if more than one methods available
225
- if (count($methods)!=1) {
226
- return;
227
- }
228
-
229
- $method = current($methods);
230
-
231
- // check if only payline methods (direct method should not be skipped)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  if (!in_array($method->getCode(), array('PaylineCPT', 'PaylineNX', 'PaylineWALLET'))) {
233
- return;
234
- }
235
-
236
- $data = array('method' => $method->getCode());
237
-
238
- if ($method->getCode()=='PaylineCPT') {
239
- // retrive sub methods (card types)
240
- $cptBlock = $controller->getLayout()->createBlock('payline/cpt');
241
- $ccTypes = $cptBlock->getPaymentMethods();
242
- if (count($ccTypes)!=1) {
243
  return;
244
  }
245
- $ccType = current($ccTypes);
246
  $data['cc_type'] = $ccType['number'];
247
- }
248
-
249
- // seems that payment step can be skipped, so save the unique payment method now
250
  $result = Mage::getSingleton('checkout/type_onepage')->savePayment($data);
251
  if (!empty($result['error'])) {
252
  return;
253
  }
254
-
255
- $layout = Mage::getModel('core/layout');
256
  $layout->getUpdate()->load('checkout_onepage_review');
257
  $layout->generateXml()->generateBlocks();
258
  $layout->getBlock('root')->getChild('button')->setTemplate('checkout/onepage/review/button.phtml');
259
  $reviewHtml = $layout->getBlock('root')->toHtml();
260
-
261
- $result['goto_section'] = 'review';
262
  $result['update_section'] = array(
263
  'name' => 'review',
264
  'html' => $reviewHtml
265
  );
266
-
267
- $json = Mage::helper('core')->jsonEncode($result);
268
  $response = Mage::helper('core')->jsonDecode($controller->getResponse()->getBody());
269
-
270
  $response['update_section']['html'].= '<script type="text/javascript">
271
  //<![CDATA[
272
  paylinePaymentSavedTransport = ' . $json . ';
273
  paylineTrySkipPaymentMethod();
274
  //]]>
275
  </script>';
276
-
277
-
278
  $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
279
- }
 
280
  }
1
  <?php
2
+
3
  class Monext_Payline_Model_Observer
4
  {
5
+
6
  protected $_mode;
7
+
8
  public function createInvoiceWhenStatusChange(Varien_Event_Observer $observer)
9
  {
10
+ // Only if the payment method is one of Payline
11
+ $code = $observer->getOrder()->getPayment()->getMethodInstance()->getCode();
12
+ if (!Mage::helper('payline')->isPayline($code)) {
13
+ return;
14
+ }
15
+
16
  // infinite loop protection
17
+ if (is_null(Mage::registry('payline_create_invoice'))) {
18
  $order = $observer->getEvent()->getOrder();
19
+ if ($this->_canCreateInvoice($order)) {
20
+ $this->_createInvoice($order);
21
  }
22
  // capture or not, that is the question
23
+ $paymentMethod = $order->getPayment()->getMethod();
24
+ $paymentActionConf = Mage::getStoreConfig('payment/' . $paymentMethod . '/payline_payment_action');
25
  // if payment action user conf == authorization => need to capture
26
+ if ($paymentActionConf == "100") {
27
+ $fireCaptureOption = Mage::getStoreConfig('payment/' . $paymentMethod . '/capture_payment_when_i_said');
28
  // if status match w/ user conf && !PaylineNX
29
+ if ($order->getStatus() == $fireCaptureOption && $paymentMethod != 'PaylineNX') {
30
+ $invoice = $this->_getInvoiceFromOrder($order);
31
+ if ($invoice) {
32
+ $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_OPEN);
33
+ }
34
+ if ($invoice && $invoice->parentCanCapture()) { // invoice present && ok => capture
35
  Mage::register('payline_create_invoice', true);
36
  $invoice->capture();
37
  Mage::unregister('payline_create_invoice');
39
  } // end if status matches
40
  } // end if( $paymentActionConf == 100 )
41
  }
42
+ }
43
 
44
+ // end createInvoiceWhenStatusChange()
45
 
46
  /**
47
  * Return the invoice's order data or false if not exist or NX payment
48
  */
49
  protected function _getInvoiceFromOrder($order)
50
  {
51
+ $invoice = $order->getInvoiceCollection();
52
+ $invoice = sizeof($invoice) == 1 ? $invoice->getFirstItem() : false;
53
  return $invoice;
54
  }
55
+
56
  protected function _getMode($order)
57
  {
58
  if ($this->_mode === null) {
59
  $paymentMethod = $order->getPayment()->getMethod();
60
+ $mode = explode('Payline', $paymentMethod);
61
  if (isset($mode[1])) {
62
+ $mode = $mode[1];
63
  $this->_mode = $mode;
64
  }
65
  }
66
  return $this->_mode;
67
  }
68
+
69
  protected function _canCreateInvoice($order)
70
  {
71
  $result = false;
72
+ if ($order->canInvoice()) {
73
  $paymentMethod = $order->getPayment()->getMethod();
74
  if (strstr($paymentMethod, 'Payline') !== false) {
75
  $mode = $this->_getMode($order);
76
  if (!empty($mode)) {
77
+ $statusToCreateInvoice = Mage::getStoreConfig('payment/' . $paymentMethod . '/automate_invoice_creation');
78
  if ($order->getStatus() == $statusToCreateInvoice && !empty($statusToCreateInvoice)) {
79
  if ($order->getData('status') !== $order->getOrigData('status')) {
80
  $result = true;
101
  );
102
  try {
103
  $mode = $this->_getMode($order);
104
+ $res = Mage::helper('payline')->initPayline($mode)->getTransactionDetails($array);
105
  if (isset($res['payment']['action'])) {
106
  $order->setCreateInvoice(true);
107
  $action = $res['payment']['action'];
113
  } catch (Exception $e) {
114
  Mage::logException($e);
115
  Mage::helper('payline/logger')->log(
116
+ '[createInvoiceWhenStatusChange] '
117
+ . '[' . $order->getIncrementId() . '] '
118
+ . '[' . $transId . '] '
119
+ . $e->getMessage()
120
  );
121
  }
122
  }
123
  }
124
+
125
+ public function saveQuoteNxFees(Varien_Event_Observer $observer)
126
+ {
127
+ // Only if the payment method is one of Payline
128
+ $code = $observer->getQuote()->getPayment()->getMethod();
129
+ if (!Mage::helper('payline')->isPayline($code)) {
130
+ return;
131
+ }
132
+
133
+ $applyCosts = (int) Mage::getStoreConfig('payment/PaylineNX/cost_type');
134
+ if (!$applyCosts) {
135
+ return;
136
+ }
137
+
138
+ $quote = $observer->getEvent()->getQuote();
139
+
140
+ if (!$quote->getPaylineFee()) {
141
+ $payment = $quote->getPayment();
142
+ if ($payment) {
143
+ $paymentMethod = $payment->getMethod();
144
+ $fee = Mage::getModel('payline/fees')->getCollection()
145
+ ->addFieldtoFilter('quote_id', $quote->getId())->getFirstItem();
146
+ $quote->setPaylineFee($fee);
147
+ if ($paymentMethod == 'PaylineNX') {
148
+ $amount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
149
+ $baseamount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
150
+
151
+ if ($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
152
+ $amount = round(($quote->getSubtotal() * $amount) / 100, 2);
153
+ $baseamount = round(($quote->getBaseSubtotal() * $baseamount) / 100, 2);
154
+ }
155
+
156
+ //save fees
157
+ if ($fee->getId()) {
158
+ $fee->setAmount($amount)->setBaseAmount($baseamount)->save();
159
+ } else {
160
+ Mage::getModel('payline/fees')->setQuoteId($quote->getId())
161
+ ->setAmount($amount)
162
+ ->setBaseAmount($baseamount)
163
+ ->save();
164
+ }
165
+ } elseif ($fee->getId()) {
166
+ $fee->delete();
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ public function saveOrderNxFees(Varien_Event_Observer $observer)
173
+ {
174
+ // Only if the payment method is one of Payline
175
+ $code = $observer->getOrder()->getPayment()->getMethodInstance()->getCode();
176
+ if (!Mage::helper('payline')->isPayline($code)) {
177
+ return;
178
+ }
179
+
180
+ $applyCosts = (int) Mage::getStoreConfig('payment/PaylineNX/cost_type');
181
+ if (!$applyCosts) {
182
+ return;
183
+ }
184
+
185
+ $order = $observer->getEvent()->getOrder();
186
+ if (!$order->getPaylineFee()) {
187
+ $quoteId = $order->getQuoteId();
188
+ $payment = $order->getPayment();
189
+ if ($quoteId && $payment) {
190
+ $paymentMethod = $payment->getMethod();
191
+ $fee = Mage::getModel('payline/fees')->getCollection()
192
+ ->addFieldtoFilter('quote_id', $quoteId)->getFirstItem();
193
+ $order->setPaylineFee($fee);
194
+ if ($paymentMethod == 'PaylineNX') {
195
+ $amount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
196
+ $baseamount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
197
+
198
+ if ($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
199
+ $amount = round(($order->getSubtotal() * $amount) / 100, 2);
200
+ $baseamount = round(($order->getBaseSubtotal() * $baseamount) / 100, 2);
201
+ }
202
+
203
+ //save fees
204
+ if ($fee->getId()) {
205
+ $fee->setOrderId($order->getId())->setAmount($amount)->setBaseAmount($baseamount)->save();
206
+ }
207
+ } elseif ($fee->getId()) {
208
+ $fee->delete();
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ public function saveInvoiceNxFees(Varien_Event_Observer $observer)
215
+ {
216
+ // Only if the payment method is one of Payline
217
+ $code = $observer->getInvoice()->getOrder()->getPayment()->getMethodInstance()->getCode();
218
+ if (!Mage::helper('payline')->isPayline($code)) {
219
+ return;
220
+ }
221
+
222
+ $applyCosts = (int) Mage::getStoreConfig('payment/PaylineNX/cost_type');
223
+ if (!$applyCosts) {
224
+ return;
225
+ }
226
+
227
+ $invoice = $observer->getEvent()->getInvoice();
228
+ $order = $invoice->getOrder();
229
+ $payment = $order->getPayment();
230
+ if ($payment) {
231
+ $paymentMethod = $payment->getMethod();
232
+ if ($paymentMethod == 'PaylineNX') {
233
+ $fee = Mage::getModel('payline/fees')->getCollection()
234
+ ->addFieldtoFilter('order_id', $order->getId())->getFirstItem();
235
+
236
+ $amount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
237
+ $baseamount = (float) Mage::getStoreConfig('payment/PaylineNX/cost_amount');
238
+
239
+ if ($applyCosts == Monext_Payline_Model_Datasource_Costs::COST_PERCENT) {
240
+ $amount = round(($order->getSubtotal() * $amount) / 100, 2);
241
+ $baseamount = round(($order->getBaseSubtotal() * $baseamount) / 100, 2);
242
+ }
243
+
244
+ //save fees
245
+ if ($fee->getId() && !$fee->getInvoiceId()) {
246
+ $fee->setInvoiceId($invoice->getId())->save();
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ public function afterSaveShippingAction(Varien_Event_Observer $observer)
253
+ {
254
+ $controller = $observer->getControllerAction();
255
+
256
+ $paymentMethodsBlock = $controller->getLayout()->createBlock('checkout/onepage_payment_methods');
257
+ $methods = $paymentMethodsBlock->getMethods();
258
+
259
+ // check if more than one methods available
260
+ if (count($methods) != 1) {
261
+ return;
262
+ }
263
+
264
+ $method = current($methods);
265
+
266
+ // check if only payline methods (direct method should not be skipped)
267
  if (!in_array($method->getCode(), array('PaylineCPT', 'PaylineNX', 'PaylineWALLET'))) {
268
+ return;
269
+ }
270
+
271
+ $data = array('method' => $method->getCode());
272
+
273
+ if ($method->getCode() == 'PaylineCPT') {
274
+ // retrive sub methods (card types)
275
+ $cptBlock = $controller->getLayout()->createBlock('payline/cpt');
276
+ $ccTypes = $cptBlock->getPaymentMethods();
277
+ if (count($ccTypes) != 1) {
278
  return;
279
  }
280
+ $ccType = current($ccTypes);
281
  $data['cc_type'] = $ccType['number'];
282
+ }
283
+
284
+ // seems that payment step can be skipped, so save the unique payment method now
285
  $result = Mage::getSingleton('checkout/type_onepage')->savePayment($data);
286
  if (!empty($result['error'])) {
287
  return;
288
  }
289
+
290
+ $layout = Mage::getModel('core/layout');
291
  $layout->getUpdate()->load('checkout_onepage_review');
292
  $layout->generateXml()->generateBlocks();
293
  $layout->getBlock('root')->getChild('button')->setTemplate('checkout/onepage/review/button.phtml');
294
  $reviewHtml = $layout->getBlock('root')->toHtml();
295
+
296
+ $result['goto_section'] = 'review';
297
  $result['update_section'] = array(
298
  'name' => 'review',
299
  'html' => $reviewHtml
300
  );
301
+
302
+ $json = Mage::helper('core')->jsonEncode($result);
303
  $response = Mage::helper('core')->jsonDecode($controller->getResponse()->getBody());
304
+
305
  $response['update_section']['html'].= '<script type="text/javascript">
306
  //<![CDATA[
307
  paylinePaymentSavedTransport = ' . $json . ';
308
  paylineTrySkipPaymentMethod();
309
  //]]>
310
  </script>';
311
+
312
+
313
  $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
314
+ }
315
+
316
  }
app/code/community/Monext/Payline/Model/Order/Invoice.php CHANGED
@@ -7,6 +7,12 @@ class Monext_Payline_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoice
7
  */
8
  public function canCapture()
9
  {
 
 
 
 
 
 
10
  $canCapture = parent::canCapture();
11
  $paymentMethod = $this->getOrder()->getPayment()->getMethod();
12
  $paymentActionConf = Mage::getStoreConfig('payment/'.$paymentMethod.'/payline_payment_action');
7
  */
8
  public function canCapture()
9
  {
10
+ // Only if the payment method is one of Payline
11
+ $code = $this->getOrder()->getPayment()->getMethod();
12
+ if (!Mage::helper('payline')->isPayline($code)) {
13
+ return parent::canCapture();
14
+ }
15
+
16
  $canCapture = parent::canCapture();
17
  $paymentMethod = $this->getOrder()->getPayment()->getMethod();
18
  $paymentActionConf = Mage::getStoreConfig('payment/'.$paymentMethod.'/payline_payment_action');
app/code/community/Monext/Payline/Model/Order/Payment.php CHANGED
@@ -6,6 +6,12 @@ class Monext_Payline_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
6
  */
7
  public function capture($invoice)
8
  {
 
 
 
 
 
 
9
  parent::capture( $invoice );
10
 
11
  $msgError = '[Monext_Payline_Model_Order_Payment#capture] ERROR Unable to set order status';
6
  */
7
  public function capture($invoice)
8
  {
9
+ // Only if the payment method is one of Payline
10
+ $code = $this->getOrder()->getPayment()->getMethod();
11
+ if (!Mage::helper('payline')->isPayline($code)) {
12
+ return parent::capture($invoice);
13
+ }
14
+
15
  parent::capture( $invoice );
16
 
17
  $msgError = '[Monext_Payline_Model_Order_Payment#capture] ERROR Unable to set order status';
app/code/community/Monext/Payline/Model/Total/Nx/Quote.php CHANGED
@@ -85,4 +85,3 @@ class Monext_Payline_Model_Total_Nx_Quote extends Mage_Sales_Model_Quote_Address
85
  }
86
  }
87
 
88
- ?>
85
  }
86
  }
87
 
 
app/code/community/Monext/Payline/Model/Wallet.php CHANGED
@@ -71,10 +71,9 @@ class Monext_Payline_Model_Wallet extends Mage_Payment_Model_Method_Abstract
71
  public function isAvailable($quote = null){
72
  $checkResult = new StdClass;
73
  $checkResult->isAvailable=false;
74
- $customer=Mage::getSingleton('customer/session');
75
- if ($customer->isLoggedIn()){
76
- $customer=Mage::getModel('customer/customer')->load($customer->getId());
77
- if ($customer->getWalletId()){
78
  $checkResult->isAvailable=true;
79
  }
80
  }
71
  public function isAvailable($quote = null){
72
  $checkResult = new StdClass;
73
  $checkResult->isAvailable=false;
74
+ $customerSession = Mage::getSingleton('customer/session');
75
+ if ($customerSession->isLoggedIn()) {
76
+ if ($customerSession->getCustomer()->getWalletId()) {
 
77
  $checkResult->isAvailable=true;
78
  }
79
  }
app/code/community/Monext/Payline/PaylinePHPKit/lib/lib_debug.php CHANGED
@@ -549,4 +549,3 @@ if ( !defined('__LIB_DEBUG_PHP') )
549
  }
550
 
551
  } // fin de la directive contre les inclusions multiples
552
- ?>
549
  }
550
 
551
  } // fin de la directive contre les inclusions multiples
 
app/code/community/Monext/Payline/PaylinePHPKit/lib/paylineSDK.php CHANGED
@@ -356,7 +356,7 @@ final class Log {
356
  class paylineSDK{
357
 
358
  // kit version
359
- const KIT_VERSION = 'module Magento 1.7.8';
360
 
361
  // trace log
362
  var $paylineTrace;
@@ -1786,4 +1786,3 @@ class paylineSDK{
1786
  return $this->webServiceRequest($array,$WSRequest,paylineSDK::DIRECT_API,'verifyEnrollment');
1787
  }
1788
  }
1789
- ?>
356
  class paylineSDK{
357
 
358
  // kit version
359
+ const KIT_VERSION = 'Module Magento 1.7.9.0';
360
 
361
  // trace log
362
  var $paylineTrace;
1786
  return $this->webServiceRequest($array,$WSRequest,paylineSDK::DIRECT_API,'verifyEnrollment');
1787
  }
1788
  }
 
app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-12.log ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2014-04-12 22:24:55 - ----------------------------------------------------------
2
+ 2014-04-12 22:24:55 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
3
+ 2014-04-12 22:24:55 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
4
+ 2014-04-12 22:24:56 - response return (code 02303)
5
+ 2014-04-12 22:26:31 - ----------------------------------------------------------
6
+ 2014-04-12 22:26:31 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
7
+ 2014-04-12 22:26:31 - webServiceRequest(getMerchantSettings) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
8
+ 2014-04-12 22:26:32 - response return (code 00000)
9
+ 2014-04-12 22:27:08 - ----------------------------------------------------------
10
+ 2014-04-12 22:27:08 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
11
+ 2014-04-12 22:27:08 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
12
+ 2014-04-12 22:27:12 - response return (code 00000)
13
+ 2014-04-12 22:27:12 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
14
+ 2014-04-12 22:27:13 - response return (code 00000)
15
+ 2014-04-12 22:27:14 - webServiceRequest(createWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
16
+ 2014-04-12 22:27:15 - response return (code 02500)
17
+ 2014-04-12 22:27:15 - ----------------------------------------------------------
18
+ 2014-04-12 22:27:15 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
19
+ 2014-04-12 22:27:15 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
20
+ 2014-04-12 22:27:16 - response return (code 00000)
21
+ 2014-04-12 22:45:04 - ----------------------------------------------------------
22
+ 2014-04-12 22:45:04 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
23
+ 2014-04-12 22:45:04 - webServiceRequest(getMerchantSettings) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
24
+ 2014-04-12 22:45:05 - response return (code 00000)
25
+ 2014-04-12 23:13:19 - ----------------------------------------------------------
26
+ 2014-04-12 23:13:19 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
27
+ 2014-04-12 23:13:19 - webServiceRequest(getWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
28
+ 2014-04-12 23:13:20 - response return (code 02500)
29
+ 2014-04-12 23:13:39 - ----------------------------------------------------------
30
+ 2014-04-12 23:13:39 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
31
+ 2014-04-12 23:13:39 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
32
+ 2014-04-12 23:13:40 - response return (code 00000)
33
+ 2014-04-12 23:14:01 - ----------------------------------------------------------
34
+ 2014-04-12 23:14:01 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
35
+ 2014-04-12 23:14:01 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
36
+ 2014-04-12 23:14:02 - response return (code 00000)
37
+ 2014-04-12 23:14:02 - ----------------------------------------------------------
38
+ 2014-04-12 23:14:02 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
39
+ 2014-04-12 23:14:02 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
40
+ 2014-04-12 23:14:03 - response return (code 00000)
41
+ 2014-04-12 23:16:12 - ----------------------------------------------------------
42
+ 2014-04-12 23:16:12 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
43
+ 2014-04-12 23:16:12 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
44
+ 2014-04-12 23:16:13 - response return (code 00000)
45
+ 2014-04-12 23:16:17 - ----------------------------------------------------------
46
+ 2014-04-12 23:16:17 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
47
+ 2014-04-12 23:16:17 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
48
+ 2014-04-12 23:16:17 - response return (code 00000)
49
+ 2014-04-12 23:17:05 - ----------------------------------------------------------
50
+ 2014-04-12 23:17:05 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
51
+ 2014-04-12 23:17:05 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
52
+ 2014-04-12 23:17:06 - response return (code 00000)
53
+ 2014-04-12 23:17:56 - ----------------------------------------------------------
54
+ 2014-04-12 23:17:56 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
55
+ 2014-04-12 23:17:56 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
56
+ 2014-04-12 23:17:57 - response return (code 00000)
57
+ 2014-04-12 23:18:38 - ----------------------------------------------------------
58
+ 2014-04-12 23:18:38 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
59
+ 2014-04-12 23:18:38 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
60
+ 2014-04-12 23:18:40 - response return (code 00000)
61
+ 2014-04-12 23:18:41 - ----------------------------------------------------------
62
+ 2014-04-12 23:18:41 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
63
+ 2014-04-12 23:18:41 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
64
+ 2014-04-12 23:18:42 - response return (code 00000)
65
+ 2014-04-12 23:19:04 - ----------------------------------------------------------
66
+ 2014-04-12 23:19:04 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-13.log ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ 2014-04-13 16:28:45 - ----------------------------------------------------------
2
+ 2014-04-13 16:28:45 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
3
+ 2014-04-13 16:28:45 - webServiceRequest(getWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
4
+ 2014-04-13 16:28:47 - response return (code 02500)
5
+ 2014-04-13 16:57:03 - ----------------------------------------------------------
6
+ 2014-04-13 16:57:03 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
7
+ 2014-04-13 16:57:03 - webServiceRequest(getWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
8
+ 2014-04-13 16:57:05 - response return (code 02500)
app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-15.log ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2014-04-15 18:55:33 - ----------------------------------------------------------
2
+ 2014-04-15 18:55:33 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
3
+ 2014-04-15 18:55:33 - webServiceRequest(getWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
4
+ 2014-04-15 18:55:36 - response return (code 02500)
5
+ 2014-04-15 19:25:45 - ----------------------------------------------------------
6
+ 2014-04-15 19:25:45 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
7
+ 2014-04-15 19:25:45 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
8
+ 2014-04-15 19:25:48 - response return (code 00000)
9
+ 2014-04-15 19:25:48 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
10
+ 2014-04-15 19:25:50 - response return (code 00000)
11
+ 2014-04-15 19:25:50 - ----------------------------------------------------------
12
+ 2014-04-15 19:25:50 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
13
+ 2014-04-15 19:25:50 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
14
+ 2014-04-15 19:25:51 - response return (code 00000)
15
+ 2014-04-15 19:26:53 - ----------------------------------------------------------
16
+ 2014-04-15 19:26:53 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
17
+ 2014-04-15 19:26:53 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
18
+ 2014-04-15 19:26:54 - response return (code 00000)
19
+ 2014-04-15 19:27:16 - ----------------------------------------------------------
20
+ 2014-04-15 19:27:16 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
21
+ 2014-04-15 19:27:16 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
22
+ 2014-04-15 19:27:17 - response return (code 00000)
23
+ 2014-04-15 19:27:17 - ----------------------------------------------------------
24
+ 2014-04-15 19:27:17 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
25
+ 2014-04-15 19:27:17 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
26
+ 2014-04-15 19:27:18 - response return (code 00000)
27
+ 2014-04-15 20:00:50 - ----------------------------------------------------------
28
+ 2014-04-15 20:00:50 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
29
+ 2014-04-15 20:00:50 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
30
+ 2014-04-15 20:00:50 - response return (code 00000)
31
+ 2014-04-15 20:01:31 - ----------------------------------------------------------
32
+ 2014-04-15 20:01:31 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
33
+ 2014-04-15 20:01:31 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
34
+ 2014-04-15 20:01:34 - response return (code 02500)
35
+ 2014-04-15 20:01:35 - ----------------------------------------------------------
36
+ 2014-04-15 20:01:35 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
37
+ 2014-04-15 20:01:35 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
38
+ 2014-04-15 20:01:36 - response return (code 00000)
39
+ 2014-04-15 21:24:01 - ----------------------------------------------------------
40
+ 2014-04-15 21:24:01 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
41
+ 2014-04-15 21:24:01 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
42
+ 2014-04-15 21:24:03 - response return (code 00000)
43
+ 2014-04-15 21:24:03 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
44
+ 2014-04-15 21:24:04 - response return (code 00000)
45
+ 2014-04-15 21:24:04 - ----------------------------------------------------------
46
+ 2014-04-15 21:24:04 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
47
+ 2014-04-15 21:24:04 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
48
+ 2014-04-15 21:24:04 - response return (code 00000)
49
+ 2014-04-15 21:26:10 - ----------------------------------------------------------
50
+ 2014-04-15 21:26:10 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
51
+ 2014-04-15 21:26:10 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
52
+ 2014-04-15 21:26:12 - response return (code 00000)
53
+ 2014-04-15 21:26:12 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
54
+ 2014-04-15 21:26:12 - response return (code 00000)
55
+ 2014-04-15 21:26:13 - ----------------------------------------------------------
56
+ 2014-04-15 21:26:13 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
57
+ 2014-04-15 21:26:13 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
58
+ 2014-04-15 21:26:13 - response return (code 00000)
59
+ 2014-04-15 21:26:33 - ----------------------------------------------------------
60
+ 2014-04-15 21:26:33 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
61
+ 2014-04-15 21:26:33 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
62
+ 2014-04-15 21:26:34 - response return (code 00000)
63
+ 2014-04-15 21:26:45 - ----------------------------------------------------------
64
+ 2014-04-15 21:26:45 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
65
+ 2014-04-15 21:26:45 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
66
+ 2014-04-15 21:26:47 - response return (code 02500)
67
+ 2014-04-15 21:26:48 - ----------------------------------------------------------
68
+ 2014-04-15 21:26:48 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
69
+ 2014-04-15 21:26:48 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
70
+ 2014-04-15 21:26:48 - response return (code 00000)
71
+ 2014-04-15 21:27:20 - ----------------------------------------------------------
72
+ 2014-04-15 21:27:20 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
73
+ 2014-04-15 21:27:20 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
74
+ 2014-04-15 21:27:21 - response return (code 00000)
75
+ 2014-04-15 21:27:28 - ----------------------------------------------------------
76
+ 2014-04-15 21:27:28 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
77
+ 2014-04-15 21:27:28 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
78
+ 2014-04-15 21:27:29 - response return (code 00000)
79
+ 2014-04-15 21:27:29 - ----------------------------------------------------------
80
+ 2014-04-15 21:27:29 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
81
+ 2014-04-15 21:27:29 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
82
+ 2014-04-15 21:27:30 - response return (code 00000)
app/code/community/Monext/Payline/PaylinePHPKit/logs/2014-04-22.log ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2014-04-22 18:21:10 - ----------------------------------------------------------
2
+ 2014-04-22 18:21:10 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
3
+ 2014-04-22 18:21:10 - webServiceRequest(getWallet) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
4
+ 2014-04-22 18:21:11 - response return (code 02500)
5
+ 2014-04-22 18:24:32 - ----------------------------------------------------------
6
+ 2014-04-22 18:24:32 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
7
+ 2014-04-22 18:24:32 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
8
+ 2014-04-22 18:24:34 - response return (code 00000)
9
+ 2014-04-22 18:24:34 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
10
+ 2014-04-22 18:24:35 - response return (code 00000)
11
+ 2014-04-22 18:24:36 - ----------------------------------------------------------
12
+ 2014-04-22 18:24:36 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
13
+ 2014-04-22 18:24:36 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
14
+ 2014-04-22 18:24:37 - response return (code 00000)
15
+ 2014-04-22 19:03:31 - ----------------------------------------------------------
16
+ 2014-04-22 19:03:31 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
17
+ 2014-04-22 19:03:31 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
18
+ 2014-04-22 19:03:32 - response return (code 00000)
19
+ 2014-04-22 19:07:23 - ----------------------------------------------------------
20
+ 2014-04-22 19:07:23 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
21
+ 2014-04-22 19:07:23 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
22
+ 2014-04-22 19:07:23 - response return (code 00000)
23
+ 2014-04-22 19:07:23 - webServiceRequest(doRefund) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
24
+ 2014-04-22 19:07:25 - response return (code 00000)
25
+ 2014-04-22 19:44:06 - ----------------------------------------------------------
26
+ 2014-04-22 19:44:06 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
27
+ 2014-04-22 19:44:06 - webServiceRequest(doWebPayment) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
28
+ 2014-04-22 19:44:09 - response return (code 00000)
29
+ 2014-04-22 19:47:48 - ----------------------------------------------------------
30
+ 2014-04-22 19:47:48 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
31
+ 2014-04-22 19:47:48 - webServiceRequest(getWebPaymentDetails) - Location : https://homologation.payline.com/V4/services/WebPaymentAPI
32
+ 2014-04-22 19:47:49 - response return (code 00000)
33
+ 2014-04-22 19:47:50 - ----------------------------------------------------------
34
+ 2014-04-22 19:47:50 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
35
+ 2014-04-22 19:47:50 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
36
+ 2014-04-22 19:47:50 - response return (code 00000)
37
+ 2014-04-22 21:12:42 - ----------------------------------------------------------
38
+ 2014-04-22 21:12:42 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
39
+ 2014-04-22 21:12:42 - webServiceRequest(doAuthorization) - Location : https://homologation.payline.com/V4/services/DirectPaymentAPI
40
+ 2014-04-22 21:12:44 - response return (code 00000)
41
+ 2014-04-22 21:12:44 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
42
+ 2014-04-22 21:12:46 - response return (code 00000)
43
+ 2014-04-22 21:12:46 - ----------------------------------------------------------
44
+ 2014-04-22 21:12:46 - paylineSDK::__construct(20665821525569, xL****************jH, , , , , 0)
45
+ 2014-04-22 21:12:46 - webServiceRequest(getTransactionDetails) - Location : https://homologation.payline.com/V4/services/ExtendedAPI
46
+ 2014-04-22 21:12:47 - response return (code 00000)
app/code/community/Monext/Payline/PaylinePHPKit/logs/remove.me ADDED
File without changes
app/code/community/Monext/Payline/controllers/Adminhtml/ManagecontractsController.php DELETED
@@ -1,224 +0,0 @@
1
- <?php
2
- /**
3
- * This controller manage primary and secondary payline contracts in back office
4
- *
5
- */
6
- class Monext_Payline_Adminhtml_ManagecontractsController extends Mage_Adminhtml_Controller_Action
7
- {
8
-
9
- public function indexAction()
10
- {
11
- $this->_title($this->__('Manage Payline Contracts'));
12
- $this->loadLayout();
13
- $this->_setActiveMenu('system');
14
- $this->renderLayout();
15
- }
16
-
17
- public function importAction()
18
- {
19
- $updatedAt = new Zend_Date();
20
- $updatedAt = $updatedAt->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
21
-
22
- $paylineSDK = Mage::helper('payline')->initPayline('CPT');
23
- try {
24
- $result = $paylineSDK->getMerchantSettings( array('version'=>Monext_Payline_Helper_Data::VERSION) );
25
- } catch (Exception $e) {
26
- Mage::logException($e);
27
- $msg=Mage::helper('payline')->__('Error during import');
28
- Mage::getSingleton('adminhtml/session')->addError($msg);
29
- $msgLog='Unknown PAYLINE ERROR (payline unreachable?)';
30
- Mage::helper('payline/logger')->log('[importAction] ' .$this->order->getIncrementId().$msgLog);
31
- $this->_redirect('*/*');
32
- return;
33
- }
34
-
35
- if(is_string($result)){ //error message from web service
36
- $msgError = $result;
37
- if(stristr('Authorization Required',$result)) {
38
- $msgError .= '. ' . Mage::helper('payline')->__('Please check your authentication params (merchant Id / access key / production) in System > Configuration');
39
- } elseif (stristr('could not connect to host',$result)) {
40
- $msgError .= '. ' . Mage::helper('payline')->__('Please check your proxy params (Proxy host / port / login / password) in System > Configuration');
41
- }
42
-
43
- Mage::getSingleton('adminhtml/session')->addError($msgError);
44
- Mage::helper('payline/logger')->log('[importAction] ' .$result);
45
- $this->_redirect('*/*');
46
- return;
47
- }
48
-
49
- $nbContracts = Mage::getModel('payline/contract')->getCollection()->getSize();
50
- $first = true;
51
- $listPointOfSell = array();
52
- if (isset($result['listPointOfSell']['pointOfSell'])) {
53
- $listPointOfSell = $result['listPointOfSell']['pointOfSell'];
54
- }
55
- foreach ($listPointOfSell as $key => $pointOfSell) {
56
- if (is_object($pointOfSell)) {
57
- $contracts = $pointOfSell->contracts->contract;
58
- $pointOfSellLabel = $pointOfSell->label;
59
- } else { //if only one point of sell, we parse an array
60
- if($key == 'contracts') {
61
- $contracts = $pointOfSell['contract'];
62
- } elseif($key == 'label') {
63
- $pointOfSellLabel = $pointOfSell;
64
- continue;
65
- } else {
66
- continue;
67
- }
68
- }
69
-
70
- if(!is_array($contracts)) {
71
- $contracts = array($contracts);
72
- }
73
-
74
- if (is_array($contracts) && isset($contracts['contractNumber'])) {
75
- $contracts = array((object)$contracts);
76
- }
77
-
78
- foreach ($contracts as $contract) {
79
- $myContract = Mage::getModel('payline/contract')
80
- ->getCollection()
81
- ->addFieldToFilter('number',$contract->contractNumber)
82
- ->getFirstItem();
83
-
84
- if($myContract->getId()) { //contract exists, update
85
- $myContract->setName($contract->label)
86
- ->setPointOfSell($pointOfSellLabel)
87
- ->setContractDate($updatedAt)
88
- ->setContractType($contract->cardType)
89
- ->save();
90
- } else {
91
- $new_contract = Mage::getModel('payline/contract')
92
- ->setName($contract->label)
93
- ->setNumber($contract->contractNumber)
94
- ->setPointOfSell($pointOfSellLabel)
95
- ->setContractType($contract->cardType)
96
- ->setContractDate($updatedAt);
97
-
98
- if($first && !$nbContracts) { //force to have a primary contract
99
- $new_contract->setIsPrimary(1);
100
- $first = false;
101
- }
102
-
103
- $new_contract->save();
104
- }
105
- }
106
- }
107
-
108
- //delete contracts not updated
109
- $toDelete = Mage::getModel('payline/contract')->getCollection()
110
- ->addFieldToFilter('contract_date',array('neq' => $updatedAt));
111
- foreach($toDelete as $contract) {
112
- $contract->delete();
113
- }
114
-
115
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('payline')->__('Contracts imported successfully. Don\'t forget to define primary and secondary contracts!'));
116
- $this->_redirect('*/*');
117
-
118
- }
119
-
120
- /**
121
- * can't create new contract, forward to edit action
122
- */
123
- public function newAction()
124
- {
125
- $this->_forward('edit');
126
- }
127
-
128
- public function saveAction()
129
- {
130
- if ($this->getRequest()->getPost()) {
131
- try {
132
- $postData = $this->getRequest()->getPost();
133
-
134
- // Update existing contract
135
- if (array_key_exists('id', $postData)) {
136
- $contract = Mage::getModel('payline/contract')->load($postData['id']);
137
-
138
- $is_primary = (isset($postData['is_primary']) ? $postData['is_primary'] : 0);
139
- $is_secondary = (isset($postData['is_secondary']) ? $postData['is_secondary'] : 0);
140
-
141
- $count = Mage::getModel('payline/contract')->getCollection()
142
- ->addFieldToFilter('is_primary',1)
143
- ->addFieldToFilter('id', array('neq' => $contract->getId()))
144
- ->getSize();
145
- //at least one contract must be primary
146
- if(!$is_primary && !$count) {
147
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payline')->__('At leat one contract must be primary'));
148
- $this->_redirect('*/*');
149
- return;
150
- }
151
-
152
- //primary and secondary contracts must ne defined in only one point of sell
153
- //because it's impossible to send to webservice contracts that are not in the same point of sell
154
- //Mage::getResourceModel('payline/contract')->removePrimaryAndSecondaryNotIn($contract->getPointOfSell());
155
-
156
- $contract->setIsPrimary($is_primary)
157
- ->setIsSecondary($is_secondary)
158
- ->save();
159
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('payline')->__('Contract saved successfully'));
160
- }
161
-
162
- } catch (Exception $e){
163
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
164
- $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
165
- return;
166
- }
167
- }
168
-
169
- $this->_redirect('*/*/');
170
- }
171
-
172
- public function editAction()
173
- {
174
- $contract = Mage::getModel('payline/contract')->load($this->getRequest()->getParam('id',false));
175
-
176
- //checks if the item has been loaded correctly
177
- if (!$contract->getId()) {
178
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payline')->__("Required contract does not exist"));
179
- $this->_redirect('*/*/index');
180
- return;
181
- }
182
-
183
- // Register model to use later in blocks
184
- Mage::register('current_contract', $contract);
185
-
186
- $this->loadLayout();
187
- $this->renderLayout();
188
- }
189
-
190
- public function massStatusAction()
191
- {
192
- $contractIds = (array)$this->getRequest()->getParam('contract');
193
- $status = (int)$this->getRequest()->getParam('status');
194
- $store = $this->getRequest()->getParam('store',0);
195
- $website = $this->getRequest()->getParam('website',0);
196
-
197
- Mage::getResourceModel('payline/contract_status')->updateContractStatus($contractIds,$status,$website,$store);
198
-
199
- $this->_redirect('*/*/', array('website' => $website, 'store' => $store));
200
- }
201
-
202
- public function massWalletAction()
203
- {
204
- $contractIds = (array)$this->getRequest()->getParam('contract');
205
- $subscribe = (int)$this->getRequest()->getParam('walletList');
206
- $store = $this->getRequest()->getParam('store',0);
207
- $website = $this->getRequest()->getParam('website',0);
208
-
209
- Mage::getResourceModel('payline/contract')->updateContractWalletList(
210
- $contractIds, $subscribe, $website, $store );
211
-
212
- $this->_redirect('*/*/', array('website' => $website, 'store' => $store));
213
- }
214
-
215
- /**
216
- * contracts grid for AJAX request
217
- */
218
- public function gridAction()
219
- {
220
- $this->loadLayout();
221
- $this->renderLayout();
222
- }
223
-
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Monext/Payline/controllers/Adminhtml/Payline/ManagecontractsController.php ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This controller manage primary and secondary payline contracts in back office
5
+ */
6
+ class Monext_Payline_Adminhtml_Payline_ManagecontractsController extends Mage_Adminhtml_Controller_Action
7
+ {
8
+
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__('Manage Payline Contracts'));
12
+ $this->loadLayout();
13
+ $this->_setActiveMenu('system');
14
+ $this->renderLayout();
15
+ }
16
+
17
+ public function importAction()
18
+ {
19
+ $updatedAt = new Zend_Date();
20
+ $updatedAt = $updatedAt->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
21
+
22
+ $paylineSDK = Mage::helper('payline')->initPayline('CPT');
23
+ try {
24
+ $result = $paylineSDK->getMerchantSettings(array('version' => Monext_Payline_Helper_Data::VERSION));
25
+ } catch (Exception $e) {
26
+ Mage::logException($e);
27
+ $msg = Mage::helper('payline')->__('Error during import');
28
+ Mage::getSingleton('adminhtml/session')->addError($msg);
29
+ $msgLog = 'Unknown PAYLINE ERROR (payline unreachable?)';
30
+ Mage::helper('payline/logger')->log('[importAction] ' . $this->order->getIncrementId() . $msgLog);
31
+ $this->_redirect('*/*');
32
+ return;
33
+ }
34
+
35
+ if (is_string($result)) { //error message from web service
36
+ $msgError = $result;
37
+ if (stristr('Authorization Required', $result)) {
38
+ $msgError .= '. ' . Mage::helper('payline')->__('Please check your authentication params (merchant Id / access key / production) in System > Configuration');
39
+ } elseif (stristr('could not connect to host', $result)) {
40
+ $msgError .= '. ' . Mage::helper('payline')->__('Please check your proxy params (Proxy host / port / login / password) in System > Configuration');
41
+ }
42
+
43
+ Mage::getSingleton('adminhtml/session')->addError($msgError);
44
+ Mage::helper('payline/logger')->log('[importAction] ' . $result);
45
+ $this->_redirect('*/*');
46
+ return;
47
+ }
48
+
49
+ $nbContracts = Mage::getModel('payline/contract')->getCollection()->getSize();
50
+ $first = true;
51
+ $listPointOfSell = array();
52
+ if (isset($result['listPointOfSell']['pointOfSell'])) {
53
+ $listPointOfSell = $result['listPointOfSell']['pointOfSell'];
54
+ }
55
+ foreach ($listPointOfSell as $key => $pointOfSell) {
56
+ if (is_object($pointOfSell)) {
57
+ $contracts = $pointOfSell->contracts->contract;
58
+ $pointOfSellLabel = $pointOfSell->label;
59
+ } else { //if only one point of sell, we parse an array
60
+ if ($key == 'contracts') {
61
+ $contracts = $pointOfSell['contract'];
62
+ } elseif ($key == 'label') {
63
+ $pointOfSellLabel = $pointOfSell;
64
+ continue;
65
+ } else {
66
+ continue;
67
+ }
68
+ }
69
+
70
+ if (!is_array($contracts)) {
71
+ $contracts = array($contracts);
72
+ }
73
+
74
+ if (is_array($contracts) && isset($contracts['contractNumber'])) {
75
+ $contracts = array((object) $contracts);
76
+ }
77
+
78
+ foreach ($contracts as $contract) {
79
+ $myContract = Mage::getModel('payline/contract')
80
+ ->getCollection()
81
+ ->addFieldToFilter('number', $contract->contractNumber)
82
+ ->getFirstItem();
83
+
84
+ if ($myContract->getId()) { //contract exists, update
85
+ $myContract->setName($contract->label)
86
+ ->setPointOfSell($pointOfSellLabel)
87
+ ->setContractDate($updatedAt)
88
+ ->setContractType($contract->cardType)
89
+ ->save();
90
+ } else {
91
+ $new_contract = Mage::getModel('payline/contract')
92
+ ->setName($contract->label)
93
+ ->setNumber($contract->contractNumber)
94
+ ->setPointOfSell($pointOfSellLabel)
95
+ ->setContractType($contract->cardType)
96
+ ->setContractDate($updatedAt);
97
+
98
+ if ($first && !$nbContracts) { //force to have a primary contract
99
+ $new_contract->setIsPrimary(1);
100
+ $first = false;
101
+ }
102
+
103
+ $new_contract->save();
104
+ }
105
+ }
106
+ }
107
+
108
+ //delete contracts not updated
109
+ $toDelete = Mage::getModel('payline/contract')->getCollection()
110
+ ->addFieldToFilter('contract_date', array('neq' => $updatedAt));
111
+ foreach ($toDelete as $contract) {
112
+ $contract->delete();
113
+ }
114
+
115
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('payline')->__('Contracts imported successfully. Don\'t forget to define primary and secondary contracts!'));
116
+ $this->_redirect('*/*');
117
+ }
118
+
119
+ /**
120
+ * can't create new contract, forward to edit action
121
+ */
122
+ public function newAction()
123
+ {
124
+ $this->_forward('edit');
125
+ }
126
+
127
+ public function saveAction()
128
+ {
129
+ if ($this->getRequest()->getPost()) {
130
+ try {
131
+ $postData = $this->getRequest()->getPost();
132
+
133
+ // Update existing contract
134
+ if (array_key_exists('id', $postData)) {
135
+ $contract = Mage::getModel('payline/contract')->load($postData['id']);
136
+
137
+ $is_primary = (isset($postData['is_primary']) ? $postData['is_primary'] : 0);
138
+ $is_secondary = (isset($postData['is_secondary']) ? $postData['is_secondary'] : 0);
139
+
140
+ $count = Mage::getModel('payline/contract')->getCollection()
141
+ ->addFieldToFilter('is_primary', 1)
142
+ ->addFieldToFilter('id', array('neq' => $contract->getId()))
143
+ ->getSize();
144
+ //at least one contract must be primary
145
+ if (!$is_primary && !$count) {
146
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payline')->__('At leat one contract must be primary'));
147
+ $this->_redirect('*/*');
148
+ return;
149
+ }
150
+
151
+ //primary and secondary contracts must ne defined in only one point of sell
152
+ //because it's impossible to send to webservice contracts that are not in the same point of sell
153
+ //Mage::getResourceModel('payline/contract')->removePrimaryAndSecondaryNotIn($contract->getPointOfSell());
154
+
155
+ $contract->setIsPrimary($is_primary)
156
+ ->setIsSecondary($is_secondary)
157
+ ->save();
158
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('payline')->__('Contract saved successfully'));
159
+ }
160
+ } catch (Exception $e) {
161
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
162
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
163
+ return;
164
+ }
165
+ }
166
+
167
+ $this->_redirect('*/*/');
168
+ }
169
+
170
+ public function editAction()
171
+ {
172
+ $contract = Mage::getModel('payline/contract')->load($this->getRequest()->getParam('id', false));
173
+
174
+ //checks if the item has been loaded correctly
175
+ if (!$contract->getId()) {
176
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payline')->__("Required contract does not exist"));
177
+ $this->_redirect('*/*/index');
178
+ return;
179
+ }
180
+
181
+ // Register model to use later in blocks
182
+ Mage::register('current_contract', $contract);
183
+
184
+ $this->loadLayout();
185
+ $this->renderLayout();
186
+ }
187
+
188
+ public function massStatusAction()
189
+ {
190
+ $contractIds = (array) $this->getRequest()->getParam('contract');
191
+ $status = (int) $this->getRequest()->getParam('status');
192
+ $store = $this->getRequest()->getParam('store', 0);
193
+ $website = $this->getRequest()->getParam('website', 0);
194
+
195
+ Mage::getResourceModel('payline/contract_status')->updateContractStatus($contractIds, $status, $website, $store);
196
+
197
+ $this->_redirect('*/*/', array('website' => $website, 'store' => $store));
198
+ }
199
+
200
+ public function massWalletAction()
201
+ {
202
+ $contractIds = (array) $this->getRequest()->getParam('contract');
203
+ $subscribe = (int) $this->getRequest()->getParam('walletList');
204
+ $store = $this->getRequest()->getParam('store', 0);
205
+ $website = $this->getRequest()->getParam('website', 0);
206
+
207
+ Mage::getResourceModel('payline/contract')->updateContractWalletList(
208
+ $contractIds, $subscribe, $website, $store
209
+ );
210
+
211
+ $this->_redirect('*/*/', array('website' => $website, 'store' => $store));
212
+ }
213
+
214
+ /**
215
+ * contracts grid for AJAX request
216
+ */
217
+ public function gridAction()
218
+ {
219
+ $this->loadLayout();
220
+ $this->renderLayout();
221
+ }
222
+
223
+ }
app/code/community/Monext/Payline/controllers/IndexController.php CHANGED
@@ -68,10 +68,10 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
68
  if (!Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription')){
69
  return;
70
  }
71
- $customer=Mage::getSingleton('customer/session');
72
- if ($customer->isLoggedIn()){
73
- $customer=Mage::getModel('customer/customer')->load($customer->getId());
74
- if (!$customer->getWalletId()){
75
  $customer->setWalletId($walletId);
76
  $customer->save();
77
  }
@@ -245,8 +245,7 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
245
  //Must be done before call to Payline helper initialisation
246
  $expiredWalletId=false;
247
  if(Mage::getSingleton('customer/session')->isLoggedIn()){
248
- $customer=Mage::getSingleton('customer/session')->getCustomer();
249
- $customer=Mage::getModel('customer/customer')->load($customer->getId());
250
  if ($customer->getWalletId() && !Mage::getModel('payline/wallet')->checkExpirationDate()){
251
  $expiredWalletId=true;
252
  }
@@ -561,9 +560,8 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
561
  }
562
  }
563
 
564
- $customerId=Mage::getSingleton('customer/session')->getId();
565
- $customer=Mage::getModel('customer/customer')->load($customerId);
566
- $walletId=$customer->getWalletId();
567
  $array['walletId']=$walletId;
568
  $array['cardInd'] = '';
569
  $array['version'] = Monext_Payline_Helper_Data::VERSION;
@@ -643,9 +641,9 @@ class Monext_Payline_IndexController extends Mage_Core_Controller_Front_Action
643
  //Check if wallet is sendable
644
  //Must be done before call to Payline helper initialisation
645
  $expiredWalletId=false;
646
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
647
- $customer=Mage::getSingleton('customer/session')->getCustomer();
648
- $customer=Mage::getModel('customer/customer')->load($customer->getId());
649
  if ($customer->getWalletId() && !Mage::getModel('payline/wallet')->checkExpirationDate()){
650
  $expiredWalletId=true;
651
  }
68
  if (!Mage::getStoreConfig('payment/payline_common/automate_wallet_subscription')){
69
  return;
70
  }
71
+ $customerSession = Mage::getSingleton('customer/session');
72
+ if ($customerSession->isLoggedIn()){
73
+ $customer = $customerSession->getCustomer();
74
+ if (!$customer->getWalletId()) {
75
  $customer->setWalletId($walletId);
76
  $customer->save();
77
  }
245
  //Must be done before call to Payline helper initialisation
246
  $expiredWalletId=false;
247
  if(Mage::getSingleton('customer/session')->isLoggedIn()){
248
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
 
249
  if ($customer->getWalletId() && !Mage::getModel('payline/wallet')->checkExpirationDate()){
250
  $expiredWalletId=true;
251
  }
560
  }
561
  }
562
 
563
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
564
+ $walletId = $customer->getWalletId();
 
565
  $array['walletId']=$walletId;
566
  $array['cardInd'] = '';
567
  $array['version'] = Monext_Payline_Helper_Data::VERSION;
641
  //Check if wallet is sendable
642
  //Must be done before call to Payline helper initialisation
643
  $expiredWalletId=false;
644
+ $customerSession = Mage::getSingleton('customer/session');
645
+ if ($customerSession->isLoggedIn()){
646
+ $customer = $customerSession->getCustomer();
647
  if ($customer->getWalletId() && !Mage::getModel('payline/wallet')->checkExpirationDate()){
648
  $expiredWalletId=true;
649
  }
app/code/community/Monext/Payline/controllers/WalletController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * This controller manage wallet in the customer account (subscribe, update, disable, ...)
4
  * @author fague
@@ -6,6 +7,7 @@
6
  */
7
  class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
8
  {
 
9
  /**
10
  * Action predispatch
11
  *
@@ -17,7 +19,7 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
17
  if (!Mage::getSingleton('customer/session')->authenticate($this)) {
18
  $this->setFlag('', 'no-dispatch', true);
19
  }
20
- if (!Mage::getStoreConfig('payment/PaylineWALLET/active')){
21
  $this->setFlag('', 'no-dispatch', true);
22
  }
23
  }
@@ -25,16 +27,18 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
25
  /**
26
  * Simply redirect to manageAction
27
  */
28
- public function indexAction(){
 
29
  $this->_redirect('*/*/manage');
30
  }
31
 
32
  /**
33
  * Display user's wallet informations
34
  */
35
- public function manageAction(){
36
- $customer=Mage::getSingleton('customer/session')->getCustomer();
37
- if (!($walletId=$customer->getWalletId())){
 
38
  $this->_redirect('payline/wallet/subscribe');
39
  return;
40
  }
@@ -42,108 +46,108 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
42
  $this->loadLayout();
43
 
44
  $this->getLayout()->getBlock('head')->setTitle($this->__('Wallet management'));
45
-
46
- $res=Mage::getModel('payline/wallet')->getWalletData();
47
- if ($res){
48
  $this->getLayout()->getBlock('payline-wallet-details')->setWallet($res);
49
  }
50
-
51
  $this->_initLayoutMessages('customer/session');
52
  $this->_initLayoutMessages('core/session');
53
  $this->renderLayout();
54
-
55
  }
56
-
57
  /**
58
  * Display wallet subscription iframe
59
  */
60
- public function subscribeAction(){
61
- $customer=Mage::getSingleton('customer/session')->getCustomer();
62
- $customer=Mage::getModel('customer/customer')->load($customer->getId());
63
- if ($customer->getWalletId()){
64
  $this->_redirect('payline/wallet/manage');
65
  return;
66
  }
67
  $this->loadLayout();
68
-
69
  $this->getLayout()->getBlock('head')->setTitle($this->__('Subscribe to wallet'));
70
-
71
  /* @var $paylineHelper Monext_Payline_Helper_Data */
72
- $paylineHelper=Mage::helper('payline');
73
- $paylineHelper->notificationUrl=Mage::getBaseUrl().'payline/unloggedwallet/subscribeNotify';
74
- $paylineHelper->returnUrl=Mage::getBaseUrl().'payline/unloggedwallet/subscribeReturn';
75
- $paylineHelper->cancelUrl=Mage::getBaseUrl().'payline/unloggedwallet/subscribeCancel';
76
  /* @var $paylineSDK PaylineSDK */
77
- $paylineSDK=$paylineHelper->initPayline('WALLET');
78
  //TODO add address data
79
- $array=array(
80
- 'buyer'=>array(
81
- 'lastName'=>Mage::helper('payline')->encodeString(substr($customer->getLastname(),0,100)),
82
- 'firstName'=>Mage::helper('payline')->encodeString(substr($customer->getFirstname(),0,100)),
83
- 'walletId'=>Mage::getModel('payline/wallet')->generateWalletId()
84
  ),
85
- 'billingAddress'=>array(),
86
- 'shippingAddress'=>array()
87
  );
88
-
89
- $email=$customer->getEmail();
90
- $pattern = '/\+/i';
91
  $charPlusExist = preg_match($pattern, $email);
92
- if (strlen($email)<=50 && Zend_Validate::is($email, 'EmailAddress') && !$charPlusExist) {
93
- $array['buyer']['email']=Mage::helper('payline')->encodeString($email);
94
- }else{
95
  $array['buyer']['email'] = '';
96
  }
97
- $array['buyer']['customerId'] = Mage::helper('payline')->encodeString($email);;
98
-
99
- $array['contractNumber'] = $paylineHelper->contractNumber;
100
- $array['contracts']=explode(';',$paylineHelper->contractNumberList);
101
 
102
- $array['updatePersonalDetails'] = (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details') ? 1 : 0);
103
- $array['version'] = Monext_Payline_Helper_Data::VERSION;
 
 
 
104
 
105
  // ADD CONTRACT WALLET ARRAY TO $array
106
  $array['walletContracts'] = Mage::helper('payline')->buildContractNumberWalletList();
107
 
108
- try{
109
- $resultCreateWebWallet=$paylineSDK->createWebWallet($array);
110
- }catch (Exception $e){
111
  Mage::logException($e);
112
- $msgLog='Unknown PAYLINE ERROR on createWebWallet (Payline unreachable?)';
113
- $msg=Mage::helper('payline')->__('Error during subscription');
114
- Mage::helper('payline/logger')->log('[subscribeAction] ' .$msgLog);
115
  Mage::getSingleton('customer/session')->addError($msg);
116
  }
117
- if(is_string($resultCreateWebWallet)) {
118
- $msgLog='PAYLINE ERROR on createWebWallet: '.$resultCreateWebWallet;
119
- $msg=Mage::helper('payline')->__('Error during subscription');
120
- Mage::helper('payline/logger')->log('[subscribeAction] ' .$msgLog);
121
  Mage::getSingleton('customer/session')->addError($msg);
122
  $this->_redirect('customer/account');
123
  return;
124
- } elseif (!isset($resultCreateWebWallet['result']) || $resultCreateWebWallet['result']['code']!='00000'){
125
- if(isset($resultCreateWebWallet['result'])){
126
- $msgLog='PAYLINE ERROR on createWebWallet: '.$resultCreateWebWallet['result']['code']. ' '.$resultCreateWebWallet['result']['longMessage'];
127
- }else{
128
- $msgLog='Unknown PAYLINE ERROR on createWebWallet';
129
  }
130
- $msg=Mage::helper('payline')->__('Error during subscription');
131
- Mage::helper('payline/logger')->log('[subscribeAction] ' .$msgLog);
132
  Mage::getSingleton('customer/session')->addError($msg);
133
  $this->_redirect('customer/account');
134
  return;
135
  }
136
-
137
- //save contract number
138
- $customer->setWalletContractNumber($paylineHelper->contractNumber)->save();
139
-
140
  $this->getLayout()->getBlock('payline-wallet-subscribe-cmsblock')->setBlockId(Mage::getStoreConfig('payment/PaylineWALLET/payline_register-oneclick_customeraccount'));
141
- $urlPayline=$resultCreateWebWallet['redirectURL'];
142
 
143
- if (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details')){
144
- $iframeClass='iframe-subscribe-wallet iframe-with-perso-data';
145
- }else{
146
- $iframeClass='iframe-subscribe-wallet';
147
  }
148
  $this->getLayout()->getBlock('payline-wallet-subscribe-iframe')->setIframeClassName($iframeClass);
149
  $this->getLayout()->getBlock('payline-wallet-subscribe-iframe')->setIframeSrc($urlPayline);
@@ -156,135 +160,137 @@ class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
156
  /**
157
  * Disable customer wallet, delete customer's walletId attribute value
158
  */
159
- public function disableAction(){
160
- $customer=Mage::getSingleton('customer/session')->getCustomer();
161
-
162
- if (!($walletId=$customer->getWalletId())){
 
163
  $this->_redirect('payline/wallet/subscribe');
164
  return;
165
  }
166
-
167
  $paylineSDK = Mage::helper('payline')->initPayline('WALLET');
168
  $paylineSDK->setWalletIdList($walletId);
169
- $array=array('contractNumber' => $customer->getWalletContractNumber(), 'cardInd' => '');
170
- try{
171
- $res=$paylineSDK->disableWallet($array);
172
  Mage::getSingleton('customer/session')->setWalletData(null);
173
- }catch (Exception $e){
174
- $msgLog='Unknown PAYLINE ERROR on disableWallet (Payline unreachable?)';
175
- $msg=Mage::helper('payline')->__('Error while disabling wallet');
176
- Mage::helper('payline/logger')->log('[disableAction] ' .$msgLog);
177
  Mage::getSingleton('customer/session')->addError($msg);
178
  }
179
-
180
- if (!isset($res['result']) || ($res['result']['code']!='02500' && $res['result']['code']!='02501' && $res['result']['code']=='02505')){
181
- if(isset($res['result'])){
182
- $msgLog='PAYLINE ERROR on disableWallet: '.$res['result']['code']. ' '.$res['result']['longMessage'];
183
- }else{
184
- $msgLog='Unknown PAYLINE ERROR on disableWallet';
185
  }
186
- $msg=Mage::helper('payline')->__('Error during disableWallet');
187
- Mage::helper('payline/logger')->log('[disableAction] ' .$msg);
188
  Mage::getSingleton('customer/session')->addError($msg);
189
  $this->_redirect('customer/account');
190
  return;
191
  }
192
-
193
  $customer->setWalletId();
194
- $customer->setWalletContractNumber();
195
  $customer->save();
196
  Mage::getSingleton('customer/session')->addSuccess($this->__('Your wallet has been disabled.'));
197
  $this->_redirect('customer/account');
198
  return;
199
-
200
  }
201
-
202
  /**
203
  *
204
  * Display wallet update iframe
205
  * Update payment card, not perso details
206
  */
207
- public function updateAction(){
208
- $customer=Mage::getSingleton('customer/session')->getCustomer();
209
- if (!($walletId=$customer->getWalletId())){
 
210
  $this->_redirect('payline/wallet/subscribe');
211
  return;
212
  }
213
  $this->loadLayout();
214
-
215
  $this->getLayout()->getBlock('head')->setTitle($this->__('Update wallet'));
216
-
217
  /* @var $paylineHelper Monext_Payline_Helper_Data */
218
- $paylineHelper=Mage::helper('payline');
219
- $paylineHelper->notificationUrl=Mage::getBaseUrl().'payline/unloggedwallet/updateNotify';
220
- $paylineHelper->returnUrl=Mage::getBaseUrl().'payline/unloggedwallet/updateReturn';
221
- $paylineHelper->cancelUrl=Mage::getBaseUrl().'payline/unloggedwallet/updateCancel';
222
  /* @var $paylineSDK PaylineSDK */
223
- $paylineSDK=$paylineHelper->initPayline('WALLET');
224
- $array=array(
225
- 'walletId'=>$walletId,
226
- 'contractNumber' => ($customer->getWalletContractNumber()?$customer->getWalletContractNumber():$paylineHelper->contractNumber),
227
- 'cardInd' => '',
228
- 'updatePersonalDetails' => (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details') ? 1 : 0),
229
- 'updatePaymentDetails' => (Mage::getStoreConfig('payment/PaylineWALLET/update_payment_details') ? 1 : 0),
230
- 'updateOwnerDetails' => 0,
231
- 'version' => Monext_Payline_Helper_Data::VERSION,
232
- 'billingAddress' => '',
233
- 'shippingAddress' => '',
234
- 'buyer' => array(
235
- 'lastName'=> Mage::helper('payline')->encodeString(substr($customer->getLastname(),0,100)),
236
- 'firstName'=> Mage::helper('payline')->encodeString(substr($customer->getFirstname(),0,100)),
237
- 'walletId' => $walletId
238
  )
239
  );
240
- $email=$customer->getEmail();
241
- $pattern = '/\+/i';
242
- $charPlusExist = preg_match($pattern, $email);
243
- if (strlen($email)<=50 && Zend_Validate::is($email, 'EmailAddress') && !$charPlusExist) {
244
- $array['buyer']['email']=Mage::helper('payline')->encodeString($email);
245
- }else{
246
  $array['buyer']['email'] = '';
247
  }
248
- $paylineSDK->setPrivate(array('customerId'=>$customer->getId()));
249
- try{
250
- $res=$paylineSDK->updateWebWallet($array);
251
- }catch (Exception $e){
252
- Mage::logException($e);
253
- $msgLog='Unknown PAYLINE ERROR on updateWebWallet (Payline unreachable?)';
254
- $msg=Mage::helper('payline')->__('Error during wallet update');
255
- Mage::helper('payline/logger')->log('[updateAction] ' .$msgLog);
256
  Mage::getSingleton('customer/session')->addError($msg);
257
  }
258
- if (is_string($res)) {
259
- Mage::helper('payline/logger')->log('[updateAction] ' .$res);
260
  Mage::getSingleton('customer/session')->addError($res);
261
  $this->_redirect('customer/account');
262
  return;
263
- } elseif (!isset($res['result']) || ($res['result']['code']!='00000' && $res['result']['code']!='02502')){
264
- if(isset($res['result'])){
265
- $msgLog='PAYLINE ERROR on updateWebWallet: '.$res['result']['code']. ' '.$res['result']['longMessage'];
266
- }else{
267
- $msgLog='Unknown PAYLINE ERROR on updateWebWallet';
268
  }
269
- $msg=Mage::helper('payline')->__('Error while updating wallet');
270
- Mage::helper('payline/logger')->log('[updateAction] ' .$msgLog);
271
  Mage::getSingleton('customer/session')->addError($msg);
272
  $this->_redirect('customer/account');
273
  return;
274
  }
275
- $urlPayline=$res['redirectURL'];
276
 
277
  $this->_initLayoutMessages('customer/session');
278
  $this->_initLayoutMessages('core/session');
279
-
280
- if (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details')){
281
- $iframeClass='iframe-update-wallet iframe-with-perso-data';
282
- }else{
283
- $iframeClass='iframe-update-wallet';
284
  }
285
  $this->getLayout()->getBlock('payline-wallet-update-iframe')->setIframeClassName($iframeClass);
286
  $this->getLayout()->getBlock('payline-wallet-update-iframe')->setIframeSrc($urlPayline);
287
-
288
  $this->renderLayout();
289
  }
290
- }
 
1
  <?php
2
+
3
  /**
4
  * This controller manage wallet in the customer account (subscribe, update, disable, ...)
5
  * @author fague
7
  */
8
  class Monext_Payline_WalletController extends Mage_Core_Controller_Front_Action
9
  {
10
+
11
  /**
12
  * Action predispatch
13
  *
19
  if (!Mage::getSingleton('customer/session')->authenticate($this)) {
20
  $this->setFlag('', 'no-dispatch', true);
21
  }
22
+ if (!Mage::getStoreConfig('payment/PaylineWALLET/active')) {
23
  $this->setFlag('', 'no-dispatch', true);
24
  }
25
  }
27
  /**
28
  * Simply redirect to manageAction
29
  */
30
+ public function indexAction()
31
+ {
32
  $this->_redirect('*/*/manage');
33
  }
34
 
35
  /**
36
  * Display user's wallet informations
37
  */
38
+ public function manageAction()
39
+ {
40
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
41
+ if (!($walletId = $customer->getWalletId())) {
42
  $this->_redirect('payline/wallet/subscribe');
43
  return;
44
  }
46
  $this->loadLayout();
47
 
48
  $this->getLayout()->getBlock('head')->setTitle($this->__('Wallet management'));
49
+
50
+ $res = Mage::getModel('payline/wallet')->getWalletData();
51
+ if ($res) {
52
  $this->getLayout()->getBlock('payline-wallet-details')->setWallet($res);
53
  }
54
+
55
  $this->_initLayoutMessages('customer/session');
56
  $this->_initLayoutMessages('core/session');
57
  $this->renderLayout();
 
58
  }
59
+
60
  /**
61
  * Display wallet subscription iframe
62
  */
63
+ public function subscribeAction()
64
+ {
65
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
66
+ if ($customer->getWalletId()) {
67
  $this->_redirect('payline/wallet/manage');
68
  return;
69
  }
70
  $this->loadLayout();
71
+
72
  $this->getLayout()->getBlock('head')->setTitle($this->__('Subscribe to wallet'));
73
+
74
  /* @var $paylineHelper Monext_Payline_Helper_Data */
75
+ $paylineHelper = Mage::helper('payline');
76
+ $paylineHelper->notificationUrl = Mage::getUrl('payline/unloggedwallet/subscribeNotify');
77
+ $paylineHelper->returnUrl = Mage::getUrl('payline/unloggedwallet/subscribeReturn');
78
+ $paylineHelper->cancelUrl = Mage::getUrl('payline/unloggedwallet/subscribeCancel');
79
  /* @var $paylineSDK PaylineSDK */
80
+ $paylineSDK = $paylineHelper->initPayline('WALLET');
81
  //TODO add address data
82
+ $array = array(
83
+ 'buyer' => array(
84
+ 'lastName' => Mage::helper('payline')->encodeString(substr($customer->getLastname(), 0, 100)),
85
+ 'firstName' => Mage::helper('payline')->encodeString(substr($customer->getFirstname(), 0, 100)),
86
+ 'walletId' => Mage::getModel('payline/wallet')->generateWalletId()
87
  ),
88
+ 'billingAddress' => array(),
89
+ 'shippingAddress' => array()
90
  );
91
+
92
+ $email = $customer->getEmail();
93
+ $pattern = '/\+/i';
94
  $charPlusExist = preg_match($pattern, $email);
95
+ if (strlen($email) <= 50 && Zend_Validate::is($email, 'EmailAddress') && !$charPlusExist) {
96
+ $array['buyer']['email'] = Mage::helper('payline')->encodeString($email);
97
+ } else {
98
  $array['buyer']['email'] = '';
99
  }
100
+ $array['buyer']['customerId'] = Mage::helper('payline')->encodeString($email);
101
+ ;
 
 
102
 
103
+ $array['contractNumber'] = $paylineHelper->contractNumber;
104
+ $array['contracts'] = explode(';', $paylineHelper->contractNumberList);
105
+
106
+ $array['updatePersonalDetails'] = (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details') ? 1 : 0);
107
+ $array['version'] = Monext_Payline_Helper_Data::VERSION;
108
 
109
  // ADD CONTRACT WALLET ARRAY TO $array
110
  $array['walletContracts'] = Mage::helper('payline')->buildContractNumberWalletList();
111
 
112
+ try {
113
+ $resultCreateWebWallet = $paylineSDK->createWebWallet($array);
114
+ } catch (Exception $e) {
115
  Mage::logException($e);
116
+ $msgLog = 'Unknown PAYLINE ERROR on createWebWallet (Payline unreachable?)';
117
+ $msg = Mage::helper('payline')->__('Error during subscription');
118
+ Mage::helper('payline/logger')->log('[subscribeAction] ' . $msgLog);
119
  Mage::getSingleton('customer/session')->addError($msg);
120
  }
121
+ if (is_string($resultCreateWebWallet)) {
122
+ $msgLog = 'PAYLINE ERROR on createWebWallet: ' . $resultCreateWebWallet;
123
+ $msg = Mage::helper('payline')->__('Error during subscription');
124
+ Mage::helper('payline/logger')->log('[subscribeAction] ' . $msgLog);
125
  Mage::getSingleton('customer/session')->addError($msg);
126
  $this->_redirect('customer/account');
127
  return;
128
+ } elseif (!isset($resultCreateWebWallet['result']) || $resultCreateWebWallet['result']['code'] != '00000') {
129
+ if (isset($resultCreateWebWallet['result'])) {
130
+ $msgLog = 'PAYLINE ERROR on createWebWallet: ' . $resultCreateWebWallet['result']['code'] . ' ' . $resultCreateWebWallet['result']['longMessage'];
131
+ } else {
132
+ $msgLog = 'Unknown PAYLINE ERROR on createWebWallet';
133
  }
134
+ $msg = Mage::helper('payline')->__('Error during subscription');
135
+ Mage::helper('payline/logger')->log('[subscribeAction] ' . $msgLog);
136
  Mage::getSingleton('customer/session')->addError($msg);
137
  $this->_redirect('customer/account');
138
  return;
139
  }
140
+
141
+ //save contract number
142
+ $customer->setWalletContractNumber($paylineHelper->contractNumber)->save();
143
+
144
  $this->getLayout()->getBlock('payline-wallet-subscribe-cmsblock')->setBlockId(Mage::getStoreConfig('payment/PaylineWALLET/payline_register-oneclick_customeraccount'));
145
+ $urlPayline = $resultCreateWebWallet['redirectURL'];
146
 
147
+ if (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details')) {
148
+ $iframeClass = 'iframe-subscribe-wallet iframe-with-perso-data';
149
+ } else {
150
+ $iframeClass = 'iframe-subscribe-wallet';
151
  }
152
  $this->getLayout()->getBlock('payline-wallet-subscribe-iframe')->setIframeClassName($iframeClass);
153
  $this->getLayout()->getBlock('payline-wallet-subscribe-iframe')->setIframeSrc($urlPayline);
160
  /**
161
  * Disable customer wallet, delete customer's walletId attribute value
162
  */
163
+ public function disableAction()
164
+ {
165
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
166
+
167
+ if (!($walletId = $customer->getWalletId())) {
168
  $this->_redirect('payline/wallet/subscribe');
169
  return;
170
  }
171
+
172
  $paylineSDK = Mage::helper('payline')->initPayline('WALLET');
173
  $paylineSDK->setWalletIdList($walletId);
174
+ $array = array('contractNumber' => $customer->getWalletContractNumber(), 'cardInd' => '');
175
+ try {
176
+ $res = $paylineSDK->disableWallet($array);
177
  Mage::getSingleton('customer/session')->setWalletData(null);
178
+ } catch (Exception $e) {
179
+ $msgLog = 'Unknown PAYLINE ERROR on disableWallet (Payline unreachable?)';
180
+ $msg = Mage::helper('payline')->__('Error while disabling wallet');
181
+ Mage::helper('payline/logger')->log('[disableAction] ' . $msgLog);
182
  Mage::getSingleton('customer/session')->addError($msg);
183
  }
184
+
185
+ if (!isset($res['result']) || ($res['result']['code'] != '02500' && $res['result']['code'] != '02501' && $res['result']['code'] == '02505')) {
186
+ if (isset($res['result'])) {
187
+ $msgLog = 'PAYLINE ERROR on disableWallet: ' . $res['result']['code'] . ' ' . $res['result']['longMessage'];
188
+ } else {
189
+ $msgLog = 'Unknown PAYLINE ERROR on disableWallet';
190
  }
191
+ $msg = Mage::helper('payline')->__('Error during disableWallet');
192
+ Mage::helper('payline/logger')->log('[disableAction] ' . $msg);
193
  Mage::getSingleton('customer/session')->addError($msg);
194
  $this->_redirect('customer/account');
195
  return;
196
  }
197
+
198
  $customer->setWalletId();
199
+ $customer->setWalletContractNumber();
200
  $customer->save();
201
  Mage::getSingleton('customer/session')->addSuccess($this->__('Your wallet has been disabled.'));
202
  $this->_redirect('customer/account');
203
  return;
 
204
  }
205
+
206
  /**
207
  *
208
  * Display wallet update iframe
209
  * Update payment card, not perso details
210
  */
211
+ public function updateAction()
212
+ {
213
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
214
+ if (!($walletId = $customer->getWalletId())) {
215
  $this->_redirect('payline/wallet/subscribe');
216
  return;
217
  }
218
  $this->loadLayout();
219
+
220
  $this->getLayout()->getBlock('head')->setTitle($this->__('Update wallet'));
221
+
222
  /* @var $paylineHelper Monext_Payline_Helper_Data */
223
+ $paylineHelper = Mage::helper('payline');
224
+ $paylineHelper->notificationUrl = Mage::getUrl('payline/unloggedwallet/updateNotify');
225
+ $paylineHelper->returnUrl = Mage::getUrl('payline/unloggedwallet/updateReturn');
226
+ $paylineHelper->cancelUrl = Mage::getUrl('payline/unloggedwallet/updateCancel');
227
  /* @var $paylineSDK PaylineSDK */
228
+ $paylineSDK = $paylineHelper->initPayline('WALLET');
229
+ $array = array(
230
+ 'walletId' => $walletId,
231
+ 'contractNumber' => ($customer->getWalletContractNumber() ? $customer->getWalletContractNumber() : $paylineHelper->contractNumber),
232
+ 'cardInd' => '',
233
+ 'updatePersonalDetails' => (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details') ? 1 : 0),
234
+ 'updatePaymentDetails' => (Mage::getStoreConfig('payment/PaylineWALLET/update_payment_details') ? 1 : 0),
235
+ 'updateOwnerDetails' => 0,
236
+ 'version' => Monext_Payline_Helper_Data::VERSION,
237
+ 'billingAddress' => '',
238
+ 'shippingAddress' => '',
239
+ 'buyer' => array(
240
+ 'lastName' => Mage::helper('payline')->encodeString(substr($customer->getLastname(), 0, 100)),
241
+ 'firstName' => Mage::helper('payline')->encodeString(substr($customer->getFirstname(), 0, 100)),
242
+ 'walletId' => $walletId
243
  )
244
  );
245
+ $email = $customer->getEmail();
246
+ $pattern = '/\+/i';
247
+ $charPlusExist = preg_match($pattern, $email);
248
+ if (strlen($email) <= 50 && Zend_Validate::is($email, 'EmailAddress') && !$charPlusExist) {
249
+ $array['buyer']['email'] = Mage::helper('payline')->encodeString($email);
250
+ } else {
251
  $array['buyer']['email'] = '';
252
  }
253
+ $paylineSDK->setPrivate(array('customerId' => $customer->getId()));
254
+ try {
255
+ $res = $paylineSDK->updateWebWallet($array);
256
+ } catch (Exception $e) {
257
+ Mage::logException($e);
258
+ $msgLog = 'Unknown PAYLINE ERROR on updateWebWallet (Payline unreachable?)';
259
+ $msg = Mage::helper('payline')->__('Error during wallet update');
260
+ Mage::helper('payline/logger')->log('[updateAction] ' . $msgLog);
261
  Mage::getSingleton('customer/session')->addError($msg);
262
  }
263
+ if (is_string($res)) {
264
+ Mage::helper('payline/logger')->log('[updateAction] ' . $res);
265
  Mage::getSingleton('customer/session')->addError($res);
266
  $this->_redirect('customer/account');
267
  return;
268
+ } elseif (!isset($res['result']) || ($res['result']['code'] != '00000' && $res['result']['code'] != '02502')) {
269
+ if (isset($res['result'])) {
270
+ $msgLog = 'PAYLINE ERROR on updateWebWallet: ' . $res['result']['code'] . ' ' . $res['result']['longMessage'];
271
+ } else {
272
+ $msgLog = 'Unknown PAYLINE ERROR on updateWebWallet';
273
  }
274
+ $msg = Mage::helper('payline')->__('Error while updating wallet');
275
+ Mage::helper('payline/logger')->log('[updateAction] ' . $msgLog);
276
  Mage::getSingleton('customer/session')->addError($msg);
277
  $this->_redirect('customer/account');
278
  return;
279
  }
280
+ $urlPayline = $res['redirectURL'];
281
 
282
  $this->_initLayoutMessages('customer/session');
283
  $this->_initLayoutMessages('core/session');
284
+
285
+ if (Mage::getStoreConfig('payment/PaylineWALLET/update_personal_details')) {
286
+ $iframeClass = 'iframe-update-wallet iframe-with-perso-data';
287
+ } else {
288
+ $iframeClass = 'iframe-update-wallet';
289
  }
290
  $this->getLayout()->getBlock('payline-wallet-update-iframe')->setIframeClassName($iframeClass);
291
  $this->getLayout()->getBlock('payline-wallet-update-iframe')->setIframeSrc($urlPayline);
292
+
293
  $this->renderLayout();
294
  }
295
+
296
+ }
app/code/community/Monext/Payline/etc/config.xml CHANGED
@@ -3,6 +3,7 @@
3
  <modules>
4
  <Monext_Payline>
5
  <version>1.7.7</version>
 
6
  </Monext_Payline>
7
  </modules>
8
  <global>
@@ -11,34 +12,32 @@
11
  <class>Monext_Payline_Block</class>
12
  </payline>
13
  <adminhtml>
14
- <!-- Needed for Magento Enterprise 1.9 -->
15
- <rewrite>
16
  <sales_order_creditmemo_create_items>Monext_Payline_Block_Adminhtml_Sales_Order_Creditmemo_Create_Items</sales_order_creditmemo_create_items>
17
  <customer_grid>Monext_Payline_Block_Adminhtml_Customer_Grid</customer_grid>
18
- </rewrite>
19
  </adminhtml>
20
  </blocks>
21
  <models>
22
  <payline>
23
  <class>Monext_Payline_Model</class>
24
- <resourceModel>payline_mysql4</resourceModel>
25
  </payline>
26
-
27
  <payline_mysql4>
28
- <class>Monext_Payline_Model_Mysql4</class>
29
- <entities>
30
- <contract>
31
- <table>payline_contract</table>
32
- </contract>
33
- <contract_status>
34
- <table>payline_contract_status</table>
35
- </contract_status>
36
- <fees>
37
- <table>payline_nx_fees</table>
38
- </fees>
39
- </entities>
40
- </payline_mysql4>
41
-
42
  <sales>
43
  <rewrite>
44
  <order_invoice>Monext_Payline_Model_Order_Invoice</order_invoice>
@@ -51,7 +50,6 @@
51
  <class>Monext_Payline_Helper</class>
52
  </payline>
53
  </helpers>
54
-
55
  <resources>
56
  <payline_setup>
57
  <setup>
@@ -80,28 +78,28 @@
80
  <class>payline/observer</class>
81
  <method>createInvoiceWhenStatusChange</method>
82
  </payline>
83
- <payline_fees>
84
  <class>payline/observer</class>
85
  <method>saveOrderNxFees</method>
86
  </payline_fees>
87
  </observers>
88
  </sales_order_save_after>
89
- <sales_quote_collect_totals_before>
90
- <observers>
91
- <payline>
92
  <class>payline/observer</class>
93
  <method>saveQuoteNxFees</method>
94
  </payline>
95
- </observers>
96
- </sales_quote_collect_totals_before>
97
- <sales_order_invoice_save_after>
98
- <observers>
99
- <payline>
100
  <class>payline/observer</class>
101
  <method>saveInvoiceNxFees</method>
102
  </payline>
103
- </observers>
104
- </sales_order_invoice_save_after>
105
  <controller_action_postdispatch_checkout_onepage_saveShippingMethod>
106
  <observers>
107
  <payline>
@@ -111,19 +109,18 @@
111
  </observers>
112
  </controller_action_postdispatch_checkout_onepage_saveShippingMethod>
113
  </events>
114
-
115
- <sales>
116
  <quote>
117
  <totals>
118
  <payline_nx>
119
  <class>payline/total_nx_quote</class>
120
  <after>subtotal</after>
121
  <before>grand_total,tax</before>
122
- <renderer>payline/checkout_total</renderer>
123
  </payline_nx>
124
  </totals>
125
- </quote>
126
- <order_invoice>
127
  <totals>
128
  <payline_nx>
129
  <class>payline/total_nx_invoice</class>
@@ -132,9 +129,12 @@
132
  </payline_nx>
133
  </totals>
134
  </order_invoice>
135
- </sales>
136
  </global>
137
  <frontend>
 
 
 
138
  <routers>
139
  <payline>
140
  <use>standard</use>
@@ -154,26 +154,26 @@
154
  </modules>
155
  </translate>
156
  <layout>
157
- <updates>
158
- <payline module="Monext_Payline">
159
- <file>payline.xml</file>
160
- </payline>
161
- </updates>
162
- </layout>
163
  </frontend>
164
- <admin>
165
  <routers>
166
- <payline>
167
- <use>admin</use>
168
  <args>
169
- <module>Monext_Payline</module>
170
- <frontName>payline</frontName>
 
171
  </args>
172
- </payline>
173
  </routers>
174
  </admin>
175
  <adminhtml>
176
- <translate>
177
  <modules>
178
  <Monext_Payline>
179
  <files>
@@ -183,39 +183,39 @@
183
  </modules>
184
  </translate>
185
  <layout>
186
- <updates>
187
- <payline module="Monext_Payline">
188
- <file>payline.xml</file>
189
- </payline>
190
- </updates>
191
- </layout>
192
- <menu>
193
  <system>
194
  <children>
195
  <payline translate="title" module="payline">
196
  <title>Manage Payline Contracts</title>
197
  <sort_order>10</sort_order>
198
- <action>payline/adminhtml_managecontracts</action>
199
  </payline>
200
  </children>
201
  </system>
202
  </menu>
203
  <acl>
204
- <resources>
205
- <admin>
206
- <children>
207
- <system>
208
- <children>
209
- <payline>
210
- <title>Manage Payline Contracts</title>
211
- <sort_order>10</sort_order>
212
- </payline>
213
- </children>
214
- </system>
215
- </children>
216
- </admin>
217
- </resources>
218
- </acl>
219
  </adminhtml>
220
  <default>
221
  <payment>
@@ -225,7 +225,7 @@
225
  <canceled_order_status>canceled</canceled_order_status>
226
  <new_order_status>processing</new_order_status>
227
  <init_order_status>pending</init_order_status>
228
- <fraud_order_status>pending</fraud_order_status>
229
  <automate_wallet_subscription>1</automate_wallet_subscription>
230
  <primary_max_fail_retry>1</primary_max_fail_retry>
231
  <primary_call_timeout>15</primary_call_timeout>
@@ -234,12 +234,12 @@
234
  <secondary_call_timeout>15</secondary_call_timeout>
235
  <secondary_replay_timer>15</secondary_replay_timer>
236
  <switch_back_timer>600</switch_back_timer>
237
- <payline_ws_switch_enable></payline_ws_switch_enable>
238
- <payline_err_code>02101,02102,02103</payline_err_code>
239
- <payline_err_token>02317,02318</payline_err_token>
240
- <primary_token_prefix>1</primary_token_prefix>
241
- <secondary_token_prefix>2</secondary_token_prefix>
242
- <return_payment_refused>0</return_payment_refused>
243
  </payline_common>
244
  <PaylineCPT>
245
  <model>payline/cpt</model>
3
  <modules>
4
  <Monext_Payline>
5
  <version>1.7.7</version>
6
+ <release>1.7.9.0</release>
7
  </Monext_Payline>
8
  </modules>
9
  <global>
12
  <class>Monext_Payline_Block</class>
13
  </payline>
14
  <adminhtml>
15
+ <!-- Needed for Magento Enterprise 1.9 -->
16
+ <rewrite>
17
  <sales_order_creditmemo_create_items>Monext_Payline_Block_Adminhtml_Sales_Order_Creditmemo_Create_Items</sales_order_creditmemo_create_items>
18
  <customer_grid>Monext_Payline_Block_Adminhtml_Customer_Grid</customer_grid>
19
+ </rewrite>
20
  </adminhtml>
21
  </blocks>
22
  <models>
23
  <payline>
24
  <class>Monext_Payline_Model</class>
25
+ <resourceModel>payline_mysql4</resourceModel>
26
  </payline>
 
27
  <payline_mysql4>
28
+ <class>Monext_Payline_Model_Mysql4</class>
29
+ <entities>
30
+ <contract>
31
+ <table>payline_contract</table>
32
+ </contract>
33
+ <contract_status>
34
+ <table>payline_contract_status</table>
35
+ </contract_status>
36
+ <fees>
37
+ <table>payline_nx_fees</table>
38
+ </fees>
39
+ </entities>
40
+ </payline_mysql4>
 
41
  <sales>
42
  <rewrite>
43
  <order_invoice>Monext_Payline_Model_Order_Invoice</order_invoice>
50
  <class>Monext_Payline_Helper</class>
51
  </payline>
52
  </helpers>
 
53
  <resources>
54
  <payline_setup>
55
  <setup>
78
  <class>payline/observer</class>
79
  <method>createInvoiceWhenStatusChange</method>
80
  </payline>
81
+ <payline_fees>
82
  <class>payline/observer</class>
83
  <method>saveOrderNxFees</method>
84
  </payline_fees>
85
  </observers>
86
  </sales_order_save_after>
87
+ <sales_quote_collect_totals_before>
88
+ <observers>
89
+ <payline>
90
  <class>payline/observer</class>
91
  <method>saveQuoteNxFees</method>
92
  </payline>
93
+ </observers>
94
+ </sales_quote_collect_totals_before>
95
+ <sales_order_invoice_save_after>
96
+ <observers>
97
+ <payline>
98
  <class>payline/observer</class>
99
  <method>saveInvoiceNxFees</method>
100
  </payline>
101
+ </observers>
102
+ </sales_order_invoice_save_after>
103
  <controller_action_postdispatch_checkout_onepage_saveShippingMethod>
104
  <observers>
105
  <payline>
109
  </observers>
110
  </controller_action_postdispatch_checkout_onepage_saveShippingMethod>
111
  </events>
112
+ <sales>
 
113
  <quote>
114
  <totals>
115
  <payline_nx>
116
  <class>payline/total_nx_quote</class>
117
  <after>subtotal</after>
118
  <before>grand_total,tax</before>
119
+ <renderer>payline/checkout_total</renderer>
120
  </payline_nx>
121
  </totals>
122
+ </quote>
123
+ <order_invoice>
124
  <totals>
125
  <payline_nx>
126
  <class>payline/total_nx_invoice</class>
129
  </payline_nx>
130
  </totals>
131
  </order_invoice>
132
+ </sales>
133
  </global>
134
  <frontend>
135
+ <secure_url>
136
+ <monext_payline>/payline/</monext_payline>
137
+ </secure_url>
138
  <routers>
139
  <payline>
140
  <use>standard</use>
154
  </modules>
155
  </translate>
156
  <layout>
157
+ <updates>
158
+ <payline module="Monext_Payline">
159
+ <file>payline.xml</file>
160
+ </payline>
161
+ </updates>
162
+ </layout>
163
  </frontend>
164
+ <admin>
165
  <routers>
166
+ <adminhtml>
 
167
  <args>
168
+ <modules>
169
+ <monext_payline after="Mage_Adminhtml">Monext_Payline_Adminhtml</monext_payline>
170
+ </modules>
171
  </args>
172
+ </adminhtml>
173
  </routers>
174
  </admin>
175
  <adminhtml>
176
+ <translate>
177
  <modules>
178
  <Monext_Payline>
179
  <files>
183
  </modules>
184
  </translate>
185
  <layout>
186
+ <updates>
187
+ <payline module="Monext_Payline">
188
+ <file>payline.xml</file>
189
+ </payline>
190
+ </updates>
191
+ </layout>
192
+ <menu>
193
  <system>
194
  <children>
195
  <payline translate="title" module="payline">
196
  <title>Manage Payline Contracts</title>
197
  <sort_order>10</sort_order>
198
+ <action>adminhtml/payline_managecontracts/index</action>
199
  </payline>
200
  </children>
201
  </system>
202
  </menu>
203
  <acl>
204
+ <resources>
205
+ <admin>
206
+ <children>
207
+ <system>
208
+ <children>
209
+ <payline>
210
+ <title>Manage Payline Contracts</title>
211
+ <sort_order>10</sort_order>
212
+ </payline>
213
+ </children>
214
+ </system>
215
+ </children>
216
+ </admin>
217
+ </resources>
218
+ </acl>
219
  </adminhtml>
220
  <default>
221
  <payment>
225
  <canceled_order_status>canceled</canceled_order_status>
226
  <new_order_status>processing</new_order_status>
227
  <init_order_status>pending</init_order_status>
228
+ <fraud_order_status>pending</fraud_order_status>
229
  <automate_wallet_subscription>1</automate_wallet_subscription>
230
  <primary_max_fail_retry>1</primary_max_fail_retry>
231
  <primary_call_timeout>15</primary_call_timeout>
234
  <secondary_call_timeout>15</secondary_call_timeout>
235
  <secondary_replay_timer>15</secondary_replay_timer>
236
  <switch_back_timer>600</switch_back_timer>
237
+ <payline_ws_switch_enable />
238
+ <payline_err_code>02101,02102,02103</payline_err_code>
239
+ <payline_err_token>02317,02318</payline_err_token>
240
+ <primary_token_prefix>1</primary_token_prefix>
241
+ <secondary_token_prefix>2</secondary_token_prefix>
242
+ <return_payment_refused>0</return_payment_refused>
243
  </payline_common>
244
  <PaylineCPT>
245
  <model>payline/cpt</model>
app/code/community/Monext/Payline/etc/system.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
  <payline_common translate="label">
7
  <label>Payline - Common settings</label>
8
  <sort_order>200</sort_order>
@@ -10,7 +10,7 @@
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>1</show_in_store>
12
  <comment><![CDATA[<a href="http://www.payline.com/index.php/support/tester-payline.html" target="_blank">Tester Payline</a><br />La gestion des numéros de contracts se fait via "System > Gestion des contrats Payline"]]></comment>
13
- <fields>
14
  <merchant_id translate="label" module="payline">
15
  <label>Merchant ID</label>
16
  <frontend_type>text</frontend_type>
@@ -147,7 +147,7 @@
147
  <show_in_website>1</show_in_website>
148
  <show_in_store>1</show_in_store>
149
  </resignation_order_status>
150
- <fraud_order_status translate="label">
151
  <label>Order status when a fraud is suspected</label>
152
  <comment></comment>
153
  <frontend_type>select</frontend_type>
@@ -167,7 +167,7 @@
167
  <show_in_website>1</show_in_website>
168
  <show_in_store>1</show_in_store>
169
  </automate_wallet_subscription>
170
- <return_payment_refused translate="label comment">
171
  <label>Return options</label>
172
  <comment>Page to return when payment is refused</comment>
173
  <frontend_type>select</frontend_type>
@@ -179,48 +179,48 @@
179
  </return_payment_refused>
180
  </fields>
181
  </payline_common>
182
- <PaylineCPT translate="label">
183
- <label>Payline - Cash web paiement</label>
184
- <sort_order>201</sort_order>
185
- <show_in_default>1</show_in_default>
186
- <show_in_website>1</show_in_website>
187
- <show_in_store>1</show_in_store>
188
- <fields>
189
- <active translate="label">
190
- <label>Enabled</label>
191
- <frontend_type>select</frontend_type>
192
- <source_model>adminhtml/system_config_source_yesno</source_model>
193
- <sort_order>10</sort_order>
194
- <show_in_default>1</show_in_default>
195
- <show_in_website>1</show_in_website>
196
- <show_in_store>1</show_in_store>
197
- </active>
198
- <title translate="label">
199
- <label>Title</label>
200
- <frontend_type>text</frontend_type>
201
- <sort_order>20</sort_order>
202
- <show_in_default>1</show_in_default>
203
- <show_in_website>1</show_in_website>
204
- <show_in_store>1</show_in_store>
205
- </title>
206
- <template_url translate="label comment">
207
- <label>Template URL</label>
208
- <comment>URL to a custom HTML template. Refer to Payline documentation</comment>
209
- <frontend_type>text</frontend_type>
210
- <sort_order>30</sort_order>
211
- <show_in_default>1</show_in_default>
212
- <show_in_website>1</show_in_website>
213
- <show_in_store>1</show_in_store>
214
- </template_url>
215
- <custom_payment_page_code translate="label comment">
216
- <label>Custom payment page code</label>
217
- <comment>ID of a style defined in Payline administration tool.</comment>
218
- <frontend_type>text</frontend_type>
219
- <sort_order>40</sort_order>
220
- <show_in_default>1</show_in_default>
221
- <show_in_website>1</show_in_website>
222
- <show_in_store>1</show_in_store>
223
- </custom_payment_page_code>
224
  <custom_payment_page_code_ua_regexp translate="comment">
225
  <label></label>
226
  <frontend_model>adminhtml/system_config_form_field_regexceptions</frontend_model>
@@ -231,7 +231,7 @@
231
  <show_in_store>1</show_in_store>
232
  <comment>Match expressions in the same order as displayed in the configuration.</comment>
233
  </custom_payment_page_code_ua_regexp>
234
- <redirect_message translate="label">
235
  <label>Redirection message</label>
236
  <frontend_type>textarea</frontend_type>
237
  <sort_order>50</sort_order>
@@ -239,15 +239,15 @@
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>1</show_in_store>
241
  </redirect_message>
242
- <payline_payment_action translate="label">
243
- <label>Payment action</label>
244
- <frontend_type>select</frontend_type>
245
- <source_model>payline/datasource_paymentactions</source_model>
246
- <sort_order>60</sort_order>
247
- <show_in_default>1</show_in_default>
248
- <show_in_website>1</show_in_website>
249
- <show_in_store>1</show_in_store>
250
- </payline_payment_action>
251
  <capture_payment_when_i_said translate="label">
252
  <label>Capture payment when action / status is triggered</label>
253
  <comment></comment>
@@ -258,7 +258,9 @@
258
  <show_in_website>1</show_in_website>
259
  <show_in_store>1</show_in_store>
260
  <!-- 100 => authorization -->
261
- <depends><payline_payment_action>100</payline_payment_action></depends>
 
 
262
  </capture_payment_when_i_said>
263
  <send_wallet_id translate="label comment">
264
  <label>Send wallet id</label>
@@ -289,67 +291,67 @@
289
  <show_in_website>1</show_in_website>
290
  <show_in_store>1</show_in_store>
291
  </action_when_order_seven_day_old>
292
- </fields>
293
- </PaylineCPT>
294
- <PaylineNX translate="label">
295
- <label>Payline - Nx web payment</label>
296
- <sort_order>202</sort_order>
297
- <show_in_default>1</show_in_default>
298
- <show_in_website>1</show_in_website>
299
- <show_in_store>1</show_in_store>
300
- <fields>
301
- <active translate="label">
302
- <label>Enabled</label>
303
- <frontend_type>select</frontend_type>
304
- <source_model>adminhtml/system_config_source_yesno</source_model>
305
- <sort_order>10</sort_order>
306
- <show_in_default>1</show_in_default>
307
- <show_in_website>1</show_in_website>
308
- <show_in_store>1</show_in_store>
309
- </active>
310
- <title translate="label">
311
- <label>Title</label>
312
- <frontend_type>text</frontend_type>
313
- <sort_order>20</sort_order>
314
- <show_in_default>1</show_in_default>
315
- <show_in_website>1</show_in_website>
316
- <show_in_store>1</show_in_store>
317
- </title>
318
- <cost_type translate="label">
319
- <label>Costs</label>
320
- <frontend_type>select</frontend_type>
321
- <source_model>payline/datasource_costs</source_model>
322
- <sort_order>21</sort_order>
323
- <show_in_default>1</show_in_default>
324
- <show_in_website>1</show_in_website>
325
- <show_in_store>1</show_in_store>
326
- </cost_type>
327
- <cost_amount translate="label">
328
- <label>Costs amount/percentage</label>
329
- <frontend_type>text</frontend_type>
330
- <sort_order>22</sort_order>
331
- <show_in_default>1</show_in_default>
332
- <show_in_website>1</show_in_website>
333
- <show_in_store>1</show_in_store>
334
- </cost_amount>
335
- <template_url translate="label comment">
336
- <label>Template URL</label>
337
- <comment>URL to a custom HTML template. Refer to Payline documentation</comment>
338
- <frontend_type>text</frontend_type>
339
- <sort_order>30</sort_order>
340
- <show_in_default>1</show_in_default>
341
- <show_in_website>1</show_in_website>
342
- <show_in_store>1</show_in_store>
343
- </template_url>
344
- <custom_payment_page_code translate="label comment">
345
- <label>Custom payment page code</label>
346
- <comment>ID of a style defined in Payline administration tool.</comment>
347
- <frontend_type>text</frontend_type>
348
- <sort_order>40</sort_order>
349
- <show_in_default>1</show_in_default>
350
- <show_in_website>1</show_in_website>
351
- <show_in_store>1</show_in_store>
352
- </custom_payment_page_code>
353
  <custom_payment_page_code_ua_regexp translate="comment">
354
  <label></label>
355
  <frontend_model>adminhtml/system_config_form_field_regexceptions</frontend_model>
@@ -368,24 +370,24 @@
368
  <show_in_website>1</show_in_website>
369
  <show_in_store>1</show_in_store>
370
  </redirect_message>
371
- <billing_occurrences translate="label">
372
- <label>Billing occurences</label>
373
- <frontend_type>select</frontend_type>
374
- <source_model>payline/datasource_billingoccurrences</source_model>
375
- <sort_order>60</sort_order>
376
- <show_in_default>1</show_in_default>
377
- <show_in_website>1</show_in_website>
378
- <show_in_store>1</show_in_store>
379
- </billing_occurrences>
380
- <billing_cycle translate="label">
381
- <label>Billing cycle</label>
382
- <frontend_type>select</frontend_type>
383
- <source_model>payline/datasource_billingcycles</source_model>
384
- <sort_order>70</sort_order>
385
- <show_in_default>1</show_in_default>
386
- <show_in_website>1</show_in_website>
387
- <show_in_store>1</show_in_store>
388
- </billing_cycle>
389
  <send_wallet_id translate="label comment">
390
  <label>Send wallet id</label>
391
  <comment>If wallet id is provided, wallet payment will be available during web payment</comment>
@@ -425,16 +427,16 @@
425
  <show_in_store>1</show_in_store>
426
  <can_be_empty>1</can_be_empty>
427
  </status_when_credit_card_schedule_is_expired>
428
- </fields>
429
- </PaylineNX>
430
- <PaylineDIRECT translate="label">
431
- <label>Payline - direct payment</label>
432
  <sort_order>203</sort_order>
433
  <show_in_default>1</show_in_default>
434
  <show_in_website>1</show_in_website>
435
  <show_in_store>1</show_in_store>
436
- <fields>
437
- <active translate="label">
438
  <label>Enabled</label>
439
  <frontend_type>select</frontend_type>
440
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -470,7 +472,9 @@
470
  <show_in_website>1</show_in_website>
471
  <show_in_store>1</show_in_store>
472
  <!-- 100 => authorization -->
473
- <depends><payline_payment_action>100</payline_payment_action></depends>
 
 
474
  </capture_payment_when_i_said>
475
  <automate_invoice_creation>
476
  <label>Automate invoice creation</label>
@@ -491,7 +495,7 @@
491
  <show_in_website>1</show_in_website>
492
  <show_in_store>1</show_in_store>
493
  </action_when_order_seven_day_old>
494
- </fields>
495
  </PaylineDIRECT>
496
 
497
  <PaylineWALLET translate="label">
@@ -583,7 +587,9 @@
583
  <show_in_website>1</show_in_website>
584
  <show_in_store>1</show_in_store>
585
  <!-- 100 => authorization -->
586
- <depends><payline_payment_action>100</payline_payment_action></depends>
 
 
587
  </capture_payment_when_i_said>
588
  <action_when_order_seven_day_old>
589
  <label>Action when order is at least 7 days old</label>
@@ -651,7 +657,7 @@
651
  </automate_invoice_creation>
652
  </fields>
653
  </PaylineWALLET>
654
- </groups>
655
- </payment>
656
- </sections>
657
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
  <payline_common translate="label">
7
  <label>Payline - Common settings</label>
8
  <sort_order>200</sort_order>
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>1</show_in_store>
12
  <comment><![CDATA[<a href="http://www.payline.com/index.php/support/tester-payline.html" target="_blank">Tester Payline</a><br />La gestion des numéros de contracts se fait via "System > Gestion des contrats Payline"]]></comment>
13
+ <fields>
14
  <merchant_id translate="label" module="payline">
15
  <label>Merchant ID</label>
16
  <frontend_type>text</frontend_type>
147
  <show_in_website>1</show_in_website>
148
  <show_in_store>1</show_in_store>
149
  </resignation_order_status>
150
+ <fraud_order_status translate="label">
151
  <label>Order status when a fraud is suspected</label>
152
  <comment></comment>
153
  <frontend_type>select</frontend_type>
167
  <show_in_website>1</show_in_website>
168
  <show_in_store>1</show_in_store>
169
  </automate_wallet_subscription>
170
+ <return_payment_refused translate="label comment">
171
  <label>Return options</label>
172
  <comment>Page to return when payment is refused</comment>
173
  <frontend_type>select</frontend_type>
179
  </return_payment_refused>
180
  </fields>
181
  </payline_common>
182
+ <PaylineCPT translate="label">
183
+ <label>Payline - Cash web paiement</label>
184
+ <sort_order>201</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
+ <fields>
189
+ <active translate="label">
190
+ <label>Enabled</label>
191
+ <frontend_type>select</frontend_type>
192
+ <source_model>adminhtml/system_config_source_yesno</source_model>
193
+ <sort_order>10</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </active>
198
+ <title translate="label">
199
+ <label>Title</label>
200
+ <frontend_type>text</frontend_type>
201
+ <sort_order>20</sort_order>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>1</show_in_store>
205
+ </title>
206
+ <template_url translate="label comment">
207
+ <label>Template URL</label>
208
+ <comment>URL to a custom HTML template. Refer to Payline documentation</comment>
209
+ <frontend_type>text</frontend_type>
210
+ <sort_order>30</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </template_url>
215
+ <custom_payment_page_code translate="label comment">
216
+ <label>Custom payment page code</label>
217
+ <comment>ID of a style defined in Payline administration tool.</comment>
218
+ <frontend_type>text</frontend_type>
219
+ <sort_order>40</sort_order>
220
+ <show_in_default>1</show_in_default>
221
+ <show_in_website>1</show_in_website>
222
+ <show_in_store>1</show_in_store>
223
+ </custom_payment_page_code>
224
  <custom_payment_page_code_ua_regexp translate="comment">
225
  <label></label>
226
  <frontend_model>adminhtml/system_config_form_field_regexceptions</frontend_model>
231
  <show_in_store>1</show_in_store>
232
  <comment>Match expressions in the same order as displayed in the configuration.</comment>
233
  </custom_payment_page_code_ua_regexp>
234
+ <redirect_message translate="label">
235
  <label>Redirection message</label>
236
  <frontend_type>textarea</frontend_type>
237
  <sort_order>50</sort_order>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>1</show_in_store>
241
  </redirect_message>
242
+ <payline_payment_action translate="label">
243
+ <label>Payment action</label>
244
+ <frontend_type>select</frontend_type>
245
+ <source_model>payline/datasource_paymentactions</source_model>
246
+ <sort_order>60</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>1</show_in_store>
250
+ </payline_payment_action>
251
  <capture_payment_when_i_said translate="label">
252
  <label>Capture payment when action / status is triggered</label>
253
  <comment></comment>
258
  <show_in_website>1</show_in_website>
259
  <show_in_store>1</show_in_store>
260
  <!-- 100 => authorization -->
261
+ <depends>
262
+ <payline_payment_action>100</payline_payment_action>
263
+ </depends>
264
  </capture_payment_when_i_said>
265
  <send_wallet_id translate="label comment">
266
  <label>Send wallet id</label>
291
  <show_in_website>1</show_in_website>
292
  <show_in_store>1</show_in_store>
293
  </action_when_order_seven_day_old>
294
+ </fields>
295
+ </PaylineCPT>
296
+ <PaylineNX translate="label">
297
+ <label>Payline - Nx web payment</label>
298
+ <sort_order>202</sort_order>
299
+ <show_in_default>1</show_in_default>
300
+ <show_in_website>1</show_in_website>
301
+ <show_in_store>1</show_in_store>
302
+ <fields>
303
+ <active translate="label">
304
+ <label>Enabled</label>
305
+ <frontend_type>select</frontend_type>
306
+ <source_model>adminhtml/system_config_source_yesno</source_model>
307
+ <sort_order>10</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>1</show_in_website>
310
+ <show_in_store>1</show_in_store>
311
+ </active>
312
+ <title translate="label">
313
+ <label>Title</label>
314
+ <frontend_type>text</frontend_type>
315
+ <sort_order>20</sort_order>
316
+ <show_in_default>1</show_in_default>
317
+ <show_in_website>1</show_in_website>
318
+ <show_in_store>1</show_in_store>
319
+ </title>
320
+ <cost_type translate="label">
321
+ <label>Costs</label>
322
+ <frontend_type>select</frontend_type>
323
+ <source_model>payline/datasource_costs</source_model>
324
+ <sort_order>21</sort_order>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>1</show_in_website>
327
+ <show_in_store>1</show_in_store>
328
+ </cost_type>
329
+ <cost_amount translate="label">
330
+ <label>Costs amount/percentage</label>
331
+ <frontend_type>text</frontend_type>
332
+ <sort_order>22</sort_order>
333
+ <show_in_default>1</show_in_default>
334
+ <show_in_website>1</show_in_website>
335
+ <show_in_store>1</show_in_store>
336
+ </cost_amount>
337
+ <template_url translate="label comment">
338
+ <label>Template URL</label>
339
+ <comment>URL to a custom HTML template. Refer to Payline documentation</comment>
340
+ <frontend_type>text</frontend_type>
341
+ <sort_order>30</sort_order>
342
+ <show_in_default>1</show_in_default>
343
+ <show_in_website>1</show_in_website>
344
+ <show_in_store>1</show_in_store>
345
+ </template_url>
346
+ <custom_payment_page_code translate="label comment">
347
+ <label>Custom payment page code</label>
348
+ <comment>ID of a style defined in Payline administration tool.</comment>
349
+ <frontend_type>text</frontend_type>
350
+ <sort_order>40</sort_order>
351
+ <show_in_default>1</show_in_default>
352
+ <show_in_website>1</show_in_website>
353
+ <show_in_store>1</show_in_store>
354
+ </custom_payment_page_code>
355
  <custom_payment_page_code_ua_regexp translate="comment">
356
  <label></label>
357
  <frontend_model>adminhtml/system_config_form_field_regexceptions</frontend_model>
370
  <show_in_website>1</show_in_website>
371
  <show_in_store>1</show_in_store>
372
  </redirect_message>
373
+ <billing_occurrences translate="label">
374
+ <label>Billing occurences</label>
375
+ <frontend_type>select</frontend_type>
376
+ <source_model>payline/datasource_billingoccurrences</source_model>
377
+ <sort_order>60</sort_order>
378
+ <show_in_default>1</show_in_default>
379
+ <show_in_website>1</show_in_website>
380
+ <show_in_store>1</show_in_store>
381
+ </billing_occurrences>
382
+ <billing_cycle translate="label">
383
+ <label>Billing cycle</label>
384
+ <frontend_type>select</frontend_type>
385
+ <source_model>payline/datasource_billingcycles</source_model>
386
+ <sort_order>70</sort_order>
387
+ <show_in_default>1</show_in_default>
388
+ <show_in_website>1</show_in_website>
389
+ <show_in_store>1</show_in_store>
390
+ </billing_cycle>
391
  <send_wallet_id translate="label comment">
392
  <label>Send wallet id</label>
393
  <comment>If wallet id is provided, wallet payment will be available during web payment</comment>
427
  <show_in_store>1</show_in_store>
428
  <can_be_empty>1</can_be_empty>
429
  </status_when_credit_card_schedule_is_expired>
430
+ </fields>
431
+ </PaylineNX>
432
+ <PaylineDIRECT translate="label">
433
+ <label>Payline - direct payment</label>
434
  <sort_order>203</sort_order>
435
  <show_in_default>1</show_in_default>
436
  <show_in_website>1</show_in_website>
437
  <show_in_store>1</show_in_store>
438
+ <fields>
439
+ <active translate="label">
440
  <label>Enabled</label>
441
  <frontend_type>select</frontend_type>
442
  <source_model>adminhtml/system_config_source_yesno</source_model>
472
  <show_in_website>1</show_in_website>
473
  <show_in_store>1</show_in_store>
474
  <!-- 100 => authorization -->
475
+ <depends>
476
+ <payline_payment_action>100</payline_payment_action>
477
+ </depends>
478
  </capture_payment_when_i_said>
479
  <automate_invoice_creation>
480
  <label>Automate invoice creation</label>
495
  <show_in_website>1</show_in_website>
496
  <show_in_store>1</show_in_store>
497
  </action_when_order_seven_day_old>
498
+ </fields>
499
  </PaylineDIRECT>
500
 
501
  <PaylineWALLET translate="label">
587
  <show_in_website>1</show_in_website>
588
  <show_in_store>1</show_in_store>
589
  <!-- 100 => authorization -->
590
+ <depends>
591
+ <payline_payment_action>100</payline_payment_action>
592
+ </depends>
593
  </capture_payment_when_i_said>
594
  <action_when_order_seven_day_old>
595
  <label>Action when order is at least 7 days old</label>
657
  </automate_invoice_creation>
658
  </fields>
659
  </PaylineWALLET>
660
+ </groups>
661
+ </payment>
662
+ </sections>
663
  </config>
app/design/adminhtml/default/default/layout/payline.xml CHANGED
@@ -2,52 +2,54 @@
2
  <layout>
3
  <adminhtml_customer_edit>
4
  <reference name="customer_edit_tab_view">
5
- <action method="setTemplate"><template>payline/customer/tab/view.phtml</template></action>
 
 
6
  </reference>
7
  </adminhtml_customer_edit>
8
 
9
- <payline_adminhtml_managecontracts_index>
10
  <reference name="content">
11
  <block type="payline/adminhtml_managecontracts" name="contracts_container">
12
- <block type="adminhtml/system_config_switcher" name="store_switcher" as="store_switcher" template="payline/switcher.phtml"></block>
13
- </block>
14
  </reference>
15
- </payline_adminhtml_managecontracts_index>
16
 
17
- <payline_adminhtml_managecontracts_edit>
18
  <reference name="content">
19
  <block type="payline/adminhtml_managecontracts_edit" name="contract_edit" />
20
  </reference>
21
- </payline_adminhtml_managecontracts_edit>
22
 
23
- <payline_adminhtml_managecontracts_grid>
24
  <block type="core/text_list" name="root" output="toHtml">
25
  <block type="payline/adminhtml_managecontracts_grid" name="admin.contracts.grid"/>
26
  </block>
27
- </payline_adminhtml_managecontracts_grid>
28
 
29
- <adminhtml_sales_order_view>
30
- <reference name="order_totals">
31
- <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
32
- </reference>
33
- </adminhtml_sales_order_view>
34
 
35
- <adminhtml_sales_order_invoice_new>
36
- <reference name="invoice_totals">
37
- <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
38
- </reference>
39
- </adminhtml_sales_order_invoice_new>
40
 
41
- <adminhtml_sales_order_invoice_updateqty>
42
- <reference name="invoice_totals">
43
- <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
44
- </reference>
45
- </adminhtml_sales_order_invoice_updateqty>
46
 
47
- <adminhtml_sales_order_invoice_view>
48
- <reference name="invoice_totals">
49
- <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
50
- </reference>
51
- </adminhtml_sales_order_invoice_view>
52
 
53
  </layout>
2
  <layout>
3
  <adminhtml_customer_edit>
4
  <reference name="customer_edit_tab_view">
5
+ <action method="setTemplate">
6
+ <template>payline/customer/tab/view.phtml</template>
7
+ </action>
8
  </reference>
9
  </adminhtml_customer_edit>
10
 
11
+ <adminhtml_payline_managecontracts_index>
12
  <reference name="content">
13
  <block type="payline/adminhtml_managecontracts" name="contracts_container">
14
+ <block type="adminhtml/system_config_switcher" name="store_switcher" as="store_switcher" template="payline/switcher.phtml"></block>
15
+ </block>
16
  </reference>
17
+ </adminhtml_payline_managecontracts_index>
18
 
19
+ <adminhtml_payline_managecontracts_edit>
20
  <reference name="content">
21
  <block type="payline/adminhtml_managecontracts_edit" name="contract_edit" />
22
  </reference>
23
+ </adminhtml_payline_managecontracts_edit>
24
 
25
+ <adminhtml_payline_managecontracts_grid>
26
  <block type="core/text_list" name="root" output="toHtml">
27
  <block type="payline/adminhtml_managecontracts_grid" name="admin.contracts.grid"/>
28
  </block>
29
+ </adminhtml_payline_managecontracts_grid>
30
 
31
+ <adminhtml_sales_order_view>
32
+ <reference name="order_totals">
33
+ <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
34
+ </reference>
35
+ </adminhtml_sales_order_view>
36
 
37
+ <adminhtml_sales_order_invoice_new>
38
+ <reference name="invoice_totals">
39
+ <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
40
+ </reference>
41
+ </adminhtml_sales_order_invoice_new>
42
 
43
+ <adminhtml_sales_order_invoice_updateqty>
44
+ <reference name="invoice_totals">
45
+ <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
46
+ </reference>
47
+ </adminhtml_sales_order_invoice_updateqty>
48
 
49
+ <adminhtml_sales_order_invoice_view>
50
+ <reference name="invoice_totals">
51
+ <block type="payline/adminhtml_sales_order_total_nxfees" name="nxfees_total" as="nxfees_total"/>
52
+ </reference>
53
+ </adminhtml_sales_order_invoice_view>
54
 
55
  </layout>
app/design/frontend/default/default/template/payline/wallet/manage.phtml CHANGED
@@ -5,7 +5,7 @@
5
  <script type="text/javascript">
6
  function checkDisableWallet(){
7
  if(window.confirm("<?php echo $this->__("Are you sure?");?>")){
8
- window.setLocation('<?php echo Mage::getBaseUrl().'/payline/wallet/disable' ?>');
9
  }
10
  }
11
  </script>
@@ -15,7 +15,7 @@
15
 
16
  <?php echo $this->getChildHtml('payline-wallet-details');?>
17
  <div class="actions">
18
- <button type="button" title="<?php echo $this->__('Update payment informations') ?>" class="button" onclick="setLocation('<?php echo Mage::getBaseUrl().'/payline/wallet/update' ?>')"><span><span><?php echo $this->__('Update payment informations') ?></span></span></button>
19
  <button type="button" title="<?php echo $this->__('Disable wallet') ?>" class="button" onclick="checkDisableWallet();"><span><span><?php echo $this->__('Disable wallet') ?></span></span></button>
20
  </div>
21
  </div>
5
  <script type="text/javascript">
6
  function checkDisableWallet(){
7
  if(window.confirm("<?php echo $this->__("Are you sure?");?>")){
8
+ window.setLocation('<?php echo Mage::getUrl('payline/wallet/disable'); ?>');
9
  }
10
  }
11
  </script>
15
 
16
  <?php echo $this->getChildHtml('payline-wallet-details');?>
17
  <div class="actions">
18
+ <button type="button" title="<?php echo $this->__('Update payment informations') ?>" class="button" onclick="setLocation('<?php echo Mage::getUrl('payline/wallet/update'); ?>')"><span><span><?php echo $this->__('Update payment informations') ?></span></span></button>
19
  <button type="button" title="<?php echo $this->__('Disable wallet') ?>" class="button" onclick="checkDisableWallet();"><span><span><?php echo $this->__('Disable wallet') ?></span></span></button>
20
  </div>
21
  </div>
app/design/frontend/default/default/template/payline/wallet/sidebar/form.phtml CHANGED
@@ -9,7 +9,7 @@
9
  <p><a href="<?php echo Mage::getUrl('customer/address/');?>"><?php echo $this->__('Edit my data')?></a></p>
10
  <div class="actions">
11
  <button class="button" title="<?php echo $this->__('My Wallet');?>" type="button"
12
- onclick="setLocation('<?php echo $this->getUrl('payline/wallet/')?>')">
13
  <span><?php echo $this->__('My Wallet');?></span>
14
  </button>
15
  <button class="button btn-wallet-checkout" title="<?php echo $this->__('1-click checkout');?>" type="submit"><span><span><?php echo $this->__('1-click checkout');?></span></span></button>
9
  <p><a href="<?php echo Mage::getUrl('customer/address/');?>"><?php echo $this->__('Edit my data')?></a></p>
10
  <div class="actions">
11
  <button class="button" title="<?php echo $this->__('My Wallet');?>" type="button"
12
+ onclick="setLocation('<?php echo $this->getUrl('payline/wallet/index')?>')">
13
  <span><?php echo $this->__('My Wallet');?></span>
14
  </button>
15
  <button class="button btn-wallet-checkout" title="<?php echo $this->__('1-click checkout');?>" type="submit"><span><span><?php echo $this->__('1-click checkout');?></span></span></button>
app/design/frontend/default/default/template/payline/wallet/sidebar/notlogged.phtml CHANGED
@@ -8,7 +8,7 @@
8
  </div>
9
  <div class="actions">
10
  <button class="button btn-wallet-checkout"
11
- onclick="window.location='<?php echo Mage::getBaseUrl().'/payline/wallet/subscribe'?>';"
12
  title="<?php echo $label;?>" type="button"
13
  >
14
  <span><span><?php echo $label;?></span></span>
8
  </div>
9
  <div class="actions">
10
  <button class="button btn-wallet-checkout"
11
+ onclick="window.location='<?php echo Mage::getUrl('payline/wallet/subscribe'); ?>';"
12
  title="<?php echo $label;?>" type="button"
13
  >
14
  <span><span><?php echo $label;?></span></span>
app/etc/modules/Monext_Payline.xml CHANGED
@@ -1,14 +1,14 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <modules>
4
- <Monext_Payline>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Payment />
9
- <Mage_Customer />
10
- <Mage_Sales />
11
- </depends>
12
- </Monext_Payline>
13
- </modules>
14
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <modules>
4
+ <Monext_Payline>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ <Mage_Customer />
10
+ <Mage_Sales />
11
+ </depends>
12
+ </Monext_Payline>
13
+ </modules>
14
  </config>
package.xml CHANGED
@@ -1,20 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payline</name>
4
- <version>1.7.8.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Paiement s&#xE9;curis&#xE9; via Payline, par Monext.</summary>
10
- <description>Profitez d&#xE8;s &#xE0; pr&#xE9;sent de l&#x2019;essor du march&#xE9; de la vente &#xE0; distance en proposant &#xE0; vos clients une solution de paiement totalement s&#xE9;curis&#xE9;e. Gr&#xE2;ce &#xE0; Payline vous permettez &#xE0; vos clients de r&#xE9;gler avec leur moyen de paiement habituel, quel que soit votre canal de vente. Vous leur proposez une interface de paiement facile &#xE0; utiliser, en mesure de vous accompagner dans votre d&#xE9;veloppement &#xE0; l&#x2019;international, en toute simplicit&#xE9;.&#xD;
11
  &#xD;
12
  Fonctionnalit&#xE9;s : autorisation, autorisation + validation, paiement en n fois, paiement par portefeuille et en 1 clic, validation et remboursement partiels, multi-boutique...</description>
13
- <notes>Ajout d'images manquantes</notes>
14
- <authors><author><name>Payline</name><user>Payline</user><email>support@payline.com</email></author></authors>
15
- <date>2014-03-03</date>
16
- <time>09:25:34</time>
17
- <contents><target name="magecommunity"><dir name="Monext"><dir name="Payline"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><file name="Grid.php" hash="13b7c449e07ef729fbac8caa708decd1"/></dir><dir name="Managecontracts"><dir name="Edit"><file name="Form.php" hash="05040427f41fb110db974ff5a3eb6ba9"/></dir><file name="Edit.php" hash="7f026d56bfd7a7b03e9e1ad9263a008e"/><file name="Grid.php" hash="de14d88f9c299895168e5d1a214e267f"/></dir><file name="Managecontracts.php" hash="343434dde00ba5d5ba35ed255c44a98e"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Items.php" hash="c7cd82866d8788ff32d42df8fcdc11f8"/></dir></dir><dir name="Total"><file name="Nxfees.php" hash="cd28c26f717481421bfab12c55ab5378"/></dir></dir></dir></dir><dir name="Checkout"><file name="Total.php" hash="df9fd2acea6ca2be213bfd5e335cedd6"/></dir><file name="Cpt.php" hash="85df4f91ef5ca13f14ca3c15a6ff29e3"/><file name="Direct.php" hash="a176d97fe09a830fbb82d517a71c7049"/><dir name="Info"><file name="Default.php" hash="028809c8e83cd97df32d3fe15833e609"/><file name="Direct.php" hash="f3a87e79429f581e2c896cc99f169aed"/></dir><file name="Logo.php" hash="2b7784f040f04489448fbc13b05ffe74"/><file name="Nx.php" hash="e4fd920c944abe9963f76e111e90ba48"/><dir name="Wallet"><file name="Checkoutbtn.php" hash="bbd8b30f2a37e83ce295295f0fe10ebf"/><file name="Details.php" hash="03cb96bd76d2265b842677b2a6825303"/><file name="Infos.php" hash="ae673ceafb630efbf0308657f766a816"/><file name="Sidebar.php" hash="db70b60be9aa20316f91b3fa3a23a2b9"/></dir><file name="Wallet.php" hash="6326c9e76c84777597f30a89d718ccb4"/></dir><dir name="Helper"><file name="Data.php" hash="4edd6778b8a3342cdbeae5b1493bb649"/><file name="Logger.php" hash="6b7cf036fdf2e6df2cb7fa645c8912b9"/></dir><dir name="Model"><dir name="Contract"><file name="Status.php" hash="67919f148f5d50a266b92e8a32e833f1"/></dir><file name="Contract.php" hash="75ac4b82964f0b87f7b30c4fb0f6b638"/><file name="Cpt.php" hash="94254eb4113dc8a0a6cc1d4c8521a602"/><dir name="Datasource"><file name="Actions.php" hash="2152344a8bd5fbf7dbe711c58f97356c"/><file name="Billingcycles.php" hash="bef244e6d9e744fbbc3afed9cc2050f9"/><file name="Billingoccurrences.php" hash="581ce23ec626ed71791b13c7b11fe6db"/><file name="Capturepaymentoptions.php" hash="8095a47418aa5d7f0cea91718de2323f"/><dir name="Cms"><file name="Block.php" hash="eee43f517c9e29e51f0ca21fdc7b74ed"/></dir><file name="Costs.php" hash="ac09cf06fbe9a1fabddb2a4727dd696f"/><file name="Languages.php" hash="17053eec4880c5c5b1f233a3ca9f0bda"/><file name="Paymentactions.php" hash="6c4aae3b1b4e8b987a4da7393a3a92eb"/><file name="Paymentactionsreauth.php" hash="ef87674b1742240f9c2af17eb38fd994"/><file name="Return.php" hash="d8fac75b41a931a4714ed8acf846d9a2"/><file name="Securitymodes.php" hash="06c55b65e9254d96fa87595322839932"/><file name="Shippingmethods.php" hash="1c67f2af87583aae049c86cb4dcdf881"/><dir name="Status"><file name="Canceled.php" hash="c4e799efcb052536081339520c7b72c2"/><file name="Invoice.php" hash="b2cbeeaf4e78ec4545f6d45faba1922e"/></dir><file name="Status.php" hash="ec9086907481960aa7c669de0db470c3"/><file name="Statusrowempty.php" hash="94532e5d65ff502ccfaf995f2993ad10"/></dir><file name="Direct.php" hash="d7bde5b06b400fb9362a527d556287c2"/><file name="Fees.php" hash="d51c983f019b43e70516b71e163e9a28"/><dir name="Mysql4"><dir name="Contract"><file name="Collection.php" hash="7d71121cac131f11dc012375b4412d85"/><dir name="Status"><file name="Collection.php" hash="3a76926bcab21729191a4045fa9662f7"/></dir><file name="Status.php" hash="3deb3f63a199b110a3fa581ff777172f"/></dir><file name="Contract.php" hash="33cbc24553f2d90ba164363172e2f4c7"/><dir name="Fees"><file name="Collection.php" hash="b00bb0ec3e0a75a2435f6c55d3eea02c"/></dir><file name="Fees.php" hash="c398d9290276806d03af8631a09eac63"/></dir><file name="Nx.php" hash="830433cc06e92665fd554fe0030070f0"/><file name="Observer.php" hash="94824604b2ea364b1bed23bbaa01033b"/><dir name="Order"><file name="Invoice.php" hash="4b1a7d53444ad7069479ac617d7396b6"/><file name="Payment.php" hash="c8207b103d284bde7e511c57d9a5399c"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="f0cb886cd65e23ec397e651d7913ea9e"/></dir></dir></dir><dir name="Total"><dir name="Nx"><file name="Invoice.php" hash="6ead6df53b6169709797d6c08cd4d16c"/><file name="Quote.php" hash="8e7ab3cc36d180c600bb28192193567b"/></dir></dir><file name="Wallet.php" hash="b114d566bd102eb6e25c3070be79303f"/></dir><dir name="PaylinePHPKit"><dir name="configuration"><file name="HighDefinition.ini" hash="689dc8f1ba03e0c04ae6a8758df38f1b"/></dir><dir name="lib"><file name="Payline.wsdl" hash="b22b4ddfb2751c886e25d7202731c686"/><file name="jIniFileModifier.php" hash="f7d309bd1fb8f408528151b0555b188c"/><file name="lib_debug.php" hash="9cec1fd5e55fd625b98b03ca336214d1"/><file name="paylineSDK.php" hash="ad351f993cad972269e320ece22d9231"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ManagecontractsController.php" hash="f5c8ac2227e34766baed1e3e0af4bf87"/></dir><file name="CheckoutonepageController.php" hash="77772924163d5b5a2bc90f1b1ead6020"/><file name="IndexController.php" hash="2304134c659d77cd7a4d31d15cda4ea2"/><file name="UnloggedwalletController.php" hash="90af5be8a8fa8dd1b2e29a442c0b7aab"/><file name="WalletController.php" hash="9bedfe037d2d845d4b1fe2acbbf69033"/></dir><dir name="etc"><file name="config.xml" hash="c19f127b3e4926628495888d22f63a7f"/><file name="system.xml" hash="0d83d9a3b18a03bbc71191da32c22bc2"/></dir><dir name="sql"><dir name="payline_setup"><file name="mysql4-install-1.6.0.php" hash="ed5013f743ba36a7b2884fc432f97e16"/><file name="mysql4-upgrade-1.7.2-1.7.3.php" hash="7eeb0f5cfc6c379d8300428a5ec39c46"/><file name="mysql4-upgrade-1.7.5-1.7.6.php" hash="0ebfd38e90a8139c67087fc1e16f1aba"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payline.css" hash="414432db8dc1d0682f4988917bd8dd6f"/></dir><dir name="images"><dir name="payline_moyens_paiement"><file name="1euro.png" hash="8d5e4917497ba61120090e166014886d"/><file name="3xcb.png" hash="c76c834e238d3a8e3b3b4a2c116f189c"/><file name="amex.png" hash="a47d6bfc7eb4e06f3e3acb8a55cfd3c9"/><file name="amexoneclick.png" hash="a47d6bfc7eb4e06f3e3acb8a55cfd3c9"/><file name="aurore.png" hash="e2be3e130bd1212d9375a3bdb354cb78"/><file name="buyster.png" hash="8ec0f280dccd1c18c84cfbd368c6f579"/><file name="casino.png" hash="ce5b159bc98c7f71e8149e1d8b256dbd"/><file name="cb.png" hash="a5d9178bc831cbc78238dff27f79a48b"/><file name="cofinoga.png" hash="1dd7025dd22ac998aa968b38693a6a71"/><file name="cyrillus.png" hash="f762ad007f552bf409f5baa610f6746a"/><file name="default.png" hash="26c2dff177e1f8a94994352f6a7cec88"/><file name="diners.png" hash="6c907b8f0233b035ec4c27c2e9542406"/><file name="elv.png" hash="d0bd93c59ef64709b9a5cd81ff557e28"/><file name="fnac.png" hash="c0a7aa595b18fb52105d9337fda3eb1c"/><file name="ideal.png" hash="e0594aed23073daab150d8288a81103c"/><file name="internetplus.png" hash="fe1bc34531cfd6fd3dab6a6614e7ca3f"/><file name="jcb.png" hash="9801aeed2550ffccbdc3fe88b5292a60"/><file name="kangourou.png" hash="5fac97aa8f70380ec3b601ff32fdc012"/><file name="leetchi.png" hash="ecf6612b0228b889c723498f476c4309"/><file name="maestro.png" hash="19d331ae4783d590dba694cbcbb26da9"/><file name="mandarine.png" hash="745a8999468f60753c9c51a0052c527a"/><file name="mastercard.png" hash="cb7aa4a6f3870145295c4ce16a602d1e"/><file name="maxicheque.png" hash="fc3e2988c9944467fc8d4e44b4118a32"/><file name="mcvisa.png" hash="ba6349155be595d6da5ee584241c2946"/><file name="moneo.png" hash="283cf98332a5c05521229282875a158d"/><file name="neosurf.png" hash="9a747833ce3d9cbb3c26d4a11d7e4b4b"/><file name="okshopping.png" hash="8498bd45cf87124d12c4bfbf81272f14"/><file name="pass.png" hash="adb923e16cd9419960a51d0d41f26f97"/><file name="passvisa.png" hash="bd88d99714e9a3ba5000f881a0289f58"/><file name="payfair.png" hash="82f5dc87ea6f43f386b0e4887f33e5e8"/><file name="paypal.png" hash="2e9a634ffb111e1ce20b5e9017a35b29"/><file name="paysafecard.png" hash="a6776e5140ad443596587e3de12cd6a2"/><file name="printemps.png" hash="072cde23d8600c39457cf02a983b6d7f"/><file name="privilege.png" hash="883c70c0ce1c5bac23865397b0b63c5c"/><file name="skrill.png" hash="5d77ac7b63309a8691c27628aad9f60a"/><file name="sofinco.png" hash="93081c5cb7ce8ba216bbc42019cde8d3"/><file name="surcouf.png" hash="d8633f7d4b47460faac4e8657ce42f4d"/><file name="switch.png" hash="e2924bb36ad3de3d3ee61fa4dc3ffa8b"/><file name="ticketpremium.png" hash="5146987c213691e20a5461d7eed59f09"/><file name="ticketsurf.png" hash="bcd9aeb8b2784ea6a06e80cc2b2393ec"/><file name="visa.png" hash="bd8890f0147d451bf1a488d4e268332c"/><file name="wexpay.png" hash="1f3bb2ec092f283a8b27c66e2c32f22f"/></dir><file name="payline-logo.png" hash="553b387e92d95aef92a35f332e75cac4"/><file name="ae.gif" hash="bac424b0cfaa43bdba4d8d8425878159"/><file name="amex.gif" hash="bac424b0cfaa43bdba4d8d8425878159"/><file name="cb.gif" hash="4ced25b94a1720cb786cdff1debc1535"/><file name="mastercard.gif" hash="c2b21baeafcb69c8e6bef8b3f0aa550c"/><file name="mc.gif" hash="c2b21baeafcb69c8e6bef8b3f0aa550c"/><file name="payline-logo.png" hash="553b387e92d95aef92a35f332e75cac4"/><file name="vi.gif" hash="639ee8e26a7f7c4dfefb3bfbbcefbdd2"/><file name="visa.gif" hash="639ee8e26a7f7c4dfefb3bfbbcefbdd2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="0488c4cfab8321f91ec7a9adaf482837"/></dir><dir name="template"><dir name="payline"><file name="contracts.phtml" hash="6d398a529e799880533d954f53f6df96"/><dir name="customer"><dir name="tab"><file name="view.phtml" hash="1c3d9c842c802967bc867ff2be008504"/></dir></dir><dir name="payment"><dir name="info"><file name="monext.phtml" hash="6daa4bb0bc10c81fcf2a099dd789903d"/></dir></dir><file name="switcher.phtml" hash="ced863f3f520e271497c0a6bcc4b38e4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="7ec509d128fc9e459dd2bc0134500e2e"/></dir><dir name="template"><dir name="payline"><file name="Cpt.phtml" hash="d5a78eb6488ad0985a4fd62bd10e05e3"/><file name="Direct.phtml" hash="714ea31d44c8b6b25246fd97783aaad0"/><file name="Payline.phtml" hash="dc264172e5a6c5ae627b697208dff65d"/><dir name="checkout"><dir name="onepage"><file name="addjs.phtml" hash="8baee7d7d804635a6062bbb41ad4f162"/><dir name="info"><file name="default.phtml" hash="4689f891bab252ff10bb789d37e9bc2b"/></dir><dir name="payment"><file name="methods.phtml" hash="1194131c240a1154e8d0cf1c95a1e74e"/></dir><file name="shipping-method.phtml" hash="a81a9f308f15008842bfd9ba69852aa9"/></dir><file name="onepage.phtml" hash="5f159dfc756fce0ee5f80a211ae4136d"/><file name="total.phtml" hash="24170fbb2b43da6fc3d4a51db4b80d7a"/></dir><file name="iframe.phtml" hash="4a841413fa569be79b31464fc8f9a88a"/><file name="iframeleaver.phtml" hash="b617751653aa68ada738385a3959e863"/><file name="logo.phtml" hash="b850cc0f8b99d4486dedebc7c913d363"/><dir name="page"><file name="empty.phtml" hash="02134361869217c7445f46af028a050a"/></dir><dir name="payment"><dir name="info"><file name="monext.phtml" hash="ce3c565c9cdae42debacb267e2c9a9ea"/></dir></dir><dir name="wallet"><file name="checkoutbtn.phtml" hash="612617f342e05a34f6a2a618e3bf9162"/><file name="details.phtml" hash="b8d7e336b994261f66f1a9af5841661e"/><file name="form.phtml" hash="7358f21e31266c65982afb15239e659f"/><file name="manage.phtml" hash="994c98abd9b4f2f68f76eefe20c637d1"/><dir name="sidebar"><file name="form.phtml" hash="b7662b515f5195faada2736cf38b01aa"/><file name="notlogged.phtml" hash="169ccfe11034a47c74a9a78e0eac6046"/></dir><file name="sidebar.phtml" hash="2113b8dba864cd94b241dc7ecd6dff0a"/><file name="subscribe.phtml" hash="a737e95240e262e91ec01a02e2ce97a2"/><file name="update.phtml" hash="1b7048c9a839b0b0994beaf5e72b755c"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Monext_Payline.csv" hash="b972d5544df49c367f96e7fecc2ec3eb"/></dir><dir name="fr_FR"><file name="Monext_Payline.csv" hash="f32aeede40718e91cc4ff927f05f93e1"/></dir></target><target name="mageetc"><dir name="modules"><file name="Monext_Payline.xml" hash="d6ff98113ab17d2b19ee89d7a80cf7e9"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payline</name>
4
+ <version>1.7.9.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Paiement s&#xE9;curis&#xE9; via Payline, par Monext.</summary>
10
+ <description>Profitez d&#xE8;s &#xE0; pr&#xE9;sent de l'essor du march&#xE9; de la vente &#xE0; distance en proposant &#xE0; vos clients une solution de paiement totalement s&#xE9;curis&#xE9;e. Gr&#xE2;ce &#xE0; Payline vous permettez &#xE0; vos clients de r&#xE9;gler avec leur moyen de paiement habituel, quel que soit votre canal de vente. Vous leur proposez une interface de paiement facile &#xE0; utiliser, en mesure de vous accompagner dans votre d&#xE9;veloppement &#xE0; l'international, en toute simplicit&#xE9;.&#xD;
11
  &#xD;
12
  Fonctionnalit&#xE9;s : autorisation, autorisation + validation, paiement en n fois, paiement par portefeuille et en 1 clic, validation et remboursement partiels, multi-boutique...</description>
13
+ <notes>Am&#xE9;lioration des performances globales du module et mise en place d'URLs s&#xE9;curis&#xE9;es pour toutes les pages de callback de l'API Payline.</notes>
14
+ <authors><author><name>Payline</name><user>Payline</user><email>support@payline.com</email></author><author><name>Monsieur Biz</name><user>monsieurbiz</user><email>contact@monsieurbiz.com</email></author></authors>
15
+ <date>2014-04-24</date>
16
+ <time>16:35:50</time>
17
+ <contents><target name="magecommunity"><dir name="Monext"><dir name="Payline"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><file name="Grid.php" hash="13b7c449e07ef729fbac8caa708decd1"/></dir><dir name="Managecontracts"><dir name="Edit"><file name="Form.php" hash="05040427f41fb110db974ff5a3eb6ba9"/></dir><file name="Edit.php" hash="38292b1b746b401ee60bb7742885e045"/><file name="Grid.php" hash="de14d88f9c299895168e5d1a214e267f"/></dir><file name="Managecontracts.php" hash="343434dde00ba5d5ba35ed255c44a98e"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Items.php" hash="c7cd82866d8788ff32d42df8fcdc11f8"/></dir></dir><dir name="Total"><file name="Nxfees.php" hash="cd28c26f717481421bfab12c55ab5378"/></dir></dir></dir></dir><dir name="Checkout"><file name="Total.php" hash="df9fd2acea6ca2be213bfd5e335cedd6"/></dir><file name="Cpt.php" hash="dc2d6ea751fd4cdb3b0bc7398e3325e6"/><file name="Direct.php" hash="eb13793e246d22a0df6d412870ff2cf1"/><dir name="Info"><file name="Default.php" hash="028809c8e83cd97df32d3fe15833e609"/><file name="Direct.php" hash="f3a87e79429f581e2c896cc99f169aed"/></dir><file name="Logo.php" hash="2b7784f040f04489448fbc13b05ffe74"/><file name="Nx.php" hash="e4fd920c944abe9963f76e111e90ba48"/><dir name="Wallet"><file name="Checkoutbtn.php" hash="bbd8b30f2a37e83ce295295f0fe10ebf"/><file name="Details.php" hash="03cb96bd76d2265b842677b2a6825303"/><file name="Infos.php" hash="ae673ceafb630efbf0308657f766a816"/><file name="Sidebar.php" hash="db70b60be9aa20316f91b3fa3a23a2b9"/></dir><file name="Wallet.php" hash="6326c9e76c84777597f30a89d718ccb4"/></dir><dir name="Helper"><file name="Data.php" hash="728992ec9af790da602315b15c180611"/><file name="Logger.php" hash="6b7cf036fdf2e6df2cb7fa645c8912b9"/></dir><dir name="Model"><dir name="Contract"><file name="Status.php" hash="8008f1c37b76489b00fb8af1c8ac5380"/></dir><file name="Contract.php" hash="41066e691fbe94ae19e4aa54bda67415"/><file name="Cpt.php" hash="72c0674c310b4e8f726a94d3d1d80e33"/><dir name="Datasource"><file name="Actions.php" hash="2152344a8bd5fbf7dbe711c58f97356c"/><file name="Billingcycles.php" hash="bef244e6d9e744fbbc3afed9cc2050f9"/><file name="Billingoccurrences.php" hash="581ce23ec626ed71791b13c7b11fe6db"/><file name="Capturepaymentoptions.php" hash="466fa40f3dbee7274b04835437718eb5"/><dir name="Cms"><file name="Block.php" hash="eee43f517c9e29e51f0ca21fdc7b74ed"/></dir><file name="Costs.php" hash="ac09cf06fbe9a1fabddb2a4727dd696f"/><file name="Languages.php" hash="17053eec4880c5c5b1f233a3ca9f0bda"/><file name="Paymentactions.php" hash="6c4aae3b1b4e8b987a4da7393a3a92eb"/><file name="Paymentactionsreauth.php" hash="ef87674b1742240f9c2af17eb38fd994"/><file name="Return.php" hash="d8fac75b41a931a4714ed8acf846d9a2"/><file name="Securitymodes.php" hash="06c55b65e9254d96fa87595322839932"/><file name="Shippingmethods.php" hash="1c67f2af87583aae049c86cb4dcdf881"/><dir name="Status"><file name="Canceled.php" hash="c4e799efcb052536081339520c7b72c2"/><file name="Invoice.php" hash="31e818802c4419c81014dd1eafb0e587"/></dir><file name="Status.php" hash="bfbad8f0b150e92b15b8f623a2600b88"/><file name="Statusrowempty.php" hash="7865774f631fb8ffa6032aea1357a8cd"/></dir><file name="Direct.php" hash="d7bde5b06b400fb9362a527d556287c2"/><file name="Fees.php" hash="1e731ffbe45788596eb0f012c6697e21"/><dir name="Mysql4"><dir name="Contract"><file name="Collection.php" hash="7d71121cac131f11dc012375b4412d85"/><dir name="Status"><file name="Collection.php" hash="5703c017983d2511eb59db6a885f6aff"/></dir><file name="Status.php" hash="cee6aed4558ed7ee6acc393e5ac68918"/></dir><file name="Contract.php" hash="9d9befb9c0dfbf0ba702a7891106d5d4"/><dir name="Fees"><file name="Collection.php" hash="b00bb0ec3e0a75a2435f6c55d3eea02c"/></dir><file name="Fees.php" hash="fc1cec62290ea241844efd042d9db8da"/></dir><file name="Nx.php" hash="830433cc06e92665fd554fe0030070f0"/><file name="Observer.php" hash="d74fc87d32d049d98cf1daa9f6ee8ab2"/><dir name="Order"><file name="Invoice.php" hash="d11ecac46707a700ad829d2bcc74d961"/><file name="Payment.php" hash="e4c855ea48cd1044ec53c8c5d34b3c99"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="f0cb886cd65e23ec397e651d7913ea9e"/></dir></dir></dir><dir name="Total"><dir name="Nx"><file name="Invoice.php" hash="6ead6df53b6169709797d6c08cd4d16c"/><file name="Quote.php" hash="e48fd38a9d41a339d367137c2fa1e4d7"/></dir></dir><file name="Wallet.php" hash="91b56a80949971c7bb6e1388ada10ebe"/></dir><dir name="PaylinePHPKit"><dir name="configuration"><file name="HighDefinition.ini" hash="689dc8f1ba03e0c04ae6a8758df38f1b"/></dir><dir name="lib"><file name="Payline.wsdl" hash="b22b4ddfb2751c886e25d7202731c686"/><file name="jIniFileModifier.php" hash="f7d309bd1fb8f408528151b0555b188c"/><file name="lib_debug.php" hash="95068167e94fd376f0489709ebaa4cb0"/><file name="paylineSDK.php" hash="c09ce4a4363e8c4c9055fea174023912"/></dir><dir name="logs"><file name="2014-04-12.log" hash="a9200f939eee345b23b5b9acbff03a33"/><file name="2014-04-13.log" hash="29a230c53f297c97fc1beaee6508db26"/><file name="2014-04-15.log" hash="ced50e0097a970c6e072b97749e6d47f"/><file name="2014-04-22.log" hash="dff5884d03e6e3272fd6eb13c399d2ef"/><file name="remove.me" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Payline"><file name="ManagecontractsController.php" hash="068568622f140713527ee3229bdaf187"/></dir></dir><file name="CheckoutonepageController.php" hash="77772924163d5b5a2bc90f1b1ead6020"/><file name="IndexController.php" hash="84de82d8fcc6a4fb013b1aa46cf41835"/><file name="UnloggedwalletController.php" hash="90af5be8a8fa8dd1b2e29a442c0b7aab"/><file name="WalletController.php" hash="b6b77a5e4979ed582959f07a913be481"/></dir><dir name="etc"><file name="config.xml" hash="4ee785b7842c8cb401b0d4ab3d1bf149"/><file name="system.xml" hash="b49e20cd60249cf8396f940d91fbbc28"/></dir><dir name="sql"><dir name="payline_setup"><file name="mysql4-install-1.6.0.php" hash="ed5013f743ba36a7b2884fc432f97e16"/><file name="mysql4-upgrade-1.7.2-1.7.3.php" hash="7eeb0f5cfc6c379d8300428a5ec39c46"/><file name="mysql4-upgrade-1.7.5-1.7.6.php" hash="0ebfd38e90a8139c67087fc1e16f1aba"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payline.css" hash="414432db8dc1d0682f4988917bd8dd6f"/></dir><dir name="images"><dir name="payline_moyens_paiement"><file name="1euro.png" hash="8d5e4917497ba61120090e166014886d"/><file name="3xcb.png" hash="c76c834e238d3a8e3b3b4a2c116f189c"/><file name="amex.png" hash="a47d6bfc7eb4e06f3e3acb8a55cfd3c9"/><file name="amexoneclick.png" hash="a47d6bfc7eb4e06f3e3acb8a55cfd3c9"/><file name="aurore.png" hash="e2be3e130bd1212d9375a3bdb354cb78"/><file name="buyster.png" hash="8ec0f280dccd1c18c84cfbd368c6f579"/><file name="casino.png" hash="ce5b159bc98c7f71e8149e1d8b256dbd"/><file name="cb.png" hash="a5d9178bc831cbc78238dff27f79a48b"/><file name="cofinoga.png" hash="1dd7025dd22ac998aa968b38693a6a71"/><file name="cyrillus.png" hash="f762ad007f552bf409f5baa610f6746a"/><file name="default.png" hash="26c2dff177e1f8a94994352f6a7cec88"/><file name="diners.png" hash="6c907b8f0233b035ec4c27c2e9542406"/><file name="elv.png" hash="d0bd93c59ef64709b9a5cd81ff557e28"/><file name="fnac.png" hash="c0a7aa595b18fb52105d9337fda3eb1c"/><file name="ideal.png" hash="e0594aed23073daab150d8288a81103c"/><file name="internetplus.png" hash="fe1bc34531cfd6fd3dab6a6614e7ca3f"/><file name="jcb.png" hash="9801aeed2550ffccbdc3fe88b5292a60"/><file name="kangourou.png" hash="5fac97aa8f70380ec3b601ff32fdc012"/><file name="leetchi.png" hash="ecf6612b0228b889c723498f476c4309"/><file name="maestro.png" hash="19d331ae4783d590dba694cbcbb26da9"/><file name="mandarine.png" hash="745a8999468f60753c9c51a0052c527a"/><file name="mastercard.png" hash="cb7aa4a6f3870145295c4ce16a602d1e"/><file name="maxicheque.png" hash="fc3e2988c9944467fc8d4e44b4118a32"/><file name="mcvisa.png" hash="ba6349155be595d6da5ee584241c2946"/><file name="moneo.png" hash="283cf98332a5c05521229282875a158d"/><file name="neosurf.png" hash="9a747833ce3d9cbb3c26d4a11d7e4b4b"/><file name="okshopping.png" hash="8498bd45cf87124d12c4bfbf81272f14"/><file name="pass.png" hash="adb923e16cd9419960a51d0d41f26f97"/><file name="passvisa.png" hash="bd88d99714e9a3ba5000f881a0289f58"/><file name="payfair.png" hash="82f5dc87ea6f43f386b0e4887f33e5e8"/><file name="paypal.png" hash="2e9a634ffb111e1ce20b5e9017a35b29"/><file name="paysafecard.png" hash="a6776e5140ad443596587e3de12cd6a2"/><file name="printemps.png" hash="072cde23d8600c39457cf02a983b6d7f"/><file name="privilege.png" hash="883c70c0ce1c5bac23865397b0b63c5c"/><file name="skrill.png" hash="5d77ac7b63309a8691c27628aad9f60a"/><file name="sofinco.png" hash="93081c5cb7ce8ba216bbc42019cde8d3"/><file name="surcouf.png" hash="d8633f7d4b47460faac4e8657ce42f4d"/><file name="switch.png" hash="e2924bb36ad3de3d3ee61fa4dc3ffa8b"/><file name="ticketpremium.png" hash="5146987c213691e20a5461d7eed59f09"/><file name="ticketsurf.png" hash="bcd9aeb8b2784ea6a06e80cc2b2393ec"/><file name="visa.png" hash="bd8890f0147d451bf1a488d4e268332c"/><file name="wexpay.png" hash="1f3bb2ec092f283a8b27c66e2c32f22f"/></dir><file name="payline-logo.png" hash="553b387e92d95aef92a35f332e75cac4"/><file name="ae.gif" hash="bac424b0cfaa43bdba4d8d8425878159"/><file name="amex.gif" hash="bac424b0cfaa43bdba4d8d8425878159"/><file name="cb.gif" hash="4ced25b94a1720cb786cdff1debc1535"/><file name="mastercard.gif" hash="c2b21baeafcb69c8e6bef8b3f0aa550c"/><file name="mc.gif" hash="c2b21baeafcb69c8e6bef8b3f0aa550c"/><file name="vi.gif" hash="639ee8e26a7f7c4dfefb3bfbbcefbdd2"/><file name="visa.gif" hash="639ee8e26a7f7c4dfefb3bfbbcefbdd2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="de4d50873a65f710e25620b16bb5b10b"/></dir><dir name="template"><dir name="payline"><file name="contracts.phtml" hash="6d398a529e799880533d954f53f6df96"/><dir name="customer"><dir name="tab"><file name="view.phtml" hash="1c3d9c842c802967bc867ff2be008504"/></dir></dir><dir name="payment"><dir name="info"><file name="monext.phtml" hash="6daa4bb0bc10c81fcf2a099dd789903d"/></dir></dir><file name="switcher.phtml" hash="ced863f3f520e271497c0a6bcc4b38e4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="payline.xml" hash="7ec509d128fc9e459dd2bc0134500e2e"/></dir><dir name="template"><dir name="payline"><file name="Cpt.phtml" hash="d5a78eb6488ad0985a4fd62bd10e05e3"/><file name="Direct.phtml" hash="714ea31d44c8b6b25246fd97783aaad0"/><file name="Payline.phtml" hash="dc264172e5a6c5ae627b697208dff65d"/><dir name="checkout"><dir name="onepage"><file name="addjs.phtml" hash="8baee7d7d804635a6062bbb41ad4f162"/><dir name="info"><file name="default.phtml" hash="4689f891bab252ff10bb789d37e9bc2b"/></dir><dir name="payment"><file name="methods.phtml" hash="1194131c240a1154e8d0cf1c95a1e74e"/></dir><file name="shipping-method.phtml" hash="a81a9f308f15008842bfd9ba69852aa9"/></dir><file name="onepage.phtml" hash="5f159dfc756fce0ee5f80a211ae4136d"/><file name="total.phtml" hash="24170fbb2b43da6fc3d4a51db4b80d7a"/></dir><file name="iframe.phtml" hash="4a841413fa569be79b31464fc8f9a88a"/><file name="iframeleaver.phtml" hash="b617751653aa68ada738385a3959e863"/><file name="logo.phtml" hash="b850cc0f8b99d4486dedebc7c913d363"/><dir name="page"><file name="empty.phtml" hash="02134361869217c7445f46af028a050a"/></dir><dir name="payment"><dir name="info"><file name="monext.phtml" hash="ce3c565c9cdae42debacb267e2c9a9ea"/></dir></dir><dir name="wallet"><file name="checkoutbtn.phtml" hash="612617f342e05a34f6a2a618e3bf9162"/><file name="details.phtml" hash="b8d7e336b994261f66f1a9af5841661e"/><file name="form.phtml" hash="7358f21e31266c65982afb15239e659f"/><file name="manage.phtml" hash="e3ac544b3248e86b26e9afd7058406c2"/><dir name="sidebar"><file name="form.phtml" hash="e5454c273aafc3fe80bcc3bd1331c8ab"/><file name="notlogged.phtml" hash="962b06945f1297fd6eda93f2794b5d6a"/></dir><file name="sidebar.phtml" hash="2113b8dba864cd94b241dc7ecd6dff0a"/><file name="subscribe.phtml" hash="a737e95240e262e91ec01a02e2ce97a2"/><file name="update.phtml" hash="1b7048c9a839b0b0994beaf5e72b755c"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Monext_Payline.csv" hash="b972d5544df49c367f96e7fecc2ec3eb"/></dir><dir name="fr_FR"><file name="Monext_Payline.csv" hash="f32aeede40718e91cc4ff927f05f93e1"/></dir></target><target name="mageetc"><dir name="modules"><file name="Monext_Payline.xml" hash="c6bef273efdf832b90a5924c2cfb568e"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>