CDev_XPaymentsConnector - Version 1.7.1

Version Notes

What's new?

- Invoice for payment made using a saved credit card is now created automatically.

- X-Payments Connector settings page moved to admin controller. Potential 404 error fixed.

- Auto-detect of API version added. Test connection button removed, so connection between Magento store and X-Payments is tested automatically.

- Fixed issue with product attributes being reset after a product is added to the cart.

- Corrected recurring profiles creation. Fixed several issues with Recurring profiles and nominal items.

- "Allowed IP address" for X-Payments callback handling improved.

- Improved customer registration at checkout for OneStepCheckout module by Idev.

- Corrected password setting during customer registration at checkout.

- Corrected saving credit cards at customer profile.

- "My payment cards" section is now removed correctly if "Use saved card" payment method is not active.

- Compatibility with SUPEE-8788 vulnerability

- NoFraud service support added

- other minor bug-fixes and improvements in code and corrections to text labels.

Download this release

Release Info

Developer Alexander Mulin
Extension CDev_XPaymentsConnector
Version 1.7.1
Comparing to
See all releases


Code changes from version 1.7.0 to 1.7.1

Files changed (29) hide show
  1. app/code/community/Cdev/XPaymentsConnector/Block/{Control.php → Adminhtml/Settings/Xpc.php} +75 -42
  2. app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Orderdetail.php +4 -1
  3. app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Success.php +20 -0
  4. app/code/community/Cdev/XPaymentsConnector/Helper/Data.php +255 -205
  5. app/code/community/Cdev/XPaymentsConnector/Model/Fraudcheckdata.php +99 -0
  6. app/code/community/Cdev/XPaymentsConnector/{Block/Customer/Account/Navigation.php → Model/Mysql4/Fraudcheckdata.php} +14 -19
  7. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Fraudcheckdata/Collection.php +41 -0
  8. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Quote/Xpcdata.php +42 -0
  9. app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Quote/Xpcdata/Collection.php +37 -0
  10. app/code/community/Cdev/XPaymentsConnector/Model/Observer.php +7 -13
  11. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Cc.php +147 -124
  12. app/code/community/Cdev/XPaymentsConnector/Model/Payment/Savedcards.php +1 -1
  13. app/code/community/Cdev/XPaymentsConnector/Model/Quote/Xpcdata.php +56 -0
  14. app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/Sales/Order/FraudController.php +2 -1
  15. app/code/community/Cdev/XPaymentsConnector/controllers/{ControlController.php → Adminhtml/Settings/XpcController.php} +43 -32
  16. app/code/community/Cdev/XPaymentsConnector/controllers/ProcessingController.php +184 -103
  17. app/code/community/Cdev/XPaymentsConnector/etc/adminhtml.xml +5 -5
  18. app/code/community/Cdev/XPaymentsConnector/etc/config.xml +109 -107
  19. app/code/community/Cdev/XPaymentsConnector/etc/system.xml +9 -2
  20. app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.2-1.1.3.php +68 -0
  21. app/design/adminhtml/default/default/layout/xpaymentsconnector.xml +3 -3
  22. app/design/adminhtml/default/default/template/xpaymentsconnector/control.phtml +0 -212
  23. app/design/adminhtml/default/default/template/xpaymentsconnector/order/view/tab/xporderstate.phtml +94 -1
  24. app/design/adminhtml/default/default/template/xpaymentsconnector/settings/xpc.phtml +179 -0
  25. app/design/frontend/base/default/layout/xpaymentsconnector.xml +1 -1
  26. app/design/frontend/base/default/template/xpaymentsconnector/checkout/success.phtml +14 -4
  27. app/design/frontend/base/default/template/xpaymentsconnector/info/cc.phtml +1 -1
  28. js/xpayment/{xp-contorl.css → settings-xpc.css} +27 -1
  29. package.xml +23 -11
app/code/community/Cdev/XPaymentsConnector/Block/{Control.php → Adminhtml/Settings/Xpc.php} RENAMED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -20,13 +21,13 @@
20
  */
21
 
22
  /**
23
- * X-Payments connector control page block
24
  *
25
  * @package Cdev_XPaymentsConnector
26
  * @see ____class_see____
27
  * @since 1.0.0
28
  */
29
- class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Template
30
  {
31
  /**
32
  * @var array
@@ -37,40 +38,22 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
37
  * Constructor
38
  *
39
  * @return void
40
- * @access public
41
- * @see ____func_see____
42
- * @since 1.0.0
43
  */
44
  public function __construct()
45
  {
46
  parent::__construct();
47
- $this->setTemplate('xpaymentsconnector/control.phtml');
48
  }
49
 
50
  /**
51
  * Prepare layout
52
  *
53
  * @return void
54
- * @access protected
55
- * @see ____func_see____
56
- * @since 1.0.0
57
  */
58
  protected function _prepareLayout()
59
  {
60
  parent::_prepareLayout();
61
 
62
- $this->setChild(
63
- 'testButton',
64
- $this->getLayout()->createBlock('adminhtml/widget_button')
65
- ->setData(
66
- array(
67
- 'type' => 'submit',
68
- 'label' => Mage::helper('adminhtml')->__('Test module'),
69
- 'class' => 'task'
70
- )
71
- )
72
- );
73
-
74
  $this->setChild(
75
  'requestButton',
76
  $this->getLayout()->createBlock('adminhtml/widget_button')
@@ -94,17 +77,12 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
94
  )
95
  )
96
  );
97
-
98
-
99
  }
100
 
101
  /**
102
  * Check - payment configuration is requested or not
103
  *
104
  * @return boolean
105
- * @access public
106
- * @see ____func_see____
107
- * @since 1.0.0
108
  */
109
  public function isMethodsRequested()
110
  {
@@ -115,27 +93,22 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
115
  * Get requested payment configurations
116
  *
117
  * @return array
118
- * @access public
119
- * @see ____func_see____
120
- * @since 1.0.0
121
  */
122
  public function getPaymentMethods()
123
  {
124
  $list = Mage::getModel('xpaymentsconnector/paymentconfiguration')->getCollection();
125
 
126
- return ($list && count($list)) ? $list : array();
127
  }
128
 
129
  /**
130
- * Check - is payment configurations is already imported into DB or not
131
  *
132
  * @return boolean
133
- * @access public
134
- * @see ____func_see____
135
- * @since 1.0.0
136
  */
137
  public function isMethodsAlreadyImported()
138
  {
 
139
  return 0 < count($this->getPaymentMethods());
140
  }
141
 
@@ -143,9 +116,6 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
143
  * Get system requiremenets errors list
144
  *
145
  * @return array
146
- * @access public
147
- * @see ____func_see____
148
- * @since 1.0.0
149
  */
150
  public function getRequiremenetsErrors()
151
  {
@@ -173,13 +143,10 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
173
  * Get module configuration errors list
174
  *
175
  * @return array
176
- * @access public
177
- * @see ____func_see____
178
- * @since 1.0.0
179
  */
180
  public function getConfigurationErrors()
181
  {
182
- if(empty($this->_configurationErrorList)){
183
  $api = Mage::getModel('xpaymentsconnector/payment_cc');
184
 
185
  $result = $api->getConfigurationErrors();
@@ -212,5 +179,71 @@ class Cdev_XPaymentsConnector_Block_Control extends Mage_Adminhtml_Block_Templat
212
  return $this->_configurationErrorList;
213
  }
214
 
215
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
21
  */
22
 
23
  /**
24
+ * X-Payments Connector settings page block
25
  *
26
  * @package Cdev_XPaymentsConnector
27
  * @see ____class_see____
28
  * @since 1.0.0
29
  */
30
+ class Cdev_XPaymentsConnector_Block_Adminhtml_Settings_Xpc extends Mage_Adminhtml_Block_Template
31
  {
32
  /**
33
  * @var array
38
  * Constructor
39
  *
40
  * @return void
 
 
 
41
  */
42
  public function __construct()
43
  {
44
  parent::__construct();
45
+ $this->setTemplate('xpaymentsconnector/settings/xpc.phtml');
46
  }
47
 
48
  /**
49
  * Prepare layout
50
  *
51
  * @return void
 
 
 
52
  */
53
  protected function _prepareLayout()
54
  {
55
  parent::_prepareLayout();
56
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  $this->setChild(
58
  'requestButton',
59
  $this->getLayout()->createBlock('adminhtml/widget_button')
77
  )
78
  )
79
  );
 
 
80
  }
81
 
82
  /**
83
  * Check - payment configuration is requested or not
84
  *
85
  * @return boolean
 
 
 
86
  */
87
  public function isMethodsRequested()
88
  {
93
  * Get requested payment configurations
94
  *
95
  * @return array
 
 
 
96
  */
97
  public function getPaymentMethods()
98
  {
99
  $list = Mage::getModel('xpaymentsconnector/paymentconfiguration')->getCollection();
100
 
101
+ return !empty($list) ? $list : array();
102
  }
103
 
104
  /**
105
+ * Check - is payment configurations are already imported into DB or not
106
  *
107
  * @return boolean
 
 
 
108
  */
109
  public function isMethodsAlreadyImported()
110
  {
111
+ // TODO: Same as isMethodsRequested()
112
  return 0 < count($this->getPaymentMethods());
113
  }
114
 
116
  * Get system requiremenets errors list
117
  *
118
  * @return array
 
 
 
119
  */
120
  public function getRequiremenetsErrors()
121
  {
143
  * Get module configuration errors list
144
  *
145
  * @return array
 
 
 
146
  */
147
  public function getConfigurationErrors()
148
  {
149
+ if (empty($this->_configurationErrorList)) {
150
  $api = Mage::getModel('xpaymentsconnector/payment_cc');
151
 
152
  $result = $api->getConfigurationErrors();
179
  return $this->_configurationErrorList;
180
  }
181
 
182
+ /**
183
+ * Get System/X-Payments connector link
184
+ *
185
+ * @return string
186
+ */
187
+ public function getSystemConfigXpcUrl()
188
+ {
189
+ return $this->getUrl('adminhtml/system_config/edit/section/xpaymentsconnector/');
190
+ }
191
+
192
+ /**
193
+ * Get System/X-Payments connector link
194
+ *
195
+ * @return string
196
+ */
197
+ public function getTrialDemoUrl()
198
+ {
199
+ return 'http://www.x-payments.com/trial-demo.html?utm_source=mage_shop&utm_medium=link&utm_campaign=mage_shop_link';
200
+ }
201
+
202
+ /**
203
+ * Get User manual link
204
+ *
205
+ * @return string
206
+ */
207
+ public function getUserManualUrl()
208
+ {
209
+ return 'http://help.x-cart.com/index.php?title=X-Payments:User_manual#Online_Stores';
210
+ }
211
+
212
+ /**
213
+ * Get video link
214
+ *
215
+ * @return string
216
+ */
217
+ public function getVideoUrl()
218
+ {
219
+ return 'https://www.youtube.com/embed/2VRR0JW23qc';
220
+ }
221
 
222
+ /**
223
+ * Get Contact Us link
224
+ *
225
+ * @return string
226
+ */
227
+ public function getContactUsUrl()
228
+ {
229
+ return 'http://www.x-payments.com/contact-us.html?utm_source=mage_shop&utm_medium=link&utm_campaign=mage_shop_link';
230
+ }
231
+
232
+
233
+ /**
234
+ * Get description
235
+ *
236
+ * @return string
237
+ */
238
+ public function getDescription()
239
+ {
240
+ $description = 'Give your customers – and yourself – peace of mind with this payment processing module
241
+ that guarantees compliance with PCI security mandates, significantly reduces the risk of
242
+ data breaches and ensures you won’t be hit with a fine of up to $500,000 for non-compliance.
243
+ Safely and conveniently store customers credit card information to use for new orders, reorders
244
+ or recurring payments.';
245
+
246
+ return $this->__($description);
247
+ }
248
+
249
+ }
app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Orderdetail.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -58,7 +59,9 @@ class Cdev_XPaymentsConnector_Block_Checkout_Onepage_Orderdetail extends Mage_Co
58
 
59
  $product = $recQuoteItem->getProduct();
60
  $productAdditionalInfo = unserialize($product->getCustomOption('info_buyRequest')->getValue());
61
- $deferredDateStamp = strtotime($productAdditionalInfo['recurring_profile_start_datetime']);
 
 
62
  if($deferredDateStamp){
63
  $initialFeeMessage = $this->__(" (initial fee only, 1st recurring fee will be charged on %s)",date('d-M-Y',$deferredDateStamp));
64
  $rowTotal = $recQuoteItem->getXpRecurringInitialFee() + $recQuoteItem->getInitialfeeTaxAmount();
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
59
 
60
  $product = $recQuoteItem->getProduct();
61
  $productAdditionalInfo = unserialize($product->getCustomOption('info_buyRequest')->getValue());
62
+ $deferredDateStamp = isset($productAdditionalInfo['recurring_profile_start_datetime'])
63
+ ? strtotime($productAdditionalInfo['recurring_profile_start_datetime'])
64
+ : false;
65
  if($deferredDateStamp){
66
  $initialFeeMessage = $this->__(" (initial fee only, 1st recurring fee will be charged on %s)",date('d-M-Y',$deferredDateStamp));
67
  $rowTotal = $recQuoteItem->getXpRecurringInitialFee() + $recQuoteItem->getInitialfeeTaxAmount();
app/code/community/Cdev/XPaymentsConnector/Block/Checkout/Onepage/Success.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -87,4 +88,23 @@ class Cdev_XPaymentsConnector_Block_Checkout_Onepage_Success extends Mage_Checko
87
  }
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
88
  }
89
  }
90
 
91
+ /**
92
+ * Get recurring profiles
93
+ *
94
+ * @return array
95
+ */
96
+ public function getRecurringProfiles()
97
+ {
98
+ $order = Mage::getModel('sales/order')->load($this->getData('order_entity_id'));
99
+
100
+ $profile = Mage::helper('xpaymentsconnector')->getOrderRecurringProfile($order);
101
+
102
+ if ($profile) {
103
+ $profile = array($profile);
104
+ } else {
105
+ $profile = false;
106
+ }
107
+
108
+ return $profile;
109
+ }
110
  }
app/code/community/Cdev/XPaymentsConnector/Helper/Data.php CHANGED
@@ -34,7 +34,12 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
34
  const WEEK_TIME_STAMP = 604800;
35
  const SEMI_MONTH_TIME_STAMP = 1209600;
36
 
37
- const STATE_XPAYMENTS_PENDING_PAYMENT = 'xp_pending_payment';
 
 
 
 
 
38
 
39
  const XPAYMENTS_LOG_FILE = 'xpayments.log';
40
  const RECURRING_ORDER_TYPE = 'recurring';
@@ -323,15 +328,17 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
323
  */
324
  public function setPrepareOrderType()
325
  {
326
- $xpaymentPrepareOrder = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
327
- $result = $this->checkIssetRecurringOrder();
328
- if ($result['isset']) {
329
- $xpaymentPrepareOrder['type'] = self::RECURRING_ORDER_TYPE;
 
 
330
  } else {
331
- $xpaymentPrepareOrder['type'] = self::SIMPLE_ORDER_TYPE;
332
  }
333
 
334
- Mage::getSingleton('checkout/session')->setData('xpayment_prepare_order', $xpaymentPrepareOrder);
335
  }
336
 
337
  /**
@@ -701,47 +708,35 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
701
  $recurringProfile->save();
702
  }
703
 
704
- public function checkIssetRecurringOrder()
 
 
 
 
 
 
 
705
  {
706
- $checkoutSession = Mage::getSingleton('checkout/session');
707
- $quoteItems = $checkoutSession->getQuote()->getAllItems();
708
- $result = array();
709
 
710
- foreach ($quoteItems as $quoteItem) {
711
- if ($quoteItem) {
712
- $product = $quoteItem->getProduct();
713
- $issetRecurringOreder = (bool)$product->getIsRecurring();
714
- if ($issetRecurringOreder) {
715
- $result['isset'] = $issetRecurringOreder;
716
- $result['quote_item'] = $quoteItem;
717
- return $result;
718
- }
719
- }
720
  }
721
- $result['isset'] = false;
722
-
723
- return $result;
724
- }
725
 
726
- /**
727
- * @return bool
728
- */
729
- public function checkIssetSimpleOrder()
730
- {
731
- $checkoutSession = Mage::getSingleton('checkout/session');
732
- $quoteItems = $checkoutSession->getQuote()->getAllItems();
733
 
734
- foreach ($quoteItems as $quoteItem) {
735
- if ($quoteItem) {
736
- $product = $quoteItem->getProduct();
737
- $issetRecurringOreder = (bool)$product->getIsRecurring();
738
- if (!$issetRecurringOreder) {
739
- return true;
740
- }
 
741
  }
742
  }
743
 
744
- return false;
745
  }
746
 
747
  /**
@@ -754,7 +749,9 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
754
 
755
  $orderItemInfo = $recurringProfile->getData('order_item_info');
756
  $infoBuyRequest = unserialize($orderItemInfo['info_buyRequest']);
757
- $startDateTime = $infoBuyRequest['recurring_profile_start_datetime'];
 
 
758
  $xpaymentCCModel = Mage::getModel('xpaymentsconnector/payment_cc');
759
 
760
  if (!empty($startDateTime)) {
@@ -905,7 +902,9 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
905
  public function checkStartDateDataByProduct($product,$quoteItem = false)
906
  {
907
  $productAdditionalInfo = unserialize($product->getCustomOption('info_buyRequest')->getValue());
908
- $dateTimeStamp = strtotime($productAdditionalInfo['recurring_profile_start_datetime']);
 
 
909
 
910
  if ($dateTimeStamp) {
911
  $userSetTime = new Zend_Date($productAdditionalInfo['recurring_profile_start_datetime']);
@@ -963,20 +962,6 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
963
  Mage::getSingleton('checkout/session')->addNotice($this->getFailureCheckoutNoticeHelper());
964
  }
965
 
966
- public function setRecurringProductDiscount()
967
- {
968
- $quote = Mage::getSingleton('checkout/session')->getQuote();
969
- $items = $quote->getAllVisibleItems();
970
- foreach ($items as $item) {
971
- if($item->getIsNominal()){
972
- $discount = $item->getDiscountAmount();
973
- $profile = $item->getProduct()->getRecurringProfile();
974
- $profile['discount_amount'] = $discount;
975
- $item->getProduct()->setRecurringProfile($profile)->save();
976
- }
977
- }
978
- }
979
-
980
  /**
981
  * This function fixed magento bug. Magento can't create user
982
  * during checkout with recurring products.
@@ -1403,31 +1388,26 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1403
  *
1404
  * @return void
1405
  */
1406
- protected function prepareRequringItems(Mage_Sales_Model_Quote $quote, &$result)
1407
  {
1408
- $issetRecurringProduct = $this->checkIssetRecurringOrder();
1409
-
1410
- $quoteItem = $issetRecurringProduct['quote_item'];
1411
- $product = $quoteItem->getProduct();
1412
-
1413
- $item = $quote->getItemByProduct($product);
1414
-
1415
  $recurringProfile = $product->getRecurringProfile();
1416
 
1417
  $startDateParams = $this->checkStartDateDataByProduct($product, $item);
1418
  $startDateParams = $startDateParams[$product->getId()];
1419
 
1420
- $shipping = $issetRecurringProduct['quote_item']->getData('shipping_amount');
1421
- $discount = abs($issetRecurringProduct['quote_item']->getData('discount_amount'));
1422
 
1423
- $quantity = $quoteItem->getQty();
1424
 
1425
  if ($startDateParams['success']) {
1426
 
1427
  $minimalPayment = $startDateParams['minimal_payment_amount'];
1428
 
1429
  $tax = !empty($recurringProfile['init_amount'])
1430
- ? $quoteItem->getData('initialfee_tax_amount')
1431
  : 0;
1432
 
1433
  $totalCost = $minimalPayment + $tax + $shipping - $discount;
@@ -1436,15 +1416,15 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1436
 
1437
  $minimalPayment = 0;
1438
 
1439
- $tax = $quoteItem->getData('initialfee_tax_amount') + $quoteItem->getData('tax_amount');
1440
 
1441
- $totalCost = $quoteItem->getData('nominal_row_total');
1442
  }
1443
 
1444
  $recurringPrice = $product->getPrice();
1445
 
1446
  if (!empty($recurringProfile['init_amount'])) {
1447
- $recurringPrice += $quoteItem->getXpRecurringInitialFee() / $quantity;
1448
  }
1449
 
1450
  $price = $minimalPayment
@@ -1458,7 +1438,8 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1458
  'quantity' => intval($quantity),
1459
  );
1460
 
1461
- $result['totalCost'] = $this->preparePrice($totalCost);
 
1462
  $result['shippingCost'] = $this->preparePrice($shipping);
1463
  $result['taxCost'] = $this->preparePrice($tax);
1464
  $result['discount'] = $this->preparePrice($discount);
@@ -1474,11 +1455,9 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1474
  */
1475
  protected function prepareItems(Mage_Sales_Model_Quote $quote, &$result)
1476
  {
1477
- $issetSimpleProducts = $this->checkIssetSimpleOrder();
1478
- $issetRecurringProduct = $this->checkIssetRecurringOrder();
1479
-
1480
- if ($issetRecurringProduct['isset'] && !$issetSimpleProducts) {
1481
- $this->prepareRequringItems($quote, $result);
1482
  } else {
1483
  $this->prepareSimpleItems($quote, $result);
1484
  }
@@ -1633,6 +1612,40 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1633
  return $url;
1634
  }
1635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1636
  /**
1637
  * Get address data saved at checkout
1638
  *
@@ -1656,6 +1669,17 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1656
 
1657
  if (isset($data[$type])) {
1658
 
 
 
 
 
 
 
 
 
 
 
 
1659
  // Addrress data from checkout
1660
  $result += array_filter($data[$type]);
1661
  }
@@ -1664,110 +1688,34 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1664
  }
1665
 
1666
  /**
1667
- * Save checkout data
1668
- *
1669
- * @param Mage_Sales_Model_Quote $quote
1670
- * @param array $data Some checkout data
1671
- *
1672
- * @return void
1673
- */
1674
- public function saveCheckoutData($quote, $data)
1675
- {
1676
- $this->writeLog('Save checkout data for Quote #' . $quote->getEntityId(), $data);
1677
-
1678
- $data = serialize($data);
1679
- $quote->setData(self::CHECKOUT_DATA, $data);
1680
- $quote->save();
1681
- }
1682
-
1683
- /**
1684
- * Load data saved at checkou
1685
  *
1686
  * @param Mage_Sales_Model_Quote $quote
1687
- *
1688
- * @return array
1689
- */
1690
- public function loadCheckoutData(Mage_Sales_Model_Quote $quote)
1691
- {
1692
- return unserialize($quote->getData(self::CHECKOUT_DATA));
1693
- }
1694
-
1695
- /**
1696
- * Save some temporary X-Payments data to Quote
1697
- *
1698
- * @param Mage_Sales_Model_Quote $quote
1699
- * @param array $data Some data
1700
  *
1701
- * @return void
1702
  */
1703
- public function saveQuoteXpcData(Mage_Sales_Model_Quote $quote, $data = array())
1704
  {
1705
- $data = serialize($data);
1706
- $quote->setData(self::XPC_DATA, $data);
1707
- $quote->save();
1708
- }
1709
 
1710
- /**
1711
- * Clear temporary X-Payments data from Quote (just a wrapper)
1712
- *
1713
- * @param Mage_Sales_Model_Quote $quote
1714
- *
1715
- * @return void
1716
- */
1717
- public function clearQuoteXpcData(Mage_Sales_Model_Quote $quote)
1718
- {
1719
- return $this->saveQuoteXpcData($quote);
1720
- }
1721
-
1722
- /**
1723
- * Append some temporary X-Payments data to Quote
1724
- *
1725
- * @param Mage_Sales_Model_Quote $quote
1726
- * @param array $appendData Some data to append
1727
- *
1728
- * @return void
1729
- */
1730
- public function appendQuoteXpcData(Mage_Sales_Model_Quote $quote, $appendData = array())
1731
- {
1732
- $data = $this->loadQuoteXpcData($quote);
1733
-
1734
- $data += $appendData;
1735
-
1736
- $this->saveQuoteXpcData($quote, $data);
1737
- }
1738
-
1739
- /**
1740
- * Load temporary X-Payments data from Quote
1741
- *
1742
- * @param Mage_Sales_Model_Quote $quote
1743
- *
1744
- * @return array
1745
- */
1746
- public function loadQuoteXpcData(Mage_Sales_Model_Quote $quote)
1747
- {
1748
- $data = unserialize($quote->getData(self::XPC_DATA));
1749
-
1750
- if (!is_array($data)) {
1751
- $data = array();
1752
  }
1753
 
1754
- return $data;
1755
- }
 
 
 
1756
 
1757
- /**
1758
- * Get token from quote
1759
- *
1760
- * @param Mage_Sales_Model_Quote $quote
1761
- *
1762
- * @return string or false
1763
- */
1764
- public function getQuoteXpcDataToken(Mage_Sales_Model_Quote $quote)
1765
- {
1766
- $data = $this->loadQuoteXpcData($quote);
1767
 
1768
- return !empty($data['token'])
1769
- ? $data['token']
1770
- : false;
1771
  }
1772
 
1773
  /**
@@ -1780,7 +1728,7 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1780
  protected function processCheckoutData(Mage_Sales_Model_Quote $quote)
1781
  {
1782
  // Grab data saved at checkout
1783
- $data = $this->loadCheckoutData($quote);
1784
 
1785
  // Add billing address data from checkout
1786
  $quote->getBillingAddress()->addData($this->getCheckoutAddressData($data, 'billing'));
@@ -1842,36 +1790,67 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1842
  }
1843
 
1844
  /**
1845
- * Prepare quote for customer registration and customer order submit
 
 
1846
  *
1847
- * @return Mage_Checkout_Model_Type_Onepage
1848
  */
1849
  protected function createNewCustomer(Mage_Sales_Model_Quote $quote)
1850
  {
1851
- $billing = $quote->getBillingAddress();
1852
- $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
 
 
 
1853
 
1854
- //$customer = Mage::getModel('customer/customer');
1855
  $customer = $quote->getCustomer();
1856
- /* @var $customer Mage_Customer_Model_Customer */
1857
  $customerBilling = $billing->exportCustomerAddress();
1858
  $customer->addAddress($customerBilling);
1859
  $billing->setCustomerAddress($customerBilling);
1860
  $customerBilling->setIsDefaultBilling(true);
1861
- if ($shipping && !$shipping->getSameAsBilling()) {
 
 
 
 
 
1862
  $customerShipping = $shipping->exportCustomerAddress();
1863
  $customer->addAddress($customerShipping);
1864
  $shipping->setCustomerAddress($customerShipping);
1865
  $customerShipping->setIsDefaultShipping(true);
 
1866
  } else {
 
1867
  $customerBilling->setIsDefaultShipping(true);
1868
  }
1869
 
1870
  Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);
1871
- $customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1872
  $quote->setCustomer($customer)
1873
  ->setCustomerId(true);
1874
 
 
 
 
 
 
1875
  return $customer;
1876
  }
1877
 
@@ -1890,7 +1869,7 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1890
  if ($this->checkOscModuleEnabled()) {
1891
 
1892
  // For One Step Checkout module
1893
- $data = $this->loadCheckoutData($quote);
1894
 
1895
  $result = isset($data['create_account'])
1896
  && (bool)$data['create_account'];
@@ -1898,7 +1877,7 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1898
  } elseif ($this->checkFirecheckoutModuleEnabled()) {
1899
 
1900
  // For Firecheckout module
1901
- $data = $this->loadCheckoutData($quote);
1902
 
1903
  $result = isset($data['billing']['register_account'])
1904
  && (bool)$data['billing']['register_account'];
@@ -1933,11 +1912,12 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1933
 
1934
  if ($this->isCreateNewCustomer($quote)) {
1935
 
1936
- // Prepare data for customer who's registered at checkout
1937
- $customer = $this->createNewCustomer($quote);
1938
- $customer->save();
1939
 
1940
- $this->appendQuoteXpcData($quote, array('address_saved' => true));
 
 
1941
  }
1942
 
1943
  // Set payment method (maybe not necessary. Just in case)
@@ -1949,37 +1929,102 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
1949
 
1950
  $order = $service->getOrder();
1951
 
1952
- $quote->setIsActive(false)->save();
1953
 
1954
- $cardData = $quote->getData(self::XPC_DATA);
1955
- $order->setData(self::XPC_DATA, $cardData);
1956
 
1957
- $cardData = unserialize($cardData);
 
 
1958
 
1959
- $order->setData('xpc_txnid', $cardData['txnId']);
1960
 
1961
- $order->save();
 
 
 
 
 
 
 
 
 
 
1962
 
1963
  $refId = $order->getIncrementId();
1964
 
1965
- $this->writeLog('Placed order #' . $refId, $cardData);
1966
 
1967
  } catch (Exception $e) {
1968
 
1969
  $this->writeLog('Unable to create order: ' . $e->getMessage(), $e->getTraceAsString());
1970
 
1971
  // Save error message in quote
1972
- $this->appendQuoteXpcData(
1973
- $quote,
1974
- array(
1975
- 'xpc_message' => $e->getMessage(),
1976
- )
1977
- );
1978
  }
1979
 
1980
  return $refId;
1981
  }
1982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1983
  /**
1984
  * Just a wrapper to omit sid and secure params
1985
  *
@@ -2070,7 +2115,7 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
2070
  $quote = Mage::getSingleton('checkout/session')->getQuote();
2071
  }
2072
 
2073
- $this->clearQuoteXpcData($quote);
2074
  }
2075
 
2076
  /**
@@ -2091,12 +2136,13 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
2091
  /**
2092
  * Write log
2093
  *
2094
- * @param string $title Log title
2095
  * @param mixed $data Data to log
 
2096
  *
2097
  * @return void
2098
  */
2099
- public function writeLog($title, $data = '')
2100
  {
2101
  if (!is_string($data)) {
2102
  $data = var_export($data, true);
@@ -2105,9 +2151,13 @@ class Cdev_XPaymentsConnector_Helper_Data extends Mage_Payment_Helper_Data
2105
  $message = PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL
2106
  . $title . PHP_EOL
2107
  . $data . PHP_EOL
2108
- . Mage::helper('core/url')->getCurrentUrl() . PHP_EOL
2109
- . '--------------------------' . PHP_EOL
2110
- . PHP_EOL;
 
 
 
 
2111
 
2112
  Mage::log($message, null, self::XPAYMENTS_LOG_FILE, true);
2113
  }
34
  const WEEK_TIME_STAMP = 604800;
35
  const SEMI_MONTH_TIME_STAMP = 1209600;
36
 
37
+ /**
38
+ * Order statuses. Constant values are left for the backwards compatibility
39
+ */
40
+ const STATUS_AUTHORIZED = 'xp_pending_payment';
41
+ const STATUS_CHARGED = 'processing';
42
+ const STATUS_FRAUD = 'fraud';
43
 
44
  const XPAYMENTS_LOG_FILE = 'xpayments.log';
45
  const RECURRING_ORDER_TYPE = 'recurring';
328
  */
329
  public function setPrepareOrderType()
330
  {
331
+ // TODO: Remove it? Or rework.
332
+
333
+ $data = Mage::getSingleton('checkout/session')->getData('xpayment_prepare_order');
334
+
335
+ if ($this->getRecurringQuoteItem()) {
336
+ $data['type'] = self::RECURRING_ORDER_TYPE;
337
  } else {
338
+ $data['type'] = self::SIMPLE_ORDER_TYPE;
339
  }
340
 
341
+ Mage::getSingleton('checkout/session')->setData('xpayment_prepare_order', $data);
342
  }
343
 
344
  /**
708
  $recurringProfile->save();
709
  }
710
 
711
+ /**
712
+ * Get quote item for the recurring product from the current checkout session. If any.
713
+ *
714
+ * @param Mage_Sales_model_Quote $quote Quote. If omitted use quote from checkout session
715
+ *
716
+ * @return Mage_Sales_Model_Quote_Item or false
717
+ */
718
+ public function getRecurringQuoteItem($quote = false)
719
  {
720
+ $result = false;
 
 
721
 
722
+ if (!$quote) {
723
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
 
 
 
 
 
 
 
 
724
  }
 
 
 
 
725
 
726
+ foreach ($quote->getAllItems() as $item) {
 
 
 
 
 
 
727
 
728
+ if (
729
+ $item
730
+ && $item->getProduct()
731
+ && $item->getProduct()->getIsRecurring()
732
+ ) {
733
+
734
+ $result = $item;
735
+ break;
736
  }
737
  }
738
 
739
+ return $result;
740
  }
741
 
742
  /**
749
 
750
  $orderItemInfo = $recurringProfile->getData('order_item_info');
751
  $infoBuyRequest = unserialize($orderItemInfo['info_buyRequest']);
752
+ $startDateTime = isset($infoBuyRequest['recurring_profile_start_datetime'])
753
+ ? $infoBuyRequest['recurring_profile_start_datetime']
754
+ : false;
755
  $xpaymentCCModel = Mage::getModel('xpaymentsconnector/payment_cc');
756
 
757
  if (!empty($startDateTime)) {
902
  public function checkStartDateDataByProduct($product,$quoteItem = false)
903
  {
904
  $productAdditionalInfo = unserialize($product->getCustomOption('info_buyRequest')->getValue());
905
+ $dateTimeStamp = isset($productAdditionalInfo['recurring_profile_start_datetime'])
906
+ ? strtotime($productAdditionalInfo['recurring_profile_start_datetime'])
907
+ : false;
908
 
909
  if ($dateTimeStamp) {
910
  $userSetTime = new Zend_Date($productAdditionalInfo['recurring_profile_start_datetime']);
962
  Mage::getSingleton('checkout/session')->addNotice($this->getFailureCheckoutNoticeHelper());
963
  }
964
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
965
  /**
966
  * This function fixed magento bug. Magento can't create user
967
  * during checkout with recurring products.
1388
  *
1389
  * @return void
1390
  */
1391
+ protected function prepareRecurringItems(Mage_Sales_Model_Quote $quote, &$result)
1392
  {
1393
+ $item = $this->getRecurringQuoteItem($quote);
1394
+ $product = $item->getProduct();
 
 
 
 
 
1395
  $recurringProfile = $product->getRecurringProfile();
1396
 
1397
  $startDateParams = $this->checkStartDateDataByProduct($product, $item);
1398
  $startDateParams = $startDateParams[$product->getId()];
1399
 
1400
+ $shipping = $item->getData('shipping_amount');
1401
+ $discount = abs($item->getData('discount_amount'));
1402
 
1403
+ $quantity = $item->getQty();
1404
 
1405
  if ($startDateParams['success']) {
1406
 
1407
  $minimalPayment = $startDateParams['minimal_payment_amount'];
1408
 
1409
  $tax = !empty($recurringProfile['init_amount'])
1410
+ ? $item->getData('initialfee_tax_amount')
1411
  : 0;
1412
 
1413
  $totalCost = $minimalPayment + $tax + $shipping - $discount;
1416
 
1417
  $minimalPayment = 0;
1418
 
1419
+ $tax = $item->getData('initialfee_tax_amount') + $item->getData('tax_amount');
1420
 
1421
+ $totalCost = $item->getData('nominal_row_total');
1422
  }
1423
 
1424
  $recurringPrice = $product->getPrice();
1425
 
1426
  if (!empty($recurringProfile['init_amount'])) {
1427
+ $recurringPrice += $item->getXpRecurringInitialFee() / $quantity;
1428
  }
1429
 
1430
  $price = $minimalPayment
1438
  'quantity' => intval($quantity),
1439
  );
1440
 
1441
+
1442
+ $result['totalCost'] = $this->preparePrice($price);
1443
  $result['shippingCost'] = $this->preparePrice($shipping);
1444
  $result['taxCost'] = $this->preparePrice($tax);
1445
  $result['discount'] = $this->preparePrice($discount);
1455
  */
1456
  protected function prepareItems(Mage_Sales_Model_Quote $quote, &$result)
1457
  {
1458
+ if ($this->getRecurringQuoteItem($quote)) {
1459
+ // Actually, only one item per order
1460
+ $this->prepareRecurringItems($quote, $result);
 
 
1461
  } else {
1462
  $this->prepareSimpleItems($quote, $result);
1463
  }
1612
  return $url;
1613
  }
1614
 
1615
+ /**
1616
+ * Get error message from X-Payments callback or detailed info data
1617
+ *
1618
+ * @param array $data Callback data
1619
+ *
1620
+ * @return string
1621
+ */
1622
+ public function getResultMessage($data)
1623
+ {
1624
+ $message = array();
1625
+
1626
+ // Regular message from X-Payments
1627
+ if (!empty($data['message'])) {
1628
+ $message[] = $data['message'];
1629
+ }
1630
+
1631
+ if (isset($data['advinfo'])) {
1632
+
1633
+ // Message from payment gateway
1634
+ if (isset($data['advinfo']['message'])) {
1635
+ $message[] = $data['advinfo']['message'];
1636
+ }
1637
+
1638
+ // Message from 3-D Secure
1639
+ if (isset($data['advinfo']['s3d_message'])) {
1640
+ $message[] = $data['advinfo']['s3d_message'];
1641
+ }
1642
+ }
1643
+
1644
+ $message = array_unique($message);
1645
+
1646
+ return implode("\n", $message);
1647
+ }
1648
+
1649
  /**
1650
  * Get address data saved at checkout
1651
  *
1669
 
1670
  if (isset($data[$type])) {
1671
 
1672
+ if (
1673
+ isset($data[$type]['street'])
1674
+ && is_array($data[$type]['street'])
1675
+ ) {
1676
+
1677
+ // Prevent array to string conversion notice.
1678
+ // Necessary for:
1679
+ // - Registration at checkout for OSC module
1680
+ $data[$type]['street'] = implode(PHP_EOL, $data[$type]['street']);
1681
+ }
1682
+
1683
  // Addrress data from checkout
1684
  $result += array_filter($data[$type]);
1685
  }
1688
  }
1689
 
1690
  /**
1691
+ * Get Quote xpc data (just a wrapper)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1692
  *
1693
  * @param Mage_Sales_Model_Quote $quote
 
 
 
 
 
 
 
 
 
 
 
 
 
1694
  *
1695
+ * @return Cdev_XPaymentsConnector_Model_Quote_XpcData
1696
  */
1697
+ public function getQuoteXpcData(Mage_Sales_Model_Quote $quote, $methodCode = false)
1698
  {
1699
+ $quoteId = $quote->getEntityId();
 
 
 
1700
 
1701
+ if (!$methodCode) {
1702
+ $methodCode = 'xpaymentsconnector/payment_cc';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1703
  }
1704
 
1705
+ $model = Mage::getModel('xpaymentsconnector/quote_xpcdata')
1706
+ ->getCollection()
1707
+ ->addFieldToFilter('quote_id', $quoteId)
1708
+ ->addFieldToFilter('payment_method_code', $methodCode)
1709
+ ->getFirstItem();
1710
 
1711
+ if (!$model->getQuoteId()) {
1712
+ // Fill "primary key" for the new entity
1713
+ $model->setQuoteId($quoteId)
1714
+ ->setPaymentMethodCode($methodCode)
1715
+ ->save();
1716
+ }
 
 
 
 
1717
 
1718
+ return $model;
 
 
1719
  }
1720
 
1721
  /**
1728
  protected function processCheckoutData(Mage_Sales_Model_Quote $quote)
1729
  {
1730
  // Grab data saved at checkout
1731
+ $data = unserialize($this->getQuoteXpcData($quote)->getData('checkout_data'));
1732
 
1733
  // Add billing address data from checkout
1734
  $quote->getBillingAddress()->addData($this->getCheckoutAddressData($data, 'billing'));
1790
  }
1791
 
1792
  /**
1793
+ * Create customer and assign it to the quote
1794
+ *
1795
+ * @param Mage_Sales_Model_Quote $quote
1796
  *
1797
+ * @return Mage_Customer_Model_Customer
1798
  */
1799
  protected function createNewCustomer(Mage_Sales_Model_Quote $quote)
1800
  {
1801
+ $billing = $quote->getBillingAddress();
1802
+
1803
+ $shipping = $quote->isVirtual()
1804
+ ? null
1805
+ : $quote->getShippingAddress();
1806
 
 
1807
  $customer = $quote->getCustomer();
1808
+
1809
  $customerBilling = $billing->exportCustomerAddress();
1810
  $customer->addAddress($customerBilling);
1811
  $billing->setCustomerAddress($customerBilling);
1812
  $customerBilling->setIsDefaultBilling(true);
1813
+
1814
+ if (
1815
+ $shipping
1816
+ && !$shipping->getSameAsBilling()
1817
+ ) {
1818
+
1819
  $customerShipping = $shipping->exportCustomerAddress();
1820
  $customer->addAddress($customerShipping);
1821
  $shipping->setCustomerAddress($customerShipping);
1822
  $customerShipping->setIsDefaultShipping(true);
1823
+
1824
  } else {
1825
+
1826
  $customerBilling->setIsDefaultShipping(true);
1827
  }
1828
 
1829
  Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);
1830
+
1831
+ $password = '';
1832
+
1833
+ if ($quote->getPasswordHash()) {
1834
+ // One page checkout
1835
+ $password = $customer->decryptPassword($quote->getPasswordHash());
1836
+ } else {
1837
+ $data = unserialize($this->getQuoteXpcData($quote)->getData('checkout_data'));
1838
+ if (!empty($data['billing']['customer_password'])) {
1839
+ // One step checkout
1840
+ $password = $data['billing']['customer_password'];
1841
+ }
1842
+ }
1843
+
1844
+ $customer->setPassword($password);
1845
+
1846
  $quote->setCustomer($customer)
1847
  ->setCustomerId(true);
1848
 
1849
+ $quote->save();
1850
+ $customer->save();
1851
+
1852
+ $this->writeLog('Created new customer', $customer->getId());
1853
+
1854
  return $customer;
1855
  }
1856
 
1869
  if ($this->checkOscModuleEnabled()) {
1870
 
1871
  // For One Step Checkout module
1872
+ $data = unserialize($this->getQuoteXpcData($quote)->getData('checkout_data'));
1873
 
1874
  $result = isset($data['create_account'])
1875
  && (bool)$data['create_account'];
1877
  } elseif ($this->checkFirecheckoutModuleEnabled()) {
1878
 
1879
  // For Firecheckout module
1880
+ $data = unserialize($this->getQuoteXpcData($quote)->getData('checkout_data'));
1881
 
1882
  $result = isset($data['billing']['register_account'])
1883
  && (bool)$data['billing']['register_account'];
1912
 
1913
  if ($this->isCreateNewCustomer($quote)) {
1914
 
1915
+ // Create customer's profile who's registered at checkout
1916
+ $this->createNewCustomer($quote);
 
1917
 
1918
+ $this->getQuoteXpcData($quote)
1919
+ ->setData('address_saved', true)
1920
+ ->save();
1921
  }
1922
 
1923
  // Set payment method (maybe not necessary. Just in case)
1929
 
1930
  $order = $service->getOrder();
1931
 
1932
+ if (!$order) {
1933
 
1934
+ $orderId = $this->getQuoteXpcData($quote)->getData('recurring_order_id');
 
1935
 
1936
+ if ($orderId) {
1937
+ $order = Mage::getModel('sales/order')->load($orderId);
1938
+ }
1939
 
1940
+ if (!$order) {
1941
 
1942
+ // Cannot proceed further without an order anyway
1943
+ throw new Exception('Quote was not converted to order');
1944
+ }
1945
+ }
1946
+
1947
+ $quote->setIsActive(false)->save();
1948
+
1949
+ $xpcData = $this->getQuoteXpcData($quote)->getData();
1950
+ $order->setData(self::XPC_DATA, serialize($xpcData));
1951
+
1952
+ $order->setData('xpc_txnid', $xpcData['txn_id'])->save();
1953
 
1954
  $refId = $order->getIncrementId();
1955
 
1956
+ $this->writeLog('Placed order #' . $refId, $xpcData);
1957
 
1958
  } catch (Exception $e) {
1959
 
1960
  $this->writeLog('Unable to create order: ' . $e->getMessage(), $e->getTraceAsString());
1961
 
1962
  // Save error message in quote
1963
+ $this->getQuoteXpcData($quote)
1964
+ ->setData('xpc_message', $e->getMessage())
1965
+ ->save();
 
 
 
1966
  }
1967
 
1968
  return $refId;
1969
  }
1970
 
1971
+ /**
1972
+ * Create invoice for the charged payment
1973
+ *
1974
+ * @param Mage_Sales_Model_Order $order
1975
+ *
1976
+ * @return void
1977
+ */
1978
+ public function processCreateInvoice(Mage_Sales_Model_Order $order)
1979
+ {
1980
+ if (
1981
+ $order->getStatus() == self::STATUS_CHARGED
1982
+ && $order->canInvoice()
1983
+ ) {
1984
+
1985
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
1986
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
1987
+
1988
+ $invoice->register();
1989
+
1990
+ $transaction = Mage::getModel('core/resource_transaction')
1991
+ ->addObject($invoice)
1992
+ ->addObject($invoice->getOrder());
1993
+
1994
+ $transaction->save();
1995
+ }
1996
+ }
1997
+
1998
+ /**
1999
+ * Get recurring profile for order
2000
+ *
2001
+ * @param Mage_Sales_Model_Order $order Order
2002
+ *
2003
+ * @return Mage_Sales_Model_Recurring_Profile or false
2004
+ */
2005
+ public function getOrderRecurringProfile(Mage_Sales_Model_Order $order)
2006
+ {
2007
+ $txnId = $order->getData('xpc_txnid');
2008
+
2009
+ try {
2010
+
2011
+ $profile = Mage::getModel('sales/recurring_profile')->load($txnId, 'reference_id');
2012
+
2013
+ if (!$profile->isValid()) {
2014
+
2015
+ $profile = false;
2016
+ }
2017
+
2018
+ } catch (Exception $e) {
2019
+
2020
+ $this->writeLog('Unable to load recurring profile for reference ' . $txnId, $e->getMessage());
2021
+
2022
+ $profile = false;
2023
+ }
2024
+
2025
+ return $profile;
2026
+ }
2027
+
2028
  /**
2029
  * Just a wrapper to omit sid and secure params
2030
  *
2115
  $quote = Mage::getSingleton('checkout/session')->getQuote();
2116
  }
2117
 
2118
+ $this->getQuoteXpcData($quote)->clear();
2119
  }
2120
 
2121
  /**
2136
  /**
2137
  * Write log
2138
  *
2139
+ * @param string $title Log title
2140
  * @param mixed $data Data to log
2141
+ * @param bool $trace Include backtrace or not
2142
  *
2143
  * @return void
2144
  */
2145
+ public function writeLog($title, $data = '', $trace = false)
2146
  {
2147
  if (!is_string($data)) {
2148
  $data = var_export($data, true);
2151
  $message = PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL
2152
  . $title . PHP_EOL
2153
  . $data . PHP_EOL
2154
+ . Mage::helper('core/url')->getCurrentUrl() . PHP_EOL;
2155
+
2156
+ if ($trace) {
2157
+ $message .= '--------------------------' . PHP_EOL
2158
+ . Varien_Debug::backtrace(true, false, false)
2159
+ . PHP_EOL;
2160
+ }
2161
 
2162
  Mage::log($message, null, self::XPAYMENTS_LOG_FILE, true);
2163
  }
app/code/community/Cdev/XPaymentsConnector/Model/Fraudcheckdata.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * Data from the fraud-check service (Kount, NoFraud, etc)
25
+ * Class Cdev_XPaymentsConnector_Model_FraudCheckData
26
+ */
27
+
28
+ class Cdev_XPaymentsConnector_Model_Fraudcheckdata extends Mage_Core_Model_Abstract
29
+ {
30
+ /**
31
+ * Internal constructor
32
+ *
33
+ * @return void
34
+ */
35
+ protected function _construct()
36
+ {
37
+ $this->_init('xpaymentsconnector/fraudcheckdata');
38
+ }
39
+
40
+ /**
41
+ * Get and unserialize some data
42
+ *
43
+ * @param string $name Data name
44
+ *
45
+ * @return array
46
+ */
47
+ private function getUnserializedData($name)
48
+ {
49
+ $list = $this->getData($name);
50
+
51
+ $list = @unserialize($list);
52
+
53
+ if (!is_array($list)) {
54
+ $list = array();
55
+ }
56
+
57
+ return $list;
58
+ }
59
+
60
+ /**
61
+ * Get list of the triggered rules
62
+ *
63
+ * @return array
64
+ */
65
+ public function getRulesList()
66
+ {
67
+ return $this->getUnserializedData('rules');
68
+ }
69
+
70
+ /**
71
+ * Get list of the errors
72
+ *
73
+ * @return array
74
+ */
75
+ public function getErrorsList()
76
+ {
77
+ return $this->getUnserializedData('errors');
78
+ }
79
+
80
+ /**
81
+ * Get list of the warnings
82
+ *
83
+ * @return array
84
+ */
85
+ public function getWarningsList()
86
+ {
87
+ return $this->getUnserializedData('warnings');
88
+ }
89
+
90
+ /**
91
+ * Get data as list
92
+ *
93
+ * @return array
94
+ */
95
+ public function getDataList()
96
+ {
97
+ return $this->getUnserializedData('data');
98
+ }
99
+ }
app/code/community/Cdev/XPaymentsConnector/{Block/Customer/Account/Navigation.php → Model/Mysql4/Fraudcheckdata.php} RENAMED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -20,28 +21,22 @@
20
  */
21
 
22
  /**
23
- * Remove account link "My Payment Cards"
 
 
 
 
24
  */
25
- class Cdev_XPaymentsConnector_Block__Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation
26
- {
27
- /**
28
- * @return $this
29
- */
30
- public function removeLink()
31
- {
32
- $IsSaveCardsPaymentActive = (bool)Mage::getStoreConfig('payment/savedcards/active');
33
- if (!$IsSaveCardsPaymentActive) {
34
- unset($this->_links['customer_usercards']);
35
- }
36
- return $this;
37
- }
38
 
 
 
39
  /**
40
- * @return mixed
 
 
41
  */
42
- protected function _toHtml()
43
  {
44
- $this->removeLink();
45
- return parent::_toHtml();
46
  }
47
- }
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
21
  */
22
 
23
  /**
24
+ * Fraud check data RDBS-specific model
25
+ *
26
+ * @package Cdev_XPaymentsConnector
27
+ * @see ____class_see____
28
+ * @since 1.0.0
29
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ class Cdev_XPaymentsConnector_Model_Mysql4_Fraudcheckdata extends Mage_Core_Model_Mysql4_Abstract
32
+ {
33
  /**
34
+ * Internal constructor
35
+ *
36
+ * @return void
37
  */
38
+ protected function _construct()
39
  {
40
+ $this->_init('xpaymentsconnector/fraudcheckdata', 'data_id');
 
41
  }
42
+ }
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Fraudcheckdata/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * Fraud check data RDMS-specific collection model
25
+ *
26
+ * @package Cdev_XPaymentsConnector
27
+ * @see ____class_see____
28
+ * @since 1.0.0
29
+ */
30
+
31
+ class Cdev_XPaymentsConnector_Model_Mysql4_Fraudcheckdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
32
+ {
33
+ /**
34
+ * Initialize collection
35
+ *
36
+ */
37
+ public function _construct()
38
+ {
39
+ $this->_init('xpaymentsconnector/fraudcheckdata');
40
+ }
41
+ }
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Quote/Xpcdata.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * X-Payments Connector Quote data RDBS-specific model
25
+ *
26
+ * @package Cdev_XPaymentsConnector
27
+ * @see ____class_see____
28
+ * @since 1.0.0
29
+ */
30
+
31
+ class Cdev_XPaymentsConnector_Model_Mysql4_Quote_Xpcdata extends Mage_Core_Model_Mysql4_Abstract
32
+ {
33
+ /**
34
+ * Internal constructor
35
+ *
36
+ * @return void
37
+ */
38
+ protected function _construct()
39
+ {
40
+ $this->_init('xpaymentsconnector/quote_xpcdata', 'data_id');
41
+ }
42
+ }
app/code/community/Cdev/XPaymentsConnector/Model/Mysql4/Quote/Xpcdata/Collection.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * X-Payments Connector Data in quote
25
+ *
26
+ * @package Cdev_XPaymentsConnector
27
+ */
28
+ class Cdev_XPaymentsConnector_Model_Mysql4_Quote_Xpcdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
29
+ {
30
+ /**
31
+ * Initialize collection
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('xpaymentsconnector/quote_xpcdata');
36
+ }
37
+ }
app/code/community/Cdev/XPaymentsConnector/Model/Observer.php CHANGED
@@ -37,12 +37,6 @@ class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model
37
  $xpHelper = Mage::helper('xpaymentsconnector');
38
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
39
 
40
- //set recurring product discount
41
- $issetRecurrnigProduct = $xpHelper->checkIssetRecurringOrder();
42
- if ($issetRecurrnigProduct['isset']) {
43
- $xpHelper->setRecurringProductDiscount();
44
- }
45
-
46
  }
47
 
48
  public function paymentMethodIsActive($observer)
@@ -112,9 +106,16 @@ class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model
112
 
113
  if ($response['success']) {
114
  $result = $paymentCcModel->updateOrderByXpaymentResponse($order->getId(), $response['response']['transaction_id']);
 
 
 
 
115
  if (!$result['success']) {
116
  $checkoutSession->addError($result['error_message']);
117
  $checkoutSession->addNotice($noticeHelper);
 
 
 
118
  }
119
  } else {
120
  $checkoutSession->addError($response['error_message']);
@@ -465,9 +466,6 @@ class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model
465
  $xpHelper = Mage::helper('xpaymentsconnector');
466
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
467
 
468
- //set recurring product discount
469
- Mage::helper('xpaymentsconnector')->setRecurringProductDiscount();
470
-
471
  // update InitAmount for recurring products
472
  $cart = $observer->getCart('quote');
473
  foreach ($cart->getAllVisibleItems() as $item){
@@ -584,10 +582,6 @@ class Cdev_XPaymentsConnector_Model_Observer extends Mage_CatalogInventory_Model
584
  $unsetParams = array('token');
585
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
586
  }
587
-
588
- //set recurring product discount
589
- $xpHelper->setRecurringProductDiscount();
590
-
591
  }
592
 
593
 
37
  $xpHelper = Mage::helper('xpaymentsconnector');
38
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
39
 
 
 
 
 
 
 
40
  }
41
 
42
  public function paymentMethodIsActive($observer)
106
 
107
  if ($response['success']) {
108
  $result = $paymentCcModel->updateOrderByXpaymentResponse($order->getId(), $response['response']['transaction_id']);
109
+
110
+ // Reload order data, since it has been changed
111
+ $order = Mage::getModel('sales/order')->load($order->getId());
112
+
113
  if (!$result['success']) {
114
  $checkoutSession->addError($result['error_message']);
115
  $checkoutSession->addNotice($noticeHelper);
116
+ } else {
117
+ // Auto create invoice if necessary
118
+ Mage::helper('xpaymentsconnector')->processCreateInvoice($order);
119
  }
120
  } else {
121
  $checkoutSession->addError($response['error_message']);
466
  $xpHelper = Mage::helper('xpaymentsconnector');
467
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
468
 
 
 
 
469
  // update InitAmount for recurring products
470
  $cart = $observer->getCart('quote');
471
  foreach ($cart->getAllVisibleItems() as $item){
582
  $unsetParams = array('token');
583
  $xpHelper->unsetXpaymentPrepareOrder($unsetParams);
584
  }
 
 
 
 
585
  }
586
 
587
 
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Cc.php CHANGED
@@ -63,6 +63,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
63
  const XPATH_IP_ADDRESSES = 'xpaymentsconnector/settings/xpay_allowed_ip_addresses';
64
  const XPATH_CURRENCY = 'xpaymentsconnector/settings/xpay_currency';
65
  const XPATH_CONF_BUNDLE = 'xpaymentsconnector/settings/xpay_conf_bundle';
 
66
 
67
  // Error codes
68
  const REQ_CURL = 1;
@@ -122,7 +123,6 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
122
  const TRAN_TYPE_GET_INFO = 'getInfo';
123
  const TRAN_TYPE_ACCEPT = 'accept';
124
  const TRAN_TYPE_DECLINE = 'decline';
125
- const XP_API = '1.6';
126
 
127
  /**
128
  * Show or not save card checkbox statuses
@@ -131,6 +131,14 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
131
  const SAVE_CARD_REQUIRED = 'Y';
132
  const SAVE_CARD_OPTIONAL = 'O';
133
 
 
 
 
 
 
 
 
 
134
  /**
135
  * unique internal payment method identifier
136
  *
@@ -377,6 +385,16 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
377
 
378
  }
379
 
 
 
 
 
 
 
 
 
 
 
380
  /**
381
  * Check - module is configured
382
  *
@@ -502,7 +520,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
502
  'callbackUrl' => Mage::getUrl('xpaymentsconnector/processing/callback',
503
  array('order_refid' => $refId,'quote_id' => $quoteId,'_secure' => true)),
504
  'saveCard' => 'Y',
505
- 'api_version' => self::XP_API
506
  );
507
 
508
  list($status, $response) = $this->request('payment', 'init', $data);
@@ -548,6 +566,8 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
548
  public function requestPaymentInfo($txn_id, $refresh = false,$withAdditionalInfo = false)
549
  {
550
 
 
 
551
  if($withAdditionalInfo){
552
  $data = array(
553
  'txnId' => $txn_id,
@@ -643,19 +663,38 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
643
  {
644
  srand();
645
 
646
- $hash_code = strval(rand(0, 1000000));
647
 
648
- // Make test request
649
- list($status, $response) = $this->request(
650
- 'connect',
651
- 'test',
652
- array('testCode' => $hash_code)
653
  );
654
 
655
- // Compare MD5 hashes
656
- if ($status && md5($hash_code) !== $response['hashCode']) {
657
- $this->getAPIError('Test connection data is not valid');
658
- $status = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  }
660
 
661
  return $status;
@@ -715,7 +754,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
715
  $data['target'] = $target;
716
  $data['action'] = $action;
717
  if(!isset($data['api_version'])){
718
- $data['api_version'] = self::XP_API;
719
  }
720
 
721
 
@@ -900,36 +939,46 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
900
  * Check - force use authorization request or not
901
  *
902
  * @return boolean
903
- * @access protected
904
- * @see ____func_see____
905
- * @since 1.0.0
906
  */
907
  protected function isForceAuth()
908
  {
909
- $xpHelper = Mage::helper('xpaymentsconnector');
910
- $isRecurringProduct = $xpHelper->checkIssetRecurringOrder();
911
 
912
- $request = Mage::app()->getRequest()->getActionName();
913
- if($request == 'cardadd'){
914
- return true;
915
- };
916
 
917
- if ($xpHelper->checkIssetSimpleOrder()) {
918
- $useAuthorize = Mage::getStoreConfig('payment/xpayments/use_authorize');
919
- return (bool)$useAuthorize;
920
- }
 
 
 
 
 
 
921
 
922
- if ($isRecurringProduct['isset']) {
923
- $currentProduct = $isRecurringProduct['quote_item']->getProduct();
924
- $checkQuoteItemResult = $xpHelper->checkStartDateDataByProduct($currentProduct,$isRecurringProduct['quote_item']);
925
- if ($checkQuoteItemResult[$currentProduct->getId()]['success']) {
926
- if (!$isRecurringProduct['quote_item']->getXpRecurringInitialFee()) {
927
- return true;
 
 
 
 
 
 
 
 
 
 
928
  }
929
  }
930
- $useInitialFeeAuthorize = Mage::getStoreConfig('payment/xpayments/use_initialfee_authorize');
931
- return (bool)$useInitialFeeAuthorize;
932
  }
 
 
933
  }
934
 
935
  /**
@@ -1345,12 +1394,10 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1345
 
1346
  if (!$zeroAuth) {
1347
 
1348
- $xpcData = array(
1349
- 'txnId' => $response['txnId'],
1350
- 'token' => $response['token'],
1351
- );
1352
-
1353
- $helper->saveQuoteXpcData($quote, $xpcData);
1354
  }
1355
  }
1356
 
@@ -1364,17 +1411,16 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1364
  */
1365
  protected function getAllowSaveCard()
1366
  {
 
 
1367
  // Check if save card feature is available for customer
1368
- $showToUser = Mage::helper('xpaymentsconnector')->isRegisteredUser()
1369
  && Mage::getStoreConfig('payment/savedcards/active');
1370
 
1371
- // Check if recurring product is purchased
1372
- $isRecuringProduct = Mage::helper('xpaymentsconnector')->checkIssetRecurringOrder();
1373
- $isRecuringProduct = (bool)$isRecuringProduct['isset'];
1374
-
1375
  if ($showToUser) {
1376
 
1377
- $allowSaveCard = $isRecuringProduct
 
1378
  ? static::SAVE_CARD_REQUIRED
1379
  : static::SAVE_CARD_OPTIONAL;
1380
 
@@ -1397,7 +1443,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1397
 
1398
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1399
 
1400
- if (!$helper->getQuoteXpcDataToken($quote)) {
1401
  // This saves token in the quote model
1402
  $data = $this->sendIframeHandshakeRequest();
1403
  }
@@ -1416,7 +1462,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1416
 
1417
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1418
 
1419
- return (bool)$helper->getQuoteXpcDataToken($quote);
1420
  }
1421
 
1422
  /**
@@ -1430,7 +1476,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1430
 
1431
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1432
 
1433
- $token = $helper->getQuoteXpcDataToken($quote);
1434
 
1435
  return array(
1436
  'target' => 'main',
@@ -1544,8 +1590,6 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1544
  $status
1545
  && in_array($response['payment']['status'], array(self::AUTH_STATUS, self::CHARGED_STATUS))
1546
  ) {
1547
- // TODO - save message - $response['message']
1548
- // TODO - process faud status
1549
 
1550
  if ($response['payment']['amount'] != number_format($order->getGrandTotal(), 2, '.','') && $checkOrderAmount) {
1551
  $order->cancel();
@@ -1582,27 +1626,30 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1582
  $order->getPayment()->setCcAvsStatus($response['payment']['advinfo']['AVS']);
1583
  }
1584
 
1585
- if ($response['payment']['status'] == self::AUTH_ACTION) {
1586
- $order->setState(
1587
- Mage_Sales_Model_Order::STATE_PROCESSING,
1588
- (bool)$order->getPayment()->getMethodInstance()->getConfigData('order_status'),
1589
- $xpaymentsHelper->__('preauthorize: Customer returned successfully')
1590
- );
1591
- $order->setStatus(Cdev_XPaymentsConnector_Helper_Data::STATE_XPAYMENTS_PENDING_PAYMENT);
1592
- }else{
1593
- $order->setState(
1594
- Mage_Sales_Model_Order::STATE_PROCESSING,
1595
- (bool)$order->getPayment()->getMethodInstance()->getConfigData('order_status'),
1596
- $xpaymentsHelper->__('preauthorize: Customer returned successfully')
1597
- );
1598
- $order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
1599
- }
1600
 
1601
- if(isset($response['payment']['isFraudStatus']) && $response['payment']['isFraudStatus']){
1602
- $order->setStatus('fraud');
 
 
 
 
 
 
 
1603
  }
1604
 
 
 
1605
  $order->save();
 
1606
  if(method_exists($order,'sendNewOrderEmail')){
1607
  $order->sendNewOrderEmail();
1608
  }elseif(method_exists($order,'queueNewOrderEmail')){
@@ -1767,74 +1814,45 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1767
  }
1768
 
1769
  /**
1770
- * Submit to the gateway
1771
  *
1772
  * @param Mage_Payment_Model_Recurring_Profile $profile
1773
  * @param Mage_Payment_Model_Info $paymentInfo
 
 
1774
  */
1775
  public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
1776
  {
1777
- $xpHelper = Mage::helper('xpaymentsconnector');
 
 
 
 
1778
  $quote = $profile->getQuote();
1779
- // registered new user and update profile
1780
- $xpHelper->addXpDefaultRecurringSettings($profile);
1781
- // end registered user
1782
- $xpHelper->setPrepareOrderType();
1783
 
1784
- //add txnid for all subscriptions
1785
- $cardData = $xpHelper->getXpCardData();
1786
 
1787
- $useIframe = Mage::helper('xpaymentsconnector')->isUseIframe();
1788
-
1789
- if (!$xpHelper->checkIssetSimpleOrder()) {
1790
- if ($useIframe) {
1791
- if (is_null($this->_currentProfileId)) {
1792
- $payDeferredSubscription = $xpHelper->payDeferredSubscription($profile);
1793
- if ($payDeferredSubscription) {
1794
- $this->_currentProfileId = $profile->getProfileId();
1795
- } else {
1796
- $this->createFirstRecurringOrder($profile);
1797
- }
1798
- if($profile->getState() == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED){
1799
- $this->firstTransactionSuccess = false;
1800
- };
1801
- }else{
1802
- if (!$this->firstTransactionSuccess) {
1803
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
1804
- }
1805
- }
1806
- $xpHelper->prepareOrderKeyByRecurringProfile($profile);
1807
- } else {
1808
- if (is_null($this->_currentProfileId)) {
1809
- $xpaymentResponse = $this->sendIframeHandshakeRequest();
1810
-
1811
- if (isset($xpaymentResponse['success']) && !$xpaymentResponse['success']) {
1812
- $this->firstTransactionSuccess = false;
1813
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
1814
- }
1815
- $xpHelper->updateRecurringMasKeys($profile);
1816
- $this->_currentProfileId = $profile->getProfileId();
1817
- } else {
1818
- if (!$this->firstTransactionSuccess) {
1819
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED);
1820
- }
1821
- }
1822
- }
1823
  }
1824
 
1825
- if($useIframe){
1826
- $profile->setReferenceId($cardData['txnId']);
1827
- if (is_null($this->_currentProfileId) && $xpHelper->checkIssetSimpleOrder()) {
1828
- //save user card
1829
- Mage::getSingleton('checkout/session')->setData('user_card_save', true);
1830
- $this->saveUserCard($cardData, $usageType = Cdev_XPaymentsConnector_Model_Usercards::RECURRING_CARD);
1831
- }
1832
- $this->_currentProfileId = $profile->getProfileId();
1833
- }else {
1834
- $orderItemInfo = $profile->getData('order_item_info');
1835
- $quote->getItemById($orderItemInfo['item_id'])->isDeleted(true);
1836
  }
1837
 
 
 
 
 
 
 
 
 
 
 
1838
  }
1839
 
1840
  /**
@@ -1894,7 +1912,12 @@ class Cdev_XPaymentsConnector_Model_Payment_Cc extends Mage_Payment_Model_Method
1894
  */
1895
  public function createFirstRecurringOrder(Mage_Payment_Model_Recurring_Profile $profile)
1896
  {
1897
- $xpHelper = Mage::helper('xpaymentsconnector');
 
 
 
 
 
1898
  $cardData = $xpHelper->getXpCardData();
1899
  $orderId = $xpHelper->createOrder($profile, $isFirstRecurringOrder = true);
1900
 
63
  const XPATH_IP_ADDRESSES = 'xpaymentsconnector/settings/xpay_allowed_ip_addresses';
64
  const XPATH_CURRENCY = 'xpaymentsconnector/settings/xpay_currency';
65
  const XPATH_CONF_BUNDLE = 'xpaymentsconnector/settings/xpay_conf_bundle';
66
+ const XPATH_API_VERSION = 'xpaymentsconnector/settings/xpay_api_version';
67
 
68
  // Error codes
69
  const REQ_CURL = 1;
123
  const TRAN_TYPE_GET_INFO = 'getInfo';
124
  const TRAN_TYPE_ACCEPT = 'accept';
125
  const TRAN_TYPE_DECLINE = 'decline';
 
126
 
127
  /**
128
  * Show or not save card checkbox statuses
131
  const SAVE_CARD_REQUIRED = 'Y';
132
  const SAVE_CARD_OPTIONAL = 'O';
133
 
134
+ /**
135
+ * List of supported API versions
136
+ */
137
+ private $apiVersions = array(
138
+ 1.7,
139
+ 1.6,
140
+ );
141
+
142
  /**
143
  * unique internal payment method identifier
144
  *
385
 
386
  }
387
 
388
+ /**
389
+ * Get API version setting
390
+ *
391
+ * @return string
392
+ */
393
+ public function getApiVersion()
394
+ {
395
+ return Mage::getStoreConfig(self::XPATH_API_VERSION);
396
+ }
397
+
398
  /**
399
  * Check - module is configured
400
  *
520
  'callbackUrl' => Mage::getUrl('xpaymentsconnector/processing/callback',
521
  array('order_refid' => $refId,'quote_id' => $quoteId,'_secure' => true)),
522
  'saveCard' => 'Y',
523
+ 'api_version' => $this->getApiVersion(),
524
  );
525
 
526
  list($status, $response) = $this->request('payment', 'init', $data);
566
  public function requestPaymentInfo($txn_id, $refresh = false,$withAdditionalInfo = false)
567
  {
568
 
569
+ Mage::helper('xpaymentsconnector')->writeLog('INFO', array($txn_id, $refresh, $withAdditionalInfo));
570
+
571
  if($withAdditionalInfo){
572
  $data = array(
573
  'txnId' => $txn_id,
663
  {
664
  srand();
665
 
666
+ $hashCode = strval(rand(0, 1000000));
667
 
668
+ $params = array(
669
+ 'testCode' => $hashCode,
 
 
 
670
  );
671
 
672
+ foreach ($this->apiVersions as $version) {
673
+
674
+ $params['api_version'] = $version;
675
+
676
+ // Make test request
677
+ list($status, $response) = $this->request(
678
+ 'connect',
679
+ 'test',
680
+ $params
681
+ );
682
+
683
+ if (
684
+ $status
685
+ && isset($response['hashCode'])
686
+ && md5($hashCode) == $response['hashCode']
687
+ ) {
688
+
689
+ // Save working API version
690
+ Mage::getConfig()->saveConfig(self::XPATH_API_VERSION, $version);
691
+ Mage::getConfig()->reinit();
692
+ break;
693
+
694
+ } else {
695
+
696
+ $status = false;
697
+ }
698
  }
699
 
700
  return $status;
754
  $data['target'] = $target;
755
  $data['action'] = $action;
756
  if(!isset($data['api_version'])){
757
+ $data['api_version'] = $this->getApiVersion();
758
  }
759
 
760
 
939
  * Check - force use authorization request or not
940
  *
941
  * @return boolean
 
 
 
942
  */
943
  protected function isForceAuth()
944
  {
945
+ if ('cardadd' == Mage::app()->getRequest()->getActionName()) {
 
946
 
947
+ // Force auth only for zero-auth/card setup
948
+ $result = true;
 
 
949
 
950
+ } else {
951
+
952
+ // Use option for regular products
953
+ $result = (bool)Mage::getStoreConfig('payment/xpayments/use_authorize');
954
+
955
+ $helper = Mage::helper('xpaymentsconnector');
956
+
957
+ $item = $helper->getRecurringQuoteItem();
958
+
959
+ if ($item) {
960
 
961
+ $product = $item->getProduct();
962
+
963
+ $checkQuoteItemResult = $helper->checkStartDateDataByProduct($product, $item);
964
+
965
+ if (
966
+ $checkQuoteItemResult[$product->getId()]['success']
967
+ && !$item->getXpRecurringInitialFee()
968
+ ) {
969
+
970
+ // Force auth because... It was forced.
971
+ $result = true;
972
+
973
+ } else {
974
+
975
+ // Use option for recurring products
976
+ $result = (bool)Mage::getStoreConfig('payment/xpayments/use_initialfee_authorize');
977
  }
978
  }
 
 
979
  }
980
+
981
+ return $result;
982
  }
983
 
984
  /**
1394
 
1395
  if (!$zeroAuth) {
1396
 
1397
+ $helper->getQuoteXpcData($quote)
1398
+ ->setData('token', $response['token'])
1399
+ ->setData('txn_id', $response['txnId'])
1400
+ ->save();
 
 
1401
  }
1402
  }
1403
 
1411
  */
1412
  protected function getAllowSaveCard()
1413
  {
1414
+ $helper = Mage::helper('xpaymentsconnector');
1415
+
1416
  // Check if save card feature is available for customer
1417
+ $showToUser = $helper->isRegisteredUser()
1418
  && Mage::getStoreConfig('payment/savedcards/active');
1419
 
 
 
 
 
1420
  if ($showToUser) {
1421
 
1422
+ // Check if recurring product is purchased
1423
+ $allowSaveCard = $helper->getRecurringQuoteItem()
1424
  ? static::SAVE_CARD_REQUIRED
1425
  : static::SAVE_CARD_OPTIONAL;
1426
 
1443
 
1444
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1445
 
1446
+ if (!$helper->getQuoteXpcData($quote)->getData('token')) {
1447
  // This saves token in the quote model
1448
  $data = $this->sendIframeHandshakeRequest();
1449
  }
1462
 
1463
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1464
 
1465
+ return (bool)$helper->getQuoteXpcData($quote)->getData('token');
1466
  }
1467
 
1468
  /**
1476
 
1477
  $quote = Mage::getSingleton('checkout/session')->getQuote();
1478
 
1479
+ $token = $helper->getQuoteXpcData($quote)->getData('token');
1480
 
1481
  return array(
1482
  'target' => 'main',
1590
  $status
1591
  && in_array($response['payment']['status'], array(self::AUTH_STATUS, self::CHARGED_STATUS))
1592
  ) {
 
 
1593
 
1594
  if ($response['payment']['amount'] != number_format($order->getGrandTotal(), 2, '.','') && $checkOrderAmount) {
1595
  $order->cancel();
1626
  $order->getPayment()->setCcAvsStatus($response['payment']['advinfo']['AVS']);
1627
  }
1628
 
1629
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
1630
+
1631
+ $statusMessage = $xpaymentsHelper->getResultMessage($response);
1632
+
1633
+ if (
1634
+ isset($response['payment']['isFraudStatus'])
1635
+ && $response['payment']['isFraudStatus']
1636
+ ) {
 
 
 
 
 
 
 
1637
 
1638
+ $status = Cdev_XPaymentsConnector_Helper_Data::STATUS_FRAUD;
1639
+
1640
+ } elseif (self::AUTH_ACTION == $response['payment']['status']) {
1641
+
1642
+ $status = Cdev_XPaymentsConnector_Helper_Data::STATUS_AUTHORIZED;
1643
+
1644
+ } else {
1645
+
1646
+ $status = Cdev_XPaymentsConnector_Helper_Data::STATUS_CHARGED;
1647
  }
1648
 
1649
+ $order->setState($state, $status, $statusMessage, false);
1650
+
1651
  $order->save();
1652
+
1653
  if(method_exists($order,'sendNewOrderEmail')){
1654
  $order->sendNewOrderEmail();
1655
  }elseif(method_exists($order,'queueNewOrderEmail')){
1814
  }
1815
 
1816
  /**
1817
+ * Process recurring profile when quote is converted to order
1818
  *
1819
  * @param Mage_Payment_Model_Recurring_Profile $profile
1820
  * @param Mage_Payment_Model_Info $paymentInfo
1821
+ *
1822
+ * @return void
1823
  */
1824
  public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
1825
  {
1826
+ $helper = Mage::helper('xpaymentsconnector');
1827
+
1828
+ // Just in case. We don't know the status of the transaction yet
1829
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_UNKNOWN);
1830
+
1831
  $quote = $profile->getQuote();
1832
+ $txnId = $helper->getQuoteXpcData($quote)->getData('txn_id');
 
 
 
1833
 
1834
+ if (empty($txnId)) {
 
1835
 
1836
+ // Processing of exception is performed in helper's funcPlaceOrder()
1837
+ throw new Exception('Unable to submit recurring profile. TxnId is empty');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1838
  }
1839
 
1840
+ $helper->writeLog('Quote customer ID', $quote->getCustomer()->getId());
1841
+
1842
+ if ($quote->getCustomer()->getId()) {
1843
+ $profile->setCustomerId($quote->getCustomer()->getId());
 
 
 
 
 
 
 
1844
  }
1845
 
1846
+ $profile->setReferenceId($txnId)->save();
1847
+
1848
+ $orderId = $helper->createOrder($profile, true);
1849
+
1850
+ $helper->getQuoteXpcData($quote)
1851
+ ->setData('recurring_order_id', $orderId)
1852
+ ->setData('recurring_profile_id', $profile->getInternalReferenceId())
1853
+ ->save();
1854
+
1855
+ $helper->writeLog('Submit recurring profile #' . $profile->getInternalReferenceId() . ' TxnId: ' . $txnId);
1856
  }
1857
 
1858
  /**
1912
  */
1913
  public function createFirstRecurringOrder(Mage_Payment_Model_Recurring_Profile $profile)
1914
  {
1915
+ $helper = Mage::helper('xpaymentsconnector');
1916
+ $cardData = $helper->getXpCardData();
1917
+
1918
+
1919
+ $helper->writeLog('Create first recurring order', $cardData, true);
1920
+
1921
  $cardData = $xpHelper->getXpCardData();
1922
  $orderId = $xpHelper->createOrder($profile, $isFirstRecurringOrder = true);
1923
 
app/code/community/Cdev/XPaymentsConnector/Model/Payment/Savedcards.php CHANGED
@@ -144,7 +144,7 @@ class Cdev_XPaymentsConnector_Model_Payment_Savedcards extends Mage_Payment_Mode
144
  $cardData = Mage::getModel('xpaymentsconnector/usercards')->load($paymentCardNumber);
145
  $txnid = $cardData->getData('txnId');
146
 
147
- if (!$xpHelper->checkIssetSimpleOrder()) {
148
  if(is_null($xpHelper->payDeferredProfileId)){
149
  $payDeferredSubscription = $xpHelper->payDeferredSubscription($profile);
150
  if(!$payDeferredSubscription){
144
  $cardData = Mage::getModel('xpaymentsconnector/usercards')->load($paymentCardNumber);
145
  $txnid = $cardData->getData('txnId');
146
 
147
+ if ($xpHelper->getRecurringQuoteItem()) {
148
  if(is_null($xpHelper->payDeferredProfileId)){
149
  $payDeferredSubscription = $xpHelper->payDeferredSubscription($profile);
150
  if(!$payDeferredSubscription){
app/code/community/Cdev/XPaymentsConnector/Model/Quote/Xpcdata.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * X-Payments Connector Data in quote
25
+ * Class Cdev_XPaymentsConnector_Model_FraudCheckData
26
+ */
27
+
28
+ class Cdev_XPaymentsConnector_Model_Quote_Xpcdata extends Mage_Core_Model_Abstract
29
+ {
30
+ /**
31
+ * Internal constructor
32
+ *
33
+ * @return void
34
+ */
35
+ protected function _construct()
36
+ {
37
+ $this->_init('xpaymentsconnector/quote_xpcdata');
38
+ }
39
+
40
+ /**
41
+ * Clear data
42
+ *
43
+ * @return void
44
+ */
45
+ public function clear()
46
+ {
47
+ $this->setData('txn_id', '')
48
+ ->setData('token', '')
49
+ ->setData('address_saved', false)
50
+ ->setData('recurring_order_id', 0)
51
+ ->setData('recurring_profile_id', 0)
52
+ ->setData('xpc_message', '')
53
+ ->setData('checkout_data', '')
54
+ ->save();
55
+ }
56
+ }
app/code/community/Cdev/XPaymentsConnector/controllers/Adminhtml/Sales/Order/FraudController.php CHANGED
@@ -37,7 +37,8 @@ class Cdev_XPaymentsConnector_Adminhtml_Sales_Order_FraudController extends Mage
37
  $result = $xpaymentCCModel->sendFraudRequest($xpcTxnid,'accept');
38
 
39
  if ($result) {
40
- $order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
 
41
  $order->save();
42
  }
43
  }
37
  $result = $xpaymentCCModel->sendFraudRequest($xpcTxnid,'accept');
38
 
39
  if ($result) {
40
+ // TODO: Make sure for authorized payments the correct status is set
41
+ $order->setStatus(Cdev_XPaymentsConnector_Helper_Data::STATUS_CHARGED);
42
  $order->save();
43
  }
44
  }
app/code/community/Cdev/XPaymentsConnector/controllers/{ControlController.php → Adminhtml/Settings/XpcController.php} RENAMED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -26,59 +27,69 @@
26
  * @see ____class_see____
27
  * @since 1.0.0
28
  */
29
- class Cdev_XPaymentsConnector_ControlController extends Mage_Adminhtml_Controller_Action
30
  {
 
 
31
  /**
32
- * General action
33
- *
34
  * @return void
35
- * @access public
36
- * @see ____func_see____
37
- * @since 1.0.0
38
  */
39
- public function indexAction()
40
  {
41
- $this->_title($this->__('System'))->_title($this->__('X-Payments connector control'));
42
 
43
- $this->loadLayout();
44
 
45
- $this->_setActiveMenu('system');
46
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'));
47
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('X-Payments connector control'), Mage::helper('adminhtml')->__('X-Payments connector control'));
48
 
49
- $block = $this->getLayout()->createBlock('xpaymentsconnector/control');
50
- $this->_addContent($block);
51
 
52
- $this->renderLayout();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
56
- * Test connection to X-Payments
57
  *
58
  * @return void
59
- * @access public
60
- * @see ____func_see____
61
- * @since 1.0.0
62
  */
63
- public function testAction()
64
  {
65
- $session = Mage::getSingleton('adminhtml/session');
66
 
67
- $model = Mage::getModel('xpaymentsconnector/payment_cc');
68
 
69
- try {
70
- if ($model->sendTestRequest()) {
71
- $session->addSuccess(Mage::helper('adminhtml')->__('The test transaction has been completed successfully.'));
72
 
73
- } else {
74
- $session->addError(Mage::helper('adminhtml')->__('Test transaction failed. Please check the X-Payment Connector settings and try again. If all options is ok review your X-Payments settings and make sure you have properly defined shopping cart properties.'));
75
- }
76
 
77
- } catch (Exception $e) {
78
- $session->addException($e, 'Test transaction failed. Please check the X-Payment Connector settings and try again. If all options is ok review your X-Payments settings and make sure you have properly defined shopping cart properties.');
79
- }
80
 
81
- $this->_redirect('*/*/index');
 
 
 
82
  }
83
 
84
  /**
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
27
  * @see ____class_see____
28
  * @since 1.0.0
29
  */
30
+ class Cdev_XPaymentsConnector_Adminhtml_Settings_XpcController extends Mage_Adminhtml_Controller_Action
31
  {
32
+ const ERROR_TEXT = 'Conection failed. Please check the X-Payment Connector settings and try again. If all options is ok review your X-Payments settings and make sure you have properly defined shopping cart properties.';
33
+
34
  /**
35
+ * Check connection with X-Payments via test request. Set the API version
36
+ *
37
  * @return void
 
 
 
38
  */
39
+ public function checkConnection()
40
  {
41
+ $session = Mage::getSingleton('adminhtml/session');
42
 
43
+ $model = Mage::getModel('xpaymentsconnector/payment_cc');
44
 
45
+ try {
 
 
46
 
47
+ $result = $model->sendTestRequest();
 
48
 
49
+ } catch (Exception $e) {
50
+
51
+ $result = false;
52
+ }
53
+
54
+ if ($result) {
55
+
56
+ $text = Mage::helper('adminhtml')->__('Connection with X-Payments is OK. API version: ')
57
+ . $model->getApiVersion();
58
+
59
+ $session->addSuccess($text);
60
+
61
+ } else {
62
+
63
+
64
+ $session->addError(
65
+ Mage::helper('adminhtml')->__(self::ERROR_TEXT)
66
+ );
67
+ }
68
  }
69
 
70
  /**
71
+ * General action
72
  *
73
  * @return void
 
 
 
74
  */
75
+ public function indexAction()
76
  {
77
+ $this->_title($this->__('System'))->_title($this->__('X-Payments Connector settings'));
78
 
79
+ $this->loadLayout();
80
 
81
+ $this->_setActiveMenu('system');
82
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'));
83
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('X-Payments connector control'), Mage::helper('adminhtml')->__('X-Payments Connector settings'));
84
 
85
+ $this->checkConnection();
 
 
86
 
87
+ $this->_initLayoutMessages('adminhtml/session');
 
 
88
 
89
+ $block = $this->getLayout()->createBlock('xpaymentsconnector/adminhtml_settings_xpc');
90
+ $this->_addContent($block);
91
+
92
+ $this->renderLayout();
93
  }
94
 
95
  /**
app/code/community/Cdev/XPaymentsConnector/controllers/ProcessingController.php CHANGED
@@ -79,6 +79,13 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
79
  $result = in_array($remoteAddr, $ips);
80
  }
81
 
 
 
 
 
 
 
 
82
  return $result;
83
  }
84
 
@@ -92,11 +99,18 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
92
  */
93
  protected function saveUserCard($cardData, $customerId)
94
  {
95
- $usercards = Mage::getModel('xpaymentsconnector/usercards');
 
 
 
 
 
 
 
96
 
97
  $data = array(
98
  'user_id' => $customerId,
99
- 'txnId' => $cardData['txnId'],
100
  'last_4_cc_num' => $cardData['last4'],
101
  'first6' => $cardData['first6'],
102
  'card_type' => $cardData['type'],
@@ -105,9 +119,11 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
105
  'usage_type' => Cdev_XPaymentsConnector_Model_Usercards::SIMPLE_CARD,
106
  );
107
 
108
- $usercards->setData($data);
 
 
109
 
110
- $usercards->save();
111
  }
112
 
113
  /**
@@ -155,37 +171,61 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
155
  }
156
 
157
  /**
158
- * Get error message from X-Payments callback data
159
- *
160
- * @param array $data Callback data
161
- *
162
- * @return string
 
163
  */
164
- protected function getResultMessage($data)
165
  {
166
- $message = array();
 
167
 
168
- // Regular message from X-Payments
169
- if (!empty($data['message'])) {
170
- $message[] = $data['message'];
171
- }
172
 
173
- if (isset($data['advinfo'])) {
 
 
 
 
174
 
175
- // Message from payment gateway
176
- if (isset($data['advinfo']['message'])) {
177
- $message[] = $data['advinfo']['message'];
178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
- // Message from 3-D Secure
181
- if (isset($data['advinfo']['s3d_message'])) {
182
- $message[] = $data['advinfo']['s3d_message'];
183
  }
184
- }
185
-
186
- $message = array_unique($message);
187
 
188
- return implode("\n", $message);
 
 
189
  }
190
 
191
  /**
@@ -206,6 +246,9 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
206
  !$order->getId()
207
  || empty($data['status'])
208
  ) {
 
 
 
209
  return;
210
  }
211
 
@@ -214,7 +257,7 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
214
  $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
215
  $api = Mage::getModel('xpaymentsconnector/payment_cc');
216
 
217
- $message = $this->getResultMessage($data);
218
 
219
  if (
220
  $api::AUTH_STATUS == $data['status']
@@ -223,27 +266,48 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
223
 
224
  // Success
225
 
226
- // Set X-Payments payment reference
227
- $order->getPayment()->setTransactionId($txnId);
228
 
229
- // Set AVS. Something wrong actually. Need to add cardValidation
230
- if (
231
- isset($data['advinfo'])
232
- && isset($data['advinfo']['AVS'])
233
- ) {
234
- $order->getPayment()->setCcAvsStatus($data['advinfo']['AVS']);
235
- }
 
 
 
236
 
237
- // Set status
238
- $status = $api::AUTH_STATUS == $data['status']
239
- ? Cdev_XPaymentsConnector_Helper_Data::STATE_XPAYMENTS_PENDING_PAYMENT
240
- : Mage_Sales_Model_Order::STATE_PROCESSING;
241
 
 
 
242
 
243
- // Set state
244
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
 
 
 
245
 
246
- } elseif ($api::DECLINED_STATUS == $data['status']) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  // Failure
249
 
@@ -251,13 +315,10 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
251
 
252
  $state = $status = $order::STATE_CANCELED;
253
 
254
- // Save error message in quote
255
- $helper->appendQuoteXpcData(
256
- $quote,
257
- array(
258
- 'xpc_message' => $message,
259
- )
260
- );
261
 
262
  $quote->setIsActive(true)->save();
263
  }
@@ -293,25 +354,42 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
293
  {
294
  $helper = Mage::helper('xpaymentsconnector');
295
 
296
- $response = array(
297
- 'status' => 'cart-changed',
298
- );
299
-
300
  $quote = Mage::getModel('sales/quote')->load($quoteId);
301
 
302
- // Place order
303
- $refId = $helper->funcPlaceOrder($quote);
304
 
305
- if ($refId) {
306
-
307
- // Cart data to update payment
308
- $preparedCart = $helper->prepareCart($quote, $refId);
309
 
310
- $response += array(
311
- 'ref_id' => $refId,
312
- 'cart' => $preparedCart,
313
  );
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  }
316
 
317
  return $response;
@@ -365,8 +443,7 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
365
 
366
  // Check IP addresses
367
  if (!$this->checkIpAdress()) {
368
- $api->getApiError('IP can\'t be validated as X-Payments server IP.');
369
- return;
370
  }
371
 
372
  $helper = Mage::helper('xpaymentsconnector');
@@ -413,6 +490,9 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
413
  // Save used credit card
414
  $this->processMaskedCardData($data, $request['txnId']);
415
 
 
 
 
416
  // Change order status according to the X-Payments payment status
417
  $this->processPaymentStatus($data, $request['txnId']);
418
 
@@ -609,9 +689,7 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
609
  */
610
  private function processSaveAddresses(Mage_Sales_Model_Quote $quote)
611
  {
612
- $data = Mage::helper('xpaymentsconnector')->loadQuoteXpcData($quote);
613
-
614
- if (!empty($data['address_saved'])) {
615
  // Address already saved during customer registration
616
  return;
617
  }
@@ -645,25 +723,15 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
645
  $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId);
646
  $session->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
647
 
648
- if (
649
- $order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING
650
- && $order->canInvoice()
651
- ) {
652
-
653
- // Auto create invoice for the charged payment
654
-
655
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
656
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
657
 
658
- $invoice->register();
659
-
660
- $transaction = Mage::getModel('core/resource_transaction')
661
- ->addObject($invoice)
662
- ->addObject($invoice->getOrder());
663
-
664
- $transaction->save();
665
  }
666
 
 
 
 
667
  // Save addresses in the adress book if necessary
668
  $this->processSaveAddresses($quote);
669
 
@@ -683,11 +751,11 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
683
  $session = $this->getOnePage()->getCheckout();
684
  $helper = Mage::helper('xpaymentsconnector');
685
 
686
- $data = $helper->loadQuoteXpcData($quote);
687
 
688
- $message = !empty($data['xpc_message'])
689
- ? $data['xpc_message']
690
- : 'Order declined. Try again';
691
 
692
  $session->clearHelperData();
693
 
@@ -710,11 +778,9 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
710
  {
711
  $helper = Mage::helper('xpaymentsconnector');
712
 
713
- $data = $helper->loadQuoteXpcData($quote);
714
 
715
- if (!empty($data['xpc_message'])) {
716
- $message = $data['xpc_message'];
717
- } else {
718
  $message = 'Order was lost';
719
  }
720
 
@@ -779,10 +845,27 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
779
  $helper = Mage::helper('xpaymentsconnector');
780
  $helper->writeLog('Customer returned from X-Payments', $request);
781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
782
  try {
783
 
784
- $quoteId = Mage::app()->getRequest()->getParam('quote_id');
785
- $quote = Mage::getModel('sales/quote')->load($quoteId);
786
  $order = $helper->getOrderByTxnId($request['txnId']);
787
 
788
  if (!$order->getId()) {
@@ -806,14 +889,10 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
806
 
807
  $order->save();
808
 
809
- // Login customer who's registered at checkout
810
- if ($helper->isCreateNewCustomer($quote, true)) {
811
- $customerId = $quote->getCustomer()->getId();
812
- Mage::getSingleton('customer/session')->loginById($customerId);
813
- }
814
-
815
  } catch (Mage_Core_Exception $e) {
816
 
 
 
817
  $this->_getCheckout()->addError($e->getMessage());
818
 
819
  $session->setXpcRedirectUrl(Mage::getUrl('checkout/onepage/failure'));
@@ -879,8 +958,10 @@ class Cdev_XPaymentsConnector_ProcessingController extends Mage_Core_Controller_
879
  $helper = Mage::helper('xpaymentsconnector');
880
 
881
  $quote = Mage::getSingleton('checkout/session')->getQuote();
882
- $helper->saveCheckoutData($quote, $request->getPost());
883
- $quote->save();
 
 
884
 
885
  if ($helper->checkFirecheckoutModuleEnabled()) {
886
  // return properly formatted {} for Firecheckout
79
  $result = in_array($remoteAddr, $ips);
80
  }
81
 
82
+ if (!$result) {
83
+ Mage::helper('xpaymentsconnector')->writeLog(
84
+ 'Received callback request from unallowed IP address: ' . $remoteAddr . PHP_EOL
85
+ . 'Allowed IP\'s are: ' . Mage::getStoreConfig('xpaymentsconnector/settings/xpay_allowed_ip_addresses')
86
+ );
87
+ }
88
+
89
  return $result;
90
  }
91
 
99
  */
100
  protected function saveUserCard($cardData, $customerId)
101
  {
102
+ $txnId = $cardData['txnId'];
103
+
104
+ // Try to find card with already existing txnId.
105
+ // Then update it or fill the empty found entity.
106
+ $usercards = Mage::getModel('xpaymentsconnector/usercards')
107
+ ->getCollection()
108
+ ->addFieldToFilter('txnId', $txnId)
109
+ ->getFirstItem();
110
 
111
  $data = array(
112
  'user_id' => $customerId,
113
+ 'txnId' => $txnId,
114
  'last_4_cc_num' => $cardData['last4'],
115
  'first6' => $cardData['first6'],
116
  'card_type' => $cardData['type'],
119
  'usage_type' => Cdev_XPaymentsConnector_Model_Usercards::SIMPLE_CARD,
120
  );
121
 
122
+ if ($usercards->getData('xp_card_id')) {
123
+ $data['xp_card_id'] = $usercards->getData('xp_card_id');
124
+ }
125
 
126
+ $usercards->setData($data)->save();
127
  }
128
 
129
  /**
171
  }
172
 
173
  /**
174
+ * Process fraud check data from the callback request
175
+ *
176
+ * @param array $data Update data
177
+ * @param string $txnId Payment reference
178
+ *
179
+ * @return void
180
  */
181
+ protected function processFraudCheckData($data, $txnId)
182
  {
183
+ $helper = Mage::helper('xpaymentsconnector');
184
+ $order = $helper->getOrderByTxnId($txnId);
185
 
186
+ try {
 
 
 
187
 
188
+ if (
189
+ $order->getId()
190
+ && !empty($data['fraudCheckData'])
191
+ && is_array($data['fraudCheckData'])
192
+ ) {
193
 
194
+ foreach ($data['fraudCheckData'] as $fraudCheckData) {
195
+
196
+ $model = Mage::getModel('xpaymentsconnector/fraudcheckdata')
197
+ ->getCollection()
198
+ ->addFieldToFilter('order_id', $order->getId())
199
+ ->addFieldToFilter('code', $fraudCheckData['code'])
200
+ ->getFirstItem();
201
+
202
+ $modelData = array(
203
+ 'order_id' => $order->getId(),
204
+ 'code' => $fraudCheckData['code'],
205
+ 'service' => $fraudCheckData['service'],
206
+ 'result' => $fraudCheckData['result'],
207
+ 'status' => $fraudCheckData['status'],
208
+ 'score' => isset($fraudCheckData['score']) ? $fraudCheckData['score'] : 0,
209
+ 'message' => isset($fraudCheckData['message']) ? $fraudCheckData['message'] : '',
210
+ 'transaction_id' => isset($fraudCheckData['transactionId']) ? $fraudCheckData['transactionId'] : '',
211
+ 'url' => isset($fraudCheckData['url']) ? $fraudCheckData['url'] : '',
212
+ 'errors' => isset($fraudCheckData['errors']) ? serialize($fraudCheckData['errors']) : '',
213
+ 'warnings' => isset($fraudCheckData['warnings']) ? serialize($fraudCheckData['warnings']) : '',
214
+ 'rules' => isset($fraudCheckData['rules']) ? serialize($fraudCheckData['rules']) : '',
215
+ 'data' => isset($fraudCheckData['data']) ? serialize($fraudCheckData['data']) : '',
216
+ );
217
+
218
+ if ($model->getData('data_id')) {
219
+ $modelData['data_id'] = $model->getData('data_id');
220
+ }
221
 
222
+ $model->setData($modelData)->save();
223
+ }
 
224
  }
 
 
 
225
 
226
+ } catch (Exception $e) {
227
+ $helper->writeLog('Error while saving fraud check data: ' . $e->getMessage(), $e->getTraceAsString());
228
+ }
229
  }
230
 
231
  /**
246
  !$order->getId()
247
  || empty($data['status'])
248
  ) {
249
+
250
+ $helper->writeLog('Order not found for ' . $txnId);
251
+
252
  return;
253
  }
254
 
257
  $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
258
  $api = Mage::getModel('xpaymentsconnector/payment_cc');
259
 
260
+ $message = $helper->getResultMessage($data);
261
 
262
  if (
263
  $api::AUTH_STATUS == $data['status']
266
 
267
  // Success
268
 
269
+ try {
 
270
 
271
+ // Set X-Payments payment reference
272
+ $order->getPayment()->setTransactionId($txnId);
273
+
274
+ // Set AVS. Something wrong actually. Need to add cardValidation
275
+ if (
276
+ isset($data['advinfo'])
277
+ && isset($data['advinfo']['AVS'])
278
+ ) {
279
+ $order->getPayment()->setCcAvsStatus($data['advinfo']['AVS']);
280
+ }
281
 
282
+ // Set status
283
+ $status = $api::AUTH_STATUS == $data['status']
284
+ ? Cdev_XPaymentsConnector_Helper_Data::STATUS_AUTHORIZED
285
+ : Cdev_XPaymentsConnector_Helper_Data::STATUS_CHARGED;
286
 
287
+ // Set state
288
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
289
 
290
+ $recurringProfile = $helper->getOrderRecurringProfile($order);
291
+
292
+ if ($recurringProfile) {
293
+ $recurringProfile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)->save();
294
+ }
295
 
296
+ } catch (Exception $e) {
297
+
298
+ // Something wrong has happened.
299
+ // Even if the payment is successfull, try to finalize the order correctly with failed status
300
+ $helper->writeLog('Exception while processing successful payment', $e->getMessage());
301
+ $data['status'] = $api::DECLINED_STATUS;
302
+
303
+ $message = $this->__(
304
+ 'Gateway reported about the successfull transaction, but the store cannot complete the order. Original response was: %s',
305
+ $message
306
+ );
307
+ }
308
+ }
309
+
310
+ if ($api::DECLINED_STATUS == $data['status']) {
311
 
312
  // Failure
313
 
315
 
316
  $state = $status = $order::STATE_CANCELED;
317
 
318
+ // Save error message for quote
319
+ $helper->getQuoteXpcData($quote)
320
+ ->setData('xpc_message', $message)
321
+ ->save();
 
 
 
322
 
323
  $quote->setIsActive(true)->save();
324
  }
354
  {
355
  $helper = Mage::helper('xpaymentsconnector');
356
 
 
 
 
 
357
  $quote = Mage::getModel('sales/quote')->load($quoteId);
358
 
359
+ if ($helper->getRecurringQuoteItem($quote)) {
 
360
 
361
+ // Place order with recurring profile.
362
+ // After that checking for nominal item is not possible.
363
+ $refId = $helper->funcPlaceOrder($quote);
 
364
 
365
+ // Send nominal items "as is"
366
+ $response = array(
367
+ 'status' => 'cart-not-changed',
368
  );
369
 
370
+ } else {
371
+
372
+ // Place regular order.
373
+ $refId = $helper->funcPlaceOrder($quote);
374
+
375
+ if ($refId) {
376
+
377
+ // Cart data to update payment
378
+ $preparedCart = $helper->prepareCart($quote, $refId);
379
+
380
+ $response = array(
381
+ 'status' => 'cart-changed',
382
+ 'ref_id' => $refId,
383
+ 'cart' => $preparedCart,
384
+ );
385
+
386
+ } else {
387
+
388
+ // This will decline payment
389
+ $response = array(
390
+ 'status' => 'cart-changed',
391
+ );
392
+ }
393
  }
394
 
395
  return $response;
443
 
444
  // Check IP addresses
445
  if (!$this->checkIpAdress()) {
446
+ exit;
 
447
  }
448
 
449
  $helper = Mage::helper('xpaymentsconnector');
490
  // Save used credit card
491
  $this->processMaskedCardData($data, $request['txnId']);
492
 
493
+ // Process fraud check data
494
+ $this->processFraudCheckData($data, $request['txnId']);
495
+
496
  // Change order status according to the X-Payments payment status
497
  $this->processPaymentStatus($data, $request['txnId']);
498
 
689
  */
690
  private function processSaveAddresses(Mage_Sales_Model_Quote $quote)
691
  {
692
+ if (Mage::helper('xpaymentsconnector')->getQuoteXpcData($quote)->getData('address_saved')) {
 
 
693
  // Address already saved during customer registration
694
  return;
695
  }
723
  $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId);
724
  $session->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
725
 
726
+ $profile = Mage::helper('xpaymentsconnector')->getOrderRecurringProfile($order);
 
 
 
 
 
 
 
 
727
 
728
+ if ($profile) {
729
+ $session->setLastRecurringProfileIds(array($profile->getProfileId()));
 
 
 
 
 
730
  }
731
 
732
+ // Auto create invoice if necessary
733
+ Mage::helper('xpaymentsconnector')->processCreateInvoice($order);
734
+
735
  // Save addresses in the adress book if necessary
736
  $this->processSaveAddresses($quote);
737
 
751
  $session = $this->getOnePage()->getCheckout();
752
  $helper = Mage::helper('xpaymentsconnector');
753
 
754
+ $message = $helper->getQuoteXpcData($quote)->getData('xpc_message');
755
 
756
+ if (!$message) {
757
+ $message = 'Order declined. Try again';
758
+ }
759
 
760
  $session->clearHelperData();
761
 
778
  {
779
  $helper = Mage::helper('xpaymentsconnector');
780
 
781
+ $message = $helper->getQuoteXpcData($quote)->getData('xpc_message');
782
 
783
+ if (!$message) {
 
 
784
  $message = 'Order was lost';
785
  }
786
 
845
  $helper = Mage::helper('xpaymentsconnector');
846
  $helper->writeLog('Customer returned from X-Payments', $request);
847
 
848
+ $quoteId = Mage::app()->getRequest()->getParam('quote_id');
849
+ $quote = Mage::getModel('sales/quote')->load($quoteId);
850
+
851
+ try {
852
+
853
+ // Log in customer who's registered at checkout
854
+ if ($helper->isCreateNewCustomer($quote, true)) {
855
+
856
+ $customerId = $quote->getCustomer()->getId();
857
+ $result = Mage::getSingleton('customer/session')->loginById($customerId);
858
+
859
+ $helper->writeLog('Log in customer who\'s registered at checkout: user #' . $customerId, $result);
860
+ }
861
+
862
+ } catch (Exception $e) {
863
+
864
+ $helper->writeLog('Unable to log in user registered at checkout. ' . $e->getMessage(), $e->getTraceAsString());
865
+ }
866
+
867
  try {
868
 
 
 
869
  $order = $helper->getOrderByTxnId($request['txnId']);
870
 
871
  if (!$order->getId()) {
889
 
890
  $order->save();
891
 
 
 
 
 
 
 
892
  } catch (Mage_Core_Exception $e) {
893
 
894
+ $helper->writeLog($e->getMessage(), $e->getTraceAsString());
895
+
896
  $this->_getCheckout()->addError($e->getMessage());
897
 
898
  $session->setXpcRedirectUrl(Mage::getUrl('checkout/onepage/failure'));
958
  $helper = Mage::helper('xpaymentsconnector');
959
 
960
  $quote = Mage::getSingleton('checkout/session')->getQuote();
961
+
962
+ $helper->getQuoteXpcData($quote)
963
+ ->setData('checkout_data', serialize($request->getPost()))
964
+ ->save();
965
 
966
  if ($helper->checkFirecheckoutModuleEnabled()) {
967
  // return properly formatted {} for Firecheckout
app/code/community/Cdev/XPaymentsConnector/etc/adminhtml.xml CHANGED
@@ -25,9 +25,9 @@
25
  <system>
26
  <children>
27
  <control translate="title" module="xpaymentsconnector">
28
- <title>X-Payments connector</title>
29
  <sort_order>300</sort_order>
30
- <action>xpaymentsconnector/control</action>
31
  </control>
32
  </children>
33
  </system>
@@ -39,12 +39,12 @@
39
  <system>
40
  <children>
41
  <control>
42
- <title>X-Payments connector</title>
43
  </control>
44
  <config>
45
  <children>
46
- <xpaymentsconnector>
47
- <title>X-Payments connector Settings</title>
48
  </xpaymentsconnector>
49
  </children>
50
  </config>
25
  <system>
26
  <children>
27
  <control translate="title" module="xpaymentsconnector">
28
+ <title>X-Payments Connector</title>
29
  <sort_order>300</sort_order>
30
+ <action>adminhtml/settings_xpc/index</action>
31
  </control>
32
  </children>
33
  </system>
39
  <system>
40
  <children>
41
  <control>
42
+ <title>X-Payments Connector</title>
43
  </control>
44
  <config>
45
  <children>
46
+ <xpaymentsconnector translate="title" module="xpaymentsconnector">
47
+ <title>X-Payments Connector Settings</title>
48
  </xpaymentsconnector>
49
  </children>
50
  </config>
app/code/community/Cdev/XPaymentsConnector/etc/config.xml CHANGED
@@ -1,4 +1,5 @@
1
  <?xml version="1.0"?>
 
2
  <!--
3
  /**
4
  * Magento
@@ -23,11 +24,11 @@
23
  <config>
24
  <modules>
25
  <Cdev_XPaymentsConnector>
26
- <version>1.1.2</version>
27
  </Cdev_XPaymentsConnector>
28
  </modules>
29
- <global>
30
- <models>
31
  <sales>
32
  <rewrite>
33
  <recurring_profile>Cdev_XPaymentsConnector_Model_Sales_Recurring_Profile</recurring_profile>
@@ -40,10 +41,10 @@
40
  <recurring_profile>Cdev_XPaymentsConnector_Model_Payment_Recurring_Profile</recurring_profile>
41
  </rewrite>
42
  </payment>
43
- <xpaymentsconnector>
44
- <class>Cdev_XPaymentsConnector_Model</class>
45
- <resourceModel>xpaymentsconnector_mysql4</resourceModel>
46
- </xpaymentsconnector>
47
  <xpaymentsconnector_mysql4>
48
  <class>Cdev_XPaymentsConnector_Model_Mysql4</class>
49
  <entities>
@@ -53,34 +54,40 @@
53
  <usercards>
54
  <table>xpayment_user_cards</table>
55
  </usercards>
 
 
 
 
 
 
56
  </entities>
57
  </xpaymentsconnector_mysql4>
58
- </models>
59
- <helpers>
60
- <xpaymentsconnector>
61
- <class>Cdev_XPaymentsConnector_Helper</class>
62
- </xpaymentsconnector>
63
- </helpers>
64
- <resources>
65
- <xpaymentsconnector_setup>
66
- <setup>
67
- <module>Cdev_XPaymentsConnector</module>
68
- </setup>
69
- <connection>
70
- <use>core_setup</use>
71
- </connection>
72
- </xpaymentsconnector_setup>
73
- <xpaymentsconnector_write>
74
- <connection>
75
- <use>core_write</use>
76
- </connection>
77
- </xpaymentsconnector_write>
78
- <xpaymentsconnector_read>
79
- <connection>
80
- <use>core_read</use>
81
- </connection>
82
- </xpaymentsconnector_read>
83
- </resources>
84
  <fieldsets>
85
  <sales_convert_quote>
86
  <xp_card_data>
@@ -89,13 +96,8 @@
89
  </sales_convert_quote>
90
  </fieldsets>
91
  <blocks>
92
- <customer>
93
- <rewrite>
94
- <account_navigation>Cdev_XPaymentsConnector_Block__Customer_Account_Navigation</account_navigation>
95
- </rewrite>
96
- </customer>
97
  <xpaymentsconnector>
98
- <class>Cdev_XPaymentsConnector_Block</class>
99
  </xpaymentsconnector>
100
  <checkout>
101
  <rewrite>
@@ -108,7 +110,7 @@
108
  <sales_order_view>Cdev_XPaymentsConnector_Block_Adminhtml_Sales_Order_View</sales_order_view>
109
  </rewrite>
110
  </adminhtml>
111
- </blocks>
112
  <events>
113
  <sales_order_payment_cancel_invoice>
114
  <observers>
@@ -326,48 +328,28 @@
326
  </nominal_totals>
327
  </quote>
328
  </sales>
329
- </global>
330
- <frontend>
331
- <routers>
332
- <xpaymentsconnector>
333
- <use>standard</use>
334
- <args>
335
- <module>Cdev_XPaymentsConnector</module>
336
- <frontName>xpaymentsconnector</frontName>
337
- </args>
338
- </xpaymentsconnector>
339
- </routers>
340
  <events>
341
  </events>
342
- <translate>
343
- <modules>
344
- <Cdev_XPaymentsConnector>
345
- <files>
346
- <default>Cdev_XPaymentsConnector.csv</default>
347
- </files>
348
- </Cdev_XPaymentsConnector>
349
- </modules>
350
- </translate>
351
- <layout>
352
- <updates>
353
- <xpaymentsconnector>
354
- <file>xpaymentsconnector.xml</file>
355
- </xpaymentsconnector>
356
- </updates>
357
- </layout>
358
- </frontend>
359
- <admin>
360
- <routers>
361
- <xpaymentsconnector>
362
- <use>admin</use>
363
- <args>
364
- <module>Cdev_XPaymentsConnector</module>
365
- <frontName>xpaymentsconnector</frontName>
366
- </args>
367
- </xpaymentsconnector>
368
- </routers>
369
- </admin>
370
- <adminhtml>
371
  <layout>
372
  <updates>
373
  <xpaymentsconnector>
@@ -375,26 +357,46 @@
375
  </xpaymentsconnector>
376
  </updates>
377
  </layout>
378
- <translate>
379
- <modules>
380
- <Cdev_XPaymentsConnector>
381
- <files>
382
- <default>Cdev_XPaymentsConnector.csv</default>
383
- </files>
384
- </Cdev_XPaymentsConnector>
385
- </modules>
386
- </translate>
387
- </adminhtml>
388
- <default>
389
- <payment>
390
- <xpayments>
391
- <active>0</active>
392
- <model>xpaymentsconnector/payment_cc</model>
393
- <order_status>1</order_status>
394
- <allowspecific>0</allowspecific>
395
- <title>Credit Card (X-Payments)</title>
396
- <use_iframe>1</use_iframe>
397
- </xpayments>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  <savedcards>
399
  <active>0</active>
400
  <model>xpaymentsconnector/payment_savedcards</model>
@@ -410,15 +412,15 @@
410
  <allowspecific>0</allowspecific>
411
  <title>Prepaid Payments (X-Payments)</title>
412
  </prepaidpayments>-->
413
- </payment>
414
- <xpaymentsconnector>
415
- <settings>
416
- <activationstatus>0</activationstatus>
417
  <xpay_minimum_payment_recurring_amount>0.5</xpay_minimum_payment_recurring_amount>
418
  <xpay_currency>USD</xpay_currency>
419
- </settings>
420
- </xpaymentsconnector>
421
- </default>
422
  <admin>
423
  <routers>
424
  <adminhtml>
1
  <?xml version="1.0"?>
2
+ <!-- vim: set ts=4 sw=4 sts=4 et: -->
3
  <!--
4
  /**
5
  * Magento
24
  <config>
25
  <modules>
26
  <Cdev_XPaymentsConnector>
27
+ <version>1.1.3</version>
28
  </Cdev_XPaymentsConnector>
29
  </modules>
30
+ <global>
31
+ <models>
32
  <sales>
33
  <rewrite>
34
  <recurring_profile>Cdev_XPaymentsConnector_Model_Sales_Recurring_Profile</recurring_profile>
41
  <recurring_profile>Cdev_XPaymentsConnector_Model_Payment_Recurring_Profile</recurring_profile>
42
  </rewrite>
43
  </payment>
44
+ <xpaymentsconnector>
45
+ <class>Cdev_XPaymentsConnector_Model</class>
46
+ <resourceModel>xpaymentsconnector_mysql4</resourceModel>
47
+ </xpaymentsconnector>
48
  <xpaymentsconnector_mysql4>
49
  <class>Cdev_XPaymentsConnector_Model_Mysql4</class>
50
  <entities>
54
  <usercards>
55
  <table>xpayment_user_cards</table>
56
  </usercards>
57
+ <quote_xpcdata>
58
+ <table>xpayment_quote_xpcdata</table>
59
+ </quote_xpcdata>
60
+ <fraudcheckdata>
61
+ <table>xpayment_fraud_check_data</table>
62
+ </fraudcheckdata>
63
  </entities>
64
  </xpaymentsconnector_mysql4>
65
+ </models>
66
+ <helpers>
67
+ <xpaymentsconnector>
68
+ <class>Cdev_XPaymentsConnector_Helper</class>
69
+ </xpaymentsconnector>
70
+ </helpers>
71
+ <resources>
72
+ <xpaymentsconnector_setup>
73
+ <setup>
74
+ <module>Cdev_XPaymentsConnector</module>
75
+ </setup>
76
+ <connection>
77
+ <use>core_setup</use>
78
+ </connection>
79
+ </xpaymentsconnector_setup>
80
+ <xpaymentsconnector_write>
81
+ <connection>
82
+ <use>core_write</use>
83
+ </connection>
84
+ </xpaymentsconnector_write>
85
+ <xpaymentsconnector_read>
86
+ <connection>
87
+ <use>core_read</use>
88
+ </connection>
89
+ </xpaymentsconnector_read>
90
+ </resources>
91
  <fieldsets>
92
  <sales_convert_quote>
93
  <xp_card_data>
96
  </sales_convert_quote>
97
  </fieldsets>
98
  <blocks>
 
 
 
 
 
99
  <xpaymentsconnector>
100
+ <class>Cdev_XPaymentsConnector_Block</class>
101
  </xpaymentsconnector>
102
  <checkout>
103
  <rewrite>
110
  <sales_order_view>Cdev_XPaymentsConnector_Block_Adminhtml_Sales_Order_View</sales_order_view>
111
  </rewrite>
112
  </adminhtml>
113
+ </blocks>
114
  <events>
115
  <sales_order_payment_cancel_invoice>
116
  <observers>
328
  </nominal_totals>
329
  </quote>
330
  </sales>
331
+ </global>
332
+ <frontend>
333
+ <routers>
334
+ <xpaymentsconnector>
335
+ <use>standard</use>
336
+ <args>
337
+ <module>Cdev_XPaymentsConnector</module>
338
+ <frontName>xpaymentsconnector</frontName>
339
+ </args>
340
+ </xpaymentsconnector>
341
+ </routers>
342
  <events>
343
  </events>
344
+ <translate>
345
+ <modules>
346
+ <Cdev_XPaymentsConnector>
347
+ <files>
348
+ <default>Cdev_XPaymentsConnector.csv</default>
349
+ </files>
350
+ </Cdev_XPaymentsConnector>
351
+ </modules>
352
+ </translate>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  <layout>
354
  <updates>
355
  <xpaymentsconnector>
357
  </xpaymentsconnector>
358
  </updates>
359
  </layout>
360
+ </frontend>
361
+ <admin>
362
+ <routers>
363
+ <xpaymentsconnector>
364
+ <use>admin</use>
365
+ <args>
366
+ <module>Cdev_XPaymentsConnector</module>
367
+ <frontName>xpaymentsconnector</frontName>
368
+ </args>
369
+ </xpaymentsconnector>
370
+ </routers>
371
+ </admin>
372
+ <adminhtml>
373
+ <layout>
374
+ <updates>
375
+ <xpaymentsconnector>
376
+ <file>xpaymentsconnector.xml</file>
377
+ </xpaymentsconnector>
378
+ </updates>
379
+ </layout>
380
+ <translate>
381
+ <modules>
382
+ <Cdev_XPaymentsConnector>
383
+ <files>
384
+ <default>Cdev_XPaymentsConnector.csv</default>
385
+ </files>
386
+ </Cdev_XPaymentsConnector>
387
+ </modules>
388
+ </translate>
389
+ </adminhtml>
390
+ <default>
391
+ <payment>
392
+ <xpayments>
393
+ <active>0</active>
394
+ <model>xpaymentsconnector/payment_cc</model>
395
+ <order_status>1</order_status>
396
+ <allowspecific>0</allowspecific>
397
+ <title>Credit Card (X-Payments)</title>
398
+ <use_iframe>1</use_iframe>
399
+ </xpayments>
400
  <savedcards>
401
  <active>0</active>
402
  <model>xpaymentsconnector/payment_savedcards</model>
412
  <allowspecific>0</allowspecific>
413
  <title>Prepaid Payments (X-Payments)</title>
414
  </prepaidpayments>-->
415
+ </payment>
416
+ <xpaymentsconnector>
417
+ <settings>
418
+ <activationstatus>0</activationstatus>
419
  <xpay_minimum_payment_recurring_amount>0.5</xpay_minimum_payment_recurring_amount>
420
  <xpay_currency>USD</xpay_currency>
421
+ </settings>
422
+ </xpaymentsconnector>
423
+ </default>
424
  <admin>
425
  <routers>
426
  <adminhtml>
app/code/community/Cdev/XPaymentsConnector/etc/system.xml CHANGED
@@ -223,8 +223,8 @@
223
  <show_in_store>0</show_in_store>
224
  </xpay_conf_bundle>
225
  <xpay_allowed_ip_addresses translate="label,comment">
226
- <label>IP addresses for X-Payments callbacks</label>
227
- <comment><![CDATA[X-Payments sends callback requests to the store from specific IP addresses. To secure the data transfer and avoid fraudulent requests, specify these IP addresses here as a comma-separated list. Usually it is IP address of the server where X-Payments is installed.]]></comment>
228
  <frontend_type>text</frontend_type>
229
  <sort_order>60</sort_order>
230
  <show_in_default>1</show_in_default>
@@ -249,6 +249,13 @@
249
  <show_in_website>0</show_in_website>
250
  <show_in_store>0</show_in_store>
251
  </xpay_minimum_payment_recurring_amount>
 
 
 
 
 
 
 
252
 
253
  </fields>
254
  <label>X-Payments Connector Settings</label>
223
  <show_in_store>0</show_in_store>
224
  </xpay_conf_bundle>
225
  <xpay_allowed_ip_addresses translate="label,comment">
226
+ <label>Allowed X-Payments IP addresses</label>
227
+ <comment><![CDATA[X-Payments sends callback requests to the store from specific IP addresses. To secure the data transfer and avoid fraudulent requests, specify these IP addresses here as a comma-separated list. Usually it is IP address of the server where X-Payments is installed.]]></comment>
228
  <frontend_type>text</frontend_type>
229
  <sort_order>60</sort_order>
230
  <show_in_default>1</show_in_default>
249
  <show_in_website>0</show_in_website>
250
  <show_in_store>0</show_in_store>
251
  </xpay_minimum_payment_recurring_amount>
252
+ <xpay_api_version>
253
+ <label>API version</label>
254
+ <sort_order>90</sort_order>
255
+ <show_in_default>0</show_in_default>
256
+ <show_in_website>0</show_in_website>
257
+ <show_in_store>0</show_in_store>
258
+ </xpay_api_version>
259
 
260
  </fields>
261
  <label>X-Payments Connector Settings</label>
app/code/community/Cdev/XPaymentsConnector/sql/xpaymentsconnector_setup/mysql4-upgrade-1.1.2-1.1.3.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * Used to store saved customer payment cards
25
+ */
26
+
27
+ $installer = $this;
28
+ $installer->startSetup();
29
+
30
+ $installer->run("
31
+ CREATE TABLE {$this->getTable('xpayment_quote_xpcdata')} (
32
+ `data_id` int(11) unsigned NOT NULL auto_increment,
33
+ `quote_id` int(11) NOT NULL default 0,
34
+ `payment_method_code` varchar(255) NOT NULL,
35
+ `txn_id` varchar(255) NOT NULL,
36
+ `token` varchar(255) NOT NULL,
37
+ `address_saved` BOOL default false,
38
+ `recurring_order_id` int(11) NOT NULL default 0,
39
+ `recurring_profile_id` int(11) NOT NULL default 0,
40
+ `xpc_message` TEXT,
41
+ `checkout_data` TEXT,
42
+ PRIMARY KEY (`data_id`)
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44
+
45
+ ");
46
+
47
+ $installer->run("
48
+ CREATE TABLE {$this->getTable('xpayment_fraud_check_data')} (
49
+ `data_id` int(11) unsigned NOT NULL auto_increment,
50
+ `order_id` int(11) NOT NULL default 0,
51
+ `code` varchar(255) NOT NULL,
52
+ `service` varchar(255) NOT NULL,
53
+ `result` int(11) NOT NULL,
54
+ `status` varchar(255) NOT NULL,
55
+ `score` int(11) NOT NULL,
56
+ `message` varchar(255) NOT NULL,
57
+ `transaction_id` varchar(255) NOT NULL,
58
+ `url` varchar(255) NOT NULL,
59
+ `errors` varchar(255) NOT NULL,
60
+ `warnings` varchar(255) NOT NULL,
61
+ `rules` varchar(255) NOT NULL,
62
+ `data` varchar(255) NOT NULL,
63
+ PRIMARY KEY (data_id)
64
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
65
+
66
+ ");
67
+
68
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/xpaymentsconnector.xml CHANGED
@@ -93,13 +93,13 @@
93
  </reference>
94
  </adminhtml_system_config_edit>
95
 
96
- <xpaymentsconnector_control_index>
97
  <reference name="head">
98
  <action method="addItem">
99
  <type>js_css</type>
100
- <name>xpayment/xp-contorl.css</name>
101
  </action>
102
  </reference>
103
- </xpaymentsconnector_control_index>
104
 
105
  </layout>
93
  </reference>
94
  </adminhtml_system_config_edit>
95
 
96
+ <adminhtml_settings_xpc_index>
97
  <reference name="head">
98
  <action method="addItem">
99
  <type>js_css</type>
100
+ <name>xpayment/settings-xpc.css</name>
101
  </action>
102
  </reference>
103
+ </adminhtml_settings_xpc_index>
104
 
105
  </layout>
app/design/adminhtml/default/default/template/xpaymentsconnector/control.phtml DELETED
@@ -1,212 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @author Qualiteam Software info@qtmsoft.com
16
- * @category Cdev
17
- * @package Cdev_XPaymentsConnector
18
- * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
- ?>
22
- <?php
23
- /**
24
- * @see Cdev_XPaymentsConnector_Block_Control
25
- */
26
- ?>
27
- <?php if ($this->getRequiremenetsErrors()) { ?>
28
-
29
- <h4><?php echo $this->__('Failed to meet environment requirements'); ?></h4>
30
- <ul>
31
- <?php foreach ($this->getRequiremenetsErrors() as $err) { ?>
32
- <li class="error"><?php echo $this->__($err); ?></li>
33
- <?php } ?>
34
- </ul>
35
- <br/>
36
- <?php } ?>
37
-
38
- <div class="xpayment-info">
39
- <div class="content-header">
40
- <table cellspacing="0">
41
- <tbody>
42
- <tr>
43
- <td>
44
- <h3>
45
- <?php echo $this->__('X-Payments connector'); ?>
46
- </h3>
47
- </td>
48
- </tr>
49
- </tbody>
50
- </table>
51
- </div>
52
-
53
- <?php if ($this->getConfigurationErrors()) { ?>
54
- <p><strong>
55
- <h4 class="sub-heading">
56
- <?php echo $this->__('X-Payments not configured yet. Please, check x-payment'); ?>
57
- <a href="<?php echo $this->getUrl('adminhtml/system_config/edit/section/xpaymentsconnector/'); ?>"
58
- target="_blank">
59
- <strong>
60
- <?php echo $this->__('settings') ?>
61
- </strong>
62
- </a>
63
- </h4>
64
- </strong>
65
- </p>
66
-
67
- <div class="payment-description">
68
- <div class="payment-logo">
69
- <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/xpayment-logo.png'; ?>"
70
- alt="xpayments connector"/>
71
- </div>
72
- <div class="description-block">
73
- <p>
74
-
75
- <?php
76
- $xpDescr = "Give your customers – and yourself – peace of mind with this payment processing module "
77
- . "that guarantees compliance with PCI security mandates, significantly reduces the risk of "
78
- . "data breaches and ensures you won’t be hit with a fine of up to $500,000 for non-compliance. "
79
- . "Safely and conveniently store customers credit card information to use for new orders, reorders "
80
- . "or recurring payments.";
81
- echo $this->__($xpDescr); ?>
82
- </p>
83
- </div>
84
- </div>
85
-
86
- <h4>
87
- <?php echo $this->__('Connect to X-Payments in 3 easy steps:'); ?>
88
- </h4>
89
- <div class="payment-step">
90
- <div class="step">
91
- <span class="step-number">1</span>
92
- <p><?php echo $this->__('Open your'); ?>
93
- <a href="http://www.x-payments.com/trial-demo.html?utm_source=mage_shop&utm_medium=link&utm_campaign=mage_shop_link"
94
- target="_blank">
95
- <?php echo $this->__('X-Payments'); ?>
96
- </a>
97
- <?php echo $this->__('back-end (if you do not have it)'); ?>
98
- </p>
99
- <button onclick="window.open('http://www.x-payments.com/trial-demo.html?utm_source=mage_shop&utm_medium=link&utm_campaign=mage_shop_link');">
100
- <span>
101
- <span>
102
- <span>
103
- <?php echo $this->__('Start free Trial'); ?>
104
- </span>
105
- </span>
106
- </span>
107
- </button>
108
- </div>
109
- <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/atep-arrow.png' ?>" class=" step-arrow">
110
- <div class="step">
111
- <span class="step-number">2</span>
112
-
113
- <p>
114
- <?php echo $this->__('Configure payment methods at'); ?>
115
- <strong>
116
- <?php echo $this->__('X-Payments'); ?>
117
- </strong>
118
- </p>
119
- <a href="http://help.x-cart.com/index.php?title=X-Payments:User_manual#Online_Stores" target="_blank">
120
- <?php echo $this->__('Read how to do that'); ?>
121
- </a>
122
- </div>
123
- <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/atep-arrow.png' ?>" class=" step-arrow">
124
- <div class="step">
125
- <span class="step-number">3</span>
126
- <p>
127
- <?php echo $this->__('Connect'); ?>
128
- <strong>
129
- <?php echo $this->__('X-Payments'); ?>
130
- </strong>
131
- <?php echo $this->__('with'); ?>
132
- <strong>
133
- <?php echo $this->__('Magento'); ?>
134
- </strong>
135
- </p>
136
- <a href="https://www.youtube.com/embed/2VRR0JW23qc" target="_blank">See how to do that</a>
137
- </div>
138
- </div>
139
- <?php } ?>
140
- </div>
141
- <?php if ($this->getConfigurationErrors()): ?>
142
- <hr/>
143
- <?php endif; ?>
144
- <br/>
145
-
146
- <h4><?php echo $this->__('Test module'); ?></h4>
147
-
148
- <p><?php echo $this->__("To test the module settings and connection with X-Payments click the button below. If the module is configured properly, a 'Test transaction completed successfully' message will be displayed at the top of the page."); ?></p>
149
-
150
- <form action="<?php echo $this->getUrl('xpaymentsconnector/control/test'); ?>" method="post" name="testmodule_form">
151
- <?php echo $this->getBlockHtml('formkey'); ?>
152
- <?php echo $this->getChildHtml('testButton'); ?>
153
- </form>
154
-
155
- <br/>
156
- <br/>
157
-
158
- <h4><?php echo $this->__('Import payment methods'); ?></h4>
159
-
160
- <p><?php echo $this->__('To be able to use X-Payments payment methods you need to import them from X-Payments first.'); ?></p>
161
-
162
- <?php if ($this->isMethodsRequested()) { ?>
163
-
164
- <?php echo $this->__('The list of payment configurations imported from X-Payments'); ?>:<br/>
165
-
166
- <div class="grid">
167
- <table cellpadding="5" cellspacing="1">
168
- <tr class="headings">
169
- <th><?php echo $this->__('Payment method'); ?></th>
170
- <th><?php echo $this->__('Payment method ID'); ?></th>
171
- <th><?php echo $this->__('Auth'); ?></th>
172
- </tr>
173
-
174
- <?php foreach ($this->getPaymentMethods() as $pm) { ?>
175
-
176
- <tr>
177
- <td><?php echo $pm['name']; ?></td>
178
- <td><?php echo $pm['confid']; ?></td>
179
- <td><?php if ($pm['is_auth']) { ?><?php echo $this->__('Yes'); ?><?php } else { ?><?php echo $this->__('No'); ?><?php } ?></td>
180
- </tr>
181
-
182
- <?php } ?>
183
-
184
- </table>
185
- </div>
186
-
187
- <form action="<?php echo $this->getUrl('xpaymentsconnector/control/clear'); ?>" method="post" name="clear_form">
188
- <?php echo $this->getBlockHtml('formkey'); ?>
189
- <?php echo $this->getChildHtml('clearButton'); ?>
190
- </form>
191
-
192
- <?php if ($this->isMethodsAlreadyImported()) { ?>
193
- <br/>
194
- <br/>
195
- <p><?php echo $this->__('Warning! Importing payment configurations from X-Payments will disable the X-Payments connector payment method!'); ?></p>
196
- <?php } ?>
197
-
198
- <?php } ?>
199
-
200
- <form action="<?php echo $this->getUrl('xpaymentsconnector/control/request'); ?>" method="post" name="request_form">
201
- <?php echo $this->getBlockHtml('formkey'); ?>
202
- <?php echo $this->getChildHtml('requestButton'); ?>
203
- </form>
204
-
205
- <br/>
206
- <br/>
207
- <h4>
208
- <?php echo $this->__('Need help in settings of x-payments?'); ?>
209
- <a href="http://www.x-payments.com/contact-us.html?utm_source=mage_shop&utm_medium=link&utm_campaign=mage_shop_link" target="_blank">
210
- <?php echo $this->__('Contact us!'); ?>
211
- </a>
212
- </h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/xpaymentsconnector/order/view/tab/xporderstate.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
@@ -274,3 +274,96 @@
274
  <?php else: ?>
275
  <?php echo $xpaymentsOrderInfo["error_message"];?>
276
  <?php endif;?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ // vim: set ts=2 sw=2 sts=2 et:
3
  /**
4
  * Magento
5
  *
274
  <?php else: ?>
275
  <?php echo $xpaymentsOrderInfo["error_message"];?>
276
  <?php endif;?>
277
+
278
+ <?php
279
+
280
+ $fraudCheckData = Mage::getModel('xpaymentsconnector/fraudcheckdata')
281
+ ->getCollection()
282
+ ->addFieldToFilter('order_id', $this->getOrder()->getId());
283
+ ?>
284
+
285
+ <?php foreach ($fraudCheckData as $data): ?>
286
+ <div class="entry-edit">
287
+ <div class="entry-edit-head">
288
+ <h4><?php echo $this->__($data->getData('service')); ?></h4>
289
+ </div>
290
+ <div class="fieldset">
291
+ <table cellspacing="0" class="form-list">
292
+ <tr>
293
+ <td class="label"><?php echo $this->__('Result'); ?></td>
294
+ <td class="value">
295
+ <?php if ('1' == $data->getData('result')): ?>
296
+ <strong><?php echo $this->__('Antifraud check passed'); ?></strong>
297
+ <?php elseif ('2' == $data->getData('result') && 'nofraud' == $data->getData('code')): ?>
298
+ <strong><?php echo $this->__('Being Reviewed by NoFraud'); ?></strong>
299
+ <?php elseif ('2' == $data->getData('result')): ?>
300
+ <strong><?php echo $this->__('Manual Review required'); ?></strong>
301
+ <?php elseif ('3' == $data->getData('result')): ?>
302
+ <strong><?php echo $this->__('High fraud risk detected'); ?></strong>
303
+ <?php else: ?>
304
+ <strong><?php echo $this->__('Unknown'); ?></strong>
305
+ <?php endif; ?>
306
+ </td>
307
+ </td>
308
+ <tr>
309
+ <td class="label"><?php echo $this->__('Status'); ?></td>
310
+ <td class="value"><strong><?php echo $data->getData('status'); ?></strong></td>
311
+ </td>
312
+ <?php if ($data->getData('score')): ?>
313
+ <tr>
314
+ <td class="label"><?php echo $this->__('Score'); ?></td>
315
+ <td class="value"><strong><?php echo $data->getData('score'); ?></strong></td>
316
+ </td>
317
+ <?php endif; ?>
318
+ <?php if ($data->getData('transaction_id')): ?>
319
+ <tr>
320
+ <td class="label"><?php echo $this->__('Transaction ID'); ?></td>
321
+ <td class="value">
322
+ <?php if ($data->getData('url')): ?>
323
+ <strong><a href="<?php echo $data->getData('url'); ?>" target="_blank"><?php echo $data->getData('transaction_id'); ?></a></strong>
324
+ <?php else: ?>
325
+ <strong><?php echo $data->getData('transaction_id'); ?></strong>
326
+ <?php endif; ?>
327
+ </td>
328
+ </td>
329
+ <?php endif; ?>
330
+ <?php if ($data->getData('rules')): ?>
331
+ <tr>
332
+ <td class="label"><?php echo $this->__('Triggered rules'); ?></td>
333
+ <td class="value">
334
+ <ul>
335
+ <?php foreach ($data->getRulesList() as $rule): ?>
336
+ <li><?php echo $rule; ?></li>
337
+ <?php endforeach; ?>
338
+ </ul>
339
+ </td>
340
+ </td>
341
+ <?php endif; ?>
342
+ <?php if ($data->getData('errors')): ?>
343
+ <tr>
344
+ <td class="label"><?php echo $this->__('Errors'); ?></td>
345
+ <td class="value">
346
+ <ul>
347
+ <?php foreach ($data->getErrorsList() as $error): ?>
348
+ <li><?php echo $error; ?></li>
349
+ <?php endforeach; ?>
350
+ </ul>
351
+ </td>
352
+ </td>
353
+ <?php endif; ?>
354
+ <?php if ($data->getData('warnings')): ?>
355
+ <tr>
356
+ <td class="label"><?php echo $this->__('Warnings'); ?></td>
357
+ <td class="value">
358
+ <ul>
359
+ <?php foreach ($data->getWarningsList() as $warning): ?>
360
+ <li><?php echo $warning; ?></li>
361
+ <?php endforeach; ?>
362
+ </ul>
363
+ </td>
364
+ </td>
365
+ <?php endif; ?>
366
+ </table>
367
+ </div>
368
+ </div>
369
+ <?php endforeach; ?>
app/design/adminhtml/default/default/template/xpaymentsconnector/settings/xpc.phtml ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // vim: set ts=2 sw=2 sts=2 et:
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @author Qualiteam Software info@qtmsoft.com
17
+ * @category Cdev
18
+ * @package Cdev_XPaymentsConnector
19
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ ?>
23
+ <?php
24
+ /**
25
+ * @see Cdev_XPaymentsConnector_Block_Adminhtml_Settings_Xpc
26
+ */
27
+ ?>
28
+ <?php if ($this->getRequiremenetsErrors()): ?>
29
+
30
+ <h4><?php echo $this->__('Failed to meet environment requirements'); ?></h4>
31
+
32
+ <ul>
33
+ <?php foreach ($this->getRequiremenetsErrors() as $err): ?>
34
+ <li class="error">
35
+ <?php echo $this->__($err); ?>
36
+ </li>
37
+ <?php endforeach; ?>
38
+ </ul>
39
+
40
+ <br/>
41
+
42
+ <?php endif; ?>
43
+
44
+ <div class="xpayment-info">
45
+
46
+ <div class="content-header">
47
+ <table cellspacing="0">
48
+ <tr>
49
+ <td><h3><?php echo $this->__('X-Payments Connector'); ?></h3></td>
50
+ </tr>
51
+ </table>
52
+ </div>
53
+
54
+ <?php if ($this->getConfigurationErrors()): ?>
55
+
56
+ <h4 class="sub-heading">
57
+ <?php echo $this->__('X-Payments Connector is not configured yet. Please, check'); ?>
58
+ <a href="<?php echo $this->getSystemConfigXpcUrl(); ?>" target="_blank"><?php echo $this->__('settings') ?></a>
59
+ </h4>
60
+
61
+ <div class="payment-description">
62
+
63
+ <div class="payment-logo">
64
+ <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/xpayment-logo.png'; ?>" alt="X-Payments Connector"/>
65
+ </div>
66
+
67
+ <div class="description-block">
68
+ <p>
69
+ <?php echo $this->getDescription(); ?>
70
+ </p>
71
+ </div>
72
+
73
+ </div>
74
+
75
+ <h4>
76
+ <?php echo $this->__('Connect to X-Payments in 3 easy steps:'); ?>
77
+ </h4>
78
+
79
+ <div class="payment-step">
80
+
81
+ <div class="step">
82
+ <span class="step-number">1</span>
83
+ <p>
84
+ <?php echo $this->__('Open your'); ?>
85
+ <a href="<?php echo $this->getTrialDemoUrl(); ?>" target="_blank"><?php echo $this->__('X-Payments'); ?></a>
86
+ <?php echo $this->__('back-end (if you do not have it)'); ?>
87
+ </p>
88
+ <button onclick="javascript: window.open('<?php echo $this->getTrialDemoUrl(); ?>');">
89
+ <?php echo $this->__('Start free Trial'); ?>
90
+ </button>
91
+ </div>
92
+
93
+ <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/atep-arrow.png' ?>" class="step-arrow">
94
+
95
+ <div class="step">
96
+ <span class="step-number">2</span>
97
+ <p>
98
+ <?php echo $this->__('Configure payment methods at'); ?>
99
+ <strong style="white-space: nowrap;"><?php echo $this->__('X-Payments'); ?></strong>
100
+ </p>
101
+ <a href="<?php echo $this->getUserManualUrl(); ?>" target="_blank"><?php echo $this->__('Read how to do that'); ?></a>
102
+ </div>
103
+
104
+ <img src="<?php echo Mage::getBaseUrl('js') . 'xpayment/images/atep-arrow.png' ?>" class="step-arrow">
105
+
106
+ <div class="step">
107
+ <span class="step-number">3</span>
108
+ <p>
109
+ <?php echo $this->__('Connect'); ?>
110
+ <strong><?php echo $this->__('X-Payments'); ?></strong>
111
+ <?php echo $this->__('with'); ?>
112
+ <strong><?php echo $this->__('Magento'); ?></strong>
113
+ </p>
114
+ <a href="<?php echo $this->getUserVideoUrl(); ?>" target="_blank"><?php echo $this->__('See how to do that'); ?></a>
115
+ </div>
116
+
117
+ </div>
118
+
119
+ <hr/>
120
+
121
+ <?php endif; ?>
122
+
123
+ </div>
124
+
125
+ <br/>
126
+
127
+ <h4><?php echo $this->__('Import payment methods'); ?></h4>
128
+
129
+ <p><?php echo $this->__('To be able to use X-Payments payment methods you need to import them from X-Payments first.'); ?></p>
130
+
131
+ <?php if ($this->isMethodsRequested()) { ?>
132
+
133
+ <?php echo $this->__('The list of payment configurations imported from X-Payments'); ?>:<br/>
134
+
135
+ <div class="grid">
136
+ <table cellpadding="5" cellspacing="1">
137
+ <tr class="headings">
138
+ <th><?php echo $this->__('Payment method'); ?></th>
139
+ <th><?php echo $this->__('Payment method ID'); ?></th>
140
+ <th><?php echo $this->__('Auth'); ?></th>
141
+ </tr>
142
+
143
+ <?php foreach ($this->getPaymentMethods() as $pm) { ?>
144
+
145
+ <tr>
146
+ <td><?php echo $pm['name']; ?></td>
147
+ <td><?php echo $pm['confid']; ?></td>
148
+ <td><?php if ($pm['is_auth']) { ?><?php echo $this->__('Yes'); ?><?php } else { ?><?php echo $this->__('No'); ?><?php } ?></td>
149
+ </tr>
150
+
151
+ <?php } ?>
152
+
153
+ </table>
154
+ </div>
155
+
156
+ <form action="<?php echo $this->getUrl('adminhtml/settings_xpc/clear'); ?>" method="post" name="clear_form">
157
+ <?php echo $this->getBlockHtml('formkey'); ?>
158
+ <?php echo $this->getChildHtml('clearButton'); ?>
159
+ </form>
160
+
161
+ <?php if ($this->isMethodsAlreadyImported()) { ?>
162
+ <br/>
163
+ <br/>
164
+ <p><?php echo $this->__('Warning! Importing payment configurations from X-Payments will disable the X-Payments connector payment method!'); ?></p>
165
+ <?php } ?>
166
+
167
+ <?php } ?>
168
+
169
+ <form action="<?php echo $this->getUrl('adminhtml/settings_xpc/request'); ?>" method="post" name="request_form">
170
+ <?php echo $this->getBlockHtml('formkey'); ?>
171
+ <?php echo $this->getChildHtml('requestButton'); ?>
172
+ </form>
173
+
174
+ <br/>
175
+ <br/>
176
+ <h4>
177
+ <?php echo $this->__('Need help in settings of X-Payments?'); ?>
178
+ <a href="<?php echo $this->getContactUsUrl(); ?>" target="_blank"><?php echo $this->__('Contact us!'); ?></a>
179
+ </h4>
app/design/frontend/base/default/layout/xpaymentsconnector.xml CHANGED
@@ -153,7 +153,7 @@ vim: set ts=4 sw=4 sts=4 et:
153
  </action>
154
  </reference>
155
  <reference name="customer_account_navigation">
156
- <action method="addLink" translate="label" module="xpaymentsconnector">
157
  <name>customer_usercards</name>
158
  <path>xpaymentsconnector/customer/usercards</path>
159
  <label>My Payment Cards</label>
153
  </action>
154
  </reference>
155
  <reference name="customer_account_navigation">
156
+ <action method="addLink" translate="label" module="xpaymentsconnector" ifconfig="payment/savedcards/active">
157
  <name>customer_usercards</name>
158
  <path>xpaymentsconnector/customer/usercards</path>
159
  <label>My Payment Cards</label>
app/design/frontend/base/default/template/xpaymentsconnector/checkout/success.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Magento
4
  *
@@ -23,8 +24,9 @@
23
  * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
- ?>
27
 
 
 
28
  <div class="page-title">
29
  <h1>
30
  <?php if ($this->checkOrderSuccess()): ?>
@@ -62,12 +64,20 @@
62
  <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
63
  <?php endif;?>
64
 
65
- <?php if ($profiles = $this->getRecurringProfiles() && $this->checkOrderSuccess()):?>
 
66
  <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
67
  <ul class="disc">
68
  <?php foreach($profiles as $profile):?>
69
- <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id'))); ?>
70
- <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description'))) ?></li>
 
 
 
 
 
 
 
71
  <?php endforeach;?>
72
  </ul>
73
  <?php endif;?>
1
  <?php
2
+ // vim: set ts=4 sw=4 sts=4 et:
3
  /**
4
  * Magento
5
  *
24
  * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
25
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
  */
 
27
 
28
+ $profiles = $this->getRecurringProfiles();
29
+ ?>
30
  <div class="page-title">
31
  <h1>
32
  <?php if ($this->checkOrderSuccess()): ?>
64
  <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
65
  <?php endif;?>
66
 
67
+ <?php if ($profiles && $this->checkOrderSuccess()): ?>
68
+
69
  <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
70
  <ul class="disc">
71
  <?php foreach($profiles as $profile):?>
72
+ <li>
73
+ <?php echo $this->__('Payment profile #'); ?>
74
+ <?php if ($this->getCanViewProfiles()): ?>
75
+ <a href="<?php echo $this->escapeHtml($this->getProfileUrl($profile)); ?>"><?php echo $profile->getReferenceId(); ?></a>
76
+ <?php else: ?>
77
+ <?php echo $profile->getReferenceId(); ?>
78
+ <?php endif; ?>
79
+ : <?php echo $profile->getScheduleDescription(); ?>
80
+ </li>
81
  <?php endforeach;?>
82
  </ul>
83
  <?php endif;?>
app/design/frontend/base/default/template/xpaymentsconnector/info/cc.phtml CHANGED
@@ -43,6 +43,6 @@ if ($order) {
43
 
44
  <?php if ($cardData): ?>
45
  <span id="x-payment-prepaid-card-info">
46
- <?php echo $this->__('Credit card used for this order: %s', $cardData); ?>
47
  </span>
48
  <?php endif; ?>
43
 
44
  <?php if ($cardData): ?>
45
  <span id="x-payment-prepaid-card-info">
46
+ <?php echo $this->__('Payment card used for this order: %s', $cardData); ?>
47
  </span>
48
  <?php endif; ?>
js/xpayment/{xp-contorl.css → settings-xpc.css} RENAMED
@@ -1,3 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .xpayment-info .payment-step {
2
  padding-bottom: 64px;
3
  }
@@ -70,4 +96,4 @@
70
 
71
  .payment-step p {
72
  margin: 0 0 20px;
73
- }
1
+ /**
2
+ vim: set ts=4 sw=4 sts=4 et:
3
+ * X-Payments Connector Settings
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @author Qualiteam Software info@qtmsoft.com
16
+ * @category Cdev
17
+ * @package Cdev_XPaymentsConnector
18
+ * @copyright (c) 2010-2016 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ .xpayment-info h4 a,
23
+ .xpayment-info h4 a:hover {
24
+ font-weight: bold;
25
+ }
26
+
27
  .xpayment-info .payment-step {
28
  padding-bottom: 64px;
29
  }
96
 
97
  .payment-step p {
98
  margin: 0 0 20px;
99
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CDev_XPaymentsConnector</name>
4
- <version>1.7.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
@@ -11,23 +11,35 @@
11
  This extension integrates Magento with X-Payments - a PA-DSS certified payment module.</description>
12
  <notes>What's new?&#xD;
13
  &#xD;
14
- - Re-factored code that implements Magento communication with X-Payments, namely: changed order placing procedure, fixed "The txnId field is missing or incorrect" and other errors.&#xD;
15
  &#xD;
16
- - Support of X-Payments v3.0 API 1.6: new templates, improved operating of recurring charges.&#xD;
17
  &#xD;
18
- - Improved look and feel of X-Payments credit card form. Credit card form displaying is now allowed before entering the address details.&#xD;
19
  &#xD;
20
- - Improved errors processing (from X-Payments, from payment gateways etc).&#xD;
21
  &#xD;
22
- - Integrated with One Step Checkout (http://www.onestepcheckout.com)&#xD;
23
  &#xD;
24
- - Integrated with Firecheckout (http://www.firecheckout.com)&#xD;
25
  &#xD;
26
- - Export to Stone Edge order manager</notes>
 
 
 
 
 
 
 
 
 
 
 
 
27
  <authors><author><name>Alexander Mulin</name><user>xpayments</user><email>alex.mulin@x-payments.com</email></author></authors>
28
- <date>2016-07-22</date>
29
- <time>17:58:44</time>
30
- <contents><target name="magecommunity"><dir name="Cdev"><dir name="XPaymentsConnector"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Renderer"><file name="Cardnumber.php" hash="208d21b744e56583b868038a0410b4f7"/><file name="Cardtype.php" hash="a2428e2e572e4d4a8cec6fd4b9519807"/><file name="Txnid.php" hash="27ef7dcdcb042b270758dbed42888e93"/></dir><dir name="Tab"><file name="Usercards.php" hash="958a1e10005ee9109e85d7e9ca448251"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Xporderstate.php" hash="bf18faf8efa855d23a098c0a79d3da43"/></dir></dir><file name="View.php" hash="8e26bb4e8c69e388aaec6a5b3709ca9c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Subselect.php" hash="4386558bb6ea49f56fb72e04cb1ed7a1"/></dir></dir></dir><dir name="Usercards"><file name="Grid.php" hash="98675f504e5ad16f25fa56b1222fb233"/></dir></dir><file name="Beforesuccess.php" hash="6a2d9e8742024b527efa9b64bb8c2d1d"/><file name="Cancel.php" hash="a119a76eb7b3d829df844a1450ebbf4d"/><dir name="Checkout"><dir name="Onepage"><file name="Orderdetail.php" hash="87bd0df83e6f5599d722ddc5e634db5a"/><file name="Settings.php" hash="366aa9c1ecb505be9b141c33e4f48983"/><file name="Success.php" hash="1a088733576ad7b07f5c9b42a9b073e3"/></dir></dir><file name="Control.php" hash="4ca05330579dd64dc492ef071b9fa820"/><dir name="Customer"><dir name="Account"><file name="Navigation.php" hash="e09c51996c7e0430d32f8a34479853da"/></dir><file name="Cardadd.php" hash="4fbb08e3a63034d4f4e3132f6a462902"/><file name="Success.php" hash="626854ad5b66983245ca05fec3139d10"/><file name="Usercards.php" hash="dacb606ccd0fe69666db059189406242"/></dir><file name="Failure.php" hash="4bc8bca872e68e55995c8996704a684d"/><dir name="Form"><file name="Cc.php" hash="4098182e7fcd53c3393736ca8a3b952e"/><file name="Container.php" hash="135a20a2537d890a7f304c09d28a3fa2"/><file name="Prepaidpayments.php" hash="6d24537b07085cf3cd497838be5ae641"/><file name="Savedcards.php" hash="fef05cb7cb4968a7a1f25adacbfa291d"/></dir><dir name="Info"><file name="Cc.php" hash="535973175a08d886d887743841c2259f"/><file name="Prepaidpayments.php" hash="27e8370e77323ef3d4509883317da43e"/><file name="Savedcards.php" hash="0ecab8333c35cc2c23c7460cd182f3f8"/></dir><dir name="Recurring"><dir name="Profile"><file name="View.php" hash="dd064d6997e107a12bd67666358961c1"/></dir></dir><file name="Redirect.php" hash="d06d3d1971637ec51f1663a0e5d06249"/><file name="Return.php" hash="7e69b6d4db495181f130874e3955d4ba"/><file name="Success.php" hash="557dcdaf4997f652c7949846bfe75f43"/></dir><dir name="Helper"><file name="Data.php" hash="0f029a1c927deea7495dd2e27d5af4f9"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Placedisplay.php" hash="ce97cc70fad01ae856186ed84f96a091"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Paymentconfiguration"><file name="Collection.php" hash="e639637d93fced47e15feff45dde7040"/></dir><file name="Paymentconfiguration.php" hash="27933b2a1a1b48f79c086fa2a1a055dc"/><dir name="Usercards"><file name="Collection.php" hash="6181af181afe7ca149a4f4def81ab2c3"/></dir><file name="Usercards.php" hash="6987664f7d934a01a20cd4b2360410ec"/></dir><file name="Observer.php" hash="bd91ad52f90f01643866e6e3a90793a6"/><dir name="Payment"><file name="Cc.php" hash="bdae2cee2cec0fe417a08c7393262c4a"/><file name="Prepaidpayments.php" hash="d95213d1d1a1ca0a75f21331e20c6112"/><dir name="Recurring"><file name="Profile.php" hash="81d78bf46f16921f315d25a1882f689c"/></dir><file name="Savedcards.php" hash="177be52129ddd5a85cc267e4798f439c"/></dir><file name="Paymentconfiguration.php" hash="8f59c00bb689cba01419643291f84c5a"/><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="Nominal"><dir name="Recurring"><file name="Discount.php" hash="de7bad92f97b7ae18c0ea14553b20b6e"/><dir name="Initialfee"><file name="Tax.php" hash="c34e0dfc1cda64509c20095d48280d30"/></dir></dir></dir><file name="Nominal.php" hash="151e80f6a973925ba5e75d53185b9a17"/></dir></dir></dir><file name="Quote.php" hash="f9ce2d25eac3ffe894586370f2b7e875"/><dir name="Sales"><dir name="Recurring"><file name="Profile.php" hash="ab2f07180d0f9e6b07739dcd9a72aaaf"/></dir></dir><dir name="Source"><file name="Paymentconfiguration.php" hash="e43240d7f8c5ce6c79a11cd22fdf1654"/></dir><file name="Usercards.php" hash="d60af463fad1d64a44e3132e6dd8145d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="2afbf9ce68581c095b1c0908c338bf8b"/><dir name="Sales"><dir name="Order"><file name="FraudController.php" hash="2e0a090bb9be675825c745749d8f6326"/></dir></dir></dir><file name="ControlController.php" hash="a8b443665c0e0d6545ea53e9e16c84f4"/><file name="CustomerController.php" hash="826b6c20bac3e7cda40d777f299185a0"/><file name="ProcessingController.php" hash="b8172d20445ca4ae8e4ecd96201da64a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="78e39e2b965ba1f3b42dc15165e5980d"/><file name="config.xml" hash="4d5380472a56701c514904baa1fbb649"/><file name="system.xml" hash="92af8118851818b7aa03a04621f30098"/></dir><dir name="sql"><dir name="xpaymentsconnector_setup"><file name="mysql4-install-1.0.0.php" hash="54fd2b472da6f22807d7ce9d55f76f68"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="ecfbe69f2a44d954419a5ba8e6a33601"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="38f97b9ad495e37cd5616b63244003d8"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="52b4b083d68c400a2d15b7ab24432d31"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9f504310fbd5760dbc4121575d58c1ff"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="bc258c44475f4820820b34e25a692e11"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="673e6984f3629a287cf750c62ad409d3"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="adde05f2858ab60250b0d66d88f7ccf1"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="ded44ef94cce61a6bbe76e97190e0508"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="e4ff2a01393423ea4a82226c1c160e83"/><file name="mysql4-upgrade-1.0.9-1.1.0.php" hash="f8332f7edb571e682dca101fb0a5f0d8"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="ff155b7f421d73c4962c373c88bc3ca0"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="07611a099e3057b57ec75d30e1b3cf17"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="xpayment"><file name="backend-xpayment.js" hash="0a21df00e9499cbdbf1f83866d5da7f7"/><file name="checkout-submit.js" hash="5b993541002979e0e050bff8688e6e42"/><dir name="images"><file name="arrow-down.png" hash="a0beb6cd0ca4dd686ee5bf772432176e"/><file name="arrow-up.png" hash="df40115c816a7e08016c04120ac22e53"/><file name="atep-arrow.png" hash="99b20583434330394fb2302b9b9f7331"/><file name="btn_bg_fraud.png" hash="028ca5db7bdc7a5327e5cafa8747e079"/><file name="card_types.png" hash="d35ba97c55e2cc1273a0dd1d7862d84c"/><file name="loader.gif" hash="e67d85a8d2d4021514815d0ff4d65173"/><file name="xpayment-logo.png" hash="a46be1bc2589a988172a104c11bed332"/></dir><file name="settings.css" hash="75fd8264d825def2a1c8538d052b9b25"/><file name="xp-contorl.css" hash="1c59c23f49000d35ba43149500b97682"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Cdev_XPaymentsConnector.csv" hash="38e98f8fd9a7ce64b0dd18ae6c00a481"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cdev_XPaymentsConnector.xml" hash="d45ede4b1566ecf143546c1c9b2330c7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><file name="control.phtml" hash="76989067ba4a38dab48e15ea784ddbf4"/><dir><dir name="form"><file name="prepaidpayments.phtml" hash="4dbfedd5c45d0238a77e2856d151165d"/><file name="savedcards.phtml" hash="2657b09d08dda25c96f787edf00dcb21"/></dir><dir name="info"><file name="cc.phtml" hash="87b0d497ce0c26cc7f9508da5d392d27"/><file name="prepaidpayments.phtml" hash="46668fa9790f7567512a320ca6192846"/><file name="savedcards.phtml" hash="e947d6efe2602959be9a9723a1f5a470"/></dir><dir name="order"><dir name="view"><dir name="tab"><file name="xporderstate.phtml" hash="f74738e126f5b5a377f6b6dd231e2bb2"/></dir></dir></dir><dir name="pdf"><file name="info.phtml" hash="ff4c8de6adb0c26a14bdb67b84002591"/></dir><dir name="usercards"><dir name="tab"><file name="js.phtml" hash="066a4fbebce98147eb69e37a37797187"/></dir></dir></dir><file name="info.phtml" hash="18765aeb9490d25c6cb72d90355815c1"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="d6a3c4f69e4d02070d139f1c1f6b9da5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><file name="blank.phtml" hash="a1d80c783123430a9821084154e74d3a"/><file name="cancel.phtml" hash="b7b95521b4bce46fa00a7d48799d2159"/><dir name="checkout"><dir name="onepage"><file name="beforesuccess.phtml" hash="e93a3c562ffa3bb11e1ccc85c60e9305"/><file name="order-detail.phtml" hash="d0f638fba56e1a38bf47060e540034c0"/><dir name="review"><file name="button.phtml" hash="e2b28eda13695bff1107e32382f1d944"/></dir><file name="xpayment-iframe.phtml" hash="01d055a10a706e16dcd6cb1cc3e162c3"/></dir><file name="success.phtml" hash="5a8796782f54d41e6065144aa1adbf68"/></dir><dir name="customer"><file name="cardaddsuccess.phtml" hash="ed7746e9d604ffb8d047fd8086c12531"/><dir name="usercards"><file name="cardadd.phtml" hash="d57f1f395a42ce0adb7f531b0f01c246"/><file name="list.phtml" hash="18e4d3d87d1ad121392deaeff263194b"/></dir></dir><file name="failure.phtml" hash="ff9a3cab106068011e2fc5617bb5c9db"/><dir name="form"><file name="cc.phtml" hash="5aa9052f7b789c20b9a5ba5d424d636b"/><file name="savedcards.phtml" hash="40815a71bfbcb61bb6975042159da4d3"/></dir><dir name="info"><file name="cc.phtml" hash="dff25040debc42f3bf08fdb7829e2fa8"/><file name="prepaidpayments.phtml" hash="4e8fec0502e991c6634233e3ba15202d"/><file name="savedcards.phtml" hash="e97d1c1356bf89eff3a969d430872136"/></dir><file name="redirect.phtml" hash="295b92ed99297c0349225e97b895110d"/><file name="redirectiframe.phtml" hash="8e9b635f16fbe7deb271759714eb856d"/><file name="return.phtml" hash="ae55cad4282970013ab72f746002fded"/><file name="xpc_data.phtml" hash="e1d2b67adc37e07bce05d2f2ef8f610f"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="e818bab9188628976a0fa782e1bea371"/></dir></dir></dir></dir></target></contents>
31
  <compatible/>
32
  <dependencies><required><php><min>5.3.0</min><max>7.0.9</max></php></required></dependencies>
33
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CDev_XPaymentsConnector</name>
4
+ <version>1.7.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
11
  This extension integrates Magento with X-Payments - a PA-DSS certified payment module.</description>
12
  <notes>What's new?&#xD;
13
  &#xD;
14
+ - Invoice for payment made using a saved credit card is now created automatically.&#xD;
15
  &#xD;
16
+ - X-Payments Connector settings page moved to admin controller. Potential 404 error fixed.&#xD;
17
  &#xD;
18
+ - Auto-detect of API version added. Test connection button removed, so connection between Magento store and X-Payments is tested automatically.&#xD;
19
  &#xD;
20
+ - Fixed issue with product attributes being reset after a product is added to the cart.&#xD;
21
  &#xD;
22
+ - Corrected recurring profiles creation. Fixed several issues with Recurring profiles and nominal items.&#xD;
23
  &#xD;
24
+ - "Allowed IP address" for X-Payments callback handling improved.&#xD;
25
  &#xD;
26
+ - Improved customer registration at checkout for OneStepCheckout module by Idev.&#xD;
27
+ &#xD;
28
+ - Corrected password setting during customer registration at checkout.&#xD;
29
+ &#xD;
30
+ - Corrected saving credit cards at customer profile.&#xD;
31
+ &#xD;
32
+ - "My payment cards" section is now removed correctly if "Use saved card" payment method is not active.&#xD;
33
+ &#xD;
34
+ - Compatibility with SUPEE-8788 vulnerability&#xD;
35
+ &#xD;
36
+ - NoFraud service support added&#xD;
37
+ &#xD;
38
+ - other minor bug-fixes and improvements in code and corrections to text labels.</notes>
39
  <authors><author><name>Alexander Mulin</name><user>xpayments</user><email>alex.mulin@x-payments.com</email></author></authors>
40
+ <date>2016-10-31</date>
41
+ <time>14:06:47</time>
42
+ <contents><target name="magecommunity"><dir name="Cdev"><dir name="XPaymentsConnector"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Renderer"><file name="Cardnumber.php" hash="208d21b744e56583b868038a0410b4f7"/><file name="Cardtype.php" hash="a2428e2e572e4d4a8cec6fd4b9519807"/><file name="Txnid.php" hash="27ef7dcdcb042b270758dbed42888e93"/></dir><dir name="Tab"><file name="Usercards.php" hash="958a1e10005ee9109e85d7e9ca448251"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Xporderstate.php" hash="bf18faf8efa855d23a098c0a79d3da43"/></dir></dir><file name="View.php" hash="8e26bb4e8c69e388aaec6a5b3709ca9c"/></dir></dir><dir name="Settings"><file name="Xpc.php" hash="d255424fb7efede011fa0ae347d533f5"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Subselect.php" hash="4386558bb6ea49f56fb72e04cb1ed7a1"/></dir></dir></dir><dir name="Usercards"><file name="Grid.php" hash="98675f504e5ad16f25fa56b1222fb233"/></dir></dir><file name="Beforesuccess.php" hash="6a2d9e8742024b527efa9b64bb8c2d1d"/><file name="Cancel.php" hash="a119a76eb7b3d829df844a1450ebbf4d"/><dir name="Checkout"><dir name="Onepage"><file name="Orderdetail.php" hash="bd289826d2bf55ea59437ec98dabe0dd"/><file name="Settings.php" hash="366aa9c1ecb505be9b141c33e4f48983"/><file name="Success.php" hash="08efe39f353822c763bf0893a7f50090"/></dir></dir><dir name="Customer"><file name="Cardadd.php" hash="4fbb08e3a63034d4f4e3132f6a462902"/><file name="Success.php" hash="626854ad5b66983245ca05fec3139d10"/><file name="Usercards.php" hash="dacb606ccd0fe69666db059189406242"/></dir><file name="Failure.php" hash="4bc8bca872e68e55995c8996704a684d"/><dir name="Form"><file name="Cc.php" hash="4098182e7fcd53c3393736ca8a3b952e"/><file name="Container.php" hash="135a20a2537d890a7f304c09d28a3fa2"/><file name="Prepaidpayments.php" hash="6d24537b07085cf3cd497838be5ae641"/><file name="Savedcards.php" hash="fef05cb7cb4968a7a1f25adacbfa291d"/></dir><dir name="Info"><file name="Cc.php" hash="535973175a08d886d887743841c2259f"/><file name="Prepaidpayments.php" hash="27e8370e77323ef3d4509883317da43e"/><file name="Savedcards.php" hash="0ecab8333c35cc2c23c7460cd182f3f8"/></dir><dir name="Recurring"><dir name="Profile"><file name="View.php" hash="dd064d6997e107a12bd67666358961c1"/></dir></dir><file name="Redirect.php" hash="d06d3d1971637ec51f1663a0e5d06249"/><file name="Return.php" hash="7e69b6d4db495181f130874e3955d4ba"/><file name="Success.php" hash="557dcdaf4997f652c7949846bfe75f43"/></dir><dir name="Helper"><file name="Data.php" hash="2751c4c0ea2f01a3f0a8ed23223ca870"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Placedisplay.php" hash="ce97cc70fad01ae856186ed84f96a091"/></dir></dir></dir></dir><file name="Fraudcheckdata.php" hash="55e3d4d8cd9922656370750d06db29c9"/><dir name="Mysql4"><dir name="Fraudcheckdata"><file name="Collection.php" hash="1cfe63c0fdd6e32f84b65a509297ed1f"/></dir><file name="Fraudcheckdata.php" hash="bbb6193b99c15a83c77840b5e40b610a"/><dir name="Paymentconfiguration"><file name="Collection.php" hash="e639637d93fced47e15feff45dde7040"/></dir><file name="Paymentconfiguration.php" hash="27933b2a1a1b48f79c086fa2a1a055dc"/><dir name="Quote"><dir name="Xpcdata"><file name="Collection.php" hash="ae6baceed692aed2da612097d7e48a62"/></dir><file name="Xpcdata.php" hash="ecd2a442867bb59d716910be0327e4c0"/></dir><dir name="Usercards"><file name="Collection.php" hash="6181af181afe7ca149a4f4def81ab2c3"/></dir><file name="Usercards.php" hash="6987664f7d934a01a20cd4b2360410ec"/></dir><file name="Observer.php" hash="d90c8ed40aca74010998e3b040d0d8b0"/><dir name="Payment"><file name="Cc.php" hash="4cc153ad9e7c3376b2cee0c826aff29c"/><file name="Prepaidpayments.php" hash="d95213d1d1a1ca0a75f21331e20c6112"/><dir name="Recurring"><file name="Profile.php" hash="81d78bf46f16921f315d25a1882f689c"/></dir><file name="Savedcards.php" hash="e95aaf3421eb394d2cfefce2b4f4fcd4"/></dir><file name="Paymentconfiguration.php" hash="8f59c00bb689cba01419643291f84c5a"/><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="Nominal"><dir name="Recurring"><file name="Discount.php" hash="de7bad92f97b7ae18c0ea14553b20b6e"/><dir name="Initialfee"><file name="Tax.php" hash="c34e0dfc1cda64509c20095d48280d30"/></dir></dir></dir><file name="Nominal.php" hash="151e80f6a973925ba5e75d53185b9a17"/></dir></dir><file name="Xpcdata.php" hash="fca39568010bbcce0c88a5069cf7ef4a"/></dir><file name="Quote.php" hash="f9ce2d25eac3ffe894586370f2b7e875"/><dir name="Sales"><dir name="Recurring"><file name="Profile.php" hash="ab2f07180d0f9e6b07739dcd9a72aaaf"/></dir></dir><dir name="Source"><file name="Paymentconfiguration.php" hash="e43240d7f8c5ce6c79a11cd22fdf1654"/></dir><file name="Usercards.php" hash="d60af463fad1d64a44e3132e6dd8145d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="2afbf9ce68581c095b1c0908c338bf8b"/><dir name="Sales"><dir name="Order"><file name="FraudController.php" hash="b3dfee2e445d0ef0946c0c617a58ae7c"/></dir></dir><dir name="Settings"><file name="XpcController.php" hash="b4f3258f36018e63d2712c7b180fd83b"/></dir></dir><file name="CustomerController.php" hash="826b6c20bac3e7cda40d777f299185a0"/><file name="ProcessingController.php" hash="7da853c09b9c13bee733bcba6677f41a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="38134239e74d0a020fb7ae2e8a83304a"/><file name="config.xml" hash="7d1a38e617473b73a6d8ecd2b34bcb76"/><file name="system.xml" hash="f1fb265a300efb04a2d715d5489b0ec9"/></dir><dir name="sql"><dir name="xpaymentsconnector_setup"><file name="mysql4-install-1.0.0.php" hash="54fd2b472da6f22807d7ce9d55f76f68"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="ecfbe69f2a44d954419a5ba8e6a33601"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="38f97b9ad495e37cd5616b63244003d8"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="52b4b083d68c400a2d15b7ab24432d31"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9f504310fbd5760dbc4121575d58c1ff"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="bc258c44475f4820820b34e25a692e11"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="673e6984f3629a287cf750c62ad409d3"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="adde05f2858ab60250b0d66d88f7ccf1"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="ded44ef94cce61a6bbe76e97190e0508"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="e4ff2a01393423ea4a82226c1c160e83"/><file name="mysql4-upgrade-1.0.9-1.1.0.php" hash="f8332f7edb571e682dca101fb0a5f0d8"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="ff155b7f421d73c4962c373c88bc3ca0"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="07611a099e3057b57ec75d30e1b3cf17"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="fcca09f1a92b89c23741adcbe28bb674"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="xpayment"><file name="backend-xpayment.js" hash="0a21df00e9499cbdbf1f83866d5da7f7"/><file name="checkout-submit.js" hash="5b993541002979e0e050bff8688e6e42"/><dir name="images"><file name="arrow-down.png" hash="a0beb6cd0ca4dd686ee5bf772432176e"/><file name="arrow-up.png" hash="df40115c816a7e08016c04120ac22e53"/><file name="atep-arrow.png" hash="99b20583434330394fb2302b9b9f7331"/><file name="btn_bg_fraud.png" hash="028ca5db7bdc7a5327e5cafa8747e079"/><file name="card_types.png" hash="d35ba97c55e2cc1273a0dd1d7862d84c"/><file name="loader.gif" hash="e67d85a8d2d4021514815d0ff4d65173"/><file name="xpayment-logo.png" hash="a46be1bc2589a988172a104c11bed332"/></dir><file name="settings-xpc.css" hash="65f93e043e6710b0755e43f403fb6aa7"/><file name="settings.css" hash="75fd8264d825def2a1c8538d052b9b25"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Cdev_XPaymentsConnector.csv" hash="38e98f8fd9a7ce64b0dd18ae6c00a481"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cdev_XPaymentsConnector.xml" hash="d45ede4b1566ecf143546c1c9b2330c7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><dir><dir name="form"><file name="prepaidpayments.phtml" hash="4dbfedd5c45d0238a77e2856d151165d"/><file name="savedcards.phtml" hash="2657b09d08dda25c96f787edf00dcb21"/></dir><dir name="info"><file name="cc.phtml" hash="87b0d497ce0c26cc7f9508da5d392d27"/><file name="prepaidpayments.phtml" hash="46668fa9790f7567512a320ca6192846"/><file name="savedcards.phtml" hash="e947d6efe2602959be9a9723a1f5a470"/></dir><dir name="order"><dir name="view"><dir name="tab"><file name="xporderstate.phtml" hash="47dc7e8b7e946cf8e5ffb0257d8a19e5"/></dir></dir></dir><dir name="pdf"><file name="info.phtml" hash="ff4c8de6adb0c26a14bdb67b84002591"/></dir><dir name="settings"><file name="xpc.phtml" hash="390a08b88913d55281e889b1bde16a61"/></dir><dir name="usercards"><dir name="tab"><file name="js.phtml" hash="066a4fbebce98147eb69e37a37797187"/></dir></dir></dir><file name="info.phtml" hash="18765aeb9490d25c6cb72d90355815c1"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="fb87962a843d476eb48c7a7b85d442fa"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="xpaymentsconnector"><file name="blank.phtml" hash="a1d80c783123430a9821084154e74d3a"/><file name="cancel.phtml" hash="b7b95521b4bce46fa00a7d48799d2159"/><dir name="checkout"><dir name="onepage"><file name="beforesuccess.phtml" hash="e93a3c562ffa3bb11e1ccc85c60e9305"/><file name="order-detail.phtml" hash="d0f638fba56e1a38bf47060e540034c0"/><dir name="review"><file name="button.phtml" hash="e2b28eda13695bff1107e32382f1d944"/></dir><file name="xpayment-iframe.phtml" hash="01d055a10a706e16dcd6cb1cc3e162c3"/></dir><file name="success.phtml" hash="6051fdfd2efbfc936b8b7beb573c233d"/></dir><dir name="customer"><file name="cardaddsuccess.phtml" hash="ed7746e9d604ffb8d047fd8086c12531"/><dir name="usercards"><file name="cardadd.phtml" hash="d57f1f395a42ce0adb7f531b0f01c246"/><file name="list.phtml" hash="18e4d3d87d1ad121392deaeff263194b"/></dir></dir><file name="failure.phtml" hash="ff9a3cab106068011e2fc5617bb5c9db"/><dir name="form"><file name="cc.phtml" hash="5aa9052f7b789c20b9a5ba5d424d636b"/><file name="savedcards.phtml" hash="40815a71bfbcb61bb6975042159da4d3"/></dir><dir name="info"><file name="cc.phtml" hash="c47bcbf6bc0373cebe15beabfc6214c9"/><file name="prepaidpayments.phtml" hash="4e8fec0502e991c6634233e3ba15202d"/><file name="savedcards.phtml" hash="e97d1c1356bf89eff3a969d430872136"/></dir><file name="redirect.phtml" hash="295b92ed99297c0349225e97b895110d"/><file name="redirectiframe.phtml" hash="8e9b635f16fbe7deb271759714eb856d"/><file name="return.phtml" hash="ae55cad4282970013ab72f746002fded"/><file name="xpc_data.phtml" hash="e1d2b67adc37e07bce05d2f2ef8f610f"/></dir></dir><dir name="layout"><file name="xpaymentsconnector.xml" hash="0e2680e432b27aa30b72d260ae6210a2"/></dir></dir></dir></dir></target></contents>
43
  <compatible/>
44
  <dependencies><required><php><min>5.3.0</min><max>7.0.9</max></php></required></dependencies>
45
  </package>