CLS_Paypal_Credit_Card_Tokenization - Version 1.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Classy Llama
Extension CLS_Paypal_Credit_Card_Tokenization
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (72) hide show
  1. app/code/community/CLS/Paypal/Block/Adminhtml/Sales/Order/Create/Customer.php +61 -0
  2. app/code/community/CLS/Paypal/Block/Customer/Storedcard.php +93 -0
  3. app/code/community/CLS/Paypal/Block/Payment/Form/Cc.php +55 -0
  4. app/code/community/CLS/Paypal/Block/Paypal/Adminhtml/System/Config/Fieldset/Location.php +363 -0
  5. app/code/community/CLS/Paypal/Block/Paypal/Payflow/Advanced/Form.php +52 -0
  6. app/code/community/CLS/Paypal/Block/Paypal/Payflow/Link/Form.php +52 -0
  7. app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Customerstored.php +51 -0
  8. app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Orderstored.php +120 -0
  9. app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Orderstored/Agreement.php +55 -0
  10. app/code/community/CLS/Paypal/Block/Paypaluk/Payment/Form/Orderstored/Agreement.php +32 -0
  11. app/code/community/CLS/Paypal/CHANGELOG.txt +3 -0
  12. app/code/community/CLS/Paypal/Helper/Data.php +292 -0
  13. app/code/community/CLS/Paypal/Helper/Orderstored/Agreement.php +78 -0
  14. app/code/community/CLS/Paypal/Helper/Paypal/Data.php +53 -0
  15. app/code/community/CLS/Paypal/Helper/Storedcard.php +72 -0
  16. app/code/community/CLS/Paypal/LICENSE.txt +48 -0
  17. app/code/community/CLS/Paypal/Model/Customerstored.php +125 -0
  18. app/code/community/CLS/Paypal/Model/Observer.php +237 -0
  19. app/code/community/CLS/Paypal/Model/Paypal/Api/Nvp.php +50 -0
  20. app/code/community/CLS/Paypal/Model/Paypal/Config.php +327 -0
  21. app/code/community/CLS/Paypal/Model/Paypal/Direct.php +32 -0
  22. app/code/community/CLS/Paypal/Model/Paypal/Express.php +54 -0
  23. app/code/community/CLS/Paypal/Model/Paypal/Express/Checkout.php +57 -0
  24. app/code/community/CLS/Paypal/Model/Paypal/Info.php +56 -0
  25. app/code/community/CLS/Paypal/Model/Paypal/Method/Orderstored/Agreement.php +99 -0
  26. app/code/community/CLS/Paypal/Model/Paypal/Payflowadvanced.php +139 -0
  27. app/code/community/CLS/Paypal/Model/Paypal/Payflowlink.php +134 -0
  28. app/code/community/CLS/Paypal/Model/Paypal/Payflowpro.php +64 -0
  29. app/code/community/CLS/Paypal/Model/Paypal/Stored/Abstract.php +94 -0
  30. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored.php +189 -0
  31. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Direct.php +172 -0
  32. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflow.php +105 -0
  33. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowadvanced.php +161 -0
  34. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowlink.php +161 -0
  35. app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowpro.php +155 -0
  36. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored.php +176 -0
  37. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Direct.php +155 -0
  38. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflow.php +98 -0
  39. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowadvanced.php +161 -0
  40. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowlink.php +161 -0
  41. app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowpro.php +155 -0
  42. app/code/community/CLS/Paypal/Model/Paypal/Stored/Payflow.php +179 -0
  43. app/code/community/CLS/Paypal/Model/Paypaluk/Api/Nvp.php +204 -0
  44. app/code/community/CLS/Paypal/Model/Paypaluk/Express.php +50 -0
  45. app/code/community/CLS/Paypal/Model/Paypaluk/Express/Checkout.php +56 -0
  46. app/code/community/CLS/Paypal/Model/Paypaluk/Method/Agreement.php +135 -0
  47. app/code/community/CLS/Paypal/Model/Paypaluk/Method/Orderstored/Agreement.php +103 -0
  48. app/code/community/CLS/Paypal/Model/Resource/Customerstored.php +77 -0
  49. app/code/community/CLS/Paypal/Model/Resource/Customerstored/Collection.php +99 -0
  50. app/code/community/CLS/Paypal/README.txt +65 -0
  51. app/code/community/CLS/Paypal/controllers/Adminhtml/Sales/Order/CreateController.php +63 -0
  52. app/code/community/CLS/Paypal/controllers/Customer/StoredcardController.php +89 -0
  53. app/code/community/CLS/Paypal/controllers/Paypal/ExpressController.php +130 -0
  54. app/code/community/CLS/Paypal/controllers/PaypalUk/ExpressController.php +131 -0
  55. app/code/community/CLS/Paypal/etc/config.xml +368 -0
  56. app/code/community/CLS/Paypal/etc/system.xml +1289 -0
  57. app/code/community/CLS/Paypal/sql/cls_paypal_setup/install-0.0.1.php +76 -0
  58. app/code/community/CLS/Paypal/sql/cls_paypal_setup/upgrade-0.3.0-0.3.1.php +46 -0
  59. app/design/adminhtml/default/default/layout/cls_paypal.xml +69 -0
  60. app/design/adminhtml/default/default/template/cls_paypal/payment/form/cc.phtml +133 -0
  61. app/design/adminhtml/default/default/template/cls_paypal/payment/form/customer_stored.phtml +54 -0
  62. app/design/adminhtml/default/default/template/cls_paypal/payment/form/order_stored.phtml +48 -0
  63. app/design/adminhtml/default/default/template/cls_paypal/sales/order/create/form/address.phtml +104 -0
  64. app/design/adminhtml/default/default/template/cls_paypal/sales/payment/form/orderstored/agreement.phtml +40 -0
  65. app/design/frontend/base/default/layout/cls_paypal.xml +47 -0
  66. app/design/frontend/base/default/template/cls_paypal/customer/storedcard.phtml +81 -0
  67. app/design/frontend/base/default/template/cls_paypal/payment/form/cc.phtml +155 -0
  68. app/design/frontend/base/default/template/cls_paypal/payment/form/customer_stored.phtml +52 -0
  69. app/design/frontend/base/default/template/cls_paypal/paypal/payflow/info.phtml +45 -0
  70. app/etc/modules/CLS_Paypal.xml +13 -0
  71. app/locale/en_US/CLS_Paypal.csv +28 -0
  72. package.xml +83 -0
app/code/community/CLS/Paypal/Block/Adminhtml/Sales/Order/Create/Customer.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Adminhtml_Sales_Order_Create_Customer extends Mage_Adminhtml_Block_Sales_Order_Create_Customer
30
+ {
31
+
32
+ /**
33
+ * Additionally render "Create Guest Order" button
34
+ *
35
+ * @return string
36
+ */
37
+ public function getButtonsHtml()
38
+ {
39
+ $html = parent::getButtonsHtml();
40
+
41
+ // "Create Guest Order" button
42
+ $addButtonData = array(
43
+ 'label' => Mage::helper('cls_paypal')->__('Create Guest Order'),
44
+ 'onclick' => "order.setLoadBaseUrl('{$this->getGuestLoadBlockUrl()}'); order.setCustomerId(false);",
45
+ 'style' => 'margin-left: 6px'
46
+ );
47
+ $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
48
+
49
+ return $html;
50
+ }
51
+
52
+ /**
53
+ * Retrieve url for loading blocks (guest order)
54
+ * @return string
55
+ */
56
+ public function getGuestLoadBlockUrl()
57
+ {
58
+ return $this->getUrl('*/*/loadBlock', array('is_guest_order' => true));
59
+ }
60
+
61
+ }
app/code/community/CLS/Paypal/Block/Customer/Storedcard.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Customer_Storedcard extends Mage_Core_Block_Template
30
+ {
31
+
32
+ /**
33
+ * Return the list of customer's stored cards
34
+ *
35
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection|null
36
+ */
37
+ public function getStoredCards()
38
+ {
39
+ if (is_null($this->getData('stored_cards'))) {
40
+ $customerId = $this->getCustomer()->getId();
41
+
42
+ if (!$customerId) {
43
+ return null;
44
+ }
45
+
46
+ $collection = Mage::getSingleton('cls_paypal/customerstored')->getCustomerstoredCollection($customerId);
47
+ $this->setData('stored_cards', $collection);
48
+ }
49
+
50
+ return $this->getData('stored_cards');
51
+ }
52
+
53
+ /**
54
+ * Transform date to store format
55
+ *
56
+ * @param string $date
57
+ * @return Zend_Date
58
+ */
59
+ public function transformDate($date)
60
+ {
61
+ return Mage::app()->getLocale()->storeDate(
62
+ $this->getCustomer()->getStoreId(),
63
+ Varien_Date::toTimestamp($date)
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Return current customer model
69
+ *
70
+ * @return Mage_Customer_Model_Customer
71
+ */
72
+ public function getCustomer()
73
+ {
74
+ $customer = $this->getData('customer');
75
+ if (is_null($customer)) {
76
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
77
+ $this->setData('customer', $customer);
78
+ }
79
+ return $customer;
80
+ }
81
+
82
+ /**
83
+ * Build 'Delete' URL
84
+ *
85
+ * @param CLS_Paypal_Model_Customerstored $storedCard
86
+ * @return string
87
+ */
88
+ public function getDeleteUrl($storedCard)
89
+ {
90
+ return $this->getUrl('*/*/delete', array('stored_card_id' => $storedCard->getId()));
91
+ }
92
+
93
+ }
app/code/community/CLS/Paypal/Block/Payment/Form/Cc.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Custom CC payment form
31
+ */
32
+ class CLS_Paypal_Block_Payment_Form_Cc extends Mage_Payment_Block_Form_Cc
33
+ {
34
+
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+
39
+ // Set custom template
40
+ $this->setTemplate('cls_paypal/payment/form/cc.phtml');
41
+ }
42
+
43
+ /**
44
+ * Check if the "Save this card" feature is allowed
45
+ *
46
+ * @return bool
47
+ */
48
+ public function isCcSaveAllowed()
49
+ {
50
+ $quote = $this->getMethod()->getInfoInstance()->getQuote();
51
+
52
+ return Mage::helper('cls_paypal')->isCcSaveAllowed($quote, $this->getMethod()->getCode());
53
+ }
54
+
55
+ }
app/code/community/CLS/Paypal/Block/Paypal/Adminhtml/System/Config/Fieldset/Location.php ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Adminhtml_System_Config_Fieldset_Location extends Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location
30
+ {
31
+ /**
32
+ * Add conflicts resolution js code to the fieldset
33
+ *
34
+ * @param Varien_Data_Form_Element_Abstract $element
35
+ * @param bool $tooltipsExist Init tooltips observer or not
36
+ * @return string
37
+ */
38
+ protected function _getExtraJs($element, $tooltipsExist = false)
39
+ {
40
+ $js = '
41
+ document.observe("dom:loaded", function() {
42
+ $$(".with-button button.button").each(function(configureButton) {
43
+ togglePaypalSolutionConfigureButton(configureButton, true);
44
+ });
45
+ var paypalConflictsObject = {
46
+ "isConflict": false,
47
+ "ecMissed": false,
48
+ sharePayflowEnabling: function(enabler, isEvent) {
49
+ // If we are enabling any method, we need to disable billing agreements on others
50
+ if (enabler.value == 1 && isEvent) {
51
+ // We are either disabling PayFlow billing agreement, or non-PayFlow
52
+ var baDisableClass = (enabler.enablerObject.ecPayflow) ? ".paypal-ba-enabler" : ".paypal-ba-payflow-enabler";
53
+ $$(baDisableClass).each(function(baEnabler) {
54
+ baEnabler.value = 0;
55
+ fireEvent(baEnabler, "change");
56
+ });
57
+ // Do the same for the orderstored methods
58
+ var orderstoredBaDisableClass = (enabler.enablerObject.ecPayflow) ? ".paypal-orderstored-ba-enabler" : ".paypal-orderstored-ba-payflow-enabler";
59
+ $$(orderstoredBaDisableClass).each(function(baEnabler) {
60
+ baEnabler.value = 0;
61
+ fireEvent(baEnabler, "change");
62
+ });
63
+ }
64
+
65
+ var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0];
66
+ if (typeof ecPayflowEnabler == "undefined") {
67
+ return;
68
+ }
69
+ var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
70
+
71
+ if (!enabler.enablerObject.ecPayflow) {
72
+ if ((!ecPayflowScopeElement || !ecPayflowScopeElement.checked) && isEvent
73
+ && enabler.value == 1
74
+ ) {
75
+ ecPayflowEnabler.value = 0;
76
+ fireEvent(ecPayflowEnabler, "change");
77
+ }
78
+ return;
79
+ }
80
+
81
+ var enablerScopeElement = adminSystemConfig.getScopeElement(enabler);
82
+ if (enablerScopeElement && ecPayflowScopeElement
83
+ && enablerScopeElement.checked != ecPayflowScopeElement.checked
84
+ && (isEvent || ecPayflowScopeElement.checked)
85
+ ) {
86
+ $(ecPayflowScopeElement).click();
87
+ }
88
+
89
+ var ecEnabler = $$(".paypal-ec-enabler")[0];
90
+ if (ecPayflowEnabler.value != enabler.value && (isEvent || enabler.value == 1)) {
91
+ ecPayflowEnabler.value = enabler.value;
92
+ fireEvent(ecPayflowEnabler, "change");
93
+ if (ecPayflowEnabler.value == 1) {
94
+ if (typeof ecEnabler != "undefined") {
95
+ var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
96
+ ecEnabler.value = 1;
97
+ if (ecEnablerScopeElement && ecEnablerScopeElement.checked) {
98
+ paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false);
99
+ }
100
+ paypalConflictsObject.checklessEventAction(ecEnabler, true);
101
+ }
102
+ }
103
+ }
104
+ if (!isEvent && ecPayflowEnabler.value == 1 && typeof ecEnabler != "undefined") {
105
+ var ecSolution = $$(".pp-method-express")[0];
106
+ if (typeof ecSolution != "undefined" && !$(ecSolution).hasClassName("enabled")) {
107
+ ecSolution.addClassName("enabled");
108
+ }
109
+ }
110
+ },
111
+ onChangeEnabler: function(event) {
112
+ paypalConflictsObject.checkPaymentConflicts($(Event.element(event)), "change");
113
+ },
114
+ onClickEnablerScope: function(event) {
115
+ paypalConflictsObject.checkPaymentConflicts(
116
+ $(adminSystemConfig.getUpTr($(Event.element(event))).select(".paypal-enabler")[0]),
117
+ "click"
118
+ );
119
+ },
120
+ getSharedElements: function(element) {
121
+ var sharedElements = [];
122
+ adminSystemConfig.mapClasses(element, true, function(elementClassName) {
123
+ $$("." + elementClassName).each(function(sharedElement) {
124
+ if (sharedElements.indexOf(sharedElement) == -1) {
125
+ sharedElements.push(sharedElement);
126
+ }
127
+ });
128
+ });
129
+ if (sharedElements.length == 0) {
130
+ sharedElements.push(element);
131
+ }
132
+ return sharedElements;
133
+ },
134
+ checklessEventAction: function(element, isChange) {
135
+ var action = isChange ? "change" : "click";
136
+ var handler = isChange
137
+ ? paypalConflictsObject.onChangeEnabler
138
+ : paypalConflictsObject.onClickEnablerScope;
139
+ paypalConflictsObject.getSharedElements(element).each(function(sharedElement) {
140
+ Event.stopObserving(sharedElement, action, handler);
141
+ if (isChange) {
142
+ sharedElement.value = element.value;
143
+ if ($(sharedElement).requiresObj) {
144
+ $(sharedElement).requiresObj.indicateEnabled();
145
+ }
146
+ }
147
+ });
148
+ if (isChange) {
149
+ fireEvent(element, "change");
150
+ } else {
151
+ $(element).click();
152
+ }
153
+ paypalConflictsObject.getSharedElements(element).each(function(sharedElement) {
154
+ Event.observe(sharedElement, action, handler);
155
+ });
156
+ },
157
+ ecCheckAvailability: function() {
158
+ var ecButton = $$(".pp-method-express button.button")[0];
159
+ if (typeof ecButton == "undefined") {
160
+ return;
161
+ }
162
+ var couldBeConfigured = true;
163
+ $$(".paypal-enabler").each(function(enabler) {
164
+ if (enabler.enablerObject.ecEnabler || enabler.enablerObject.ecConflicts
165
+ || enabler.enablerObject.ecSeparate
166
+ ) {
167
+ return;
168
+ }
169
+ if (enabler.value == 1) {
170
+ couldBeConfigured = false;
171
+ }
172
+ });
173
+ if (couldBeConfigured) {
174
+ togglePaypalSolutionConfigureButton(ecButton, true);
175
+ } else {
176
+ togglePaypalSolutionConfigureButton(ecButton, false);
177
+ }
178
+ },
179
+ // type could be "initial", "change", "click"
180
+ checkPaymentConflicts: function(enabler, type) {
181
+ var isEvent = (type != "initial");
182
+ var ecEnabler = $$(".paypal-ec-enabler")[0];
183
+
184
+ if (enabler.value == 0) {
185
+ if (!enabler.enablerObject.ecIndependent && type == "change") {
186
+ if (typeof ecEnabler != "undefined" && ecEnabler.value == 1) {
187
+ var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
188
+ if (!ecEnablerScopeElement || !ecEnablerScopeElement.checked) {
189
+ ecEnabler.value = 0;
190
+ paypalConflictsObject.checklessEventAction(ecEnabler, true);
191
+ }
192
+ }
193
+ }
194
+ paypalConflictsObject.ecCheckAvailability();
195
+ paypalConflictsObject.sharePayflowEnabling(enabler, isEvent);
196
+ return;
197
+ }
198
+
199
+ var confirmationApproved = isEvent;
200
+ var confirmationShowed = false;
201
+ // check other solutions
202
+ $$(".paypal-enabler").each(function(anotherEnabler) {
203
+ var anotherEnablerScopeElement = adminSystemConfig.getScopeElement(anotherEnabler);
204
+ if (!confirmationApproved && isEvent || $(anotherEnabler) == enabler
205
+ || anotherEnabler.value == 0
206
+ && (!anotherEnablerScopeElement || !anotherEnablerScopeElement.checked)
207
+ ) {
208
+ return;
209
+ }
210
+ var conflict = enabler.enablerObject.ecConflicts && anotherEnabler.enablerObject.ecEnabler
211
+ || enabler.enablerObject.ecEnabler && anotherEnabler.enablerObject.ecConflicts
212
+ || !enabler.enablerObject.ecIndependent && anotherEnabler.enablerObject.ecConflicts
213
+ || !enabler.enablerObject.ecEnabler && !anotherEnabler.enablerObject.ecEnabler;
214
+
215
+ if (conflict && !confirmationShowed && anotherEnabler.value == 1) {
216
+ if (isEvent) {
217
+ confirmationApproved = confirm(\'' . $this->helper('core')->jsQuoteEscape($this->__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\');
218
+ } else {
219
+ paypalConflictsObject.isConflict = true;
220
+ }
221
+ confirmationShowed = true;
222
+ }
223
+ if (conflict && confirmationApproved) {
224
+ anotherEnabler.value = 0;
225
+ if (anotherEnablerScopeElement && anotherEnablerScopeElement.checked && isEvent) {
226
+ paypalConflictsObject.checklessEventAction(anotherEnablerScopeElement, false);
227
+ }
228
+ paypalConflictsObject.checklessEventAction(anotherEnabler, true);
229
+ }
230
+ });
231
+
232
+ if (!enabler.enablerObject.ecIndependent) {
233
+ if (!isEvent && (typeof ecEnabler == "undefined" || ecEnabler.value == 0)) {
234
+ if (!enabler.enablerObject.ecPayflow) {
235
+ paypalConflictsObject.ecMissed = true;
236
+ }
237
+ } else if (isEvent && typeof ecEnabler != "undefined" && confirmationApproved) {
238
+ var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
239
+ if (ecEnablerScopeElement && ecEnablerScopeElement.checked) {
240
+ paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false);
241
+ }
242
+ if (ecEnabler.value == 0) {
243
+ ecEnabler.value = 1;
244
+ paypalConflictsObject.checklessEventAction(ecEnabler, true);
245
+ }
246
+ }
247
+ }
248
+
249
+ if (!confirmationApproved && isEvent) {
250
+ enabler.value = 0;
251
+ paypalConflictsObject.checklessEventAction(enabler, true);
252
+ }
253
+ paypalConflictsObject.ecCheckAvailability();
254
+ paypalConflictsObject.sharePayflowEnabling(enabler, isEvent);
255
+ }
256
+ };
257
+
258
+ // fill enablers with conflict data
259
+ $$(".paypal-enabler").each(function(enablerElement) {
260
+ var enablerObj = {
261
+ ecIndependent: false,
262
+ ecConflicts: false,
263
+ ecEnabler: false,
264
+ ecSeparate: false,
265
+ ecPayflow: false
266
+ };
267
+ $(enablerElement).classNames().each(function(className) {
268
+ switch (className) {
269
+ case "paypal-ec-conflicts":
270
+ enablerObj.ecConflicts = true;
271
+ case "paypal-ec-independent":
272
+ enablerObj.ecIndependent = true;
273
+ break;
274
+ case "paypal-ec-enabler":
275
+ enablerObj.ecEnabler = true;
276
+ enablerObj.ecIndependent = true;
277
+ break;
278
+ case "paypal-ec-separate":
279
+ enablerObj.ecSeparate = true;
280
+ enablerObj.ecIndependent = true;
281
+ break;
282
+ case "paypal-ec-pe":
283
+ enablerObj.ecPayflow = true;
284
+ break;
285
+ }
286
+ });
287
+ enablerElement.enablerObject = enablerObj;
288
+
289
+ Event.observe(enablerElement, "change", paypalConflictsObject.onChangeEnabler);
290
+ var enablerScopeElement = adminSystemConfig.getScopeElement(enablerElement);
291
+ if (enablerScopeElement) {
292
+ Event.observe(enablerScopeElement, "click", paypalConflictsObject.onClickEnablerScope);
293
+ }
294
+ });
295
+
296
+ // initially uncheck payflow
297
+ var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0];
298
+ if (typeof ecPayflowEnabler != "undefined") {
299
+ if (ecPayflowEnabler.value == 1) {
300
+ ecPayflowEnabler.value = 0;
301
+ fireEvent(ecPayflowEnabler, "change");
302
+ }
303
+
304
+ var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
305
+ if (ecPayflowScopeElement && !ecPayflowScopeElement.checked) {
306
+ $(ecPayflowScopeElement).click();
307
+ }
308
+ }
309
+
310
+ $$(".paypal-enabler").each(function(enablerElement) {
311
+ paypalConflictsObject.checkPaymentConflicts(enablerElement, "initial");
312
+ });
313
+ if (paypalConflictsObject.isConflict || paypalConflictsObject.ecMissed) {
314
+ var notification = \'' . $this->helper('core')->jsQuoteEscape($this->__('The following error(s) occured:')) . '\';
315
+ if (paypalConflictsObject.isConflict) {
316
+ notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('Some PayPal solutions conflict.')) . '\';
317
+ }
318
+ if (paypalConflictsObject.ecMissed) {
319
+ notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('PayPal Express Checkout is not enabled.')) . '\';
320
+ }
321
+ notification += "\\n" + \'' . $this->helper('core')->jsQuoteEscape($this->__('Please re-enable the previously enabled payment solutions.')) . '\';
322
+ setTimeout(function() {
323
+ alert(notification);
324
+ }, 1);
325
+ }
326
+
327
+ $$(".requires").each(function(dependent) {
328
+ var $dependent = $(dependent);
329
+ if ($dependent.hasClassName("paypal-ec-enabler")) {
330
+ $dependent.requiresObj.callback = function(required) {
331
+ if ($(required).hasClassName("paypal-enabler") && required.value == 0) {
332
+ $dependent.disable();
333
+ }
334
+ }
335
+ $dependent.requiresObj.requires.each(function(required) {
336
+ $dependent.requiresObj.callback(required);
337
+ });
338
+ }
339
+ });
340
+
341
+ var originalFormValidation = configForm.validator.options.onFormValidate;
342
+ configForm.validator.options.onFormValidate = function(result, form) {
343
+ originalFormValidation(result, form);
344
+ if (result) {
345
+ var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0];
346
+ if (typeof ecPayflowEnabler == "undefined") {
347
+ return;
348
+ }
349
+ var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
350
+ if ((typeof ecPayflowScopeElement == "undefined" || !ecPayflowScopeElement.checked)
351
+ && ecPayflowEnabler.value == 1
352
+ ) {
353
+ $$(".paypal-ec-enabler").each(function(ecEnabler) {
354
+ ecEnabler.value = 0;
355
+ });
356
+ }
357
+ }
358
+ }
359
+ });
360
+ ';
361
+ return Mage_Adminhtml_Block_System_Config_Form_Fieldset::_getExtraJs($element, $tooltipsExist) . $this->helper('adminhtml/js')->getScript($js);
362
+ }
363
+ }
app/code/community/CLS/Paypal/Block/Paypal/Payflow/Advanced/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Payflow_Advanced_Form extends Mage_Paypal_Block_Payflow_Advanced_Form
30
+ {
31
+
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+
36
+ // Set custom template
37
+ $this->setTemplate('cls_paypal/paypal/payflow/info.phtml');
38
+ }
39
+
40
+ /**
41
+ * Check if the "Save this card" feature is allowed
42
+ *
43
+ * @return bool
44
+ */
45
+ public function isCcSaveAllowed()
46
+ {
47
+ $quote = $this->getMethod()->getInfoInstance()->getQuote();
48
+
49
+ return Mage::helper('cls_paypal')->isCcSaveAllowed($quote, $this->getMethod()->getCode());
50
+ }
51
+
52
+ }
app/code/community/CLS/Paypal/Block/Paypal/Payflow/Link/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Payflow_Link_Form extends Mage_Paypal_Block_Payflow_Link_Form
30
+ {
31
+
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+
36
+ // Set custom template
37
+ $this->setTemplate('cls_paypal/paypal/payflow/info.phtml');
38
+ }
39
+
40
+ /**
41
+ * Check if the "Save this card" feature is allowed
42
+ *
43
+ * @return bool
44
+ */
45
+ public function isCcSaveAllowed()
46
+ {
47
+ $quote = $this->getMethod()->getInfoInstance()->getQuote();
48
+
49
+ return Mage::helper('cls_paypal')->isCcSaveAllowed($quote, $this->getMethod()->getCode());
50
+ }
51
+
52
+ }
app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Customerstored.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Payment_Form_Customerstored extends Mage_Payment_Block_Form
30
+ {
31
+ /**
32
+ * Set custom template
33
+ *
34
+ */
35
+ public function __construct()
36
+ {
37
+ parent::__construct();
38
+ $this->setTemplate('cls_paypal/payment/form/customer_stored.phtml');
39
+ }
40
+
41
+ /**
42
+ * Get the list of customer's stored cards
43
+ *
44
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
45
+ */
46
+ public function getStoredCards()
47
+ {
48
+ return $this->getMethod()->getStoredCards();
49
+ }
50
+
51
+ }
app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Orderstored.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Payment_Form_Orderstored extends Mage_Payment_Block_Form
30
+ {
31
+ /**
32
+ * Order instance of the original order
33
+ *
34
+ * @var Mage_Sales_Model_Order
35
+ */
36
+ protected $_storedOrder = null;
37
+
38
+ /**
39
+ * Payment method instance from the original order
40
+ *
41
+ * @var $_storedPayment Mage_Sales_Model_Order_Payment|null
42
+ */
43
+ protected $_storedPayment = null;
44
+
45
+ /**
46
+ * Set custom template
47
+ *
48
+ */
49
+ public function __construct()
50
+ {
51
+ parent::__construct();
52
+ $this->setTemplate('cls_paypal/payment/form/order_stored.phtml');
53
+
54
+ // Get original order payment
55
+ /** @var $session Mage_Adminhtml_Model_Session_Quote */
56
+ $session = Mage::getSingleton('adminhtml/session_quote');
57
+
58
+ if (
59
+ ($originalOrderId = $session->getPreviousOrderId())
60
+ || ($originalOrderId = $session->getOrderId())
61
+ ) {
62
+ // Get original order data
63
+ /** @var $originalOrder Mage_Sales_Model_Order */
64
+ $originalOrder = Mage::getModel('sales/order')->load($originalOrderId);
65
+
66
+ if ($originalOrder->getId()) {
67
+ $this->_storedOrder = $originalOrder;
68
+
69
+ $originalOrderPayment = $originalOrder->getPayment();
70
+
71
+ if ($originalOrderPayment->getId()) {
72
+ $this->_storedPayment = $originalOrderPayment;
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Get the original order's increment ID
80
+ *
81
+ * @return string
82
+ */
83
+ public function getOrderIncrementId()
84
+ {
85
+ if (!is_null($this->_storedOrder)) {
86
+ return $this->_storedOrder->getIncrementId();
87
+ }
88
+
89
+ return '';
90
+ }
91
+
92
+ /**
93
+ * Get the original order's CC type
94
+ *
95
+ * @return string
96
+ */
97
+ public function getCcType()
98
+ {
99
+ if (!is_null($this->_storedPayment)) {
100
+ return $this->_storedPayment->getCcType();
101
+ }
102
+
103
+ return '';
104
+ }
105
+
106
+ /**
107
+ * Get the original order's CC last4
108
+ *
109
+ * @return string
110
+ */
111
+ public function getCcLast4()
112
+ {
113
+ if (!is_null($this->_storedPayment)) {
114
+ return $this->_storedPayment->getCcLast4();
115
+ }
116
+
117
+ return '';
118
+ }
119
+
120
+ }
app/code/community/CLS/Paypal/Block/Paypal/Payment/Form/Orderstored/Agreement.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypal_Payment_Form_Orderstored_Agreement extends Mage_Sales_Block_Payment_Form_Billing_Agreement
30
+ {
31
+ /**
32
+ * Set custom template
33
+ *
34
+ */
35
+ public function __construct()
36
+ {
37
+ parent::__construct();
38
+ $this->setTemplate('cls_paypal/sales/payment/form/orderstored/agreement.phtml');
39
+ }
40
+
41
+ /**
42
+ * Get the billing agreement id from the session order
43
+ *
44
+ * @return string
45
+ * @throws Mage_Core_Exception
46
+ */
47
+ public function getBillingAgreementId() {
48
+ $billingAgreementId = Mage::helper('cls_paypal/orderstored_agreement')->getBillingAgreementIdFromSessionOrder();
49
+ if ($billingAgreementId) {
50
+ return $billingAgreementId;
51
+ } else {
52
+ throw new Mage_Core_Exception(Mage::helper('cls_paypal')->__('Billing agreement not found. Order could not be loaded.'));
53
+ }
54
+ }
55
+ }
app/code/community/CLS/Paypal/Block/Paypaluk/Payment/Form/Orderstored/Agreement.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Block_Paypaluk_Payment_Form_Orderstored_Agreement extends CLS_Paypal_Block_Paypal_Payment_Form_Orderstored_Agreement
30
+ {
31
+
32
+ }
app/code/community/CLS/Paypal/CHANGELOG.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ CLS_Paypal 1.0.0 (07/01/2013)
2
+ =======================================
3
+ Initial release
app/code/community/CLS/Paypal/Helper/Data.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Helper_Data extends Mage_Core_Helper_Abstract
30
+ {
31
+
32
+ const PAYPAL_INFO_CODE = 'Q2xhc3N5TGxhbWFfU0lfTWFnZW50b0VFX1JlZlRyYW4=';
33
+
34
+ /**
35
+ * Native payment methods supported by the module
36
+ *
37
+ * @var array
38
+ */
39
+ public static $supportedPaymentMethods = array(
40
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWADVANCED,
41
+ CLS_Paypal_Model_Paypal_Config::METHOD_WPP_DIRECT,
42
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWLINK,
43
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO
44
+ );
45
+
46
+ /**
47
+ * Module-specific custom payment methods
48
+ *
49
+ * @var array
50
+ */
51
+ public static $customPaymentMethods = array(
52
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED,
53
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED,
54
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED,
55
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED,
56
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_DIRECT_ORDERSTORED,
57
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED,
58
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED,
59
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED
60
+ );
61
+
62
+ /**
63
+ * SDK-based payment methods
64
+ *
65
+ * @var array
66
+ */
67
+ public static $sdkPaymentMethods = array(
68
+ CLS_Paypal_Model_Paypal_Config::METHOD_WPP_DIRECT,
69
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO
70
+ );
71
+
72
+ /**
73
+ * Custom Payment additional information fields
74
+ *
75
+ * @var array
76
+ */
77
+ public static $customPaymentAddInfoFields = array(
78
+ 'cc_save_future',
79
+ 'stored_card_id',
80
+ 'stored_card_transaction_id',
81
+ 'orderstored_original_order_id',
82
+ 'orderstored_transaction_id'
83
+ );
84
+
85
+ /**
86
+ * Return parameters for the "New Order from this Payment" button (admin)
87
+ *
88
+ * @return string
89
+ */
90
+ public function getAdminOrderFromPaymentButton()
91
+ {
92
+ $params = array();
93
+
94
+ if ( $order = Mage::registry('sales_order') ) {
95
+ $params['order_id'] = $order->getId();
96
+ }
97
+
98
+ return array(
99
+ 'label' => $this->__('New Order from this Payment'),
100
+ 'onclick' => 'setLocation(\''.Mage::helper("adminhtml")->getUrl('*/sales_order_create/orderFromPayment', $params).'\')'
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Get Paypal info code
106
+ *
107
+ * @return string
108
+ */
109
+ public function getPaypalInfoCode() {
110
+ return base64_decode(self::PAYPAL_INFO_CODE);
111
+ }
112
+
113
+ /**
114
+ * Check if any of supported payment methods is active
115
+ *
116
+ * @todo Remove this method if it will not be actually used
117
+ * @return bool
118
+ */
119
+ public function isSupportedCcMethodEnabled()
120
+ {
121
+ if (!empty(self::$supportedPaymentMethods)) {
122
+ foreach (self::$supportedPaymentMethods as $paymentMethodCode) {
123
+ if ( (bool)Mage::getStoreConfig("payment/{$paymentMethodCode}/active") === true ) {
124
+ return true;
125
+ }
126
+ }
127
+ }
128
+
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Check whether the payment method is supported
134
+ *
135
+ * @param string $paymentMethod
136
+ * @return bool
137
+ */
138
+ public function isSupportedPaymentMethod($paymentMethod)
139
+ {
140
+ if (
141
+ $paymentMethod &&
142
+ !empty(self::$supportedPaymentMethods) &&
143
+ in_array($paymentMethod, self::$supportedPaymentMethods)
144
+ ) {
145
+ return true;
146
+ }
147
+
148
+ return false;
149
+ }
150
+
151
+ /**
152
+ * Check among native and custom methods whether the payment method is supported
153
+ *
154
+ * @param string $paymentMethod
155
+ * @return bool
156
+ */
157
+ public function isSupportedPaymentMethodFull($paymentMethod)
158
+ {
159
+ // Check native methods
160
+ if ($this->isSupportedPaymentMethod($paymentMethod)) {
161
+ return true;
162
+ }
163
+
164
+ // Check custom methods
165
+ if (
166
+ $paymentMethod &&
167
+ !empty(self::$customPaymentMethods) &&
168
+ in_array($paymentMethod, self::$customPaymentMethods)
169
+ ) {
170
+ return true;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ /**
177
+ * Check whether the payment method is based on PayPal SDK
178
+ *
179
+ * @param string $paymentMethod
180
+ * @return bool
181
+ */
182
+ public function isSdkPaymentMethod($paymentMethod)
183
+ {
184
+ if (
185
+ $paymentMethod &&
186
+ !empty(self::$sdkPaymentMethods) &&
187
+ in_array($paymentMethod, self::$sdkPaymentMethods)
188
+ ) {
189
+ return true;
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+ /**
196
+ * Check if the payment method belongs to the 'Customer Stored' family
197
+ *
198
+ * @param string $paymentMethod
199
+ * @return bool
200
+ */
201
+ public function isCustomerstoredPaymentMethod($paymentMethod)
202
+ {
203
+ if ( $paymentMethod && (strpos($paymentMethod, '_customerstored') !== false) ) {
204
+ return true;
205
+ }
206
+
207
+ return false;
208
+ }
209
+
210
+ /**
211
+ * Check if the payment method is compatible with its parent method
212
+ *
213
+ * @param string $paymentMethod
214
+ * @param string $parentPaymentMethod
215
+ * @return bool
216
+ */
217
+ public function isValidParentPaymentMethod($paymentMethod, $parentPaymentMethod)
218
+ {
219
+ // WPP-based methods
220
+ if (
221
+ (strpos($paymentMethod, 'paypal_direct') !== false)
222
+ && (strpos($parentPaymentMethod, 'paypal_direct') !== false)
223
+ ) {
224
+ return true;
225
+ }
226
+
227
+ // Payflow-based methods
228
+ if (
229
+ (strpos($paymentMethod, 'payflow_') !== false || strpos($paymentMethod, 'verisign') !== false)
230
+ && (strpos($parentPaymentMethod, 'payflow_') !== false || strpos($parentPaymentMethod, 'verisign') !== false)
231
+ ) {
232
+ return true;
233
+ }
234
+
235
+ return false;
236
+ }
237
+
238
+ /**
239
+ * Check if the "Save this card" feature is allowed
240
+ * (for any not-guest order, child customerstored method should be active)
241
+ *
242
+ * @param Mage_Sales_Model_Quote $quote
243
+ * @param string $paymentMethodCode
244
+ * @return bool
245
+ */
246
+ public function isCcSaveAllowed($quote, $paymentMethodCode)
247
+ {
248
+ if (!$paymentMethodCode) {
249
+ return false;
250
+ }
251
+ else {
252
+ // @todo Adjust this code if 'customerstored' methods naming convention will change
253
+ $customerstoredPaymentMethodCode = $paymentMethodCode . '_customerstored';
254
+ }
255
+
256
+ if (
257
+ $quote &&
258
+ !(
259
+ $quote->getData('checkout_method') == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST ||
260
+ $quote->getData('customer_is_guest')
261
+ ) &&
262
+ Mage::getStoreConfig("payment/{$customerstoredPaymentMethodCode}/active", $quote->getStoreId())
263
+ ) {
264
+ return true;
265
+ }
266
+
267
+ return false;
268
+ }
269
+
270
+ /**
271
+ * Determine if a transaction has been voided, using the "txn_type" field
272
+ * instead of "type" like the native isVoided method does
273
+ *
274
+ * @param Mage_Sales_Model_Order_Payment_Transaction $trans
275
+ * @return bool
276
+ */
277
+ public function transactionIsVoided($trans)
278
+ {
279
+ $children = $trans->getChildTransactions();
280
+
281
+ $result = false;
282
+ if (Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH === $trans->getTxnType()) {
283
+ foreach ($children as $child) {
284
+ if (Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID === $child->getTxnType()) {
285
+ $result = true;
286
+ }
287
+ }
288
+ }
289
+
290
+ return $result;
291
+ }
292
+ }
app/code/community/CLS/Paypal/Helper/Orderstored/Agreement.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypay
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Helper_Orderstored_Agreement extends Mage_Core_Helper_Data
30
+ {
31
+ protected $_sessionOrder = NULL;
32
+
33
+ /**
34
+ * Check payment additional information for a billing agreement id
35
+ *
36
+ * @return string | bool
37
+ */
38
+ public function getBillingAgreementIdFromSessionOrder()
39
+ {
40
+ $billingAgreementReferenceId = false;
41
+ $order = $this->getSessionOrder();
42
+ if ($order->getId()) {
43
+ //Get payments for this order
44
+ $payments = Mage::getResourceModel('sales/order_payment_collection')
45
+ ->setOrderFilter($order)
46
+ ->addAttributeToSort('entity_id', 'desc');
47
+ foreach ($payments as $payment) {
48
+ if (!$payment->isDeleted()) {
49
+ //Return the first billing agreement id found
50
+ if ($paymentReferenceId = $payment->getAdditionalInformation(Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID)) {
51
+ $billingAgreementReferenceId = $paymentReferenceId;
52
+ break;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ return $billingAgreementReferenceId;
58
+ }
59
+
60
+ /**
61
+ * Get the order from the session. The order or order id is stored differently based on
62
+ * the current action (edit / new order from this payment)
63
+ *
64
+ * @return Mage_Sales_Model_Order
65
+ */
66
+ public function getSessionOrder() {
67
+ if (is_null($this->_sessionOrder)) {
68
+ //New order from this payment
69
+ if ($orderId = Mage::getSingleton('adminhtml/session_quote')->getPreviousOrderId()) {
70
+ $this->_sessionOrder = Mage::getModel('sales/order')->load($orderId);
71
+ } else {
72
+ //Edit
73
+ $this->_sessionOrder = Mage::getSingleton('adminhtml/session_quote')->getOrder();
74
+ }
75
+ }
76
+ return $this->_sessionOrder;
77
+ }
78
+ }
app/code/community/CLS/Paypal/Helper/Paypal/Data.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Helper_Paypal_Data extends Mage_Paypal_Helper_Data
30
+ {
31
+
32
+ /**
33
+ * Check whether customer should be asked confirmation whether to sign a billing agreement
34
+ *
35
+ * @param Mage_Paypal_Model_Config $config
36
+ * @param int $customerId
37
+ * @return bool
38
+ */
39
+ public function shouldAskToCreateBillingAgreement(Mage_Paypal_Model_Config $config, $customerId)
40
+ {
41
+ if (null === self::$_shouldAskToCreateBillingAgreement) {
42
+ self::$_shouldAskToCreateBillingAgreement = false;
43
+ if ($customerId && $config->shouldAskToCreateBillingAgreement()) {
44
+ if (Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($customerId)) {
45
+ self::$_shouldAskToCreateBillingAgreement = true;
46
+ }
47
+ } elseif (!$customerId && $config->shouldAskToCreateBillingAgreement()) {
48
+ self::$_shouldAskToCreateBillingAgreement = true;
49
+ }
50
+ }
51
+ return self::$_shouldAskToCreateBillingAgreement;
52
+ }
53
+ }
app/code/community/CLS/Paypal/Helper/Storedcard.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Helper file for 'Stored card' payment methods
31
+ */
32
+ class CLS_Paypal_Helper_Storedcard extends Mage_Core_Helper_Data
33
+ {
34
+
35
+ /**
36
+ * Keeps CC types
37
+ *
38
+ * @var array
39
+ */
40
+ protected $_ccTypes = array();
41
+
42
+ /**
43
+ * Get CC names list
44
+ *
45
+ * @return array
46
+ */
47
+ protected function _getCcTypes()
48
+ {
49
+ if (empty($this->_ccTypes)) {
50
+ $this->_ccTypes = Mage::getSingleton('payment/config')->getCcTypes();
51
+ }
52
+
53
+ return $this->_ccTypes;
54
+ }
55
+
56
+ /**
57
+ * Obtain the full CC type name
58
+ *
59
+ * @param string $ccTypeShort
60
+ * @return string
61
+ */
62
+ public function translateCcType($ccTypeShort)
63
+ {
64
+ $ccTypes = $this->_getCcTypes();
65
+ if ( !empty($ccTypes) && $ccTypeShort && isset($ccTypes[$ccTypeShort]) ) {
66
+ return $ccTypes[$ccTypeShort];
67
+ }
68
+
69
+ return '';
70
+ }
71
+
72
+ }
app/code/community/CLS/Paypal/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Open Software License ("OSL") v. 3.0
3
+
4
+ This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Open Software License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/CLS/Paypal/Model/Customerstored.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Customerstored extends Mage_Core_Model_Abstract
30
+ {
31
+
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->_init('cls_paypal/customerstored');
36
+ }
37
+
38
+ /**
39
+ * Return customer's stored card collection
40
+ *
41
+ * @param int $customerId
42
+ * @param string $paymentMethod
43
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
44
+ */
45
+ public function getCustomerstoredCollection($customerId, $paymentMethod = null)
46
+ {
47
+ /** @var $collection CLS_Paypal_Model_Resource_Customerstored_Collection */
48
+ $collection = $this->getCollection();
49
+ $collection
50
+ ->filterByCustomerId($customerId)
51
+ ->filterByActiveState()
52
+ ->filterByExpirationDate();
53
+
54
+ if (!is_null($paymentMethod)) {
55
+ // Select cards compatible with the current payment method only
56
+ // @todo This section needs to be updated if new payment methods support will be added
57
+
58
+ $paymentMethodFilter = array();
59
+
60
+ if ($paymentMethod == CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED) {
61
+ // WPP payment method
62
+ $paymentMethodFilter[] = CLS_Paypal_Model_Paypal_Config::METHOD_WPP_DIRECT;
63
+ }
64
+ else {
65
+ // Payflow methods
66
+ $paymentMethodFilter[] = CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWADVANCED;
67
+ $paymentMethodFilter[] = CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWLINK;
68
+ $paymentMethodFilter[] = CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO;
69
+ }
70
+
71
+ $collection->filterByPaymentMethod($paymentMethodFilter);
72
+ }
73
+
74
+ return $collection;
75
+ }
76
+
77
+ /**
78
+ * Check if the newly save card already exists
79
+ *
80
+ * @return CLS_Paypal_Model_Customerstored
81
+ */
82
+ protected function _beforeSave()
83
+ {
84
+ parent::_beforeSave();
85
+
86
+ if (!$this->getId()) {
87
+ $compatiblePaymentMethods = array();
88
+
89
+ $compatibleGroups = array(
90
+ array(
91
+ CLS_Paypal_Model_Paypal_Config::METHOD_WPP_DIRECT,
92
+ ),
93
+ array(
94
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWADVANCED,
95
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWLINK,
96
+ CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO,
97
+ )
98
+ );
99
+
100
+ foreach ($compatibleGroups as $group) {
101
+ if (in_array($this->getPaymentMethod(), $group)) {
102
+ $compatiblePaymentMethods = $group;
103
+ break;
104
+ }
105
+ }
106
+
107
+ $cardDuplicate = $this->getResource()->checkCardDuplicate(
108
+ $this->getData('customer_id'),
109
+ $this->getData('cc_type'),
110
+ $this->getData('cc_last4'),
111
+ $this->getData('cc_exp_month'),
112
+ $this->getData('cc_exp_year'),
113
+ $compatiblePaymentMethods
114
+ );
115
+
116
+ if ($cardDuplicate) {
117
+ // Disallow card save
118
+ $this->_dataSaveAllowed = false;
119
+ }
120
+ }
121
+
122
+ return $this;
123
+ }
124
+
125
+ }
app/code/community/CLS/Paypal/Model/Observer.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Observer
30
+ {
31
+
32
+ /**
33
+ * Catch guest order creation in admin
34
+ *
35
+ * @param Varien_Event_Observer $observer
36
+ * @return void
37
+ */
38
+ public function adminCheckGuestOrder(Varien_Event_Observer $observer)
39
+ {
40
+ /* @var $request Mage_Core_Controller_Request_Http */
41
+ $request = $observer->getRequestModel();
42
+
43
+ /** @var $session Mage_Adminhtml_Model_Session_Quote */
44
+ $session = $observer->getSession();
45
+
46
+ if ($request->getParam('is_guest_order')) {
47
+ // In case of guest order mark the quote appropriately
48
+ $session->getQuote()->setCustomerIsGuest(true);
49
+
50
+ if ( ($originalOrderId = $session->getPreviousOrderId()) && (!$session->getIsGuestAddressPopulated()) ) {
51
+ // Populate address fields from the original order
52
+ $originalOrder = Mage::getModel('sales/order')->load($originalOrderId);
53
+
54
+ if ($originalOrder->getId()) {
55
+ $session->getQuote()->getBillingAddress()->setCustomerAddressId('');
56
+ Mage::helper('core')->copyFieldset(
57
+ 'sales_copy_order_billing_address',
58
+ 'to_order',
59
+ $originalOrder->getBillingAddress(),
60
+ $session->getQuote()->getBillingAddress()
61
+ );
62
+
63
+ $session->getQuote()->getShippingAddress()->setCustomerAddressId('');
64
+ Mage::helper('core')->copyFieldset(
65
+ 'sales_copy_order_shipping_address',
66
+ 'to_order',
67
+ $originalOrder->getShippingAddress(),
68
+ $session->getQuote()->getShippingAddress()
69
+ );
70
+
71
+ // Don't set our "guest address populated" flag on the session just yet,
72
+ // because quote isn't saved during this request in every case. Wait for save.
73
+ $session->getQuote()->setFlagGuestAddressOnSave(true);
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * On quote save during admin order creation, if guess address was populated in this request,
81
+ * set a flag on the session
82
+ *
83
+ * @param Varien_Event_Observer $observer
84
+ */
85
+ public function adminQuoteFlagGuestAddress(Varien_Event_Observer $observer)
86
+ {
87
+ $quote = $observer->getQuote();
88
+ if ($quote->getFlagGuestAddressOnSave()) {
89
+ Mage::getSingleton('adminhtml/session_quote')->setIsGuestAddressPopulated(true);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Handle custom payment data fields
95
+ *
96
+ * @param Varien_Event_Observer $observer
97
+ * @return void
98
+ */
99
+ public function salesQuotePaymentImportDataBefore(Varien_Event_Observer $observer)
100
+ {
101
+ /** @var $input Varien_Object */
102
+ $input = $observer->getInput();
103
+
104
+ /** @var $payment Mage_Sales_Model_Quote_Payment */
105
+ $payment = $observer->getPayment();
106
+
107
+ $paymentMethod = $input->getMethod();
108
+
109
+ if (isset($paymentMethod)) {
110
+ // Clear any possible additional info from previous requests
111
+ $customPaymentAddInfoFields = CLS_Paypal_Helper_Data::$customPaymentAddInfoFields;
112
+ if (!empty($customPaymentAddInfoFields)) {
113
+ foreach ($customPaymentAddInfoFields as $_customField) {
114
+ if ($payment->hasAdditionalInformation($_customField)) {
115
+ $payment->unsAdditionalInformation($_customField);
116
+ }
117
+ }
118
+ }
119
+
120
+ /** @var $helper CLS_Paypal_Helper_Data */
121
+ $helper = Mage::helper('cls_paypal');
122
+
123
+ // Handle "Save this card" option for native Magento payment methods
124
+ if ($helper->isSupportedPaymentMethod($paymentMethod)) {
125
+ if ($input['cc_save_future'] == 'Y') {
126
+ // Set 'Save for future use' flag
127
+ $payment->setAdditionalInformation('cc_save_future', 'Y');
128
+ }
129
+ }
130
+
131
+ // Handle "Customer stored card" payment methods selection
132
+ elseif ($helper->isCustomerstoredPaymentMethod($paymentMethod)) {
133
+ if ($input['stored_card_id']) {
134
+ // Save stared card ID into the additional information,
135
+ // card ID will be validated afterwards
136
+ $payment->setAdditionalInformation('stored_card_id', $input['stored_card_id']);
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Add custom data to the payment info block
144
+ *
145
+ * @param Varien_Event_Observer $observer
146
+ * @return void
147
+ */
148
+ public function paymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer)
149
+ {
150
+ /** @var $payment Mage_Sales_Model_Quote_Payment */
151
+ $payment = $observer->getPayment();
152
+
153
+ /** @var $transport Varien_Object */
154
+ $transport = $observer->getTransport();
155
+
156
+ $paymentMethod = $payment->getMethod();
157
+
158
+ // Display custom data for supported payment methods only
159
+ /** @var $helper CLS_Paypal_Helper_Data */
160
+ $helper = Mage::helper('cls_paypal');
161
+
162
+ if ($helper->isSupportedPaymentMethod($paymentMethod)) {
163
+ if ($payment->hasAdditionalInformation('cc_save_future')) {
164
+ $transport->setData($helper->__('Save this card for future use'), $helper->__('Yes'));
165
+ }
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Save stored card details
171
+ *
172
+ * @param Varien_Event_Observer $observer
173
+ * @return void
174
+ */
175
+ public function checkoutSubmitAllAfter(Varien_Event_Observer $observer)
176
+ {
177
+ /** @var $order Mage_Sales_Model_Order */
178
+ $order = $observer->getOrder();
179
+
180
+ $customerId = $order->getData('customer_id');
181
+
182
+ if (!$customerId) {
183
+ // Save transaction details for registered customers only
184
+ return;
185
+ }
186
+
187
+ $payment = $order->getPayment();
188
+ $paymentMethod = $payment->getMethod();
189
+
190
+ if ( isset($paymentMethod) && $payment->getData('transaction_id') ) {
191
+
192
+ /** @var $helper CLS_Paypal_Helper_Data */
193
+ $helper = Mage::helper('cls_paypal');
194
+
195
+ if ($helper->isSdkPaymentMethod($paymentMethod)) {
196
+ if (
197
+ $payment->hasAdditionalInformation('cc_save_future') &&
198
+ ($payment->getAdditionalInformation('cc_save_future') == 'Y')
199
+ ) {
200
+ // Create new stored card
201
+ $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
202
+ $customerstoredModel->setData(array(
203
+ 'transaction_id' => $payment->getData('transaction_id'),
204
+ 'customer_id' => $customerId,
205
+ 'cc_type' => $payment->getData('cc_type'),
206
+ 'cc_last4' => $payment->getData('cc_last4'),
207
+ 'cc_exp_month' => $payment->getData('cc_exp_month'),
208
+ 'cc_exp_year' => $payment->getData('cc_exp_year'),
209
+ 'date' => Varien_Date::formatDate(true, true),
210
+ 'payment_method' => $paymentMethod
211
+ ));
212
+ $customerstoredModel->save();
213
+ }
214
+ }
215
+
216
+ elseif ($helper->isCustomerstoredPaymentMethod($paymentMethod)) {
217
+ // Update existing stored card
218
+ $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
219
+
220
+ if ($payment->hasAdditionalInformation('stored_card_id')) {
221
+ // Reference payment using existing customer's stored card
222
+ $storedCardId = $payment->getAdditionalInformation('stored_card_id');
223
+ $customerstoredModel->load($storedCardId);
224
+
225
+ if ($customerstoredModel->getId()) {
226
+ // Update stored card record with a new transaction ID
227
+ $customerstoredModel
228
+ ->setData('transaction_id', $payment->getData('transaction_id'))
229
+ ->setData('date', Varien_Date::formatDate(true, false));
230
+ $customerstoredModel->save();
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+
237
+ }
app/code/community/CLS/Paypal/Model/Paypal/Api/Nvp.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp
30
+ {
31
+
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+
36
+ $this->_globalMap['BUTTONSOURCE'] = 'paypal_info_code';
37
+ $this->_debugReplacePrivateDataKeys[] = 'BUTTONSOURCE';
38
+ }
39
+
40
+ /**
41
+ * Get Paypal info code
42
+ *
43
+ * @return string
44
+ */
45
+ public function getPaypalInfoCode()
46
+ {
47
+ return Mage::helper('cls_paypal')->getPaypalInfoCode();
48
+ }
49
+
50
+ }
app/code/community/CLS/Paypal/Model/Paypal/Config.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Config extends Mage_Paypal_Model_Config
30
+ {
31
+ const METHOD_PAYPAL_ORDERSTORED_AGREEMENT = 'paypal_orderstored_agreement';
32
+ const METHOD_PAYFLOW_BILLING_AGREEMENT = 'paypaluk_billing_agreement';
33
+ const METHOD_PAYFLOW_ORDERSTORED_AGREEMENT = 'paypaluk_orderstored_agreement';
34
+
35
+ // "Customer stored" payment methods
36
+ const METHOD_PAYPAL_DIRECT_CUSTOMERSTORED = 'paypal_direct_customerstored';
37
+ const METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED = 'payflow_advanced_customerstored';
38
+ const METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED = 'verisign_customerstored';
39
+ const METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED = 'payflow_link_customerstored';
40
+
41
+ // "Order stored" payment methods
42
+ const METHOD_PAYPAL_DIRECT_ORDERSTORED = 'paypal_direct_orderstored';
43
+ const METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED = 'payflow_advanced_orderstored';
44
+ const METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED = 'verisign_orderstored';
45
+ const METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED = 'payflow_link_orderstored';
46
+
47
+ // Stored card lifetime (in months)
48
+ const STORED_CARD_TTL_MONTHS = 12;
49
+
50
+ /**
51
+ * Fall-back payment method (to get missing config parameters)
52
+ *
53
+ * @var string
54
+ */
55
+ protected $_fallBackMethod = null;
56
+
57
+ /**
58
+ * Fallback method setter
59
+ *
60
+ * @param string $fallBackMethod
61
+ * @return Mage_Paypal_Model_Config
62
+ */
63
+ public function setFallBackMethod($fallBackMethod)
64
+ {
65
+ $this->_fallBackMethod = $fallBackMethod;
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Whether to ask customer to create billing agreements
71
+ * Unilateral payments are incompatible with the billing agreements
72
+ *
73
+ * @return bool
74
+ */
75
+ public function shouldAskToCreateBillingAgreement()
76
+ {
77
+ if ($this->getMethodCode() == Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS) {
78
+ return ($this->allow_ba_signup === Mage_Paypal_Model_Config::EC_BA_SIGNUP_ASK) && $this->business_account;
79
+ }
80
+
81
+ return parent::shouldAskToCreateBillingAgreement();
82
+ }
83
+
84
+ /**
85
+ * Return list of allowed methods for specified country iso code
86
+ *
87
+ * @param string $countryCode 2-letters iso code
88
+ * @return array
89
+ */
90
+ public function getCountryMethods($countryCode = null)
91
+ {
92
+ //Countries where this method is available
93
+ // (based on countries where PayFlow Pro, PayFlow Express Checkout and Billing Agreements are available)
94
+ $countriesByMethod = array(
95
+ self::METHOD_PAYFLOW_BILLING_AGREEMENT => array(
96
+ 'US',
97
+ 'CA',
98
+ 'AU',
99
+ 'NZ',
100
+ ),
101
+ self::METHOD_PAYPAL_ORDERSTORED_AGREEMENT => array(
102
+ 'other',
103
+ 'US',
104
+ 'CA',
105
+ 'GB',
106
+ 'AU',
107
+ 'NZ',
108
+ 'JP',
109
+ 'FR',
110
+ 'IT',
111
+ 'ES',
112
+ 'HK',
113
+ ),
114
+ self::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT => array(
115
+ 'other',
116
+ 'US',
117
+ 'CA',
118
+ 'GB',
119
+ 'AU',
120
+ 'NZ',
121
+ 'JP',
122
+ 'FR',
123
+ 'IT',
124
+ 'ES',
125
+ 'HK',
126
+ ),
127
+ );
128
+
129
+ // PayPal Direct 'Stored card' methods
130
+ $countriesByMethod[self::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED] =
131
+ $countriesByMethod[self::METHOD_PAYPAL_DIRECT_ORDERSTORED] = array(
132
+ 'US',
133
+ 'CA',
134
+ 'GB'
135
+ );
136
+
137
+ // PayPal Payflow-based 'Stored card' methods (Payflow Pro defines the list of supported countries)
138
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED] =
139
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED] =
140
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED] =
141
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED] =
142
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED] =
143
+ $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED] = array(
144
+ 'US',
145
+ 'CA',
146
+ 'AU',
147
+ 'NZ'
148
+ );
149
+
150
+ $countryMethods = parent::getCountryMethods($countryCode);
151
+
152
+ foreach ($countriesByMethod as $methodCode => $countries) {
153
+ //Add this method to the list of available methods in appropriate countries
154
+ if (is_null($countryCode)) {
155
+ foreach ($countries as $country) {
156
+ array_push($countryMethods[$country], $methodCode);
157
+ }
158
+ } elseif (in_array($countryCode, $countries)) {
159
+ array_push($countryMethods, $methodCode);
160
+ }
161
+ }
162
+
163
+ return $countryMethods;
164
+ }
165
+
166
+ /**
167
+ * Map any supported payment method into a config path by specified field name
168
+ *
169
+ * @param string $fieldName
170
+ * @return string|null
171
+ */
172
+ protected function _getSpecificConfigPath($fieldName)
173
+ {
174
+ $path = parent::_getSpecificConfigPath($fieldName);
175
+
176
+ if (is_null($path)) {
177
+ switch ($this->_methodCode) {
178
+ case self::METHOD_PAYFLOW_BILLING_AGREEMENT:
179
+ case self::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT:
180
+ $path = $this->_mapMethodFieldset($fieldName);
181
+ if (is_null($path)) {
182
+ $path = $this->_mapWpukFieldset($fieldName);
183
+ }
184
+ break;
185
+ case self::METHOD_PAYPAL_ORDERSTORED_AGREEMENT:
186
+ $path = $this->_mapMethodFieldset($fieldName);
187
+ if (is_null($path)) {
188
+ $path = $this->_mapWppFieldset($fieldName);
189
+ }
190
+ break;
191
+ case self::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED:
192
+ case self::METHOD_PAYPAL_DIRECT_ORDERSTORED:
193
+ $path = $this->_mapStoredFieldset($fieldName);
194
+ break;
195
+ default:
196
+ }
197
+ }
198
+
199
+ return $path;
200
+ }
201
+
202
+ /**
203
+ * Check whether method available for checkout or not
204
+ * Logic based on merchant country, methods dependence
205
+ *
206
+ * @param string $methodCode
207
+ * @return bool
208
+ */
209
+ public function isMethodAvailable($methodCode = null)
210
+ {
211
+ $result = parent::isMethodAvailable($methodCode);
212
+
213
+ if (!$result) {
214
+ return false;
215
+ }
216
+
217
+ // Additionally check parent method
218
+ if ($methodCode === null) {
219
+ $methodCode = $this->getMethodCode();
220
+ }
221
+
222
+ switch ($methodCode) {
223
+ case self::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED:
224
+ case self::METHOD_PAYPAL_DIRECT_ORDERSTORED:
225
+ if (!$this->isMethodActive(self::METHOD_WPP_DIRECT)) {
226
+ $result = false;
227
+ }
228
+ break;
229
+ case self::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED:
230
+ case self::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED:
231
+ if (!$this->isMethodActive(self::METHOD_PAYFLOWADVANCED)) {
232
+ $result = false;
233
+ }
234
+ break;
235
+ case self::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED:
236
+ case self::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED:
237
+ if (!$this->isMethodActive(self::METHOD_PAYFLOWLINK)) {
238
+ $result = false;
239
+ }
240
+ break;
241
+ case self::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED:
242
+ case self::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED:
243
+ if (!$this->isMethodActive(self::METHOD_PAYFLOWPRO)) {
244
+ $result = false;
245
+ }
246
+ break;
247
+ }
248
+
249
+ return $result;
250
+ }
251
+
252
+ /**
253
+ * Map PayPal Website Payments Pro common config fields
254
+ *
255
+ * @param string $fieldName
256
+ * @return string|null
257
+ */
258
+ protected function _mapWpukFieldset($fieldName)
259
+ {
260
+ $result = null;
261
+ switch ($this->_methodCode) {
262
+ case self::METHOD_PAYFLOW_BILLING_AGREEMENT:
263
+ case self::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT:
264
+ $pathPrefix = 'paypal/wpuk';
265
+ // Use PUMP credentials from Verisign for EC when Direct Payments are unavailable
266
+ if (!$this->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_PE_DIRECT)) {
267
+ $pathPrefix = 'payment/verisign';
268
+ }
269
+ switch ($fieldName) {
270
+ case 'partner':
271
+ case 'user':
272
+ case 'vendor':
273
+ case 'pwd':
274
+ case 'sandbox_flag':
275
+ case 'use_proxy':
276
+ case 'proxy_host':
277
+ case 'proxy_port':
278
+ $result = $pathPrefix . '/' . $fieldName;
279
+ break;
280
+ default:
281
+ }
282
+ break;
283
+
284
+ default:
285
+ $result = parent::_mapWpukFieldset($fieldName);
286
+ }
287
+
288
+ return $result;
289
+ }
290
+
291
+ /**
292
+ * Map 'Stored card' common config fields
293
+ *
294
+ * @param string $fieldName
295
+ * @return string|null
296
+ */
297
+ protected function _mapStoredFieldset($fieldName)
298
+ {
299
+ switch ($fieldName)
300
+ {
301
+ // The following fields should be taken from the actual 'Stored' payment method
302
+ case 'active':
303
+ case 'title':
304
+ case 'sort_order':
305
+ case 'payment_action':
306
+ case 'allowspecific':
307
+ case 'specificcountry':
308
+ case 'debug':
309
+ case 'verify_peer':
310
+ case 'line_items_enabled':
311
+ return "payment/{$this->_methodCode}/{$fieldName}";
312
+ default:
313
+ if (!is_null($this->_fallBackMethod)) {
314
+ // Fall back to the parent payment method
315
+ switch ($this->_fallBackMethod)
316
+ {
317
+ case self::METHOD_WPP_DIRECT:
318
+ return $this->_mapWppFieldset($fieldName);
319
+ default:
320
+ return null;
321
+ }
322
+ }
323
+
324
+ return null;
325
+ }
326
+ }
327
+ }
app/code/community/CLS/Paypal/Model/Paypal/Direct.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Direct extends Mage_Paypal_Model_Direct
30
+ {
31
+ protected $_formBlockType = 'cls_paypal/payment_form_cc';
32
+ }
app/code/community/CLS/Paypal/Model/Paypal/Express.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Express extends Mage_Paypal_Model_Express
30
+ {
31
+
32
+ /**
33
+ * Import payment info to payment
34
+ *
35
+ * @param Mage_Paypal_Model_Api_Nvp
36
+ * @param Mage_Sales_Model_Order_Payment
37
+ */
38
+ protected function _importToPayment($api, $payment)
39
+ {
40
+ $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)
41
+ ->setAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT,
42
+ $api->getRedirectRequired()
43
+ );
44
+
45
+ if ($api->getBillingAgreementId() && $payment->getOrder()->getCustomerId()) {
46
+ $payment->setBillingAgreementData(array(
47
+ 'billing_agreement_id' => $api->getBillingAgreementId(),
48
+ 'method_code' => Mage_Paypal_Model_Config::METHOD_BILLING_AGREEMENT
49
+ ));
50
+ }
51
+
52
+ $this->_pro->importPaymentInfo($api, $payment);
53
+ }
54
+ }
app/code/community/CLS/Paypal/Model/Paypal/Express/Checkout.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Express_Checkout extends Mage_Paypal_Model_Express_Checkout
30
+ {
31
+
32
+ /**
33
+ * Set create billing agreement flag to api call
34
+ *
35
+ * @return Mage_Paypal_Model_Express_Checkout
36
+ */
37
+ protected function _setBillingAgreementRequest()
38
+ {
39
+ if ($this->_quote->hasNominalItems()) {
40
+ return $this;
41
+ }
42
+
43
+ $isRequested = $this->_isBARequested || $this->_quote->getPayment()
44
+ ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
45
+
46
+ if (!($this->_config->allow_ba_signup == Mage_Paypal_Model_Config::EC_BA_SIGNUP_AUTO
47
+ || $isRequested && $this->_config->shouldAskToCreateBillingAgreement())) {
48
+ return $this;
49
+ }
50
+
51
+ if ($this->_customerId && !Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($this->_customerId)) {
52
+ return $this;
53
+ }
54
+ $this->_api->setBillingType($this->_api->getBillingAgreementType());
55
+ return $this;
56
+ }
57
+ }
app/code/community/CLS/Paypal/Model/Paypal/Info.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Info extends Mage_Paypal_Model_Info
30
+ {
31
+
32
+ const BILLING_AGREEMENT_ID = 'billing_agreement_id';
33
+
34
+ /**
35
+ * Initialize the Info model
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->_paymentMap[self::BILLING_AGREEMENT_ID] = Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID;
41
+ }
42
+
43
+ /**
44
+ * Render info item labels
45
+ *
46
+ * @param string $key
47
+ */
48
+ protected function _getLabel($key)
49
+ {
50
+ switch ($key) {
51
+ case Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID:
52
+ return Mage::helper('cls_paypal')->__('Billing Agreement Id');
53
+ }
54
+ return parent::_getLabel($key);
55
+ }
56
+ }
app/code/community/CLS/Paypal/Model/Paypal/Method/Orderstored/Agreement.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Method_Orderstored_Agreement extends Mage_Paypal_Model_Method_Agreement
30
+ {
31
+ /**
32
+ * Method code
33
+ *
34
+ * @var string
35
+ */
36
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_ORDERSTORED_AGREEMENT;
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored_agreement';
38
+
39
+ /**
40
+ * Method instance settings
41
+ *
42
+ */
43
+ protected $_canUseInternal = true;
44
+
45
+ /**
46
+ * Check whether method is available
47
+ *
48
+ * @param Mage_Sales_Model_Quote $quote
49
+ * @return bool
50
+ */
51
+ public function isAvailable($quote = null)
52
+ {
53
+ if (is_null($this->_isAvailable)) {
54
+ $this->_isAvailable = (Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $this->_isAvailable($quote));
55
+
56
+ if ($this->_isAvailable && is_object($quote)) {
57
+ $isAvailable = false;
58
+ $availableBA = Mage::helper('cls_paypal/orderstored_agreement')->getBillingAgreementIdFromSessionOrder();
59
+ $isAvailable = !empty($availableBA);
60
+ $this->_isAvailable = $isAvailable;
61
+ }
62
+ $this->_canUseInternal = ($this->_isAvailable && $this->_canUseInternal);
63
+ }
64
+ return $this->_isAvailable;
65
+ }
66
+
67
+ /**
68
+ * Place an order with authorization or capture action
69
+ *
70
+ * @param Mage_Sales_Model_Order_Payment $payment
71
+ * @param float $amount
72
+ * @return CLS_Paypal_Model_Paypal_Method_Orderstored_Agreement
73
+ */
74
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
75
+ {
76
+ $order = $payment->getOrder();
77
+
78
+ $api = $this->_pro->getApi()
79
+ ->setReferenceId($payment->getBillingAgreementId())
80
+ ->setPaymentAction($this->_pro->getConfig()->paymentAction)
81
+ ->setAmount($amount)
82
+ ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
83
+ ->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
84
+ ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
85
+ ->setInvNum($order->getIncrementId())
86
+ ;
87
+
88
+ // call api and import transaction and other payment information
89
+ $api->callDoReferenceTransaction();
90
+ $this->_pro->importPaymentInfo($api, $payment);
91
+ $api->callGetTransactionDetails();
92
+ $this->_pro->importPaymentInfo($api, $payment);
93
+
94
+ $payment->setTransactionId($api->getTransactionId())
95
+ ->setIsTransactionClosed(0);
96
+
97
+ return $this;
98
+ }
99
+ }
app/code/community/CLS/Paypal/Model/Paypal/Payflowadvanced.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Payflowadvanced extends Mage_Paypal_Model_Payflowadvanced
30
+ {
31
+
32
+ /**
33
+ * Type of block that generates method form
34
+ *
35
+ * @var string
36
+ */
37
+ protected $_formBlockType = 'cls_paypal/paypal_payflow_advanced_form';
38
+
39
+ /**
40
+ * Operate with order using information from silent post
41
+ *
42
+ * @param Mage_Sales_Model_Order $order
43
+ */
44
+ protected function _processOrder(Mage_Sales_Model_Order $order)
45
+ {
46
+ $response = $this->getResponse();
47
+ $payment = $order->getPayment();
48
+ $payment->setTransactionId($response->getPnref())
49
+ ->setIsTransactionClosed(0);
50
+ $canSendNewOrderEmail = true;
51
+
52
+ if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER ||
53
+ $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER
54
+ ) {
55
+ $canSendNewOrderEmail = false;
56
+ $fraudMessage = $this->_getFraudMessage() ?
57
+ $response->getFraudMessage() : $response->getRespmsg();
58
+ $payment->setIsTransactionPending(true)
59
+ ->setIsFraudDetected(true)
60
+ ->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
61
+ }
62
+
63
+ if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
64
+ $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
65
+ }
66
+ if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
67
+ $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
68
+ }
69
+
70
+ switch ($response->getType()){
71
+ case self::TRXTYPE_AUTH_ONLY:
72
+ $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
73
+ break;
74
+ case self::TRXTYPE_SALE:
75
+ $payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
76
+ break;
77
+ }
78
+ $order->save();
79
+
80
+ $customerId = $order->getCustomerId();
81
+
82
+ if (
83
+ ($response->getResult() == self::RESPONSE_CODE_APPROVED) &&
84
+ ($response->getMethod() == 'CC') &&
85
+ $customerId &&
86
+ $payment->hasAdditionalInformation('cc_save_future') &&
87
+ ($payment->getAdditionalInformation('cc_save_future') == 'Y')
88
+ ) {
89
+ // Obtain CC type
90
+ $ccType = 'OT';
91
+ $responseCcType = $response->getCardtype();
92
+ if (!is_null($responseCcType)) {
93
+ $payflowResponseCcTypesMap = array(
94
+ 0 => 'VI',
95
+ 1 => 'MC',
96
+ 2 => 'DI',
97
+ 3 => 'AE',
98
+ 4 => 'OT',
99
+ 5 => 'JCB'
100
+ );
101
+
102
+ if (isset($payflowResponseCcTypesMap[$responseCcType])) {
103
+ $ccType = $payflowResponseCcTypesMap[$responseCcType];
104
+ }
105
+ }
106
+
107
+ $ccExpMonth = ($response->getExpdate()) ? substr($response->getExpdate(), 0, 2) : '';
108
+ if ($ccExpMonth{0} == '0') {
109
+ $ccExpMonth = $ccExpMonth{1};
110
+ }
111
+
112
+ // Create new stored card
113
+ $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
114
+ $customerstoredModel->setData(array(
115
+ 'transaction_id' => $response->getPnref(),
116
+ 'customer_id' => $customerId,
117
+ 'cc_type' => $ccType,
118
+ 'cc_last4' => ($response->getAcct()) ? substr($response->getAcct(), -4) : '',
119
+ 'cc_exp_month' => $ccExpMonth,
120
+ 'cc_exp_year' => (($response->getExpdate()) ? '20'.substr($response->getExpdate(), 2) : ''),
121
+ 'date' => Varien_Date::formatDate(true, true),
122
+ 'payment_method' => $payment->getMethod()
123
+ ));
124
+ $customerstoredModel->save();
125
+ }
126
+
127
+ try {
128
+ if ($canSendNewOrderEmail) {
129
+ $order->sendNewOrderEmail();
130
+ }
131
+ Mage::getModel('sales/quote')
132
+ ->load($order->getQuoteId())
133
+ ->setIsActive(false)
134
+ ->save();
135
+ } catch (Exception $e) {
136
+ Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
137
+ }
138
+ }
139
+ }
app/code/community/CLS/Paypal/Model/Paypal/Payflowlink.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Payflowlink extends Mage_Paypal_Model_Payflowlink
30
+ {
31
+ protected $_formBlockType = 'cls_paypal/paypal_payflow_link_form';
32
+
33
+ /**
34
+ * Operate with order using information from silent post
35
+ *
36
+ * @param Mage_Sales_Model_Order $order
37
+ */
38
+ protected function _processOrder(Mage_Sales_Model_Order $order)
39
+ {
40
+ $response = $this->getResponse();
41
+ $payment = $order->getPayment();
42
+ $payment->setTransactionId($response->getPnref())
43
+ ->setIsTransactionClosed(0);
44
+ $canSendNewOrderEmail = true;
45
+
46
+ if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER ||
47
+ $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER
48
+ ) {
49
+ $canSendNewOrderEmail = false;
50
+ $fraudMessage = $this->_getFraudMessage() ?
51
+ $response->getFraudMessage() : $response->getRespmsg();
52
+ $payment->setIsTransactionPending(true)
53
+ ->setIsFraudDetected(true)
54
+ ->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
55
+ }
56
+
57
+ if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
58
+ $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
59
+ }
60
+ if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
61
+ $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
62
+ }
63
+
64
+ switch ($response->getType()){
65
+ case self::TRXTYPE_AUTH_ONLY:
66
+ $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
67
+ break;
68
+ case self::TRXTYPE_SALE:
69
+ $payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
70
+ break;
71
+ }
72
+ $order->save();
73
+
74
+ $customerId = $order->getCustomerId();
75
+
76
+ if (
77
+ ($response->getResult() == self::RESPONSE_CODE_APPROVED) &&
78
+ ($response->getMethod() == 'CC') &&
79
+ $customerId &&
80
+ $payment->hasAdditionalInformation('cc_save_future') &&
81
+ ($payment->getAdditionalInformation('cc_save_future') == 'Y')
82
+ ) {
83
+ // Obtain CC type
84
+ $ccType = 'OT';
85
+ $responseCcType = $response->getCardtype();
86
+ if (!is_null($responseCcType)) {
87
+ $payflowResponseCcTypesMap = array(
88
+ 0 => 'VI',
89
+ 1 => 'MC',
90
+ 2 => 'DI',
91
+ 3 => 'AE',
92
+ 4 => 'OT',
93
+ 5 => 'JCB'
94
+ );
95
+
96
+ if (isset($payflowResponseCcTypesMap[$responseCcType])) {
97
+ $ccType = $payflowResponseCcTypesMap[$responseCcType];
98
+ }
99
+ }
100
+
101
+ $ccExpMonth = ($response->getExpdate()) ? substr($response->getExpdate(), 0, 2) : '';
102
+ if ($ccExpMonth{0} == '0') {
103
+ $ccExpMonth = $ccExpMonth{1};
104
+ }
105
+
106
+ // Create new stored card
107
+ $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
108
+ $customerstoredModel->setData(array(
109
+ 'transaction_id' => $response->getPnref(),
110
+ 'customer_id' => $customerId,
111
+ 'cc_type' => $ccType,
112
+ 'cc_last4' => ($response->getAcct()) ? substr($response->getAcct(), -4) : '',
113
+ 'cc_exp_month' => $ccExpMonth,
114
+ 'cc_exp_year' => (($response->getExpdate()) ? '20'.substr($response->getExpdate(), 2) : ''),
115
+ 'date' => Varien_Date::formatDate(true, true),
116
+ 'payment_method' => $payment->getMethod()
117
+ ));
118
+ $customerstoredModel->save();
119
+ }
120
+
121
+ try {
122
+ if ($canSendNewOrderEmail) {
123
+ $order->sendNewOrderEmail();
124
+ }
125
+ Mage::getModel('sales/quote')
126
+ ->load($order->getQuoteId())
127
+ ->setIsActive(false)
128
+ ->save();
129
+ } catch (Exception $e) {
130
+ Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
131
+ }
132
+ }
133
+
134
+ }
app/code/community/CLS/Paypal/Model/Paypal/Payflowpro.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Payflowpro extends Mage_Paypal_Model_Payflowpro
30
+ {
31
+ protected $_formBlockType = 'cls_paypal/payment_form_cc';
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function __construct()
37
+ {
38
+ parent::__construct();
39
+
40
+ $this->_debugReplacePrivateDataKeys[] = 'buttonsource';
41
+ }
42
+
43
+ /**
44
+ * Return request object with basic information for gateway request
45
+ *
46
+ * @param Mage_Sales_Model_Order_Payment $payment
47
+ * @return Varien_Object
48
+ */
49
+ protected function _buildBasicRequest(Varien_Object $payment)
50
+ {
51
+ $request = new Varien_Object();
52
+ $request
53
+ ->setUser($this->getConfigData('user'))
54
+ ->setVendor($this->getConfigData('vendor'))
55
+ ->setPartner($this->getConfigData('partner'))
56
+ ->setPwd($this->getConfigData('pwd'))
57
+ ->setVerbosity($this->getConfigData('verbosity'))
58
+ ->setTender(self::TENDER_CC)
59
+ ->setRequestId($this->_generateRequestId())
60
+ ->setButtonsource(Mage::helper('cls_paypal')->getPaypalInfoCode());
61
+ return $request;
62
+ }
63
+
64
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Abstract.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Contains common logic for the "Stored" methods family
31
+ */
32
+ class CLS_Paypal_Model_Paypal_Stored_Abstract extends Mage_Payment_Model_Method_Abstract
33
+ {
34
+
35
+ /**
36
+ * Keeps the actual payment method instance that calls this common method
37
+ *
38
+ * @var $_callerMethod Mage_Payment_Model_Method_Abstract
39
+ */
40
+ protected $_callerMethod;
41
+
42
+ /**
43
+ * @param array $params
44
+ */
45
+ public function __construct($params = array())
46
+ {
47
+ parent::__construct($params);
48
+
49
+ if ( !empty($params) && isset($params['caller_method']) ) {
50
+ // Set '_callerMethod' property
51
+ $this->_callerMethod = $params['caller_method'];
52
+ }
53
+ else {
54
+ Mage::throwException(Mage::helper('cls_paypal')->__('Internal error: cannot initialize the payment method.'));
55
+ }
56
+
57
+ }
58
+
59
+ /**
60
+ * Retrieve payment information model object
61
+ *
62
+ * @return Mage_Payment_Model_Info
63
+ */
64
+ public function getInfoInstance()
65
+ {
66
+ $instance = $this->_callerMethod->getData('info_instance');
67
+
68
+ if (!($instance instanceof Mage_Payment_Model_Info)) {
69
+ Mage::throwException(Mage::helper('payment')->__('Cannot retrieve the payment information object instance.'));
70
+ }
71
+ return $instance;
72
+ }
73
+
74
+ /**
75
+ * To check billing country is allowed for the payment method
76
+ *
77
+ * @return bool
78
+ */
79
+ public function canUseForCountry($country)
80
+ {
81
+ /*
82
+ * for specific country, the flag will set up as 1
83
+ */
84
+ if($this->_callerMethod->getConfigData('allowspecific')==1){
85
+ $availableCountries = explode(',', $this->_callerMethod->getConfigData('specificcountry'));
86
+ if(!in_array($country, $availableCountries)){
87
+ return false;
88
+ }
89
+
90
+ }
91
+ return true;
92
+ }
93
+
94
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Contains common logic for the "Customer stored" methods family
31
+ */
32
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored extends CLS_Paypal_Model_Paypal_Stored_Abstract
33
+ {
34
+
35
+ /**
36
+ * Check whether payment method can be used
37
+ * (we consider the caller payment availability has been already checked before)
38
+ *
39
+ * @param Mage_Sales_Model_Quote $quote
40
+ * @return bool
41
+ */
42
+ public function isAvailable($quote = null)
43
+ {
44
+ $customerId = false;
45
+
46
+ // Disallow method for guest orders
47
+ if (!is_null($quote)) {
48
+ $customerId = $quote->getCustomerId();
49
+ } else {
50
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
51
+ }
52
+
53
+ if (!$customerId) {
54
+ return false;
55
+ }
56
+
57
+ // Check if active saved cards exist for the customer
58
+ $this->_callerMethod->setCustomerId($customerId);
59
+
60
+ $storedCards = $this->getStoredCards();
61
+ if ( $storedCards && ($storedCards->count() > 0) ) {
62
+ return true;
63
+ }
64
+
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * Return the list of customer's stored cards
70
+ *
71
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection|null
72
+ */
73
+ public function getStoredCards()
74
+ {
75
+ if (is_null($this->_callerMethod->getData('stored_cards'))) {
76
+ $customerId = $this->_callerMethod->getCustomerId();
77
+
78
+ if (!$customerId) {
79
+ return null;
80
+ }
81
+
82
+ /** @var $collection CLS_Paypal_Model_Resource_Customerstored_Collection */
83
+ $collection = Mage::getSingleton('cls_paypal/customerstored')->getCustomerstoredCollection($customerId, $this->_callerMethod->getCode());
84
+ $this->_callerMethod->setData('stored_cards', $collection);
85
+ }
86
+
87
+ return $this->_callerMethod->getData('stored_cards');
88
+ }
89
+
90
+ /**
91
+ * Validate payment method information object
92
+ *
93
+ * @return Mage_Payment_Model_Method_Abstract
94
+ */
95
+ public function validate()
96
+ {
97
+ parent::validate();
98
+
99
+ $paymentInfo = $this->getInfoInstance();
100
+ $paymentStoredCardId = $paymentInfo->getAdditionalInformation('stored_card_id');
101
+
102
+ $isError = true;
103
+
104
+ // Check if customer ID is available
105
+ if (!$this->_callerMethod->getCustomerId()) {
106
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
107
+ $customerId = $paymentInfo->getOrder()->getCustomerId();
108
+ } else {
109
+ $customerId = $paymentInfo->getQuote()->getCustomerId();
110
+ }
111
+
112
+ $this->_callerMethod->setCustomerId($customerId);
113
+ }
114
+
115
+ // Check stored card ID for validity
116
+ if ($paymentStoredCardId) {
117
+ $storedCards = $this->getStoredCards();
118
+
119
+ if ( $storedCards && ($storedCards->count() > 0) ) {
120
+ foreach ($storedCards as $storedCard) {
121
+ if ($storedCard->getStoredCardId() == $paymentStoredCardId) {
122
+ // Also keep stored card transaction ID
123
+ $paymentInfo->setAdditionalInformation('stored_card_transaction_id', $storedCard->getTransactionId());
124
+
125
+ $isError = false;
126
+ break;
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ if ($isError) {
133
+ Mage::throwException(Mage::helper('cls_paypal')->__('Please select valid saved card'));
134
+ }
135
+
136
+ return $this->_callerMethod;
137
+ }
138
+
139
+ /**
140
+ * Assign data to info model instance
141
+ *
142
+ * @param mixed $data
143
+ * @return Mage_Payment_Model_Method_Abstract
144
+ */
145
+ public function assignData($data)
146
+ {
147
+ if (!($data instanceof Varien_Object)) {
148
+ $data = new Varien_Object($data);
149
+ }
150
+ $info = $this->getInfoInstance();
151
+
152
+ // Assign actual payment method data
153
+ $storedCardId = $data->getStoredCardId();
154
+ $storedCards = $this->getStoredCards();
155
+
156
+ $info->setStoredCardId($storedCardId);
157
+
158
+ // Make sure no extraneous data is kept
159
+ $info->setCcType(null)
160
+ ->setCcOwner(null)
161
+ ->setCcLast4(null)
162
+ ->setCcNumber(null)
163
+ ->setCcCid(null)
164
+ ->setCcExpMonth(null)
165
+ ->setCcExpYear(null)
166
+ ->setCcSsIssue(null)
167
+ ->setCcSsStartMonth(null)
168
+ ->setCcSsStartYear(null);
169
+
170
+ if ( !is_null($storedCardId) && !is_null($storedCards) ) {
171
+ foreach ($storedCards as $storedCard) {
172
+ if ($storedCardId == $storedCard->getId()) {
173
+ // Assign CC info (taken from the selected stored card)
174
+ $info
175
+ ->setCcType($storedCard->getCcType())
176
+ ->setCcLast4($storedCard->getCcLast4())
177
+ ->setCcExpMonth($storedCard->getCcExpMonth())
178
+ ->setCcExpYear($storedCard->getCcExpYear());
179
+
180
+ break;
181
+ }
182
+ }
183
+ }
184
+
185
+
186
+ return $this->_callerMethod;
187
+ }
188
+
189
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Direct.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored_Direct extends CLS_Paypal_Model_Paypal_Direct
30
+ {
31
+
32
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED;
33
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_customerstored';
34
+
35
+ /**
36
+ * Keeps the payment method that handles all common 'Customer Stored' functionality
37
+ *
38
+ * @var CLS_Paypal_Model_Paypal_Stored_Customerstored
39
+ */
40
+ protected $_commonMethod;
41
+
42
+ /**
43
+ * @param array $params
44
+ */
45
+ public function __construct($params = array())
46
+ {
47
+ parent::__construct($params);
48
+
49
+ // Set fallback method
50
+ $this->_pro->getConfig()->setFallBackMethod(Mage_Paypal_Model_Config::METHOD_WPP_DIRECT);
51
+
52
+ // Initialize common method
53
+ $this->_commonMethod = Mage::getModel('cls_paypal/paypal_stored_customerstored', array('caller_method' => $this));
54
+ }
55
+
56
+ /**
57
+ * Check whether payment method can be used
58
+ *
59
+ * @param Mage_Sales_Model_Quote $quote
60
+ * @return bool
61
+ */
62
+ public function isAvailable($quote = null)
63
+ {
64
+ if (!(
65
+ Mage_Payment_Model_Method_Abstract::isAvailable($quote) &&
66
+ $this->_pro->getConfig()->isMethodAvailable())
67
+ ) {
68
+ return false;
69
+ }
70
+
71
+ return $this->_commonMethod->isAvailable($quote);
72
+ }
73
+
74
+ /**
75
+ * Validate payment method information object
76
+ *
77
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Direct
78
+ */
79
+ public function validate()
80
+ {
81
+ return $this->_commonMethod->validate();
82
+ }
83
+
84
+ /**
85
+ * Assign data to info model instance
86
+ *
87
+ * @param mixed $data
88
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Direct
89
+ */
90
+ public function assignData($data)
91
+ {
92
+ return $this->_commonMethod->assignData($data);
93
+ }
94
+
95
+ /**
96
+ * Authorize payment
97
+ *
98
+ * @param Mage_Sales_Model_Order_Payment $payment
99
+ * @param float $amount
100
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Direct
101
+ */
102
+ public function authorize(Varien_Object $payment, $amount)
103
+ {
104
+ return $this->_placeOrder($payment, $amount);
105
+ }
106
+
107
+ /**
108
+ * Place an order with authorization or capture action
109
+ *
110
+ * @param Mage_Sales_Model_Order_Payment $payment
111
+ * @param float $amount
112
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Direct
113
+ */
114
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
115
+ {
116
+ // Get Reference ID
117
+ $paymentStoredCardId = $this->getInfoInstance()->getData('stored_card_id');
118
+ $referenceId = null;
119
+
120
+ if ($paymentStoredCardId) {
121
+ $storedCardModel = Mage::getModel('cls_paypal/customerstored')->load($paymentStoredCardId);
122
+ if ($storedCardModel->getId()) {
123
+ $referenceId = $storedCardModel->getData('transaction_id');
124
+ }
125
+ }
126
+
127
+ if (!$referenceId) {
128
+ Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the stored card data'));
129
+ }
130
+
131
+ $order = $payment->getOrder();
132
+
133
+ $api = $this->_pro->getApi()
134
+ ->setReferenceId($referenceId)
135
+ ->setPaymentAction($this->getConfigData('payment_action'))
136
+ ->setIpAddress(Mage::app()->getRequest()->getClientIp(false))
137
+
138
+ ->setAmount($amount)
139
+ ->setCurrencyCode($order->getBaseCurrencyCode())
140
+ ->setInvNum($order->getIncrementId())
141
+ ->setEmail($order->getCustomerEmail());
142
+
143
+ // add shipping and billing addresses
144
+ /*
145
+ if ($order->getIsVirtual()) {
146
+ $api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
147
+ } else {
148
+ $api->setAddress($order->getShippingAddress());
149
+ $api->setBillingAddress($order->getBillingAddress());
150
+ }
151
+ */
152
+
153
+ // add line items
154
+ $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
155
+ ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
156
+ ;
157
+
158
+ // call api and import transaction and other payment information
159
+ $api->callDoReferenceTransaction();
160
+ $this->_importResultToPayment($api, $payment);
161
+
162
+ try {
163
+ $api->callGetTransactionDetails();
164
+ } catch (Mage_Core_Exception $e) {
165
+ // if we recieve errors, but DoDirectPayment response is Success, then set Pending status for transaction
166
+ $payment->setIsTransactionPending(true);
167
+ }
168
+ $this->_importResultToPayment($api, $payment);
169
+ return $this;
170
+ }
171
+
172
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflow.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Common "Customer stored" class for Payflow methods: Advanced, Link and Pro
31
+ */
32
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflow extends CLS_Paypal_Model_Paypal_Stored_Payflow
33
+ {
34
+
35
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_customerstored';
36
+
37
+ /**
38
+ * @param array $params
39
+ */
40
+ public function __construct($params = array())
41
+ {
42
+ parent::__construct($params);
43
+
44
+ // Initialize common method
45
+ if ( empty($params) || !isset($params['caller_method']) || !isset($params['code']) || !isset($params['parent_code']) ) {
46
+ Mage::throwException(Mage::helper('cls_paypal')->__('Internal error: cannot initialize Payflow payment method.'));
47
+ }
48
+
49
+ $this->_commonMethod = Mage::getModel(
50
+ 'cls_paypal/paypal_stored_customerstored',
51
+ array('caller_method' => $params['caller_method'])
52
+ );
53
+
54
+ $this->_code = $params['code'];
55
+ $this->_parentCode = $params['parent_code'];
56
+ }
57
+
58
+ /**
59
+ * Place an order with authorization or capture action
60
+ *
61
+ * @param Mage_Sales_Model_Order_Payment $payment
62
+ * @param float $amount
63
+ * @param string $transactionType
64
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflow
65
+ */
66
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount, $transactionType = self::TRXTYPE_AUTH_ONLY)
67
+ {
68
+ // Get Reference ID
69
+ $paymentStoredCardId = $this->_commonMethod->getInfoInstance()->getData('stored_card_id');
70
+ $referenceId = null;
71
+
72
+ if ($paymentStoredCardId) {
73
+ $storedCardModel = Mage::getModel('cls_paypal/customerstored')->load($paymentStoredCardId);
74
+ if ($storedCardModel->getId()) {
75
+ $referenceId = $storedCardModel->getData('transaction_id');
76
+ }
77
+ }
78
+
79
+ if (!$referenceId) {
80
+ Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the stored card data'));
81
+ }
82
+
83
+ // Prepare and run 'Reference Transaction' request
84
+ $request = $this->_buildBasicRequest($payment);
85
+ $request->setTrxtype($transactionType);
86
+ $request->setAmt(round($amount, 2));
87
+ $request->setOrigid($referenceId);
88
+
89
+ $response = $this->_postRequest($request);
90
+ $this->_processErrors($response);
91
+
92
+ switch ($response->getResultCode()){
93
+ case self::RESPONSE_CODE_APPROVED:
94
+ $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
95
+ break;
96
+ case self::RESPONSE_CODE_FRAUDSERVICE_FILTER:
97
+ $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
98
+ $payment->setIsTransactionPending(true);
99
+ $payment->setIsFraudDetected(true);
100
+ break;
101
+ }
102
+ return $this;
103
+ }
104
+
105
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowadvanced.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowadvanced extends CLS_Paypal_Model_Paypal_Payflowadvanced
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_customerstored';
38
+
39
+ /**
40
+ * Availability options
41
+ */
42
+ protected $_isInitializeNeeded = false;
43
+ protected $_canUseInternal = true;
44
+
45
+ /**
46
+ * Common payment method for the Payflow family
47
+ *
48
+ * @var CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflow
49
+ */
50
+ protected $_commonPayflowMethod;
51
+
52
+ /**
53
+ *
54
+ */
55
+ public function __construct()
56
+ {
57
+ parent::__construct();
58
+
59
+ // Initialize common method
60
+ $this->_commonPayflowMethod = Mage::getModel(
61
+ 'cls_paypal/paypal_stored_customerstored_payflow',
62
+ array(
63
+ 'caller_method' => $this,
64
+ 'code' => $this->_code,
65
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWADVANCED
66
+ )
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Set the info instance on the common method too
72
+ *
73
+ * @param Mage_Payment_Model_Info $info
74
+ */
75
+ public function setInfoInstance($info)
76
+ {
77
+ $this->_commonPayflowMethod->setInfoInstance($info);
78
+ $this->setData('info_instance', $info);
79
+ }
80
+
81
+ /**
82
+ * Check whether payment method can be used
83
+ *
84
+ * @param Mage_Sales_Model_Quote $quote
85
+ * @return bool
86
+ */
87
+ public function isAvailable($quote = null)
88
+ {
89
+ return $this->_commonPayflowMethod->isAvailable($quote);
90
+ }
91
+
92
+ /**
93
+ * Validate payment method information object
94
+ *
95
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowadvanced
96
+ */
97
+ public function validate()
98
+ {
99
+ return $this->_commonPayflowMethod->validate();
100
+ }
101
+
102
+ /**
103
+ * Assign data to info model instance
104
+ *
105
+ * @param mixed $data
106
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowadvanced
107
+ */
108
+ public function assignData($data)
109
+ {
110
+ return $this->_commonPayflowMethod->assignData($data);
111
+ }
112
+
113
+ /**
114
+ * Get payment action
115
+ *
116
+ * @see Mage_Sales_Model_Payment::place()
117
+ * @return string
118
+ */
119
+ public function getConfigPaymentAction()
120
+ {
121
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
122
+ }
123
+
124
+ /**
125
+ * Authorize payment
126
+ *
127
+ * @param Mage_Sales_Model_Order_Payment $payment
128
+ * @param float $amount
129
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowadvanced
130
+ */
131
+ public function authorize(Varien_Object $payment, $amount)
132
+ {
133
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
134
+ }
135
+
136
+ /**
137
+ * Capture payment
138
+ *
139
+ * @param Mage_Sales_Model_Order_Payment $payment
140
+ * @param float $amount
141
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowadvanced
142
+ */
143
+ public function capture(Varien_Object $payment, $amount)
144
+ {
145
+ return $this->_commonPayflowMethod->capture($payment, $amount);
146
+ }
147
+
148
+ /**
149
+ * Retrieve information from payment configuration
150
+ *
151
+ * @param string $field
152
+ * @param int|string|null|Mage_Core_Model_Store $storeId
153
+ *
154
+ * @return mixed
155
+ */
156
+ public function getConfigData($field, $storeId = null)
157
+ {
158
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
159
+ }
160
+
161
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowlink.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowlink extends CLS_Paypal_Model_Paypal_Payflowlink
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_customerstored';
38
+
39
+ /**
40
+ * Availability options
41
+ */
42
+ protected $_isInitializeNeeded = false;
43
+ protected $_canUseInternal = true;
44
+
45
+ /**
46
+ * Common payment method for the Payflow family
47
+ *
48
+ * @var CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflow
49
+ */
50
+ protected $_commonPayflowMethod;
51
+
52
+ /**
53
+ *
54
+ */
55
+ public function __construct()
56
+ {
57
+ parent::__construct();
58
+
59
+ // Initialize common method
60
+ $this->_commonPayflowMethod = Mage::getModel(
61
+ 'cls_paypal/paypal_stored_customerstored_payflow',
62
+ array(
63
+ 'caller_method' => $this,
64
+ 'code' => $this->_code,
65
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWLINK
66
+ )
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Set the info instance on the common method too
72
+ *
73
+ * @param Mage_Payment_Model_Info $info
74
+ */
75
+ public function setInfoInstance($info)
76
+ {
77
+ $this->_commonPayflowMethod->setInfoInstance($info);
78
+ $this->setData('info_instance', $info);
79
+ }
80
+
81
+ /**
82
+ * Check whether payment method can be used
83
+ *
84
+ * @param Mage_Sales_Model_Quote $quote
85
+ * @return bool
86
+ */
87
+ public function isAvailable($quote = null)
88
+ {
89
+ return $this->_commonPayflowMethod->isAvailable($quote);
90
+ }
91
+
92
+ /**
93
+ * Validate payment method information object
94
+ *
95
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowlink
96
+ */
97
+ public function validate()
98
+ {
99
+ return $this->_commonPayflowMethod->validate();
100
+ }
101
+
102
+ /**
103
+ * Assign data to info model instance
104
+ *
105
+ * @param mixed $data
106
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowlink
107
+ */
108
+ public function assignData($data)
109
+ {
110
+ return $this->_commonPayflowMethod->assignData($data);
111
+ }
112
+
113
+ /**
114
+ * Get payment action
115
+ *
116
+ * @see Mage_Sales_Model_Payment::place()
117
+ * @return string
118
+ */
119
+ public function getConfigPaymentAction()
120
+ {
121
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
122
+ }
123
+
124
+ /**
125
+ * Authorize payment
126
+ *
127
+ * @param Mage_Sales_Model_Order_Payment $payment
128
+ * @param float $amount
129
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowlink
130
+ */
131
+ public function authorize(Varien_Object $payment, $amount)
132
+ {
133
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
134
+ }
135
+
136
+ /**
137
+ * Capture payment
138
+ *
139
+ * @param Mage_Sales_Model_Order_Payment $payment
140
+ * @param float $amount
141
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowlink
142
+ */
143
+ public function capture(Varien_Object $payment, $amount)
144
+ {
145
+ return $this->_commonPayflowMethod->capture($payment, $amount);
146
+ }
147
+
148
+ /**
149
+ * Retrieve information from payment configuration
150
+ *
151
+ * @param string $field
152
+ * @param int|string|null|Mage_Core_Model_Store $storeId
153
+ *
154
+ * @return mixed
155
+ */
156
+ public function getConfigData($field, $storeId = null)
157
+ {
158
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
159
+ }
160
+
161
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Customerstored/Payflowpro.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowpro extends CLS_Paypal_Model_Paypal_Payflowpro
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_customerstored';
38
+
39
+ /**
40
+ * Common payment method for the Payflow family
41
+ *
42
+ * @var CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflow
43
+ */
44
+ protected $_commonPayflowMethod;
45
+
46
+ /**
47
+ *
48
+ */
49
+ public function __construct()
50
+ {
51
+ parent::__construct();
52
+
53
+ // Initialize common method
54
+ $this->_commonPayflowMethod = Mage::getModel(
55
+ 'cls_paypal/paypal_stored_customerstored_payflow',
56
+ array(
57
+ 'caller_method' => $this,
58
+ 'code' => $this->_code,
59
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO
60
+ )
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Set the info instance on the common method too
66
+ *
67
+ * @param Mage_Payment_Model_Info $info
68
+ */
69
+ public function setInfoInstance($info)
70
+ {
71
+ $this->_commonPayflowMethod->setInfoInstance($info);
72
+ $this->setData('info_instance', $info);
73
+ }
74
+
75
+ /**
76
+ * Check whether payment method can be used
77
+ *
78
+ * @param Mage_Sales_Model_Quote $quote
79
+ * @return bool
80
+ */
81
+ public function isAvailable($quote = null)
82
+ {
83
+ return $this->_commonPayflowMethod->isAvailable($quote);
84
+ }
85
+
86
+ /**
87
+ * Validate payment method information object
88
+ *
89
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowpro
90
+ */
91
+ public function validate()
92
+ {
93
+ return $this->_commonPayflowMethod->validate();
94
+ }
95
+
96
+ /**
97
+ * Assign data to info model instance
98
+ *
99
+ * @param mixed $data
100
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowpro
101
+ */
102
+ public function assignData($data)
103
+ {
104
+ return $this->_commonPayflowMethod->assignData($data);
105
+ }
106
+
107
+ /**
108
+ * Get payment action
109
+ *
110
+ * @see Mage_Sales_Model_Payment::place()
111
+ * @return string
112
+ */
113
+ public function getConfigPaymentAction()
114
+ {
115
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
116
+ }
117
+
118
+ /**
119
+ * Authorize payment
120
+ *
121
+ * @param Mage_Sales_Model_Order_Payment $payment
122
+ * @param float $amount
123
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowpro
124
+ */
125
+ public function authorize(Varien_Object $payment, $amount)
126
+ {
127
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
128
+ }
129
+
130
+ /**
131
+ * Capture payment
132
+ *
133
+ * @param Mage_Sales_Model_Order_Payment $payment
134
+ * @param float $amount
135
+ * @return CLS_Paypal_Model_Paypal_Stored_Customerstored_Payflowpro
136
+ */
137
+ public function capture(Varien_Object $payment, $amount)
138
+ {
139
+ return $this->_commonPayflowMethod->capture($payment, $amount);
140
+ }
141
+
142
+ /**
143
+ * Retrieve information from payment configuration
144
+ *
145
+ * @param string $field
146
+ * @param int|string|null|Mage_Core_Model_Store $storeId
147
+ *
148
+ * @return mixed
149
+ */
150
+ public function getConfigData($field, $storeId = null)
151
+ {
152
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
153
+ }
154
+
155
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Orderstored.php
4
+ * Contains common logic for the "Order stored" methods family
5
+ *
6
+ * @category CLS
7
+ * @package Paypal
8
+ * @copyright Copyright (c) 2013 Classy Llama Studios
9
+ */
10
+
11
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored extends CLS_Paypal_Model_Paypal_Stored_Abstract
12
+ {
13
+ /**
14
+ * Check whether payment method can be used
15
+ * (we consider the caller payment availability has been already checked before)
16
+ *
17
+ * @param Mage_Sales_Model_Quote $quote
18
+ * @return bool
19
+ */
20
+ public function isAvailable($quote = null)
21
+ {
22
+ // Allow method for admin only
23
+ if (!Mage::app()->getStore()->isAdmin()) {
24
+ return false;
25
+ }
26
+
27
+ if ($this->_getOriginalOrderData()) {
28
+ return true;
29
+ }
30
+
31
+ return false;
32
+ }
33
+
34
+ /**
35
+ * Validate payment method information object
36
+ *
37
+ * @return Mage_Payment_Model_Method_Abstract
38
+ */
39
+ public function validate()
40
+ {
41
+ parent::validate();
42
+
43
+ if (!$originalOrderData = $this->_getOriginalOrderData()) {
44
+ Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the transaction data'));
45
+ }
46
+ else {
47
+ // Keep payment-specific data
48
+ $paymentInfo = $this->getInfoInstance();
49
+
50
+ $paymentInfo->setAdditionalInformation('orderstored_original_order_id', $originalOrderData['order_id']);
51
+ $paymentInfo->setAdditionalInformation('orderstored_transaction_id', $originalOrderData['transaction_id']);
52
+ }
53
+
54
+ return $this->_callerMethod;
55
+ }
56
+
57
+ /**
58
+ * Assign data to info model instance
59
+ *
60
+ * @param mixed $data
61
+ * @return Mage_Payment_Model_Method_Abstract
62
+ */
63
+ public function assignData($data)
64
+ {
65
+ if (!($data instanceof Varien_Object)) {
66
+ $data = new Varien_Object($data);
67
+ }
68
+ $info = $this->getInfoInstance();
69
+
70
+ // Make sure no extraneous data is kept
71
+ $info
72
+ ->setStoredCardId(null)
73
+ ->setCcType(null)
74
+ ->setCcOwner(null)
75
+ ->setCcLast4(null)
76
+ ->setCcNumber(null)
77
+ ->setCcCid(null)
78
+ ->setCcExpMonth(null)
79
+ ->setCcExpYear(null)
80
+ ->setCcSsIssue(null)
81
+ ->setCcSsStartMonth(null)
82
+ ->setCcSsStartYear(null);
83
+
84
+ /** @var $session Mage_Adminhtml_Model_Session_Quote */
85
+ $session = Mage::getSingleton('adminhtml/session_quote');
86
+
87
+ if (
88
+ ($originalOrderId = $session->getPreviousOrderId())
89
+ || ($originalOrderId = $session->getOrderId())
90
+ ) {
91
+ // Assign CC info (taken from the original order)
92
+ $originalOrder = Mage::getModel('sales/order')->load($originalOrderId);
93
+
94
+ if ($originalOrder->getId()) {
95
+ $originalOrderPayment = $originalOrder->getPayment();
96
+
97
+ if ($originalOrderPayment->getId()) {
98
+ $info
99
+ ->setCcType($originalOrderPayment->getCcType())
100
+ ->setCcLast4($originalOrderPayment->getCcLast4())
101
+ ->setCcExpMonth($originalOrderPayment->getCcExpMonth())
102
+ ->setCcExpYear($originalOrderPayment->getCcExpYear());
103
+ }
104
+ }
105
+ }
106
+
107
+ return $this->_callerMethod;
108
+ }
109
+
110
+ /**
111
+ * Check original order and return specific data (order ID, transaction ID)
112
+ *
113
+ * @return array|null
114
+ */
115
+ protected function _getOriginalOrderData()
116
+ {
117
+ // Check original order
118
+ /** @var $session Mage_Adminhtml_Model_Session_Quote */
119
+ $session = Mage::getSingleton('adminhtml/session_quote');
120
+
121
+ if (
122
+ ($originalOrderId = $session->getPreviousOrderId())
123
+ || ($originalOrderId = $session->getOrderId())
124
+ ) {
125
+ // Get original order data
126
+ /** @var $originalOrder Mage_Sales_Model_Order */
127
+ $originalOrder = Mage::getModel('sales/order')->load($originalOrderId);
128
+
129
+ if ($originalOrder->getId()) {
130
+ $originalOrderPayment = $originalOrder->getPayment();
131
+
132
+ /** @var $helper CLS_Paypal_Helper_Data */
133
+ $helper = Mage::helper('cls_paypal');
134
+
135
+ // Check payment method for compatibility
136
+ if (
137
+ $originalOrderPayment->getId()
138
+ && ($helper->isSupportedPaymentMethodFull($originalOrderPayment->getMethod()))
139
+ && ($helper->isValidParentPaymentMethod($this->_callerMethod->getCode(), $originalOrderPayment->getMethod()))
140
+ ) {
141
+ // Select the last valid order's transaction
142
+ /** @var $transactionCollection Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection */
143
+ $transactionCollection = Mage::getResourceModel('sales/order_payment_transaction_collection');
144
+
145
+ $pastDate = new Zend_Date(null);
146
+ $pastDate->addMonth(0 - CLS_Paypal_Model_Paypal_Config::STORED_CARD_TTL_MONTHS);
147
+
148
+ $transactionCollection
149
+ ->addOrderIdFilter($originalOrder->getId())
150
+ ->addPaymentIdFilter($originalOrderPayment->getId())
151
+ ->addAttributeToFilter('main_table.created_at', array('gt' => Mage::getModel('core/date')->gmtDate(null, $pastDate->toValue())))
152
+ ->setOrder('main_table.created_at', Varien_Data_Collection::SORT_ORDER_DESC);
153
+
154
+ $transaction = false;
155
+ foreach ($transactionCollection as $trans) {
156
+ if ($trans->getTxnType() !== Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND
157
+ && $trans->getTxnType() !== Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID) {
158
+ $transaction = $trans;
159
+ break;
160
+ }
161
+ }
162
+
163
+ if ($transaction && !Mage::helper('cls_paypal')->transactionIsVoided($transaction)) {
164
+ return array(
165
+ 'order_id' => $originalOrderId,
166
+ 'transaction_id' => $transaction->getTxnId()
167
+ );
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ return null;
174
+ }
175
+
176
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Direct.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored_Direct extends CLS_Paypal_Model_Paypal_Direct
30
+ {
31
+
32
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_DIRECT_ORDERSTORED;
33
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored';
34
+
35
+ /**
36
+ * Keeps the payment method that handles all common 'Order Stored' functionality
37
+ *
38
+ * @var CLS_Paypal_Model_Paypal_Stored_Orderstored
39
+ */
40
+ protected $_commonMethod;
41
+
42
+ /**
43
+ * @param array $params
44
+ */
45
+ public function __construct($params = array())
46
+ {
47
+ parent::__construct($params);
48
+
49
+ // Set fallback method
50
+ $this->_pro->getConfig()->setFallBackMethod(Mage_Paypal_Model_Config::METHOD_WPP_DIRECT);
51
+
52
+ // Initialize common method
53
+ $this->_commonMethod = Mage::getModel('cls_paypal/paypal_stored_orderstored', array('caller_method' => $this));
54
+ }
55
+
56
+ /**
57
+ * Check whether payment method can be used
58
+ *
59
+ * @param Mage_Sales_Model_Quote $quote
60
+ * @return bool
61
+ */
62
+ public function isAvailable($quote = null)
63
+ {
64
+ if (!(
65
+ Mage_Payment_Model_Method_Abstract::isAvailable($quote) &&
66
+ $this->_pro->getConfig()->isMethodAvailable())
67
+ ) {
68
+ return false;
69
+ }
70
+
71
+ return $this->_commonMethod->isAvailable($quote);
72
+ }
73
+
74
+ /**
75
+ * Validate payment method information object
76
+ *
77
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Direct
78
+ */
79
+ public function validate()
80
+ {
81
+ return $this->_commonMethod->validate();
82
+ }
83
+
84
+ /**
85
+ * Assign data to info model instance
86
+ *
87
+ * @param mixed $data
88
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Direct
89
+ */
90
+ public function assignData($data)
91
+ {
92
+ return $this->_commonMethod->assignData($data);
93
+ }
94
+
95
+ /**
96
+ * Authorize payment
97
+ *
98
+ * @param Mage_Sales_Model_Order_Payment $payment
99
+ * @param float $amount
100
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Direct
101
+ */
102
+ public function authorize(Varien_Object $payment, $amount)
103
+ {
104
+ return $this->_placeOrder($payment, $amount);
105
+ }
106
+
107
+ /**
108
+ * Place an order with authorization or capture action
109
+ *
110
+ * @param Mage_Sales_Model_Order_Payment $payment
111
+ * @param float $amount
112
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Direct
113
+ */
114
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
115
+ {
116
+ // Get Reference ID
117
+ $paymentInfo = $this->getInfoInstance();
118
+ $referenceId = $paymentInfo->getAdditionalInformation('orderstored_transaction_id');
119
+
120
+ if (!$referenceId) {
121
+ Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the stored card data'));
122
+ }
123
+
124
+ $order = $payment->getOrder();
125
+
126
+ $api = $this->_pro->getApi()
127
+ ->setReferenceId($referenceId)
128
+ ->setPaymentAction($this->getConfigData('payment_action'))
129
+ ->setIpAddress(Mage::app()->getRequest()->getClientIp(false))
130
+
131
+ ->setAmount($amount)
132
+ ->setCurrencyCode($order->getBaseCurrencyCode())
133
+ ->setInvNum($order->getIncrementId())
134
+ ->setEmail($order->getCustomerEmail());
135
+
136
+ // add line items
137
+ $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
138
+ ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
139
+ ;
140
+
141
+ // call api and import transaction and other payment information
142
+ $api->callDoReferenceTransaction();
143
+ $this->_importResultToPayment($api, $payment);
144
+
145
+ try {
146
+ $api->callGetTransactionDetails();
147
+ } catch (Mage_Core_Exception $e) {
148
+ // if we recieve errors, but DoDirectPayment response is Success, then set Pending status for transaction
149
+ $payment->setIsTransactionPending(true);
150
+ }
151
+ $this->_importResultToPayment($api, $payment);
152
+ return $this;
153
+ }
154
+
155
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflow.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Common "Order stored" class for Payflow methods: Advanced, Link and Pro
31
+ */
32
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflow extends CLS_Paypal_Model_Paypal_Stored_Payflow
33
+ {
34
+
35
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored';
36
+
37
+ /**
38
+ * @param array $params
39
+ */
40
+ public function __construct($params = array())
41
+ {
42
+ parent::__construct($params);
43
+
44
+ // Initialize common method
45
+ if ( empty($params) || !isset($params['caller_method']) || !isset($params['code']) || !isset($params['parent_code']) ) {
46
+ Mage::throwException(Mage::helper('cls_paypal')->__('Internal error: cannot initialize Payflow payment method.'));
47
+ }
48
+
49
+ $this->_commonMethod = Mage::getModel(
50
+ 'cls_paypal/paypal_stored_orderstored',
51
+ array('caller_method' => $params['caller_method'])
52
+ );
53
+
54
+ $this->_code = $params['code'];
55
+ $this->_parentCode = $params['parent_code'];
56
+ }
57
+
58
+ /**
59
+ * Place an order with authorization or capture action
60
+ *
61
+ * @param Mage_Sales_Model_Order_Payment $payment
62
+ * @param float $amount
63
+ * @param string $transactionType
64
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflow
65
+ */
66
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount, $transactionType = self::TRXTYPE_AUTH_ONLY)
67
+ {
68
+ // Get Reference ID
69
+ $paymentInfo = $this->_commonMethod->getInfoInstance();
70
+ $referenceId = $paymentInfo->getAdditionalInformation('orderstored_transaction_id');
71
+
72
+ if (!$referenceId) {
73
+ Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the stored card data'));
74
+ }
75
+
76
+ // Prepare and run 'Reference Transaction' request
77
+ $request = $this->_buildBasicRequest($payment);
78
+ $request->setTrxtype($transactionType);
79
+ $request->setAmt(round($amount, 2));
80
+ $request->setOrigid($referenceId);
81
+
82
+ $response = $this->_postRequest($request);
83
+ $this->_processErrors($response);
84
+
85
+ switch ($response->getResultCode()){
86
+ case self::RESPONSE_CODE_APPROVED:
87
+ $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
88
+ break;
89
+ case self::RESPONSE_CODE_FRAUDSERVICE_FILTER:
90
+ $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
91
+ $payment->setIsTransactionPending(true);
92
+ $payment->setIsFraudDetected(true);
93
+ break;
94
+ }
95
+ return $this;
96
+ }
97
+
98
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowadvanced.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowadvanced extends CLS_Paypal_Model_Paypal_Payflowadvanced
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored';
38
+
39
+ /**
40
+ * Availability options
41
+ */
42
+ protected $_isInitializeNeeded = false;
43
+ protected $_canUseInternal = true;
44
+
45
+ /**
46
+ * Common payment method for the Payflow family
47
+ *
48
+ * @var CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflow
49
+ */
50
+ protected $_commonPayflowMethod;
51
+
52
+ /**
53
+ *
54
+ */
55
+ public function __construct()
56
+ {
57
+ parent::__construct();
58
+
59
+ // Initialize common method
60
+ $this->_commonPayflowMethod = Mage::getModel(
61
+ 'cls_paypal/paypal_stored_orderstored_payflow',
62
+ array(
63
+ 'caller_method' => $this,
64
+ 'code' => $this->_code,
65
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWADVANCED
66
+ )
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Set the info instance on the common method too
72
+ *
73
+ * @param Mage_Payment_Model_Info $info
74
+ */
75
+ public function setInfoInstance($info)
76
+ {
77
+ $this->_commonPayflowMethod->setInfoInstance($info);
78
+ $this->setData('info_instance', $info);
79
+ }
80
+
81
+ /**
82
+ * Check whether payment method can be used
83
+ *
84
+ * @param Mage_Sales_Model_Quote $quote
85
+ * @return bool
86
+ */
87
+ public function isAvailable($quote = null)
88
+ {
89
+ return $this->_commonPayflowMethod->isAvailable($quote);
90
+ }
91
+
92
+ /**
93
+ * Validate payment method information object
94
+ *
95
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowadvanced
96
+ */
97
+ public function validate()
98
+ {
99
+ return $this->_commonPayflowMethod->validate();
100
+ }
101
+
102
+ /**
103
+ * Assign data to info model instance
104
+ *
105
+ * @param mixed $data
106
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowadvanced
107
+ */
108
+ public function assignData($data)
109
+ {
110
+ return $this->_commonPayflowMethod->assignData($data);
111
+ }
112
+
113
+ /**
114
+ * Get payment action
115
+ *
116
+ * @see Mage_Sales_Model_Payment::place()
117
+ * @return string
118
+ */
119
+ public function getConfigPaymentAction()
120
+ {
121
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
122
+ }
123
+
124
+ /**
125
+ * Authorize payment
126
+ *
127
+ * @param Mage_Sales_Model_Order_Payment $payment
128
+ * @param float $amount
129
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowadvanced
130
+ */
131
+ public function authorize(Varien_Object $payment, $amount)
132
+ {
133
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
134
+ }
135
+
136
+ /**
137
+ * Capture payment
138
+ *
139
+ * @param Mage_Sales_Model_Order_Payment $payment
140
+ * @param float $amount
141
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowadvanced
142
+ */
143
+ public function capture(Varien_Object $payment, $amount)
144
+ {
145
+ return $this->_commonPayflowMethod->capture($payment, $amount);
146
+ }
147
+
148
+ /**
149
+ * Retrieve information from payment configuration
150
+ *
151
+ * @param string $field
152
+ * @param int|string|null|Mage_Core_Model_Store $storeId
153
+ *
154
+ * @return mixed
155
+ */
156
+ public function getConfigData($field, $storeId = null)
157
+ {
158
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
159
+ }
160
+
161
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowlink.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowlink extends CLS_Paypal_Model_Paypal_Payflowlink
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored';
38
+
39
+ /**
40
+ * Availability options
41
+ */
42
+ protected $_isInitializeNeeded = false;
43
+ protected $_canUseInternal = true;
44
+
45
+ /**
46
+ * Common payment method for the Payflow family
47
+ *
48
+ * @var CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflow
49
+ */
50
+ protected $_commonPayflowMethod;
51
+
52
+ /**
53
+ *
54
+ */
55
+ public function __construct()
56
+ {
57
+ parent::__construct();
58
+
59
+ // Initialize common method
60
+ $this->_commonPayflowMethod = Mage::getModel(
61
+ 'cls_paypal/paypal_stored_orderstored_payflow',
62
+ array(
63
+ 'caller_method' => $this,
64
+ 'code' => $this->_code,
65
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWLINK
66
+ )
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Set the info instance on the common method too
72
+ *
73
+ * @param Mage_Payment_Model_Info $info
74
+ */
75
+ public function setInfoInstance($info)
76
+ {
77
+ $this->_commonPayflowMethod->setInfoInstance($info);
78
+ $this->setData('info_instance', $info);
79
+ }
80
+
81
+ /**
82
+ * Check whether payment method can be used
83
+ *
84
+ * @param Mage_Sales_Model_Quote $quote
85
+ * @return bool
86
+ */
87
+ public function isAvailable($quote = null)
88
+ {
89
+ return $this->_commonPayflowMethod->isAvailable($quote);
90
+ }
91
+
92
+ /**
93
+ * Validate payment method information object
94
+ *
95
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowlink
96
+ */
97
+ public function validate()
98
+ {
99
+ return $this->_commonPayflowMethod->validate();
100
+ }
101
+
102
+ /**
103
+ * Assign data to info model instance
104
+ *
105
+ * @param mixed $data
106
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowlink
107
+ */
108
+ public function assignData($data)
109
+ {
110
+ return $this->_commonPayflowMethod->assignData($data);
111
+ }
112
+
113
+ /**
114
+ * Get payment action
115
+ *
116
+ * @see Mage_Sales_Model_Payment::place()
117
+ * @return string
118
+ */
119
+ public function getConfigPaymentAction()
120
+ {
121
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
122
+ }
123
+
124
+ /**
125
+ * Authorize payment
126
+ *
127
+ * @param Mage_Sales_Model_Order_Payment $payment
128
+ * @param float $amount
129
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowlink
130
+ */
131
+ public function authorize(Varien_Object $payment, $amount)
132
+ {
133
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
134
+ }
135
+
136
+ /**
137
+ * Capture payment
138
+ *
139
+ * @param Mage_Sales_Model_Order_Payment $payment
140
+ * @param float $amount
141
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowlink
142
+ */
143
+ public function capture(Varien_Object $payment, $amount)
144
+ {
145
+ return $this->_commonPayflowMethod->capture($payment, $amount);
146
+ }
147
+
148
+ /**
149
+ * Retrieve information from payment configuration
150
+ *
151
+ * @param string $field
152
+ * @param int|string|null|Mage_Core_Model_Store $storeId
153
+ *
154
+ * @return mixed
155
+ */
156
+ public function getConfigData($field, $storeId = null)
157
+ {
158
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
159
+ }
160
+
161
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Orderstored/Payflowpro.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowpro extends CLS_Paypal_Model_Paypal_Payflowpro
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED;
36
+
37
+ protected $_formBlockType = 'cls_paypal/paypal_payment_form_orderstored';
38
+
39
+ /**
40
+ * Common payment method for the Payflow family
41
+ *
42
+ * @var CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflow
43
+ */
44
+ protected $_commonPayflowMethod;
45
+
46
+ /**
47
+ *
48
+ */
49
+ public function __construct()
50
+ {
51
+ parent::__construct();
52
+
53
+ // Initialize common method
54
+ $this->_commonPayflowMethod = Mage::getModel(
55
+ 'cls_paypal/paypal_stored_orderstored_payflow',
56
+ array(
57
+ 'caller_method' => $this,
58
+ 'code' => $this->_code,
59
+ 'parent_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOWPRO
60
+ )
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Set the info instance on the common method too
66
+ *
67
+ * @param Mage_Payment_Model_Info $info
68
+ */
69
+ public function setInfoInstance($info)
70
+ {
71
+ $this->_commonPayflowMethod->setInfoInstance($info);
72
+ $this->setData('info_instance', $info);
73
+ }
74
+
75
+ /**
76
+ * Check whether payment method can be used
77
+ *
78
+ * @param Mage_Sales_Model_Quote $quote
79
+ * @return bool
80
+ */
81
+ public function isAvailable($quote = null)
82
+ {
83
+ return $this->_commonPayflowMethod->isAvailable($quote);
84
+ }
85
+
86
+ /**
87
+ * Validate payment method information object
88
+ *
89
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowpro
90
+ */
91
+ public function validate()
92
+ {
93
+ return $this->_commonPayflowMethod->validate();
94
+ }
95
+
96
+ /**
97
+ * Assign data to info model instance
98
+ *
99
+ * @param mixed $data
100
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowpro
101
+ */
102
+ public function assignData($data)
103
+ {
104
+ return $this->_commonPayflowMethod->assignData($data);
105
+ }
106
+
107
+ /**
108
+ * Get payment action
109
+ *
110
+ * @see Mage_Sales_Model_Payment::place()
111
+ * @return string
112
+ */
113
+ public function getConfigPaymentAction()
114
+ {
115
+ return $this->_commonPayflowMethod->getConfigPaymentAction();
116
+ }
117
+
118
+ /**
119
+ * Authorize payment
120
+ *
121
+ * @param Mage_Sales_Model_Order_Payment $payment
122
+ * @param float $amount
123
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowpro
124
+ */
125
+ public function authorize(Varien_Object $payment, $amount)
126
+ {
127
+ return $this->_commonPayflowMethod->authorize($payment, $amount);
128
+ }
129
+
130
+ /**
131
+ * Capture payment
132
+ *
133
+ * @param Mage_Sales_Model_Order_Payment $payment
134
+ * @param float $amount
135
+ * @return CLS_Paypal_Model_Paypal_Stored_Orderstored_Payflowpro
136
+ */
137
+ public function capture(Varien_Object $payment, $amount)
138
+ {
139
+ return $this->_commonPayflowMethod->capture($payment, $amount);
140
+ }
141
+
142
+ /**
143
+ * Retrieve information from payment configuration
144
+ *
145
+ * @param string $field
146
+ * @param int|string|null|Mage_Core_Model_Store $storeId
147
+ *
148
+ * @return mixed
149
+ */
150
+ public function getConfigData($field, $storeId = null)
151
+ {
152
+ return $this->_commonPayflowMethod->getConfigData($field, $storeId);
153
+ }
154
+
155
+ }
app/code/community/CLS/Paypal/Model/Paypal/Stored/Payflow.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypal_Stored_Payflow extends CLS_Paypal_Model_Paypal_Payflowpro
30
+ {
31
+
32
+ /**
33
+ * Payment method code
34
+ */
35
+ protected $_code = null;
36
+
37
+ /**
38
+ * Keeps the payment method that handles all common 'stored' functionality
39
+ *
40
+ * @var CLS_Paypal_Model_Paypal_Stored_Abstract
41
+ */
42
+ protected $_commonMethod;
43
+
44
+ /**
45
+ * Parent payment method code
46
+ */
47
+ protected $_parentCode = null;
48
+
49
+ /**
50
+ * The list of config fields that should be taken from the actual 'stored' payment method
51
+ * @var array|null
52
+ */
53
+ protected $_actualConfigFields = array(
54
+ 'active',
55
+ 'title',
56
+ 'sort_order',
57
+ 'payment_action',
58
+ 'allowspecific',
59
+ 'specificcountry',
60
+ 'debug',
61
+ 'verify_peer'
62
+ );
63
+
64
+ /**
65
+ * Check whether payment method can be used
66
+ *
67
+ * @param Mage_Sales_Model_Quote $quote
68
+ * @return bool
69
+ */
70
+ public function isAvailable($quote = null)
71
+ {
72
+ $storeId = Mage::app()->getStore($this->getStore())->getId();
73
+ $config = Mage::getModel('paypal/config')->setStoreId($storeId);
74
+
75
+ if (!(
76
+ Mage_Payment_Model_Method_Abstract::isAvailable($quote) &&
77
+ $config->isMethodAvailable($this->getCode()))
78
+ ) {
79
+ return false;
80
+ }
81
+
82
+ return $this->_commonMethod->isAvailable($quote);
83
+ }
84
+
85
+ /**
86
+ * Validate payment method information object
87
+ *
88
+ * @return Mage_Payment_Model_Method_Cc
89
+ */
90
+ public function validate()
91
+ {
92
+ return $this->_commonMethod->validate();
93
+ }
94
+
95
+ /**
96
+ * Assign data to info model instance
97
+ *
98
+ * @param mixed $data
99
+ * @return Mage_Payment_Model_Method_Cc
100
+ */
101
+ public function assignData($data)
102
+ {
103
+ return $this->_commonMethod->assignData($data);
104
+ }
105
+
106
+ /**
107
+ * Authorize payment
108
+ *
109
+ * @param Mage_Sales_Model_Order_Payment $payment
110
+ * @param float $amount
111
+ * @return CLS_Paypal_Model_Paypal_Stored_Payflow
112
+ */
113
+ public function authorize(Varien_Object $payment, $amount)
114
+ {
115
+ return $this->_placeOrder($payment, $amount, self::TRXTYPE_AUTH_ONLY);
116
+ }
117
+
118
+ /**
119
+ * Capture payment via reference transaction
120
+ *
121
+ * @param Mage_Sales_Model_Order_Payment $payment
122
+ * @param float $amount
123
+ * @return CLS_Paypal_Model_Paypal_Stored_Payflow
124
+ */
125
+ public function capture(Varien_Object $payment, $amount)
126
+ {
127
+ if ($payment->getParentTransactionId()) {
128
+ // Perform 'Delayed capture' in a usual way
129
+ return parent::capture($payment, $amount);
130
+ }
131
+ else {
132
+ // Capture funds via Reference Transaction
133
+ return $this->_placeOrder($payment, $amount, self::TRXTYPE_SALE);
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Retrieve information from payment configuration
139
+ *
140
+ * @param string $field
141
+ * @param int|string|null|Mage_Core_Model_Store $storeId
142
+ *
143
+ * @return mixed
144
+ */
145
+ public function getConfigData($field, $storeId = null)
146
+ {
147
+ if (null === $storeId) {
148
+ $storeId = $this->getStore();
149
+ }
150
+
151
+ if (!empty($this->_actualConfigFields) && in_array($field, $this->_actualConfigFields)) {
152
+ // Get this field value from the actual payment method
153
+ $code = $this->getCode();
154
+ }
155
+ else {
156
+ // Get the rest values from the parent method
157
+ $code = $this->getParentCode();
158
+ }
159
+
160
+ $path = 'payment/'.$code.'/'.$field;
161
+
162
+ return Mage::getStoreConfig($path, $storeId);
163
+ }
164
+
165
+ /**
166
+ * Retrieve parent payment method code
167
+ *
168
+ * @return string
169
+ */
170
+ public function getParentCode()
171
+ {
172
+ if (!is_null($this->_parentCode)) {
173
+ return $this->_parentCode;
174
+ }
175
+
176
+ return $this->getCode();
177
+ }
178
+
179
+ }
app/code/community/CLS/Paypal/Model/Paypaluk/Api/Nvp.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypaluk_Api_Nvp extends Mage_PaypalUk_Model_Api_Nvp
30
+ {
31
+ /**
32
+ * Paypal methods definition
33
+ */
34
+ const SET_BILLING_AGREEMENT = 'SetCustomerBillingAgreement';
35
+ const CREATE_BILLING_AGREEMENT = 'CreateBillingAgreement';
36
+ const UPDATE_BILLING_AGREEMENT = 'BillAgreementUpdate';
37
+ const DO_REFERENCE_TRANSACTION = 'DoReferenceTransaction';
38
+
39
+ /**
40
+ * Actions
41
+ */
42
+ const BA_SET = 'S';
43
+ const BA_CREATE = 'X';
44
+ const BA_UPDATE = 'U';
45
+
46
+ const RESPONSE_MSG = 'paypal_response_msg';
47
+
48
+ /**
49
+ * Create Billing Agreement request/response map
50
+ * @var array
51
+ */
52
+ protected $_createBillingAgreementResponse = array('BAID');
53
+
54
+ /**
55
+ * Update Billing Agreement request/response map
56
+ * @var array
57
+ */
58
+ protected $_updateBillingAgreementRequest = array(
59
+ 'BAID', 'TENDER', 'BA_STATUS',
60
+ );
61
+ protected $_updateBillingAgreementResponse = array(
62
+ 'BAID', 'PPREF', 'RESPMSG', 'CORRELATIONID',
63
+ );
64
+
65
+ /**
66
+ * Do Reference Transaction request/response map
67
+ *
68
+ * @var array
69
+ */
70
+ protected $_doReferenceTransactionRequest = array('BAID', 'TENDER', 'AMT', 'FREIGHTAMT',
71
+ 'TAXAMT', 'INVNUM', 'NOTIFYURL'
72
+ );
73
+ protected $_doReferenceTransactionResponse = array('BAID', 'PNREF', 'PPREF', 'PENDINGREASON', 'RESPMSG');
74
+
75
+ protected function _construct()
76
+ {
77
+ parent::_construct();
78
+
79
+ $this->_globalMap['BILLINGTYPE'] = 'billing_type';
80
+ $this->_globalMap['BAID'] = 'billing_agreement_id';
81
+ $this->_globalMap['RESPMSG'] = 'response_msg';
82
+ $this->_globalMap['BA_STATUS'] = 'billing_agreement_status';
83
+ $this->_globalMap['BUTTONSOURCE'] = 'paypal_info_code';
84
+
85
+ $this->_debugReplacePrivateDataKeys[] = 'BUTTONSOURCE';
86
+
87
+ $this->_setExpressCheckoutRequest[] = 'BILLINGTYPE';
88
+
89
+ $this->_customerBillingAgreementRequest[] = 'TENDER';
90
+ $this->_customerBillingAgreementRequest[] = 'AMT';
91
+
92
+ $this->_createBillingAgreementRequest[] = 'TENDER';
93
+ }
94
+
95
+ /**
96
+ * Get Paypal info code
97
+ *
98
+ * @return string
99
+ */
100
+ public function getPaypalInfoCode()
101
+ {
102
+ return Mage::helper('cls_paypal')->getPaypalInfoCode();
103
+ }
104
+
105
+ /**
106
+ * Return PaypalUk tender based on config data
107
+ *
108
+ * @return string
109
+ */
110
+ public function getTender()
111
+ {
112
+ switch ($this->_config->getMethodCode()) {
113
+ case CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOW_BILLING_AGREEMENT:
114
+ case CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT:
115
+ return Mage_PaypalUk_Model_Api_Nvp::TENDER_PAYPAL;
116
+
117
+ default:
118
+ return parent::getTender();
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Add method to request array
124
+ *
125
+ * @param string $methodName
126
+ * @param array $request
127
+ * @return array
128
+ */
129
+ protected function _addMethodToRequest($methodName, $request)
130
+ {
131
+ $txnType = $this->_mapPaypalMethodName($methodName);
132
+ if ($txnType) {
133
+ return parent::_addMethodToRequest($methodName, $request);
134
+ } else {
135
+ if (!is_null($this->_getPaypalUkActionName($methodName))) {
136
+ $request['ACTION'] = $this->_getPaypalUkActionName($methodName);
137
+ }
138
+ return $request;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Return Payflow Edition
144
+ *
145
+ * @param string
146
+ * @return string | null
147
+ */
148
+ protected function _getPaypalUkActionName($methodName)
149
+ {
150
+ switch($methodName) {
151
+ case self::DO_REFERENCE_TRANSACTION:
152
+ return Mage_PaypalUk_Model_Api_Nvp::EXPRESS_DO_PAYMENT;
153
+
154
+ case self::SET_BILLING_AGREEMENT:
155
+ return self::BA_SET;
156
+
157
+ case self::CREATE_BILLING_AGREEMENT:
158
+ return self::BA_CREATE;
159
+
160
+ case self::UPDATE_BILLING_AGREEMENT:
161
+ return self::BA_UPDATE;
162
+
163
+ default:
164
+ return parent::_getPaypalUkActionName($methodName);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Map paypal method names
170
+ *
171
+ * @param string| $methodName
172
+ * @return string
173
+ */
174
+ protected function _mapPaypalMethodName($methodName)
175
+ {
176
+ switch ($methodName) {
177
+ case self::DO_REFERENCE_TRANSACTION:
178
+ return ($this->_config->payment_action == Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH)
179
+ ? Mage_PaypalUk_Model_Api_Nvp::TRXTYPE_AUTH_ONLY
180
+ : Mage_PaypalUk_Model_Api_Nvp::TRXTYPE_SALE;
181
+
182
+ case self::SET_BILLING_AGREEMENT:
183
+ case self::CREATE_BILLING_AGREEMENT:
184
+ return Mage_PaypalUk_Model_Api_Nvp::TRXTYPE_AUTH_ONLY;
185
+
186
+ case self::UPDATE_BILLING_AGREEMENT:
187
+ return null;
188
+
189
+ default:
190
+ return parent::_mapPaypalMethodName($methodName);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Set Customer Billing Agreement call
196
+ *
197
+ * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement
198
+ */
199
+ public function callSetCustomerBillingAgreement()
200
+ {
201
+ $this->setAmount(0);
202
+ parent::callSetCustomerBillingAgreement();
203
+ }
204
+ }
app/code/community/CLS/Paypal/Model/Paypaluk/Express.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypaluk_Express extends Mage_PaypalUk_Model_Express
30
+ {
31
+ protected $_canCreateBillingAgreement = true;
32
+
33
+ /**
34
+ * Import payment info to payment
35
+ *
36
+ * @param Mage_Paypal_Model_Api_Nvp
37
+ * @param Mage_Sales_Model_Order_Payment
38
+ */
39
+ protected function _importToPayment($api, $payment)
40
+ {
41
+ if ($api->getBillingAgreementId() && $payment->getOrder()->getCustomerId()) {
42
+ $payment->setBillingAgreementData(array(
43
+ 'billing_agreement_id' => $api->getBillingAgreementId(),
44
+ 'method_code' => CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOW_BILLING_AGREEMENT
45
+ ));
46
+ }
47
+
48
+ parent::_importToPayment($api, $payment);
49
+ }
50
+ }
app/code/community/CLS/Paypal/Model/Paypaluk/Express/Checkout.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypaluk_Express_Checkout extends Mage_PaypalUk_Model_Express_Checkout
30
+ {
31
+ /**
32
+ * Set create billing agreement flag to api call
33
+ *
34
+ * @return Mage_Paypal_Model_Express_Checkout
35
+ */
36
+ protected function _setBillingAgreementRequest()
37
+ {
38
+ if ($this->_quote->hasNominalItems()) {
39
+ return $this;
40
+ }
41
+
42
+ $isRequested = $this->_isBARequested || $this->_quote->getPayment()
43
+ ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
44
+
45
+ if (!($this->_config->allow_ba_signup == Mage_Paypal_Model_Config::EC_BA_SIGNUP_AUTO
46
+ || $isRequested && $this->_config->shouldAskToCreateBillingAgreement())) {
47
+ return $this;
48
+ }
49
+
50
+ if ($this->_customerId && !Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($this->_customerId)) {
51
+ return $this;
52
+ }
53
+ $this->_api->setBillingType($this->_api->getBillingAgreementType());
54
+ return $this;
55
+ }
56
+ }
app/code/community/CLS/Paypal/Model/Paypaluk/Method/Agreement.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Agreement.php
4
+ *
5
+ * @category CLS
6
+ * @package Paypal
7
+ * @copyright Copyright (c) 2013 Classy Llama Studios
8
+ */
9
+
10
+ class CLS_Paypal_Model_Paypaluk_Method_Agreement extends Mage_Paypal_Model_Method_Agreement
11
+ {
12
+
13
+ const STATUS_CANCELED = 'cancel';
14
+
15
+ /**
16
+ * Method code
17
+ *
18
+ * @var string
19
+ */
20
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOW_BILLING_AGREEMENT;
21
+
22
+ /**
23
+ * Initialize Mage_Paypal_Model_Pro model
24
+ *
25
+ * @param array $params
26
+ */
27
+ public function __construct($params = array())
28
+ {
29
+ $proInstance = array_shift($params);
30
+ if ($proInstance && ($proInstance instanceof Mage_Paypal_Model_Pro)) {
31
+ $this->_pro = $proInstance;
32
+ } else {
33
+ $this->_pro = Mage::getModel('paypaluk/pro');
34
+ }
35
+ $this->_pro->setMethod($this->_code);
36
+ }
37
+
38
+ /**
39
+ * GetBillingAgreementCustomerDetails doesn't exist in PaypalUk
40
+ *
41
+ * @return array
42
+ */
43
+ public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
44
+ {
45
+ $api = $this->_pro->getApi()
46
+ ->setToken($agreement->getToken());
47
+
48
+ $api->callGetExpressCheckoutDetails();
49
+
50
+ $responseData = array(
51
+ 'token' => $api->getData('token'),
52
+ 'email' => $api->getData('email'),
53
+ 'payer_id' => $api->getData('payer_id'),
54
+ 'payer_status' => $api->getData('payer_status')
55
+ );
56
+ $agreement->addData($responseData);
57
+ return $responseData;
58
+ }
59
+
60
+ /**
61
+ * Update billing agreement status
62
+ *
63
+ * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
64
+ * @throws Exception|Mage_Core_Exception
65
+ * @return Mage_Paypal_Model_Method_Agreement
66
+ */
67
+ public function updateBillingAgreementStatus(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
68
+ {
69
+ $targetStatus = $agreement->getStatus();
70
+
71
+ if (Mage_Sales_Model_Billing_Agreement::STATUS_CANCELED == $targetStatus) {
72
+ $targetStatus = self::STATUS_CANCELED;
73
+ }
74
+
75
+ $api = $this->_pro->getApi()
76
+ ->setBillingAgreementId($agreement->getReferenceId())
77
+ ->setBillingAgreementStatus($targetStatus);
78
+ try {
79
+ $api->callUpdateBillingAgreement();
80
+ } catch (Mage_Core_Exception $e) {
81
+ // when BA was already canceled, just pretend that the operation succeeded
82
+ if (!(self::STATUS_CANCELED == $targetStatus && $api->getIsBillingAgreementAlreadyCancelled())) {
83
+ throw $e;
84
+ }
85
+ }
86
+ return $this;
87
+ }
88
+
89
+ /**
90
+ * Place an order with authorization or capture action
91
+ *
92
+ * @param Mage_Sales_Model_Order_Payment $payment
93
+ * @param float $amount
94
+ * @return Mage_Paypal_Model_Method_Agreement
95
+ */
96
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
97
+ {
98
+ $order = $payment->getOrder();
99
+ $billingAgreement = Mage::getModel('sales/billing_agreement')->load(
100
+ $payment->getAdditionalInformation(
101
+ Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID
102
+ )
103
+ );
104
+
105
+ $api = $this->_pro->getApi()
106
+ ->setBillingAgreementId($billingAgreement->getReferenceId())
107
+ ->setPaymentAction($this->_pro->getConfig()->paymentAction)
108
+ ->setAmount($amount)
109
+ ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
110
+ ->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
111
+ ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
112
+ ->setInvNum($order->getIncrementId())
113
+ ;
114
+
115
+ // call api and import transaction and other payment information
116
+ $api->callDoReferenceTransaction();
117
+ $this->_pro->importPaymentInfo($api, $payment);
118
+
119
+ $payment
120
+ ->setAdditionalInformation(CLS_Paypal_Model_Paypaluk_Api_Nvp::RESPONSE_MSG, $api->getResponseMsg())
121
+ ->setPreparedMessage(Mage::helper('cls_paypal')->__('Payflow PNREF: #%s.', $api->getTransactionId()))
122
+ ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId());
123
+
124
+ $payment->setTransactionId($api->getPaypalTransactionId())
125
+ ->setIsTransactionClosed(0);
126
+
127
+ if ($api->getBillingAgreementId()) {
128
+ $order->addRelatedObject($billingAgreement);
129
+ $billingAgreement->setIsObjectChanged(true);
130
+ $billingAgreement->addOrderRelation($order);
131
+ }
132
+
133
+ return $this;
134
+ }
135
+ }
app/code/community/CLS/Paypal/Model/Paypaluk/Method/Orderstored/Agreement.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Paypaluk_Method_Orderstored_Agreement extends CLS_Paypal_Model_Paypaluk_Method_Agreement
30
+ {
31
+
32
+ /**
33
+ * Method code
34
+ *
35
+ * @var string
36
+ */
37
+ protected $_code = CLS_Paypal_Model_Paypal_Config::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT;
38
+ protected $_formBlockType = 'cls_paypal/paypaluk_payment_form_orderstored_agreement';
39
+
40
+ /**
41
+ * Method instance settings
42
+ *
43
+ */
44
+ protected $_canUseInternal = true;
45
+
46
+ /**
47
+ * Check whether method is available
48
+ *
49
+ * @param Mage_Sales_Model_Quote $quote
50
+ * @return bool
51
+ */
52
+ public function isAvailable($quote = null)
53
+ {
54
+ if (is_null($this->_isAvailable)) {
55
+ $this->_isAvailable = (Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $this->_isAvailable($quote));
56
+
57
+ if ($this->_isAvailable && is_object($quote)) {
58
+ $isAvailable = false;
59
+ $availableBA = Mage::helper('cls_paypal/orderstored_agreement')->getBillingAgreementIdFromSessionOrder();
60
+ $isAvailable = !empty($availableBA);
61
+ $this->_isAvailable = $isAvailable;
62
+ }
63
+ $this->_canUseInternal = ($this->_isAvailable && $this->_canUseInternal);
64
+ }
65
+ return $this->_isAvailable;
66
+ }
67
+
68
+ /**
69
+ * Place an order with authorization or capture action
70
+ *
71
+ * @param Mage_Sales_Model_Order_Payment $payment
72
+ * @param float $amount
73
+ * @return Mage_Paypal_Model_Method_Agreement
74
+ */
75
+ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
76
+ {
77
+ $order = $payment->getOrder();
78
+
79
+ $api = $this->_pro->getApi()
80
+ ->setBillingAgreementId($payment->getBillingAgreementId())
81
+ ->setPaymentAction($this->_pro->getConfig()->paymentAction)
82
+ ->setAmount($amount)
83
+ ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
84
+ ->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
85
+ ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
86
+ ->setInvNum($order->getIncrementId())
87
+ ;
88
+
89
+ // call api and import transaction and other payment information
90
+ $api->callDoReferenceTransaction();
91
+ $this->_pro->importPaymentInfo($api, $payment);
92
+
93
+ $payment
94
+ ->setAdditionalInformation(CLS_Paypal_Model_Paypaluk_Api_Nvp::RESPONSE_MSG, $api->getResponseMsg())
95
+ ->setPreparedMessage(Mage::helper('cls_paypal')->__('Payflow PNREF: #%s.', $api->getTransactionId()))
96
+ ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId());
97
+
98
+ $payment->setTransactionId($api->getPaypalTransactionId())
99
+ ->setIsTransactionClosed(0);
100
+
101
+ return $this;
102
+ }
103
+ }
app/code/community/CLS/Paypal/Model/Resource/Customerstored.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Resource_Customerstored extends Mage_Core_Model_Resource_Db_Abstract
30
+ {
31
+ /**
32
+ * Initialize main table and table id field
33
+ */
34
+ protected function _construct()
35
+ {
36
+ $this->_init('cls_paypal/customerstored', 'stored_card_id');
37
+ }
38
+
39
+ /**
40
+ * Check card for duplicates
41
+ *
42
+ * @param int $customerId
43
+ * @param string $ccType
44
+ * @param string $ccLast4
45
+ * @param string $ccExpMonth
46
+ * @param string $ccExpYear
47
+ * @param array $compatiblePaymentMethods
48
+ * @return array
49
+ */
50
+ public function checkCardDuplicate($customerId, $ccType, $ccLast4, $ccExpMonth, $ccExpYear, $compatiblePaymentMethods)
51
+ {
52
+ $read = $this->_getReadAdapter();
53
+ $select = $read->select();
54
+
55
+ $binds = array(
56
+ 'customer_id' => $customerId,
57
+ 'cc_type' => $ccType,
58
+ 'cc_last4' => $ccLast4,
59
+ 'cc_exp_month' => $ccExpMonth,
60
+ 'cc_exp_year' => $ccExpYear
61
+ );
62
+
63
+ $select
64
+ ->from($this->getMainTable(), array('stored_card_id'))
65
+ ->where('customer_id = :customer_id')
66
+ ->where('cc_type = :cc_type')
67
+ ->where('cc_last4 = :cc_last4')
68
+ ->where('cc_exp_month = :cc_exp_month')
69
+ ->where('cc_exp_year = :cc_exp_year');
70
+
71
+ if (!empty($compatiblePaymentMethods)) {
72
+ $select->where('payment_method IN (?)', $compatiblePaymentMethods);
73
+ }
74
+
75
+ return $read->fetchCol($select, $binds);
76
+ }
77
+ }
app/code/community/CLS/Paypal/Model/Resource/Customerstored/Collection.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Model_Resource_Customerstored_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
30
+ {
31
+ /**
32
+ * Resource initialization
33
+ *
34
+ */
35
+ protected function _construct()
36
+ {
37
+ $this->_init('cls_paypal/customerstored');
38
+ }
39
+
40
+ /**
41
+ * Apply filter by customer
42
+ *
43
+ * @param int $customerId
44
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
45
+ */
46
+ public function filterByCustomerId($customerId)
47
+ {
48
+ $this->getSelect()->where('customer_id = ?', $customerId);
49
+
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * Apply filter by card active state (based on last usage date)
55
+ *
56
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
57
+ */
58
+ public function filterByActiveState()
59
+ {
60
+ $now = new Zend_Date(null);
61
+ $now->addMonth(0 - CLS_Paypal_Model_Paypal_Config::STORED_CARD_TTL_MONTHS);
62
+ $this->getSelect()->where('date >= ?', Varien_Date::formatDate($now, false));
63
+
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Apply filter by card expiration date (extract valid cards only)
69
+ *
70
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
71
+ */
72
+ public function filterByExpirationDate()
73
+ {
74
+ $now = new Zend_Date(null);
75
+ $dateArray = $now->toArray();
76
+
77
+ $this->getSelect()->where("
78
+ (cc_exp_year > '{$dateArray['year']}') OR
79
+ (cc_exp_year = '{$dateArray['year']}' AND cc_exp_month >= {$dateArray['month']})
80
+ ");
81
+
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * Apply filter by payment method
87
+ *
88
+ * @param array $paymentMethod
89
+ * @return CLS_Paypal_Model_Resource_Customerstored_Collection
90
+ */
91
+ public function filterByPaymentMethod(array $paymentMethod)
92
+ {
93
+ if (!empty($paymentMethod)) {
94
+ $this->getSelect()->where('payment_method IN (?)', $paymentMethod);
95
+ }
96
+
97
+ return $this;
98
+ }
99
+ }
app/code/community/CLS/Paypal/README.txt ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CLS_Paypal Module Features
2
+ ==========================
3
+ PCI Compliant saved credit cards with Paypal reference transactions.
4
+
5
+ ## Saved Credit Card
6
+
7
+ * Customers can save their credit card information during the checkout process and then use the same credit card on future orders.
8
+ * Our solution is fully PCI Compliant since it stores a secure token as a reference transaction to the credit card data. Credit card data is not actually stored on the web site.
9
+
10
+ ## Billing Agreements
11
+
12
+ * Billing agreements are now available with Payflow Pro integration.
13
+ * Billing agreements can be created during Express Checkout even for guest or registering customers, for use with the new admin order management features.
14
+
15
+ ## Admin Order Management
16
+
17
+ * When viewing an order, admins have the option to select "New Order from this Payment." This option allows the same PayPal billing agreement or credit card used on the previous order to be charged on the new order.
18
+ * The ability to re-charge the previous PayPal billing agreement or credit card is also available when editing an order.
19
+ * To better facilitate the use of the "New Order from this Payment" feature, the admin interface can now be used to create guest orders.
20
+
21
+
22
+ # What are PayPal Billing Agreements?
23
+
24
+ Billing Agreements allow you to bill customers at regular intervals.
25
+
26
+ Set up payments for dues, subscriptions, installments, and more.
27
+
28
+ * Automatically bill customers at specified intervals.
29
+ * Use automated notifications and reporting to manage billing status.
30
+ * Customers can complete transactions without leaving your app, game, or website.
31
+
32
+
33
+ # Supported PayPal Solutions
34
+
35
+ The features of this module are available for Magento integrations with the following PayPal solutions:
36
+
37
+ * Payments Pro
38
+ * Payments Advanced
39
+ * Payflow Pro
40
+ * Payflow Link
41
+ * Express Checkout
42
+
43
+
44
+ # Magento Compatibility
45
+
46
+ * Community 1.7.0.2 and up
47
+ * Enterprise 1.12.0.2 and up
48
+
49
+ # Configuration Instructions
50
+
51
+ Settings for this module's features can be found in System Configuration,
52
+ under the various existing PayPal configuration groups. In the Payment Methods
53
+ tab, navigate to a specific PayPal solution (Payments Pro, for example)
54
+ and open the the solution's Advanced Settings to find the new configuration
55
+ areas.
56
+
57
+ PayPal Billing Agreement Settings can now be found under Advanced Settings
58
+ for Payflow Pro, just as it is found for other solutions.
59
+
60
+ For each of the four supported solutions, Advanced Settings now contains
61
+ three added groups: PayPal Saved Credit Card Settings, PayPal Previous Order
62
+ Credit Card Settings, and PayPal Previous Order Billing Agreement Settings.
63
+ Enable the module's various features from these groups, as well as setting
64
+ their configuration options independently of the standard credit card
65
+ and billing agreement configurations.
app/code/community/CLS/Paypal/controllers/Adminhtml/Sales/Order/CreateController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml').DS.'Sales'.DS.'Order'.DS.'CreateController.php';
30
+
31
+ /**
32
+ * Custom adminhtml sales orders create controller
33
+ */
34
+ class CLS_Paypal_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
35
+ {
36
+
37
+ /**
38
+ * "New Order from this Payment" action initialization
39
+ */
40
+ public function orderFromPaymentAction()
41
+ {
42
+ $this->_getSession()->clear();
43
+ $orderId = $this->getRequest()->getParam('order_id');
44
+ $order = Mage::getModel('sales/order')->load($orderId);
45
+
46
+ try {
47
+ if ($order->getId()) {
48
+ $this->_getSession()->setPreviousOrderId($order->getId());
49
+
50
+ $this->_redirect('adminhtml/sales_order_create/');
51
+ }
52
+ else {
53
+ $this->_redirect('adminhtml/sales_order/');
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
57
+ $this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
58
+ } catch (Exception $e) {
59
+ Mage::getSingleton('adminhtml/session')->addException($e, $e->getMessage());
60
+ $this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
61
+ }
62
+ }
63
+ }
app/code/community/CLS/Paypal/controllers/Customer/StoredcardController.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class CLS_Paypal_Customer_StoredcardController extends Mage_Core_Controller_Front_Action
30
+ {
31
+ /**
32
+ * Retrieve customer session object
33
+ *
34
+ * @return Mage_Customer_Model_Session
35
+ */
36
+ protected function _getSession()
37
+ {
38
+ return Mage::getSingleton('customer/session');
39
+ }
40
+
41
+ public function preDispatch()
42
+ {
43
+ parent::preDispatch();
44
+
45
+ if (!Mage::getSingleton('customer/session')->authenticate($this)) {
46
+ $this->setFlag('', 'no-dispatch', true);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * List customer's stored cards
52
+ */
53
+ public function indexAction()
54
+ {
55
+ $this->loadLayout();
56
+ $this->_initLayoutMessages('customer/session');
57
+
58
+ $this->getLayout()->getBlock('head')->setTitle($this->__('My Credit Cards'));
59
+
60
+ $this->renderLayout();
61
+ }
62
+
63
+ /**
64
+ * Delete stored card
65
+ */
66
+ public function deleteAction()
67
+ {
68
+ $storedCardId = (int)$this->getRequest()->getParam('stored_card_id');
69
+
70
+ if ($storedCardId) {
71
+ $storedCardModel = Mage::getModel('cls_paypal/customerstored')->load($storedCardId);
72
+
73
+ $customerId = $this->_getSession()->getCustomerId();
74
+
75
+ // Perform a security check
76
+ if (
77
+ $storedCardModel->getId()
78
+ && ($storedCardModel->getCustomerId() == $customerId)
79
+ ) {
80
+ // Delete card
81
+ $storedCardModel->delete();
82
+
83
+ $this->_getSession()->addSuccess($this->__('The card had been deleted.'));
84
+ }
85
+ }
86
+
87
+ $this->_redirect('*/*/');
88
+ }
89
+ }
app/code/community/CLS/Paypal/controllers/Paypal/ExpressController.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ require_once Mage::getModuleDir('controllers', 'Mage_Paypal') . DS . 'ExpressController.php';
30
+
31
+ /**
32
+ * Class CLS_Paypal_Paypal_ExpressController
33
+ */
34
+ class CLS_Paypal_Paypal_ExpressController extends Mage_Paypal_ExpressController
35
+ {
36
+ /**
37
+ * Start Express Checkout by requesting initial token and dispatching customer to PayPal
38
+ */
39
+ public function startAction()
40
+ {
41
+ try {
42
+ $this->_initCheckout();
43
+
44
+ if ($this->_getQuote()->getIsMultiShipping()) {
45
+ $this->_getQuote()->setIsMultiShipping(false);
46
+ $this->_getQuote()->removeAllAddresses();
47
+ }
48
+
49
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
50
+ if ($customer && $customer->getId()) {
51
+ $this->_checkout->setCustomerWithAddressChange(
52
+ $customer, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress()
53
+ );
54
+ }
55
+
56
+ // billing agreement
57
+ $isBARequested = (bool)$this->getRequest()
58
+ ->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
59
+
60
+ if ($isBARequested) {
61
+ $this->_checkout->setIsBillingAgreementRequested($isBARequested);
62
+ }
63
+
64
+ // giropay
65
+ $this->_checkout->prepareGiropayUrls(
66
+ Mage::getUrl('checkout/onepage/success'),
67
+ Mage::getUrl('paypal/express/cancel'),
68
+ Mage::getUrl('checkout/onepage/success')
69
+ );
70
+
71
+ $token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel'));
72
+ if ($token && $url = $this->_checkout->getRedirectUrl()) {
73
+ $this->_initToken($token);
74
+ $this->getResponse()->setRedirect($url);
75
+ return;
76
+ }
77
+ } catch (Mage_Core_Exception $e) {
78
+ $this->_getCheckoutSession()->addError($e->getMessage());
79
+ } catch (Exception $e) {
80
+ $this->_getCheckoutSession()->addError($this->__('Unable to start Express Checkout.'));
81
+ Mage::logException($e);
82
+ }
83
+
84
+ $this->_redirect('checkout/cart');
85
+ }
86
+
87
+ /**
88
+ * Instantiate quote and checkout
89
+ *
90
+ * Note: The following three functions are private, so must be added here from the abstract.
91
+ * No code changes were made to the methods.
92
+ *
93
+ * @throws Mage_Core_Exception
94
+ */
95
+ private function _initCheckout()
96
+ {
97
+ $quote = $this->_getQuote();
98
+ if (!$quote->hasItems() || $quote->getHasError()) {
99
+ $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
100
+ Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.'));
101
+ }
102
+ $this->_checkout = Mage::getSingleton($this->_checkoutType, array(
103
+ 'config' => $this->_config,
104
+ 'quote' => $quote,
105
+ ));
106
+ }
107
+
108
+ /**
109
+ * Return checkout session object
110
+ *
111
+ * @return Mage_Checkout_Model_Session
112
+ */
113
+ private function _getCheckoutSession()
114
+ {
115
+ return Mage::getSingleton('checkout/session');
116
+ }
117
+
118
+ /**
119
+ * Return checkout quote object
120
+ *
121
+ * @return Mage_Sale_Model_Quote
122
+ */
123
+ private function _getQuote()
124
+ {
125
+ if (!$this->_quote) {
126
+ $this->_quote = $this->_getCheckoutSession()->getQuote();
127
+ }
128
+ return $this->_quote;
129
+ }
130
+ }
app/code/community/CLS/Paypal/controllers/PaypalUk/ExpressController.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ require_once Mage::getModuleDir('controllers', 'Mage_PaypalUk') . DS . 'ExpressController.php';
30
+
31
+ /**
32
+ * Class CLS_Paypal_PaypalUk_ExpressController
33
+ */
34
+ class CLS_Paypal_PaypalUk_ExpressController extends Mage_PaypalUk_ExpressController
35
+ {
36
+
37
+ /**
38
+ * Start Express Checkout by requesting initial token and dispatching customer to PayPal
39
+ */
40
+ public function startAction()
41
+ {
42
+ try {
43
+ $this->_initCheckout();
44
+
45
+ if ($this->_getQuote()->getIsMultiShipping()) {
46
+ $this->_getQuote()->setIsMultiShipping(false);
47
+ $this->_getQuote()->removeAllAddresses();
48
+ }
49
+
50
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
51
+ if ($customer && $customer->getId()) {
52
+ $this->_checkout->setCustomerWithAddressChange(
53
+ $customer, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress()
54
+ );
55
+ }
56
+
57
+ // billing agreement
58
+ $isBARequested = (bool)$this->getRequest()
59
+ ->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
60
+
61
+ if ($isBARequested) {
62
+ $this->_checkout->setIsBillingAgreementRequested($isBARequested);
63
+ }
64
+
65
+ // giropay
66
+ $this->_checkout->prepareGiropayUrls(
67
+ Mage::getUrl('checkout/onepage/success'),
68
+ Mage::getUrl('paypal/express/cancel'),
69
+ Mage::getUrl('checkout/onepage/success')
70
+ );
71
+
72
+ $token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel'));
73
+ if ($token && $url = $this->_checkout->getRedirectUrl()) {
74
+ $this->_initToken($token);
75
+ $this->getResponse()->setRedirect($url);
76
+ return;
77
+ }
78
+ } catch (Mage_Core_Exception $e) {
79
+ $this->_getCheckoutSession()->addError($e->getMessage());
80
+ } catch (Exception $e) {
81
+ $this->_getCheckoutSession()->addError($this->__('Unable to start Express Checkout.'));
82
+ Mage::logException($e);
83
+ }
84
+
85
+ $this->_redirect('checkout/cart');
86
+ }
87
+
88
+ /**
89
+ * Instantiate quote and checkout
90
+ *
91
+ * Note: The following three functions are private, so must be added here from the abstract.
92
+ * No code changes were made to the methods.
93
+ *
94
+ * @throws Mage_Core_Exception
95
+ */
96
+ private function _initCheckout()
97
+ {
98
+ $quote = $this->_getQuote();
99
+ if (!$quote->hasItems() || $quote->getHasError()) {
100
+ $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
101
+ Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.'));
102
+ }
103
+ $this->_checkout = Mage::getSingleton($this->_checkoutType, array(
104
+ 'config' => $this->_config,
105
+ 'quote' => $quote,
106
+ ));
107
+ }
108
+
109
+ /**
110
+ * Return checkout session object
111
+ *
112
+ * @return Mage_Checkout_Model_Session
113
+ */
114
+ private function _getCheckoutSession()
115
+ {
116
+ return Mage::getSingleton('checkout/session');
117
+ }
118
+
119
+ /**
120
+ * Return checkout quote object
121
+ *
122
+ * @return Mage_Sale_Model_Quote
123
+ */
124
+ private function _getQuote()
125
+ {
126
+ if (!$this->_quote) {
127
+ $this->_quote = $this->_getCheckoutSession()->getQuote();
128
+ }
129
+ return $this->_quote;
130
+ }
131
+ }
app/code/community/CLS/Paypal/etc/config.xml ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Classy Llama
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 to us at
14
+ * support+paypal@classyllama.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module
19
+ * to newer versions in the future. If you require customizations of this
20
+ * module for your needs, please write us at sales@classyllama.com.
21
+ *
22
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
23
+ *
24
+ * @category CLS
25
+ * @package Paypal
26
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ */
29
+ -->
30
+ <config>
31
+ <modules>
32
+ <CLS_Paypal>
33
+ <version>1.0.0</version>
34
+ </CLS_Paypal>
35
+ </modules>
36
+
37
+ <global>
38
+ <blocks>
39
+ <cls_paypal>
40
+ <class>CLS_Paypal_Block</class>
41
+ </cls_paypal>
42
+
43
+ <adminhtml>
44
+ <rewrite>
45
+ <sales_order_create_customer>CLS_Paypal_Block_Adminhtml_Sales_Order_Create_Customer</sales_order_create_customer>
46
+ </rewrite>
47
+ </adminhtml>
48
+
49
+ <paypal>
50
+ <rewrite>
51
+ <adminhtml_system_config_fieldset_location>CLS_Paypal_Block_Paypal_Adminhtml_System_Config_Fieldset_Location</adminhtml_system_config_fieldset_location>
52
+ </rewrite>
53
+ </paypal>
54
+ </blocks>
55
+
56
+ <models>
57
+ <cls_paypal>
58
+ <class>CLS_Paypal_Model</class>
59
+ <resourceModel>cls_paypal_resource</resourceModel>
60
+ </cls_paypal>
61
+
62
+ <cls_paypal_resource>
63
+ <class>CLS_Paypal_Model_Resource</class>
64
+ <entities>
65
+ <customerstored>
66
+ <table>cls_paypal_customer_stored</table>
67
+ </customerstored>
68
+ </entities>
69
+ </cls_paypal_resource>
70
+
71
+ <paypal>
72
+ <rewrite>
73
+ <api_nvp>CLS_Paypal_Model_Paypal_Api_Nvp</api_nvp>
74
+ <config>CLS_Paypal_Model_Paypal_Config</config>
75
+ <express>CLS_Paypal_Model_Paypal_Express</express>
76
+ <express_checkout>CLS_Paypal_Model_Paypal_Express_Checkout</express_checkout>
77
+ <info>CLS_Paypal_Model_Paypal_Info</info>
78
+ <direct>CLS_Paypal_Model_Paypal_Direct</direct>
79
+ <payflowpro>CLS_Paypal_Model_Paypal_Payflowpro</payflowpro>
80
+ <payflowlink>CLS_Paypal_Model_Paypal_Payflowlink</payflowlink>
81
+ <payflowadvanced>CLS_Paypal_Model_Paypal_Payflowadvanced</payflowadvanced>
82
+ </rewrite>
83
+ </paypal>
84
+
85
+ <paypaluk>
86
+ <rewrite>
87
+ <api_nvp>CLS_Paypal_Model_Paypaluk_Api_Nvp</api_nvp>
88
+ <express>CLS_Paypal_Model_Paypaluk_Express</express>
89
+ <express_checkout>CLS_Paypal_Model_Paypaluk_Express_Checkout</express_checkout>
90
+ </rewrite>
91
+ </paypaluk>
92
+ </models>
93
+
94
+ <helpers>
95
+ <cls_paypal>
96
+ <class>CLS_Paypal_Helper</class>
97
+ </cls_paypal>
98
+
99
+ <paypal>
100
+ <rewrite>
101
+ <data>CLS_Paypal_Helper_Paypal_Data</data>
102
+ </rewrite>
103
+ </paypal>
104
+ </helpers>
105
+
106
+ <resources>
107
+ <cls_paypal_setup>
108
+ <setup>
109
+ <module>CLS_Paypal</module>
110
+ </setup>
111
+ </cls_paypal_setup>
112
+ </resources>
113
+
114
+ <events>
115
+ <sales_quote_payment_import_data_before>
116
+ <observers>
117
+ <cls_paypal>
118
+ <class>cls_paypal/observer</class>
119
+ <method>salesQuotePaymentImportDataBefore</method>
120
+ </cls_paypal>
121
+ </observers>
122
+ </sales_quote_payment_import_data_before>
123
+
124
+ <payment_info_block_prepare_specific_information>
125
+ <observers>
126
+ <cls_paypal>
127
+ <type>model</type>
128
+ <class>cls_paypal/observer</class>
129
+ <method>paymentInfoBlockPrepareSpecificInformation</method>
130
+ </cls_paypal>
131
+ </observers>
132
+ </payment_info_block_prepare_specific_information>
133
+
134
+ <checkout_submit_all_after>
135
+ <observers>
136
+ <cls_paypal>
137
+ <class>cls_paypal/observer</class>
138
+ <method>checkoutSubmitAllAfter</method>
139
+ </cls_paypal>
140
+ </observers>
141
+ </checkout_submit_all_after>
142
+ </events>
143
+
144
+ <fieldsets>
145
+ <sales_convert_quote_payment>
146
+ <!-- this is not a database field, won't exist to be converted in a front-end payment method, and only converts in a single execution context -->
147
+ <billing_agreement_id>
148
+ <to_order_payment>*</to_order_payment>
149
+ </billing_agreement_id>
150
+ <stored_card_id>
151
+ <to_order_payment>*</to_order_payment>
152
+ </stored_card_id>
153
+ </sales_convert_quote_payment>
154
+ </fieldsets>
155
+ </global>
156
+
157
+ <frontend>
158
+ <layout>
159
+ <updates>
160
+ <cls_paypal module="CLS_Paypal">
161
+ <file>cls_paypal.xml</file>
162
+ </cls_paypal>
163
+ </updates>
164
+ </layout>
165
+
166
+ <translate>
167
+ <modules>
168
+ <CLS_Paypal>
169
+ <files>
170
+ <default>CLS_Paypal.csv</default>
171
+ </files>
172
+ </CLS_Paypal>
173
+ </modules>
174
+ </translate>
175
+
176
+ <routers>
177
+ <paypal>
178
+ <args>
179
+ <modules>
180
+ <cls_paypal before="Mage_Paypal">CLS_Paypal_Paypal</cls_paypal>
181
+ </modules>
182
+ </args>
183
+ </paypal>
184
+ <paypaluk>
185
+ <args>
186
+ <modules>
187
+ <cls_paypaluk before="Mage_PaypalUk">CLS_Paypal_PaypalUk</cls_paypaluk>
188
+ </modules>
189
+ </args>
190
+ </paypaluk>
191
+ <customer>
192
+ <args>
193
+ <modules>
194
+ <cls_paypal before="Mage_Customer">CLS_Paypal_Customer</cls_paypal>
195
+ </modules>
196
+ </args>
197
+ </customer>
198
+ </routers>
199
+ </frontend>
200
+
201
+ <adminhtml>
202
+ <layout>
203
+ <updates>
204
+ <cls_paypal>
205
+ <file>cls_paypal.xml</file>
206
+ </cls_paypal>
207
+ </updates>
208
+ </layout>
209
+
210
+ <translate>
211
+ <modules>
212
+ <CLS_Paypal>
213
+ <files>
214
+ <default>CLS_Paypal.csv</default>
215
+ </files>
216
+ </CLS_Paypal>
217
+ </modules>
218
+ </translate>
219
+
220
+ <events>
221
+ <adminhtml_sales_order_create_process_data_before>
222
+ <observers>
223
+ <cls_paypal>
224
+ <class>cls_paypal/observer</class>
225
+ <method>adminCheckGuestOrder</method>
226
+ </cls_paypal>
227
+ </observers>
228
+ </adminhtml_sales_order_create_process_data_before>
229
+
230
+ <sales_quote_save_after>
231
+ <observers>
232
+ <cls_paypal>
233
+ <class>cls_paypal/observer</class>
234
+ <method>adminQuoteFlagGuestAddress</method>
235
+ </cls_paypal>
236
+ </observers>
237
+ </sales_quote_save_after>
238
+ </events>
239
+ </adminhtml>
240
+
241
+ <admin>
242
+ <routers>
243
+ <adminhtml>
244
+ <args>
245
+ <modules>
246
+ <cls_paypal before="Mage_Adminhtml">CLS_Paypal_Adminhtml</cls_paypal>
247
+ </modules>
248
+ </args>
249
+ </adminhtml>
250
+ </routers>
251
+ </admin>
252
+
253
+ <default>
254
+ <payment>
255
+ <paypaluk_express>
256
+ <allow_ba_signup>never</allow_ba_signup>
257
+ </paypaluk_express>
258
+
259
+ <paypaluk_billing_agreement>
260
+ <active>0</active>
261
+ <allow_billing_agreement_wizard>1</allow_billing_agreement_wizard>
262
+ <model>cls_paypal/paypaluk_method_agreement</model>
263
+ <title>PayPal Billing Agreement</title>
264
+ <group>paypal</group>
265
+ <verify_peer>1</verify_peer>
266
+ </paypaluk_billing_agreement>
267
+
268
+ <paypal_orderstored_agreement>
269
+ <active>0</active>
270
+ <allow_billing_agreement_wizard>0</allow_billing_agreement_wizard>
271
+ <model>cls_paypal/paypal_method_orderstored_agreement</model>
272
+ <title>Billing Agreement Used on Previous Order</title>
273
+ <group>paypal</group>
274
+ <verify_peer>1</verify_peer>
275
+ </paypal_orderstored_agreement>
276
+
277
+ <paypaluk_orderstored_agreement>
278
+ <active>0</active>
279
+ <allow_billing_agreement_wizard>0</allow_billing_agreement_wizard>
280
+ <model>cls_paypal/paypaluk_method_orderstored_agreement</model>
281
+ <title>Billing Agreement Used on Previous Order</title>
282
+ <group>paypal</group>
283
+ <verify_peer>1</verify_peer>
284
+ </paypaluk_orderstored_agreement>
285
+
286
+ <payflow_advanced_customerstored>
287
+ <model>cls_paypal/paypal_stored_customerstored_payflowadvanced</model>
288
+ <active>0</active>
289
+ <title>Saved Credit Card</title>
290
+ <payment_action>Authorization</payment_action>
291
+ <allowspecific>0</allowspecific>
292
+ <group>paypal</group>
293
+ <verify_peer>1</verify_peer>
294
+ </payflow_advanced_customerstored>
295
+
296
+ <verisign_customerstored>
297
+ <model>cls_paypal/paypal_stored_customerstored_payflowpro</model>
298
+ <active>0</active>
299
+ <title>Saved Credit Card</title>
300
+ <payment_action>Authorization</payment_action>
301
+ <allowspecific>0</allowspecific>
302
+ <group>paypal</group>
303
+ <verify_peer>1</verify_peer>
304
+ </verisign_customerstored>
305
+
306
+ <paypal_direct_customerstored>
307
+ <model>cls_paypal/paypal_stored_customerstored_direct</model>
308
+ <active>0</active>
309
+ <title>Saved Credit Card</title>
310
+ <payment_action>Authorization</payment_action>
311
+ <allowspecific>0</allowspecific>
312
+ <group>paypal</group>
313
+ <verify_peer>1</verify_peer>
314
+ </paypal_direct_customerstored>
315
+
316
+ <payflow_link_customerstored>
317
+ <model>cls_paypal/paypal_stored_customerstored_payflowlink</model>
318
+ <active>0</active>
319
+ <title>Saved Credit Card</title>
320
+ <payment_action>Authorization</payment_action>
321
+ <allowspecific>0</allowspecific>
322
+ <group>paypal</group>
323
+ <verify_peer>1</verify_peer>
324
+ </payflow_link_customerstored>
325
+
326
+ <payflow_advanced_orderstored>
327
+ <model>cls_paypal/paypal_stored_orderstored_payflowadvanced</model>
328
+ <active>0</active>
329
+ <title>Credit Card Used on Previous Order</title>
330
+ <payment_action>Authorization</payment_action>
331
+ <allowspecific>0</allowspecific>
332
+ <group>paypal</group>
333
+ <verify_peer>1</verify_peer>
334
+ </payflow_advanced_orderstored>
335
+
336
+ <verisign_orderstored>
337
+ <model>cls_paypal/paypal_stored_orderstored_payflowpro</model>
338
+ <active>0</active>
339
+ <title>Credit Card Used on Previous Order</title>
340
+ <payment_action>Authorization</payment_action>
341
+ <allowspecific>0</allowspecific>
342
+ <group>paypal</group>
343
+ <verify_peer>1</verify_peer>
344
+ </verisign_orderstored>
345
+
346
+ <paypal_direct_orderstored>
347
+ <model>cls_paypal/paypal_stored_orderstored_direct</model>
348
+ <active>0</active>
349
+ <title>Credit Card Used on Previous Order</title>
350
+ <payment_action>Authorization</payment_action>
351
+ <allowspecific>0</allowspecific>
352
+ <group>paypal</group>
353
+ <verify_peer>1</verify_peer>
354
+ </paypal_direct_orderstored>
355
+
356
+ <payflow_link_orderstored>
357
+ <model>cls_paypal/paypal_stored_orderstored_payflowlink</model>
358
+ <active>0</active>
359
+ <title>Credit Card Used on Previous Order</title>
360
+ <payment_action>Authorization</payment_action>
361
+ <allowspecific>0</allowspecific>
362
+ <group>paypal</group>
363
+ <verify_peer>1</verify_peer>
364
+ </payflow_link_orderstored>
365
+
366
+ </payment>
367
+ </default>
368
+ </config>
app/code/community/CLS/Paypal/etc/system.xml ADDED
@@ -0,0 +1,1289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Classy Llama
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 to us at
14
+ * support+paypal@classyllama.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module
19
+ * to newer versions in the future. If you require customizations of this
20
+ * module for your needs, please write us at sales@classyllama.com.
21
+ *
22
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
23
+ *
24
+ * @category CLS
25
+ * @package Paypal
26
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ */
29
+ -->
30
+ <config>
31
+ <sections>
32
+ <payment>
33
+ <groups>
34
+ <paypal_payments>
35
+ <payflow_advanced>
36
+ <fields>
37
+ <settings_payments_advanced type="group" translate="label">
38
+ <fields>
39
+ <settings_payments_advanced_advanced type="group" translate="label">
40
+ <fields>
41
+ <billing_agreement>
42
+ <fields>
43
+ <active>
44
+ <frontend_class>paypal-ba-enabler</frontend_class>
45
+ </active>
46
+ </fields>
47
+ </billing_agreement>
48
+ <payflow_advanced_customerstored type="group" translate="label">
49
+ <label>PayPal Saved Credit Card Settings</label>
50
+ <frontend_type>text</frontend_type>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <sort_order>73</sort_order>
55
+ <fields>
56
+ <active translate="label comment">
57
+ <label>Enabled</label>
58
+ <config_path>payment/payflow_advanced_customerstored/active</config_path>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <shared>1</shared>
65
+ </active>
66
+ <title translate="label">
67
+ <label>Title</label>
68
+ <config_path>payment/payflow_advanced_customerstored/title</config_path>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>20</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <shared>1</shared>
75
+ </title>
76
+ <sort_order translate="label">
77
+ <label>Sort Order</label>
78
+ <config_path>payment/payflow_advanced_customerstored/sort_order</config_path>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>30</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <frontend_class>validate-number</frontend_class>
85
+ <shared>1</shared>
86
+ </sort_order>
87
+ <payment_action translate="label">
88
+ <label>Payment Action</label>
89
+ <config_path>payment/payflow_advanced_customerstored/payment_action</config_path>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>paypal/system_config_source_paymentActions</source_model>
92
+ <sort_order>40</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <shared>1</shared>
96
+ </payment_action>
97
+ <allowspecific translate="label">
98
+ <label>Payment Applicable From</label>
99
+ <config_path>payment/payflow_advanced_customerstored/allowspecific</config_path>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
102
+ <sort_order>50</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <shared>1</shared>
106
+ </allowspecific>
107
+ <specificcountry translate="label">
108
+ <label>Countries Payment Applicable From</label>
109
+ <config_path>payment/payflow_advanced_customerstored/specificcountry</config_path>
110
+ <frontend_type>multiselect</frontend_type>
111
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
112
+ <sort_order>60</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <depends><allowspecific>1</allowspecific></depends>
116
+ <shared>1</shared>
117
+ </specificcountry>
118
+ <debug translate="label">
119
+ <label>Debug Mode</label>
120
+ <config_path>payment/payflow_advanced_customerstored/debug</config_path>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>70</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <shared>1</shared>
127
+ </debug>
128
+ <verify_peer translate="label">
129
+ <label>Enable SSL verification</label>
130
+ <config_path>payment/payflow_advanced_customerstored/verify_peer</config_path>
131
+ <frontend_type>select</frontend_type>
132
+ <source_model>adminhtml/system_config_source_yesno</source_model>
133
+ <sort_order>75</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <shared>1</shared>
137
+ </verify_peer>
138
+ </fields>
139
+ </payflow_advanced_customerstored>
140
+ <payflow_advanced_orderstored type="group" translate="label">
141
+ <label>PayPal Previous Order Credit Card Settings</label>
142
+ <frontend_type>text</frontend_type>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ <sort_order>76</sort_order>
147
+ <fields>
148
+ <active translate="label comment">
149
+ <label>Enabled</label>
150
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same card that was used on the specific previous order selected.]]></comment>
151
+ <config_path>payment/payflow_advanced_orderstored/active</config_path>
152
+ <frontend_type>select</frontend_type>
153
+ <source_model>adminhtml/system_config_source_yesno</source_model>
154
+ <sort_order>10</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <shared>1</shared>
158
+ </active>
159
+ <title translate="label">
160
+ <label>Title</label>
161
+ <config_path>payment/payflow_advanced_orderstored/title</config_path>
162
+ <frontend_type>text</frontend_type>
163
+ <sort_order>20</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ <shared>1</shared>
168
+ </title>
169
+ <sort_order translate="label">
170
+ <label>Sort Order</label>
171
+ <config_path>payment/payflow_advanced_orderstored/sort_order</config_path>
172
+ <frontend_type>text</frontend_type>
173
+ <sort_order>30</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ <frontend_class>validate-number</frontend_class>
178
+ <shared>1</shared>
179
+ </sort_order>
180
+ <payment_action translate="label">
181
+ <label>Payment Action</label>
182
+ <config_path>payment/payflow_advanced_orderstored/payment_action</config_path>
183
+ <frontend_type>select</frontend_type>
184
+ <source_model>paypal/system_config_source_paymentActions</source_model>
185
+ <sort_order>40</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <shared>1</shared>
189
+ </payment_action>
190
+ <allowspecific translate="label">
191
+ <label>Payment Applicable From</label>
192
+ <config_path>payment/payflow_advanced_orderstored/allowspecific</config_path>
193
+ <frontend_type>select</frontend_type>
194
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
195
+ <sort_order>50</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <shared>1</shared>
199
+ </allowspecific>
200
+ <specificcountry translate="label">
201
+ <label>Countries Payment Applicable From</label>
202
+ <config_path>payment/payflow_advanced_orderstored/specificcountry</config_path>
203
+ <frontend_type>multiselect</frontend_type>
204
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
205
+ <sort_order>60</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <depends><allowspecific>1</allowspecific></depends>
209
+ <shared>1</shared>
210
+ </specificcountry>
211
+ <debug translate="label">
212
+ <label>Debug Mode</label>
213
+ <config_path>payment/payflow_advanced_orderstored/debug</config_path>
214
+ <frontend_type>select</frontend_type>
215
+ <source_model>adminhtml/system_config_source_yesno</source_model>
216
+ <sort_order>70</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <shared>1</shared>
220
+ </debug>
221
+ <verify_peer translate="label">
222
+ <label>Enable SSL verification</label>
223
+ <config_path>payment/payflow_advanced_orderstored/verify_peer</config_path>
224
+ <frontend_type>select</frontend_type>
225
+ <source_model>adminhtml/system_config_source_yesno</source_model>
226
+ <sort_order>75</sort_order>
227
+ <show_in_default>1</show_in_default>
228
+ <show_in_website>1</show_in_website>
229
+ <shared>1</shared>
230
+ </verify_peer>
231
+ </fields>
232
+ </payflow_advanced_orderstored>
233
+ <paypal_orderstored_billing_agreement type="group" translate="label">
234
+ <label>PayPal Previous Order Billing Agreement Settings</label>
235
+ <frontend_type>text</frontend_type>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ <sort_order>85</sort_order>
240
+ <fields>
241
+ <active translate="label comment">
242
+ <label>Enabled</label>
243
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same billing agreement that was used on the specific previous order selected.]]></comment>
244
+ <config_path>payment/paypal_orderstored_agreement/active</config_path>
245
+ <frontend_type>select</frontend_type>
246
+ <frontend_class>paypal-orderstored-ba-enabler</frontend_class>
247
+ <source_model>adminhtml/system_config_source_yesno</source_model>
248
+ <sort_order>10</sort_order>
249
+ <show_in_default>1</show_in_default>
250
+ <show_in_website>1</show_in_website>
251
+ <shared>1</shared>
252
+ </active>
253
+ <title translate="label">
254
+ <label>Title</label>
255
+ <config_path>payment/paypal_orderstored_agreement/title</config_path>
256
+ <frontend_type>text</frontend_type>
257
+ <sort_order>20</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>1</show_in_store>
261
+ <shared>1</shared>
262
+ </title>
263
+ <sort_order translate="label">
264
+ <label>Sort Order</label>
265
+ <config_path>payment/paypal_orderstored_agreement/sort_order</config_path>
266
+ <frontend_type>text</frontend_type>
267
+ <sort_order>30</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ <frontend_class>validate-number</frontend_class>
272
+ <shared>1</shared>
273
+ </sort_order>
274
+ <payment_action translate="label">
275
+ <label>Payment Action</label>
276
+ <config_path>payment/paypal_orderstored_agreement/payment_action</config_path>
277
+ <frontend_type>select</frontend_type>
278
+ <source_model>paypal/system_config_source_paymentActions</source_model>
279
+ <sort_order>40</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <shared>1</shared>
283
+ </payment_action>
284
+ <allowspecific translate="label">
285
+ <label>Payment Applicable From</label>
286
+ <config_path>payment/paypal_orderstored_agreement/allowspecific</config_path>
287
+ <frontend_type>select</frontend_type>
288
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
289
+ <sort_order>50</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <shared>1</shared>
293
+ </allowspecific>
294
+ <specificcountry translate="label">
295
+ <label>Countries Payment Applicable From</label>
296
+ <config_path>payment/paypal_orderstored_agreement/specificcountry</config_path>
297
+ <frontend_type>multiselect</frontend_type>
298
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
299
+ <sort_order>60</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ <depends><allowspecific>1</allowspecific></depends>
303
+ <shared>1</shared>
304
+ </specificcountry>
305
+ <debug translate="label">
306
+ <label>Debug Mode</label>
307
+ <config_path>payment/paypal_orderstored_agreement/debug</config_path>
308
+ <frontend_type>select</frontend_type>
309
+ <source_model>adminhtml/system_config_source_yesno</source_model>
310
+ <sort_order>70</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <shared>1</shared>
314
+ </debug>
315
+ <verify_peer translate="label">
316
+ <label>Enable SSL verification</label>
317
+ <config_path>payment/paypal_orderstored_agreement/verify_peer</config_path>
318
+ <frontend_type>select</frontend_type>
319
+ <source_model>adminhtml/system_config_source_yesno</source_model>
320
+ <sort_order>75</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <shared>1</shared>
324
+ </verify_peer>
325
+ <line_items_enabled translate="label">
326
+ <label>Transfer Cart Line Items</label>
327
+ <config_path>payment/paypal_orderstored_agreement/line_items_enabled</config_path>
328
+ <frontend_type>select</frontend_type>
329
+ <source_model>adminhtml/system_config_source_yesno</source_model>
330
+ <sort_order>80</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <shared>1</shared>
334
+ </line_items_enabled>
335
+ <allow_billing_agreement_wizard translate="label">
336
+ <label>Allow in Billing Agreement Wizard</label>
337
+ <config_path>payment/paypal_orderstored_agreement/allow_billing_agreement_wizard</config_path>
338
+ <frontend_type>select</frontend_type>
339
+ <source_model>adminhtml/system_config_source_yesno</source_model>
340
+ <sort_order>90</sort_order>
341
+ <show_in_default>0</show_in_default>
342
+ <show_in_website>0</show_in_website>
343
+ <shared>1</shared>
344
+ </allow_billing_agreement_wizard>
345
+ </fields>
346
+ </paypal_orderstored_billing_agreement>
347
+ </fields>
348
+ </settings_payments_advanced_advanced>
349
+ </fields>
350
+ </settings_payments_advanced>
351
+ </fields>
352
+ </payflow_advanced>
353
+ <wpp>
354
+ <fields>
355
+ <wpp_settings>
356
+ <fields>
357
+ <wpp_settings_advanced>
358
+ <fields>
359
+ <paypal_direct_customerstored type="group" translate="label">
360
+ <label>PayPal Saved Credit Card Settings</label>
361
+ <frontend_type>text</frontend_type>
362
+ <show_in_default>1</show_in_default>
363
+ <show_in_website>1</show_in_website>
364
+ <sort_order>73</sort_order>
365
+ <fields>
366
+ <active translate="label comment">
367
+ <label>Enabled</label>
368
+ <config_path>payment/paypal_direct_customerstored/active</config_path>
369
+ <frontend_type>select</frontend_type>
370
+ <source_model>adminhtml/system_config_source_yesno</source_model>
371
+ <sort_order>10</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>1</show_in_website>
374
+ <shared>1</shared>
375
+ </active>
376
+ <title translate="label">
377
+ <label>Title</label>
378
+ <config_path>payment/paypal_direct_customerstored/title</config_path>
379
+ <frontend_type>text</frontend_type>
380
+ <sort_order>20</sort_order>
381
+ <show_in_default>1</show_in_default>
382
+ <show_in_website>1</show_in_website>
383
+ <show_in_store>1</show_in_store>
384
+ <shared>1</shared>
385
+ </title>
386
+ <sort_order translate="label">
387
+ <label>Sort Order</label>
388
+ <config_path>payment/paypal_direct_customerstored/sort_order</config_path>
389
+ <frontend_type>text</frontend_type>
390
+ <sort_order>30</sort_order>
391
+ <show_in_default>1</show_in_default>
392
+ <show_in_website>1</show_in_website>
393
+ <show_in_store>1</show_in_store>
394
+ <frontend_class>validate-number</frontend_class>
395
+ <shared>1</shared>
396
+ </sort_order>
397
+ <payment_action translate="label">
398
+ <label>Payment Action</label>
399
+ <config_path>payment/paypal_direct_customerstored/payment_action</config_path>
400
+ <frontend_type>select</frontend_type>
401
+ <source_model>paypal/system_config_source_paymentActions</source_model>
402
+ <sort_order>40</sort_order>
403
+ <show_in_default>1</show_in_default>
404
+ <show_in_website>1</show_in_website>
405
+ <shared>1</shared>
406
+ </payment_action>
407
+ <allowspecific translate="label">
408
+ <label>Payment Applicable From</label>
409
+ <config_path>payment/paypal_direct_customerstored/allowspecific</config_path>
410
+ <frontend_type>select</frontend_type>
411
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
412
+ <sort_order>50</sort_order>
413
+ <show_in_default>1</show_in_default>
414
+ <show_in_website>1</show_in_website>
415
+ <shared>1</shared>
416
+ </allowspecific>
417
+ <specificcountry translate="label">
418
+ <label>Countries Payment Applicable From</label>
419
+ <config_path>payment/paypal_direct_customerstored/specificcountry</config_path>
420
+ <frontend_type>multiselect</frontend_type>
421
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
422
+ <sort_order>60</sort_order>
423
+ <show_in_default>1</show_in_default>
424
+ <show_in_website>1</show_in_website>
425
+ <depends><allowspecific>1</allowspecific></depends>
426
+ <shared>1</shared>
427
+ </specificcountry>
428
+ <debug translate="label">
429
+ <label>Debug Mode</label>
430
+ <config_path>payment/paypal_direct_customerstored/debug</config_path>
431
+ <frontend_type>select</frontend_type>
432
+ <source_model>adminhtml/system_config_source_yesno</source_model>
433
+ <sort_order>70</sort_order>
434
+ <show_in_default>1</show_in_default>
435
+ <show_in_website>1</show_in_website>
436
+ <shared>1</shared>
437
+ </debug>
438
+ <verify_peer translate="label">
439
+ <label>Enable SSL verification</label>
440
+ <config_path>payment/paypal_direct_customerstored/verify_peer</config_path>
441
+ <frontend_type>select</frontend_type>
442
+ <source_model>adminhtml/system_config_source_yesno</source_model>
443
+ <sort_order>75</sort_order>
444
+ <show_in_default>1</show_in_default>
445
+ <show_in_website>1</show_in_website>
446
+ <shared>1</shared>
447
+ </verify_peer>
448
+ <line_items_enabled translate="label">
449
+ <label>Transfer Cart Line Items</label>
450
+ <config_path>payment/paypal_direct_customerstored/line_items_enabled</config_path>
451
+ <frontend_type>select</frontend_type>
452
+ <source_model>adminhtml/system_config_source_yesno</source_model>
453
+ <sort_order>80</sort_order>
454
+ <show_in_default>1</show_in_default>
455
+ <show_in_website>1</show_in_website>
456
+ <shared>1</shared>
457
+ </line_items_enabled>
458
+ </fields>
459
+ </paypal_direct_customerstored>
460
+ <paypal_direct_orderstored type="group" translate="label">
461
+ <label>PayPal Previous Order Credit Card Settings</label>
462
+ <frontend_type>text</frontend_type>
463
+ <show_in_default>1</show_in_default>
464
+ <show_in_website>1</show_in_website>
465
+ <sort_order>76</sort_order>
466
+ <fields>
467
+ <active translate="label comment">
468
+ <label>Enabled</label>
469
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same card that was used on the specific previous order selected.]]></comment>
470
+ <config_path>payment/paypal_direct_orderstored/active</config_path>
471
+ <frontend_type>select</frontend_type>
472
+ <source_model>adminhtml/system_config_source_yesno</source_model>
473
+ <sort_order>10</sort_order>
474
+ <show_in_default>1</show_in_default>
475
+ <show_in_website>1</show_in_website>
476
+ <shared>1</shared>
477
+ </active>
478
+ <title translate="label">
479
+ <label>Title</label>
480
+ <config_path>payment/paypal_direct_orderstored/title</config_path>
481
+ <frontend_type>text</frontend_type>
482
+ <sort_order>20</sort_order>
483
+ <show_in_default>1</show_in_default>
484
+ <show_in_website>1</show_in_website>
485
+ <show_in_store>1</show_in_store>
486
+ <shared>1</shared>
487
+ </title>
488
+ <sort_order translate="label">
489
+ <label>Sort Order</label>
490
+ <config_path>payment/paypal_direct_orderstored/sort_order</config_path>
491
+ <frontend_type>text</frontend_type>
492
+ <sort_order>30</sort_order>
493
+ <show_in_default>1</show_in_default>
494
+ <show_in_website>1</show_in_website>
495
+ <show_in_store>1</show_in_store>
496
+ <frontend_class>validate-number</frontend_class>
497
+ <shared>1</shared>
498
+ </sort_order>
499
+ <payment_action translate="label">
500
+ <label>Payment Action</label>
501
+ <config_path>payment/paypal_direct_orderstored/payment_action</config_path>
502
+ <frontend_type>select</frontend_type>
503
+ <source_model>paypal/system_config_source_paymentActions</source_model>
504
+ <sort_order>40</sort_order>
505
+ <show_in_default>1</show_in_default>
506
+ <show_in_website>1</show_in_website>
507
+ <shared>1</shared>
508
+ </payment_action>
509
+ <allowspecific translate="label">
510
+ <label>Payment Applicable From</label>
511
+ <config_path>payment/paypal_direct_orderstored/allowspecific</config_path>
512
+ <frontend_type>select</frontend_type>
513
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
514
+ <sort_order>50</sort_order>
515
+ <show_in_default>1</show_in_default>
516
+ <show_in_website>1</show_in_website>
517
+ <shared>1</shared>
518
+ </allowspecific>
519
+ <specificcountry translate="label">
520
+ <label>Countries Payment Applicable From</label>
521
+ <config_path>payment/paypal_direct_orderstored/specificcountry</config_path>
522
+ <frontend_type>multiselect</frontend_type>
523
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
524
+ <sort_order>60</sort_order>
525
+ <show_in_default>1</show_in_default>
526
+ <show_in_website>1</show_in_website>
527
+ <depends><allowspecific>1</allowspecific></depends>
528
+ <shared>1</shared>
529
+ </specificcountry>
530
+ <debug translate="label">
531
+ <label>Debug Mode</label>
532
+ <config_path>payment/paypal_direct_orderstored/debug</config_path>
533
+ <frontend_type>select</frontend_type>
534
+ <source_model>adminhtml/system_config_source_yesno</source_model>
535
+ <sort_order>70</sort_order>
536
+ <show_in_default>1</show_in_default>
537
+ <show_in_website>1</show_in_website>
538
+ <shared>1</shared>
539
+ </debug>
540
+ <verify_peer translate="label">
541
+ <label>Enable SSL verification</label>
542
+ <config_path>payment/paypal_direct_orderstored/verify_peer</config_path>
543
+ <frontend_type>select</frontend_type>
544
+ <source_model>adminhtml/system_config_source_yesno</source_model>
545
+ <sort_order>75</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <shared>1</shared>
549
+ </verify_peer>
550
+ <line_items_enabled translate="label">
551
+ <label>Transfer Cart Line Items</label>
552
+ <config_path>payment/paypal_direct_orderstored/line_items_enabled</config_path>
553
+ <frontend_type>select</frontend_type>
554
+ <source_model>adminhtml/system_config_source_yesno</source_model>
555
+ <sort_order>80</sort_order>
556
+ <show_in_default>1</show_in_default>
557
+ <show_in_website>1</show_in_website>
558
+ <shared>1</shared>
559
+ </line_items_enabled>
560
+ </fields>
561
+ </paypal_direct_orderstored>
562
+ <wpp_orderstored_billing_agreement type="group" translate="label">
563
+ <label>PayPal Previous Order Billing Agreement Settings</label>
564
+ <frontend_type>text</frontend_type>
565
+ <show_in_default>1</show_in_default>
566
+ <show_in_website>1</show_in_website>
567
+ <sort_order>85</sort_order>
568
+ <fields>
569
+ <active extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/active" />
570
+ <title extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/title" />
571
+ <sort_order extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/sort_order" />
572
+ <payment_action extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/payment_action" />
573
+ <allowspecific extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allowspecific" />
574
+ <specificcountry extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/specificcountry" />
575
+ <debug extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/debug" />
576
+ <verify_peer extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/verify_peer" />
577
+ <line_items_enabled extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/line_items_enabled" />
578
+ <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allow_billing_agreement_wizard" />
579
+ </fields>
580
+ </wpp_orderstored_billing_agreement>
581
+ </fields>
582
+ </wpp_settings_advanced>
583
+ </fields>
584
+ </wpp_settings>
585
+ </fields>
586
+ </wpp>
587
+ <paypal_verisign_with_express_checkout>
588
+ <fields>
589
+ <settings_paypal_payflow>
590
+ <fields>
591
+ <settings_paypal_payflow_advanced>
592
+ <fields>
593
+ <verisign_customerstored type="group" translate="label">
594
+ <label>PayPal Saved Credit Card Settings</label>
595
+ <frontend_type>text</frontend_type>
596
+ <show_in_default>1</show_in_default>
597
+ <show_in_website>1</show_in_website>
598
+ <sort_order>73</sort_order>
599
+ <fields>
600
+ <active translate="label comment">
601
+ <label>Enabled</label>
602
+ <config_path>payment/verisign_customerstored/active</config_path>
603
+ <frontend_type>select</frontend_type>
604
+ <source_model>adminhtml/system_config_source_yesno</source_model>
605
+ <sort_order>10</sort_order>
606
+ <show_in_default>1</show_in_default>
607
+ <show_in_website>1</show_in_website>
608
+ <shared>1</shared>
609
+ </active>
610
+ <title translate="label">
611
+ <label>Title</label>
612
+ <config_path>payment/verisign_customerstored/title</config_path>
613
+ <frontend_type>text</frontend_type>
614
+ <sort_order>20</sort_order>
615
+ <show_in_default>1</show_in_default>
616
+ <show_in_website>1</show_in_website>
617
+ <show_in_store>1</show_in_store>
618
+ <shared>1</shared>
619
+ </title>
620
+ <sort_order translate="label">
621
+ <label>Sort Order</label>
622
+ <config_path>payment/verisign_customerstored/sort_order</config_path>
623
+ <frontend_type>text</frontend_type>
624
+ <sort_order>30</sort_order>
625
+ <show_in_default>1</show_in_default>
626
+ <show_in_website>1</show_in_website>
627
+ <show_in_store>1</show_in_store>
628
+ <frontend_class>validate-number</frontend_class>
629
+ <shared>1</shared>
630
+ </sort_order>
631
+ <payment_action translate="label">
632
+ <label>Payment Action</label>
633
+ <config_path>payment/verisign_customerstored/payment_action</config_path>
634
+ <frontend_type>select</frontend_type>
635
+ <source_model>paypal/system_config_source_paymentActions</source_model>
636
+ <sort_order>40</sort_order>
637
+ <show_in_default>1</show_in_default>
638
+ <show_in_website>1</show_in_website>
639
+ <shared>1</shared>
640
+ </payment_action>
641
+ <allowspecific translate="label">
642
+ <label>Payment Applicable From</label>
643
+ <config_path>payment/verisign_customerstored/allowspecific</config_path>
644
+ <frontend_type>select</frontend_type>
645
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
646
+ <sort_order>50</sort_order>
647
+ <show_in_default>1</show_in_default>
648
+ <show_in_website>1</show_in_website>
649
+ <shared>1</shared>
650
+ </allowspecific>
651
+ <specificcountry translate="label">
652
+ <label>Countries Payment Applicable From</label>
653
+ <config_path>payment/verisign_customerstored/specificcountry</config_path>
654
+ <frontend_type>multiselect</frontend_type>
655
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
656
+ <sort_order>60</sort_order>
657
+ <show_in_default>1</show_in_default>
658
+ <show_in_website>1</show_in_website>
659
+ <depends><allowspecific>1</allowspecific></depends>
660
+ <shared>1</shared>
661
+ </specificcountry>
662
+ <debug translate="label">
663
+ <label>Debug Mode</label>
664
+ <config_path>payment/verisign_customerstored/debug</config_path>
665
+ <frontend_type>select</frontend_type>
666
+ <source_model>adminhtml/system_config_source_yesno</source_model>
667
+ <sort_order>70</sort_order>
668
+ <show_in_default>1</show_in_default>
669
+ <show_in_website>1</show_in_website>
670
+ <shared>1</shared>
671
+ </debug>
672
+ <verify_peer translate="label">
673
+ <label>Enable SSL verification</label>
674
+ <config_path>payment/verisign_customerstored/verify_peer</config_path>
675
+ <frontend_type>select</frontend_type>
676
+ <source_model>adminhtml/system_config_source_yesno</source_model>
677
+ <sort_order>75</sort_order>
678
+ <show_in_default>1</show_in_default>
679
+ <show_in_website>1</show_in_website>
680
+ <shared>1</shared>
681
+ </verify_peer>
682
+ </fields>
683
+ </verisign_customerstored>
684
+ <verisign_orderstored type="group" translate="label">
685
+ <label>PayPal Previous Order Credit Card Settings</label>
686
+ <frontend_type>text</frontend_type>
687
+ <show_in_default>1</show_in_default>
688
+ <show_in_website>1</show_in_website>
689
+ <sort_order>76</sort_order>
690
+ <fields>
691
+ <active translate="label comment">
692
+ <label>Enabled</label>
693
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same card that was used on the specific previous order selected.]]></comment>
694
+ <config_path>payment/verisign_orderstored/active</config_path>
695
+ <frontend_type>select</frontend_type>
696
+ <source_model>adminhtml/system_config_source_yesno</source_model>
697
+ <sort_order>10</sort_order>
698
+ <show_in_default>1</show_in_default>
699
+ <show_in_website>1</show_in_website>
700
+ <shared>1</shared>
701
+ </active>
702
+ <title translate="label">
703
+ <label>Title</label>
704
+ <config_path>payment/verisign_orderstored/title</config_path>
705
+ <frontend_type>text</frontend_type>
706
+ <sort_order>20</sort_order>
707
+ <show_in_default>1</show_in_default>
708
+ <show_in_website>1</show_in_website>
709
+ <show_in_store>1</show_in_store>
710
+ <shared>1</shared>
711
+ </title>
712
+ <sort_order translate="label">
713
+ <label>Sort Order</label>
714
+ <config_path>payment/verisign_orderstored/sort_order</config_path>
715
+ <frontend_type>text</frontend_type>
716
+ <sort_order>30</sort_order>
717
+ <show_in_default>1</show_in_default>
718
+ <show_in_website>1</show_in_website>
719
+ <show_in_store>1</show_in_store>
720
+ <frontend_class>validate-number</frontend_class>
721
+ <shared>1</shared>
722
+ </sort_order>
723
+ <payment_action translate="label">
724
+ <label>Payment Action</label>
725
+ <config_path>payment/verisign_orderstored/payment_action</config_path>
726
+ <frontend_type>select</frontend_type>
727
+ <source_model>paypal/system_config_source_paymentActions</source_model>
728
+ <sort_order>40</sort_order>
729
+ <show_in_default>1</show_in_default>
730
+ <show_in_website>1</show_in_website>
731
+ <shared>1</shared>
732
+ </payment_action>
733
+ <allowspecific translate="label">
734
+ <label>Payment Applicable From</label>
735
+ <config_path>payment/verisign_orderstored/allowspecific</config_path>
736
+ <frontend_type>select</frontend_type>
737
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
738
+ <sort_order>50</sort_order>
739
+ <show_in_default>1</show_in_default>
740
+ <show_in_website>1</show_in_website>
741
+ <shared>1</shared>
742
+ </allowspecific>
743
+ <specificcountry translate="label">
744
+ <label>Countries Payment Applicable From</label>
745
+ <config_path>payment/verisign_orderstored/specificcountry</config_path>
746
+ <frontend_type>multiselect</frontend_type>
747
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
748
+ <sort_order>60</sort_order>
749
+ <show_in_default>1</show_in_default>
750
+ <show_in_website>1</show_in_website>
751
+ <depends><allowspecific>1</allowspecific></depends>
752
+ <shared>1</shared>
753
+ </specificcountry>
754
+ <debug translate="label">
755
+ <label>Debug Mode</label>
756
+ <config_path>payment/verisign_orderstored/debug</config_path>
757
+ <frontend_type>select</frontend_type>
758
+ <source_model>adminhtml/system_config_source_yesno</source_model>
759
+ <sort_order>70</sort_order>
760
+ <show_in_default>1</show_in_default>
761
+ <show_in_website>1</show_in_website>
762
+ <shared>1</shared>
763
+ </debug>
764
+ <verify_peer translate="label">
765
+ <label>Enable SSL verification</label>
766
+ <config_path>payment/verisign_orderstored/verify_peer</config_path>
767
+ <frontend_type>select</frontend_type>
768
+ <source_model>adminhtml/system_config_source_yesno</source_model>
769
+ <sort_order>75</sort_order>
770
+ <show_in_default>1</show_in_default>
771
+ <show_in_website>1</show_in_website>
772
+ <shared>1</shared>
773
+ </verify_peer>
774
+ </fields>
775
+ </verisign_orderstored>
776
+ <paypal_payflow_billing_agreement type="group" translate="label">
777
+ <label>PayPal Billing Agreement Settings</label>
778
+ <frontend_type>text</frontend_type>
779
+ <show_in_default>1</show_in_default>
780
+ <show_in_website>1</show_in_website>
781
+ <show_in_store>1</show_in_store>
782
+ <sort_order>80</sort_order>
783
+ <fields>
784
+ <active translate="label comment">
785
+ <label>Enabled</label>
786
+ <comment><![CDATA[Will appear as a payment option only for customers who have at least one active billing agreement.]]></comment>
787
+ <config_path>payment/paypaluk_billing_agreement/active</config_path>
788
+ <frontend_type>select</frontend_type>
789
+ <frontend_class>paypal-ba-payflow-enabler</frontend_class>
790
+ <source_model>adminhtml/system_config_source_yesno</source_model>
791
+ <sort_order>10</sort_order>
792
+ <show_in_default>1</show_in_default>
793
+ <show_in_website>1</show_in_website>
794
+ <shared>1</shared>
795
+ </active>
796
+ <title translate="label">
797
+ <label>Title</label>
798
+ <config_path>payment/paypaluk_billing_agreement/title</config_path>
799
+ <frontend_type>text</frontend_type>
800
+ <sort_order>20</sort_order>
801
+ <show_in_default>1</show_in_default>
802
+ <show_in_website>1</show_in_website>
803
+ <show_in_store>1</show_in_store>
804
+ <shared>1</shared>
805
+ </title>
806
+ <sort_order translate="label">
807
+ <label>Sort Order</label>
808
+ <config_path>payment/paypaluk_billing_agreement/sort_order</config_path>
809
+ <frontend_type>text</frontend_type>
810
+ <sort_order>30</sort_order>
811
+ <show_in_default>1</show_in_default>
812
+ <show_in_website>1</show_in_website>
813
+ <show_in_store>1</show_in_store>
814
+ <frontend_class>validate-number</frontend_class>
815
+ <shared>1</shared>
816
+ </sort_order>
817
+ <payment_action translate="label">
818
+ <label>Payment Action</label>
819
+ <config_path>payment/paypaluk_billing_agreement/payment_action</config_path>
820
+ <frontend_type>select</frontend_type>
821
+ <source_model>paypal/system_config_source_paymentActions</source_model>
822
+ <sort_order>40</sort_order>
823
+ <show_in_default>1</show_in_default>
824
+ <show_in_website>1</show_in_website>
825
+ <shared>1</shared>
826
+ </payment_action>
827
+ <allowspecific translate="label">
828
+ <label>Payment Applicable From</label>
829
+ <config_path>payment/paypaluk_billing_agreement/allowspecific</config_path>
830
+ <frontend_type>select</frontend_type>
831
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
832
+ <sort_order>50</sort_order>
833
+ <show_in_default>1</show_in_default>
834
+ <show_in_website>1</show_in_website>
835
+ <shared>1</shared>
836
+ </allowspecific>
837
+ <specificcountry translate="label">
838
+ <label>Countries Payment Applicable From</label>
839
+ <config_path>payment/paypaluk_billing_agreement/specificcountry</config_path>
840
+ <frontend_type>multiselect</frontend_type>
841
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
842
+ <sort_order>60</sort_order>
843
+ <show_in_default>1</show_in_default>
844
+ <show_in_website>1</show_in_website>
845
+ <depends><allowspecific>1</allowspecific></depends>
846
+ <shared>1</shared>
847
+ </specificcountry>
848
+ <debug translate="label">
849
+ <label>Debug Mode</label>
850
+ <config_path>payment/paypaluk_billing_agreement/debug</config_path>
851
+ <frontend_type>select</frontend_type>
852
+ <source_model>adminhtml/system_config_source_yesno</source_model>
853
+ <sort_order>70</sort_order>
854
+ <show_in_default>1</show_in_default>
855
+ <show_in_website>1</show_in_website>
856
+ <shared>1</shared>
857
+ </debug>
858
+ <verify_peer translate="label">
859
+ <label>Enable SSL verification</label>
860
+ <config_path>payment/paypaluk_billing_agreement/verify_peer</config_path>
861
+ <frontend_type>select</frontend_type>
862
+ <source_model>adminhtml/system_config_source_yesno</source_model>
863
+ <sort_order>75</sort_order>
864
+ <show_in_default>1</show_in_default>
865
+ <show_in_website>1</show_in_website>
866
+ <shared>1</shared>
867
+ </verify_peer>
868
+ <line_items_enabled translate="label">
869
+ <label>Transfer Cart Line Items</label>
870
+ <config_path>payment/paypaluk_billing_agreement/line_items_enabled</config_path>
871
+ <frontend_type>select</frontend_type>
872
+ <source_model>adminhtml/system_config_source_yesno</source_model>
873
+ <sort_order>80</sort_order>
874
+ <show_in_default>1</show_in_default>
875
+ <show_in_website>1</show_in_website>
876
+ <shared>1</shared>
877
+ </line_items_enabled>
878
+ <allow_billing_agreement_wizard translate="label">
879
+ <label>Allow in Billing Agreement Wizard</label>
880
+ <config_path>payment/paypaluk_billing_agreement/allow_billing_agreement_wizard</config_path>
881
+ <frontend_type>select</frontend_type>
882
+ <source_model>adminhtml/system_config_source_yesno</source_model>
883
+ <sort_order>90</sort_order>
884
+ <show_in_default>1</show_in_default>
885
+ <show_in_website>1</show_in_website>
886
+ <shared>1</shared>
887
+ </allow_billing_agreement_wizard>
888
+ </fields>
889
+ </paypal_payflow_billing_agreement>
890
+ <paypal_payflow_orderstored_billing_agreement type="group" translate="label">
891
+ <label>PayPal Previous Order Billing Agreement Settings</label>
892
+ <frontend_type>text</frontend_type>
893
+ <show_in_default>1</show_in_default>
894
+ <show_in_website>1</show_in_website>
895
+ <show_in_store>1</show_in_store>
896
+ <sort_order>85</sort_order>
897
+ <fields>
898
+ <active translate="label comment">
899
+ <label>Enabled</label>
900
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same billing agreement that was used on the specific previous order selected.]]></comment>
901
+ <config_path>payment/paypaluk_orderstored_agreement/active</config_path>
902
+ <frontend_type>select</frontend_type>
903
+ <frontend_class>paypal-orderstored-ba-payflow-enabler</frontend_class>
904
+ <source_model>adminhtml/system_config_source_yesno</source_model>
905
+ <sort_order>10</sort_order>
906
+ <show_in_default>1</show_in_default>
907
+ <show_in_website>1</show_in_website>
908
+ <shared>1</shared>
909
+ </active>
910
+ <title translate="label">
911
+ <label>Title</label>
912
+ <config_path>payment/paypaluk_orderstored_agreement/title</config_path>
913
+ <frontend_type>text</frontend_type>
914
+ <sort_order>20</sort_order>
915
+ <show_in_default>1</show_in_default>
916
+ <show_in_website>1</show_in_website>
917
+ <show_in_store>1</show_in_store>
918
+ <shared>1</shared>
919
+ </title>
920
+ <sort_order translate="label">
921
+ <label>Sort Order</label>
922
+ <config_path>payment/paypaluk_orderstored_agreement/sort_order</config_path>
923
+ <frontend_type>text</frontend_type>
924
+ <sort_order>30</sort_order>
925
+ <show_in_default>1</show_in_default>
926
+ <show_in_website>1</show_in_website>
927
+ <show_in_store>1</show_in_store>
928
+ <frontend_class>validate-number</frontend_class>
929
+ <shared>1</shared>
930
+ </sort_order>
931
+ <payment_action translate="label">
932
+ <label>Payment Action</label>
933
+ <config_path>payment/paypaluk_orderstored_agreement/payment_action</config_path>
934
+ <frontend_type>select</frontend_type>
935
+ <source_model>paypal/system_config_source_paymentActions</source_model>
936
+ <sort_order>40</sort_order>
937
+ <show_in_default>1</show_in_default>
938
+ <show_in_website>1</show_in_website>
939
+ <shared>1</shared>
940
+ </payment_action>
941
+ <allowspecific translate="label">
942
+ <label>Payment Applicable From</label>
943
+ <config_path>payment/paypaluk_orderstored_agreement/allowspecific</config_path>
944
+ <frontend_type>select</frontend_type>
945
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
946
+ <sort_order>50</sort_order>
947
+ <show_in_default>1</show_in_default>
948
+ <show_in_website>1</show_in_website>
949
+ <shared>1</shared>
950
+ </allowspecific>
951
+ <specificcountry translate="label">
952
+ <label>Countries Payment Applicable From</label>
953
+ <config_path>payment/paypaluk_orderstored_agreement/specificcountry</config_path>
954
+ <frontend_type>multiselect</frontend_type>
955
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
956
+ <sort_order>60</sort_order>
957
+ <show_in_default>1</show_in_default>
958
+ <show_in_website>1</show_in_website>
959
+ <depends><allowspecific>1</allowspecific></depends>
960
+ <shared>1</shared>
961
+ </specificcountry>
962
+ <debug translate="label">
963
+ <label>Debug Mode</label>
964
+ <config_path>payment/paypaluk_orderstored_agreement/debug</config_path>
965
+ <frontend_type>select</frontend_type>
966
+ <source_model>adminhtml/system_config_source_yesno</source_model>
967
+ <sort_order>70</sort_order>
968
+ <show_in_default>1</show_in_default>
969
+ <show_in_website>1</show_in_website>
970
+ <shared>1</shared>
971
+ </debug>
972
+ <verify_peer translate="label">
973
+ <label>Enable SSL verification</label>
974
+ <config_path>payment/paypaluk_orderstored_agreement/verify_peer</config_path>
975
+ <frontend_type>select</frontend_type>
976
+ <source_model>adminhtml/system_config_source_yesno</source_model>
977
+ <sort_order>75</sort_order>
978
+ <show_in_default>1</show_in_default>
979
+ <show_in_website>1</show_in_website>
980
+ <shared>1</shared>
981
+ </verify_peer>
982
+ <line_items_enabled translate="label">
983
+ <label>Transfer Cart Line Items</label>
984
+ <config_path>payment/paypaluk_orderstored_agreement/line_items_enabled</config_path>
985
+ <frontend_type>select</frontend_type>
986
+ <source_model>adminhtml/system_config_source_yesno</source_model>
987
+ <sort_order>80</sort_order>
988
+ <show_in_default>1</show_in_default>
989
+ <show_in_website>1</show_in_website>
990
+ <shared>1</shared>
991
+ </line_items_enabled>
992
+ <allow_billing_agreement_wizard translate="label">
993
+ <label>Allow in Billing Agreement Wizard</label>
994
+ <config_path>payment/paypaluk_orderstored_agreement/allow_billing_agreement_wizard</config_path>
995
+ <frontend_type>select</frontend_type>
996
+ <source_model>adminhtml/system_config_source_yesno</source_model>
997
+ <sort_order>90</sort_order>
998
+ <show_in_default>0</show_in_default>
999
+ <show_in_website>0</show_in_website>
1000
+ <shared>1</shared>
1001
+ </allow_billing_agreement_wizard>
1002
+ </fields>
1003
+ </paypal_payflow_orderstored_billing_agreement>
1004
+ </fields>
1005
+ </settings_paypal_payflow_advanced>
1006
+ </fields>
1007
+ </settings_paypal_payflow>
1008
+ <paypal_payflow_express_checkout>
1009
+ <fields>
1010
+ <paypal_payflow_express_checkout_advanced>
1011
+ <fields>
1012
+ <allow_ba_signup translate="label comment tooltip">
1013
+ <label>Billing Agreement Signup</label>
1014
+ <comment>Whether to create a billing agreement, if there are no active billing agreements available.</comment>
1015
+ <tooltip><![CDATA[Merchants need to apply to PayPal for enabling billing agreements feature. Do not enable this option until PayPal confirms that billing agreements are enabled for your merchant account.]]></tooltip>
1016
+ <config_path>payment/paypaluk_express/allow_ba_signup</config_path>
1017
+ <frontend_type>select</frontend_type>
1018
+ <source_model>paypal/config::getExpressCheckoutBASignupOptions</source_model>
1019
+ <sort_order>50</sort_order>
1020
+ <show_in_default>1</show_in_default>
1021
+ <show_in_website>1</show_in_website>
1022
+ <shared>1</shared>
1023
+ </allow_ba_signup>
1024
+ </fields>
1025
+ </paypal_payflow_express_checkout_advanced>
1026
+ </fields>
1027
+ </paypal_payflow_express_checkout>
1028
+ </fields>
1029
+ </paypal_verisign_with_express_checkout>
1030
+ <payflow_link>
1031
+ <fields>
1032
+ <settings_payflow_link>
1033
+ <fields>
1034
+ <settings_payflow_link_advanced>
1035
+ <fields>
1036
+ <payflow_link_customerstored type="group" translate="label">
1037
+ <label>PayPal Saved Credit Card Settings</label>
1038
+ <frontend_type>text</frontend_type>
1039
+ <show_in_default>1</show_in_default>
1040
+ <show_in_website>1</show_in_website>
1041
+ <sort_order>73</sort_order>
1042
+ <fields>
1043
+ <active translate="label comment">
1044
+ <label>Enabled</label>
1045
+ <config_path>payment/payflow_link_customerstored/active</config_path>
1046
+ <frontend_type>select</frontend_type>
1047
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1048
+ <sort_order>10</sort_order>
1049
+ <show_in_default>1</show_in_default>
1050
+ <show_in_website>1</show_in_website>
1051
+ <shared>1</shared>
1052
+ </active>
1053
+ <title translate="label">
1054
+ <label>Title</label>
1055
+ <config_path>payment/payflow_link_customerstored/title</config_path>
1056
+ <frontend_type>text</frontend_type>
1057
+ <sort_order>20</sort_order>
1058
+ <show_in_default>1</show_in_default>
1059
+ <show_in_website>1</show_in_website>
1060
+ <show_in_store>1</show_in_store>
1061
+ <shared>1</shared>
1062
+ </title>
1063
+ <sort_order translate="label">
1064
+ <label>Sort Order</label>
1065
+ <config_path>payment/payflow_link_customerstored/sort_order</config_path>
1066
+ <frontend_type>text</frontend_type>
1067
+ <sort_order>30</sort_order>
1068
+ <show_in_default>1</show_in_default>
1069
+ <show_in_website>1</show_in_website>
1070
+ <show_in_store>1</show_in_store>
1071
+ <frontend_class>validate-number</frontend_class>
1072
+ <shared>1</shared>
1073
+ </sort_order>
1074
+ <payment_action translate="label">
1075
+ <label>Payment Action</label>
1076
+ <config_path>payment/payflow_link_customerstored/payment_action</config_path>
1077
+ <frontend_type>select</frontend_type>
1078
+ <source_model>paypal/system_config_source_paymentActions</source_model>
1079
+ <sort_order>40</sort_order>
1080
+ <show_in_default>1</show_in_default>
1081
+ <show_in_website>1</show_in_website>
1082
+ <shared>1</shared>
1083
+ </payment_action>
1084
+ <allowspecific translate="label">
1085
+ <label>Payment Applicable From</label>
1086
+ <config_path>payment/payflow_link_customerstored/allowspecific</config_path>
1087
+ <frontend_type>select</frontend_type>
1088
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1089
+ <sort_order>50</sort_order>
1090
+ <show_in_default>1</show_in_default>
1091
+ <show_in_website>1</show_in_website>
1092
+ <shared>1</shared>
1093
+ </allowspecific>
1094
+ <specificcountry translate="label">
1095
+ <label>Countries Payment Applicable From</label>
1096
+ <config_path>payment/payflow_link_customerstored/specificcountry</config_path>
1097
+ <frontend_type>multiselect</frontend_type>
1098
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
1099
+ <sort_order>60</sort_order>
1100
+ <show_in_default>1</show_in_default>
1101
+ <show_in_website>1</show_in_website>
1102
+ <depends><allowspecific>1</allowspecific></depends>
1103
+ <shared>1</shared>
1104
+ </specificcountry>
1105
+ <debug translate="label">
1106
+ <label>Debug Mode</label>
1107
+ <config_path>payment/payflow_link_customerstored/debug</config_path>
1108
+ <frontend_type>select</frontend_type>
1109
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1110
+ <sort_order>70</sort_order>
1111
+ <show_in_default>1</show_in_default>
1112
+ <show_in_website>1</show_in_website>
1113
+ <shared>1</shared>
1114
+ </debug>
1115
+ <verify_peer translate="label">
1116
+ <label>Enable SSL verification</label>
1117
+ <config_path>payment/payflow_link_customerstored/verify_peer</config_path>
1118
+ <frontend_type>select</frontend_type>
1119
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1120
+ <sort_order>75</sort_order>
1121
+ <show_in_default>1</show_in_default>
1122
+ <show_in_website>1</show_in_website>
1123
+ <shared>1</shared>
1124
+ </verify_peer>
1125
+ </fields>
1126
+ </payflow_link_customerstored>
1127
+ <payflow_link_orderstored type="group" translate="label comment">
1128
+ <label>PayPal Previous Order Credit Card Settings</label>
1129
+ <comment><![CDATA[Will appear as an admin-only payment option allowing use of the same card that was used on the specific previous order selected.]]></comment>
1130
+ <frontend_type>text</frontend_type>
1131
+ <show_in_default>1</show_in_default>
1132
+ <show_in_website>1</show_in_website>
1133
+ <sort_order>76</sort_order>
1134
+ <fields>
1135
+ <active translate="label comment">
1136
+ <label>Enabled</label>
1137
+ <config_path>payment/payflow_link_orderstored/active</config_path>
1138
+ <frontend_type>select</frontend_type>
1139
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1140
+ <sort_order>10</sort_order>
1141
+ <show_in_default>1</show_in_default>
1142
+ <show_in_website>1</show_in_website>
1143
+ <shared>1</shared>
1144
+ </active>
1145
+ <title translate="label">
1146
+ <label>Title</label>
1147
+ <config_path>payment/payflow_link_orderstored/title</config_path>
1148
+ <frontend_type>text</frontend_type>
1149
+ <sort_order>20</sort_order>
1150
+ <show_in_default>1</show_in_default>
1151
+ <show_in_website>1</show_in_website>
1152
+ <show_in_store>1</show_in_store>
1153
+ <shared>1</shared>
1154
+ </title>
1155
+ <sort_order translate="label">
1156
+ <label>Sort Order</label>
1157
+ <config_path>payment/payflow_link_orderstored/sort_order</config_path>
1158
+ <frontend_type>text</frontend_type>
1159
+ <sort_order>30</sort_order>
1160
+ <show_in_default>1</show_in_default>
1161
+ <show_in_website>1</show_in_website>
1162
+ <show_in_store>1</show_in_store>
1163
+ <frontend_class>validate-number</frontend_class>
1164
+ <shared>1</shared>
1165
+ </sort_order>
1166
+ <payment_action translate="label">
1167
+ <label>Payment Action</label>
1168
+ <config_path>payment/payflow_link_orderstored/payment_action</config_path>
1169
+ <frontend_type>select</frontend_type>
1170
+ <source_model>paypal/system_config_source_paymentActions</source_model>
1171
+ <sort_order>40</sort_order>
1172
+ <show_in_default>1</show_in_default>
1173
+ <show_in_website>1</show_in_website>
1174
+ <shared>1</shared>
1175
+ </payment_action>
1176
+ <allowspecific translate="label">
1177
+ <label>Payment Applicable From</label>
1178
+ <config_path>payment/payflow_link_orderstored/allowspecific</config_path>
1179
+ <frontend_type>select</frontend_type>
1180
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1181
+ <sort_order>50</sort_order>
1182
+ <show_in_default>1</show_in_default>
1183
+ <show_in_website>1</show_in_website>
1184
+ <shared>1</shared>
1185
+ </allowspecific>
1186
+ <specificcountry translate="label">
1187
+ <label>Countries Payment Applicable From</label>
1188
+ <config_path>payment/payflow_link_orderstored/specificcountry</config_path>
1189
+ <frontend_type>multiselect</frontend_type>
1190
+ <source_model>paypal/system_config_source_buyerCountry</source_model>
1191
+ <sort_order>60</sort_order>
1192
+ <show_in_default>1</show_in_default>
1193
+ <show_in_website>1</show_in_website>
1194
+ <depends><allowspecific>1</allowspecific></depends>
1195
+ <shared>1</shared>
1196
+ </specificcountry>
1197
+ <debug translate="label">
1198
+ <label>Debug Mode</label>
1199
+ <config_path>payment/payflow_link_orderstored/debug</config_path>
1200
+ <frontend_type>select</frontend_type>
1201
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1202
+ <sort_order>70</sort_order>
1203
+ <show_in_default>1</show_in_default>
1204
+ <show_in_website>1</show_in_website>
1205
+ <shared>1</shared>
1206
+ </debug>
1207
+ <verify_peer translate="label">
1208
+ <label>Enable SSL verification</label>
1209
+ <config_path>payment/payflow_link_orderstored/verify_peer</config_path>
1210
+ <frontend_type>select</frontend_type>
1211
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1212
+ <sort_order>75</sort_order>
1213
+ <show_in_default>1</show_in_default>
1214
+ <show_in_website>1</show_in_website>
1215
+ <shared>1</shared>
1216
+ </verify_peer>
1217
+ </fields>
1218
+ </payflow_link_orderstored>
1219
+ </fields>
1220
+ </settings_payflow_link_advanced>
1221
+ </fields>
1222
+ </settings_payflow_link>
1223
+ <settings_payflow_link_express_checkout>
1224
+ <fields>
1225
+ <settings_payflow_link_express_checkout_advanced>
1226
+ <fields>
1227
+ <payflow_link_orderstored_billing_agreement type="group" translate="label">
1228
+ <label>PayPal Previous Order Billing Agreement Settings</label>
1229
+ <frontend_type>text</frontend_type>
1230
+ <show_in_default>1</show_in_default>
1231
+ <show_in_website>1</show_in_website>
1232
+ <show_in_store>1</show_in_store>
1233
+ <sort_order>105</sort_order>
1234
+ <fields>
1235
+ <active extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/active" />
1236
+ <title extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/title" />
1237
+ <sort_order extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/sort_order" />
1238
+ <payment_action extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/payment_action" />
1239
+ <allowspecific extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allowspecific" />
1240
+ <specificcountry extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/specificcountry" />
1241
+ <debug extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/debug" />
1242
+ <verify_peer extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/verify_peer" />
1243
+ <line_items_enabled extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/line_items_enabled" />
1244
+ <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allow_billing_agreement_wizard" />
1245
+ </fields>
1246
+ </payflow_link_orderstored_billing_agreement>
1247
+ </fields>
1248
+ </settings_payflow_link_express_checkout_advanced>
1249
+ </fields>
1250
+ </settings_payflow_link_express_checkout>
1251
+ </fields>
1252
+ </payflow_link>
1253
+ <express_checkout>
1254
+ <fields>
1255
+ <settings_ec>
1256
+ <fields>
1257
+ <settings_ec_advanced>
1258
+ <fields>
1259
+ <express_checkout_orderstored_billing_agreement type="group" translate="label">
1260
+ <label>PayPal Previous Order Billing Agreement Settings</label>
1261
+ <frontend_type>text</frontend_type>
1262
+ <show_in_default>1</show_in_default>
1263
+ <show_in_website>1</show_in_website>
1264
+ <show_in_store>1</show_in_store>
1265
+ <sort_order>105</sort_order>
1266
+ <fields>
1267
+ <active extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/active" />
1268
+ <title extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/title" />
1269
+ <sort_order extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/sort_order" />
1270
+ <payment_action extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/payment_action" />
1271
+ <allowspecific extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allowspecific" />
1272
+ <specificcountry extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/specificcountry" />
1273
+ <debug extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/debug" />
1274
+ <verify_peer extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/verify_peer" />
1275
+ <line_items_enabled extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/line_items_enabled" />
1276
+ <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//paypal_orderstored_billing_agreement/*/allow_billing_agreement_wizard" />
1277
+ </fields>
1278
+ </express_checkout_orderstored_billing_agreement>
1279
+ </fields>
1280
+ </settings_ec_advanced>
1281
+ </fields>
1282
+ </settings_ec>
1283
+ </fields>
1284
+ </express_checkout>
1285
+ </paypal_payments>
1286
+ </groups>
1287
+ </payment>
1288
+ </sections>
1289
+ </config>
app/code/community/CLS/Paypal/sql/cls_paypal_setup/install-0.0.1.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /* @var $installer Mage_Core_Model_Resource_Setup */
30
+ $installer = $this;
31
+
32
+ $installer->startSetup();
33
+
34
+ /**
35
+ * Create table 'cls_paypal/customerstored'
36
+ */
37
+ $table = $installer->getConnection()
38
+ ->newTable($installer->getTable('cls_paypal/customerstored'))
39
+ ->addColumn('stored_card_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
40
+ 'identity' => true,
41
+ 'unsigned' => true,
42
+ 'nullable' => false,
43
+ 'primary' => true
44
+ ))
45
+ ->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
46
+ 'nullable' => false
47
+ ))
48
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
49
+ 'unsigned' => true,
50
+ 'nullable' => false,
51
+ 'default' => '0'
52
+ ))
53
+ ->addColumn('cc_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
54
+ 'nullable' => false
55
+ ))
56
+ ->addColumn('cc_last4', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
57
+ 'nullable' => false
58
+ ))
59
+ ->addColumn('cc_exp_month', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
60
+ 'nullable' => false
61
+ ))
62
+ ->addColumn('cc_exp_year', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
63
+ 'nullable' => false
64
+ ))
65
+ ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATE, null, array())
66
+ ->addColumn('payment_method', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
67
+ 'nullable' => false
68
+ ))
69
+ ->addForeignKey($installer->getFkName('cls_paypal/customerstored', 'customer_id', 'customer/entity', 'entity_id'),
70
+ 'customer_id', $installer->getTable('customer/entity'), 'entity_id',
71
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
72
+ );
73
+
74
+ $installer->getConnection()->createTable($table);
75
+
76
+ $installer->endSetup();
app/code/community/CLS/Paypal/sql/cls_paypal_setup/upgrade-0.3.0-0.3.1.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /* @var $installer Mage_Core_Model_Resource_Setup */
30
+ $installer = $this;
31
+
32
+ $installer->startSetup();
33
+
34
+ /**
35
+ * Change stored credit card date field format
36
+ */
37
+ $installer->getConnection()->changeColumn(
38
+ $installer->getTable('cls_paypal/customerstored'),
39
+ 'date',
40
+ 'date',
41
+ array(
42
+ 'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
43
+ )
44
+ );
45
+
46
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/cls_paypal.xml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Classy Llama
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 to us at
14
+ * support+paypal@classyllama.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module
19
+ * to newer versions in the future. If you require customizations of this
20
+ * module for your needs, please write us at sales@classyllama.com.
21
+ *
22
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
23
+ *
24
+ * @category CLS
25
+ * @package Paypal
26
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ */
29
+ -->
30
+ <layout>
31
+ <adminhtml_sales_order_view>
32
+ <reference name="sales_order_edit">
33
+ <action method="addButton">
34
+ <id>new_order_from_payment</id>
35
+ <button_data helper="cls_paypal/getAdminOrderFromPaymentButton" />
36
+ </action>
37
+ </reference>
38
+ </adminhtml_sales_order_view>
39
+
40
+ <adminhtml_sales_order_create_index>
41
+ <reference name="shipping_address">
42
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
43
+ </reference>
44
+ <reference name="billing_address">
45
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
46
+ </reference>
47
+ </adminhtml_sales_order_create_index>
48
+
49
+ <adminhtml_sales_order_create_load_block_data>
50
+ <reference name="shipping_address">
51
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
52
+ </reference>
53
+ <reference name="billing_address">
54
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
55
+ </reference>
56
+ </adminhtml_sales_order_create_load_block_data>
57
+
58
+ <adminhtml_sales_order_create_load_block_shipping_address>
59
+ <reference name="shipping_address">
60
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
61
+ </reference>
62
+ </adminhtml_sales_order_create_load_block_shipping_address>
63
+
64
+ <adminhtml_sales_order_create_load_block_billing_address>
65
+ <reference name="billing_address">
66
+ <action method="setTemplate"><template>cls_paypal/sales/order/create/form/address.phtml</template></action>
67
+ </reference>
68
+ </adminhtml_sales_order_create_load_block_billing_address>
69
+ </layout>
app/design/adminhtml/default/default/template/cls_paypal/payment/form/cc.phtml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Custom credit card payment form
31
+ */
32
+ ?>
33
+ <?php $_code=$this->getMethodCode() ?>
34
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
35
+ <li>
36
+ <div class="input-box">
37
+ <label for="<?php echo $_code ?>_cc_type"><?php echo Mage::helper('payment')->__('Credit Card Type') ?> <span class="required">*</span></label><br/>
38
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
39
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
40
+ <option value=""></option>
41
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
42
+ <option value="<?php echo $_typeCode ?>" <?php if($_typeCode==$_ccType): ?>selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
43
+ <?php endforeach ?>
44
+ </select>
45
+ </div>
46
+ </li>
47
+ <li>
48
+ <div class="input-box">
49
+ <label for="<?php echo $_code ?>_cc_number"><?php echo Mage::helper('payment')->__('Credit Card Number') ?> <span class="required">*</span></label><br/>
50
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo Mage::helper('payment')->__('Credit Card Number') ?>" class="input-text validate-cc-number" value="<?php echo $this->getInfoData('cc_number')?>"/>
51
+ </div>
52
+ </li>
53
+ <li>
54
+ <div class="input-box">
55
+ <label for="<?php echo $_code ?>_expiration"><?php echo Mage::helper('payment')->__('Expiration Date') ?> <span class="required">*</span></label><br/>
56
+ <select id="<?php echo $_code ?>_expiration" style="width:140px;" name="payment[cc_exp_month]" class="validate-cc-exp required-entry">
57
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
58
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
59
+ <option value="<?php echo $k ?>" <?php if($k==$_ccExpMonth): ?>selected="selected"<?php endif ?>><?php echo $v ?></option>
60
+ <?php endforeach ?>
61
+ </select>
62
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
63
+ <select id="<?php echo $_code ?>_expiration_yr" style="width:103px;" name="payment[cc_exp_year]" class="required-entry">
64
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
65
+ <option value="<?php echo $k ? $k : '' ?>" <?php if($k==$_ccExpYear): ?>selected="selected"<?php endif ?>><?php echo $v ?></option>
66
+ <?php endforeach ?>
67
+ </select>
68
+ </div>
69
+ </li>
70
+ <?php if($this->hasVerification()): ?>
71
+ <li>
72
+ <div class="input-box">
73
+ <label for="<?php echo $_code ?>_cc_cid"><?php echo Mage::helper('payment')->__('Card Verification Number') ?> <span class="required">*</span></label><br/>
74
+ <input type="text" title="<?php echo Mage::helper('payment')->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" style="width:3em;" value="<?php echo $this->getInfoData('cc_cid')?>"/>
75
+ </div>
76
+ </li>
77
+ <?php endif; ?>
78
+
79
+ <?php if ($this->isCcSaveAllowed()): ?>
80
+ <?php $_ccSaveFuture = $this->getInfoData('cc_save_future') ?>
81
+ <li>
82
+ <div class="input-box">
83
+ <input type="checkbox" id="<?php echo $_code ?>_cc_save_future" name="payment[cc_save_future]" value="Y"<?php if ($_ccSaveFuture == 'Y'): ?> checked="checked"<?php endif; ?> />
84
+ <label for="<?php echo $_code ?>_cc_save_future"><?php echo $this->__('Save this card for future use') ?><br/>
85
+ </div>
86
+ </li>
87
+ <?php endif; ?>
88
+
89
+ <?php if ($this->hasSsCardType()): ?>
90
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
91
+ <ul class="inner-form">
92
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
93
+ <li>
94
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
95
+ <span class="input-box">
96
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
97
+ </span>
98
+ </li>
99
+
100
+ <li>
101
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
102
+ <div class="input-box">
103
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
104
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
105
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
106
+ <?php endforeach ?>
107
+ </select>
108
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
109
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
110
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
111
+ <?php endforeach ?>
112
+ </select>
113
+ </div>
114
+ </li>
115
+ <li class="adv-container">&nbsp;</li>
116
+ </ul>
117
+ <script type="text/javascript">
118
+ //<![CDATA[
119
+ var SSChecked<?php echo $_code ?> = function() {
120
+ var elm = $('<?php echo $_code ?>_cc_type');
121
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
122
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
123
+ } else {
124
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
125
+ }
126
+ };
127
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
128
+ SSChecked<?php echo $_code ?>();
129
+ //]]>
130
+ </script>
131
+ </li>
132
+ <?php endif; ?>
133
+ </ul>
app/design/adminhtml/default/default/template/cls_paypal/payment/form/customer_stored.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /** @var $this CLS_Paypal_Block_Paypal_Payment_Form_Customerstored */
30
+
31
+ $_code = $this->getMethodCode();
32
+ $_storedCards = $this->getStoredCards();
33
+ $_storedCardHelper = Mage::helper('cls_paypal/storedcard');
34
+ ?>
35
+
36
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
37
+
38
+ <?php $_storedCardId = $this->getInfoData('stored_card_id') ?>
39
+ <li>
40
+ <div class="input-box">
41
+ <?php if ( $_storedCards && ($_storedCards->count() > 0) ): ?>
42
+ <select id="<?php echo $_code ?>_stored_card_id" name="payment[stored_card_id]" class="required-entry validate-select">
43
+ <?php if ($_storedCards->count() > 1): ?>
44
+ <option value=""></option>
45
+ <?php endif; ?>
46
+ <?php foreach ($_storedCards as $_storedCard): ?>
47
+ <option value="<?php echo $_storedCard->getId() ?>"<?php if ($_storedCard->getId() == $_storedCardId): ?> selected="selected" <?php endif; ?>><?php echo $_storedCardHelper->translateCcType($_storedCard->getCcType()) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getCcLast4()) ?>)</option>
48
+ <?php endforeach ?>
49
+ </select>
50
+ <?php endif; ?>
51
+ </div>
52
+ </li>
53
+
54
+ </ul>
app/design/adminhtml/default/default/template/cls_paypal/payment/form/order_stored.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /** @var $this CLS_Paypal_Block_Paypal_Payment_Form_Orderstored */
30
+
31
+ $_code = $this->getMethodCode();
32
+ $_storedCardHelper = Mage::helper('cls_paypal/storedcard');
33
+ ?>
34
+
35
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
36
+ <li>
37
+ <div class="input-box">
38
+ <?php
39
+ if ($orderId = $this->getOrderIncrementId()):
40
+ echo $this->__('Order #%s', $orderId);
41
+ if($this->getCcType()):
42
+ echo ' - ' . $_storedCardHelper->translateCcType($this->getCcType()) . '(' . sprintf('xxxx-%s', $this->getCcLast4()) . ')';
43
+ endif;
44
+ endif;
45
+ ?>
46
+ </div>
47
+ </li>
48
+ </ul>
app/design/adminhtml/default/default/template/cls_paypal/sales/order/create/form/address.phtml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ if($this->getIsShipping()):
30
+ $_fieldsContainerId = 'order-shipping_address_fields';
31
+ $_addressChoiceContainerId = 'order-shipping_address_choice';
32
+ ?>
33
+ <script type="text/javascript">
34
+ order.shippingAddressContainer = '<?php echo $_fieldsContainerId ?>';
35
+ order.setAddresses(<?php echo $this->getAddressCollectionJson() ?>);
36
+ </script>
37
+ <?php
38
+ else:
39
+ $_fieldsContainerId = 'order-billing_address_fields';
40
+ $_addressChoiceContainerId = 'order-billing_address_choice';
41
+ ?>
42
+ <script type="text/javascript">
43
+ order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>';
44
+ </script>
45
+ <?php
46
+ endif; ?>
47
+ <div class="entry-edit">
48
+
49
+ <div class="entry-edit-head">
50
+ <h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>
51
+ </div>
52
+
53
+ <fieldset class="np">
54
+ <div id = "<?php echo $_addressChoiceContainerId ?>" class="order-choose-address">
55
+ <?php $_id = $this->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?>
56
+
57
+ <?php if (!$this->getQuote()->getCustomerIsGuest()): ?>
58
+ <?php echo Mage::helper('sales')->__('Select from existing customer addresses:') ?><br/>
59
+ <select id="<?php echo $_id ?>" name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[customer_address_id]" style="width:97.5%;" onchange="order.selectAddress(this, '<?php echo $_fieldsContainerId ?>')">
60
+ <option value=""><?php echo Mage::helper('sales')->__('Add New Address') ?></option>
61
+ <?php foreach ($this->getAddressCollection() as $_address): ?>
62
+ <?php //if($this->getAddressAsString($_address)!=$this->getAddressAsString($this->getAddress())): ?>
63
+ <option value="<?php echo $_address->getId() ?>"<?php if ($_address->getId()==$this->getAddressId()): ?> selected="selected"<?php endif; ?>>
64
+ <?php echo $this->getAddressAsString($_address) ?>
65
+ </option>
66
+ <?php //endif; ?>
67
+ <?php endforeach; ?>
68
+ </select>
69
+ <br/>
70
+ <?php else: ?>
71
+ <input type="hidden" id="<?php echo $_id ?>" value="" />
72
+ <?php endif; ?>
73
+
74
+ <?php if($this->getIsShipping()): ?>
75
+ <input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing" onclick="order.setShippingAsBilling(this.checked)" <?php if($this->getIsAsBilling()): ?>checked<?php endif; ?>/>
76
+ <label for="order-shipping_same_as_billing" class="no-float"><?php echo Mage::helper('sales')->__('Same As Billing Address') ?></label>
77
+ <?php else: ?>
78
+ &nbsp;
79
+ <?php endif; ?>
80
+ </div>
81
+
82
+ <div class="order-address" id="<?php echo $_fieldsContainerId ?>">
83
+ <div class="content">
84
+ <?php echo $this->getForm()->toHtml() ?>
85
+ </div>
86
+
87
+ <?php if (!$this->getQuote()->getCustomerIsGuest()): ?>
88
+ <div class="order-save-in-address-book">
89
+ <input name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[save_in_address_book]" type="checkbox" id="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book" value="1" <?php if (!$this->getDontSaveInAddressBook() && $this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?>/>
90
+ <label for="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book"><?php echo Mage::helper('sales')->__('Save in address book') ?></label>
91
+ </div>
92
+ <?php endif; ?>
93
+ </div>
94
+ <?php $hideElement = 'address-' . ($this->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?>
95
+ <div style="display:none;" id="<?php echo $hideElement ?>" class="overlay"><span><?php echo $this->__('Shipping address selection is not applicable') ?></span></div>
96
+ <script type="text/javascript">
97
+ order.bindAddressFields('<?php echo $_fieldsContainerId ?>');
98
+ order.bindAddressFields('<?php echo $_addressChoiceContainerId ?>');
99
+ <?php if($this->getIsShipping() && $this->getIsAsBilling()): ?>
100
+ order.disableShippingAddress(true);
101
+ <?php endif; ?>
102
+ </script>
103
+ </fieldset>
104
+ </div>
app/design/adminhtml/default/default/template/cls_paypal/sales/payment/form/orderstored/agreement.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /* @var $this CLS_Paypal_Block_Paypal_Payment_Form_Orderstored_Agreement */
30
+
31
+ ?>
32
+ <?php $_method = $this->getMethod() ?>
33
+ <?php $_code = $this->getMethodCode() ?>
34
+ <?php $_billingAgreementId = $this->getBillingAgreementId() ?>
35
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
36
+ <li>
37
+ <p class="paypal-orderstored-agreement-reference-id">Agreement Id: <?php echo $_billingAgreementId ?></p>
38
+ <input type="hidden" id="<?php echo $_code ?>_billing_agreement_id" name="payment[billing_agreement_id]" value="<?php echo $_billingAgreementId ?>" />
39
+ </li>
40
+ </ul>
app/design/frontend/base/default/layout/cls_paypal.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Classy Llama
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 to us at
14
+ * support+paypal@classyllama.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module
19
+ * to newer versions in the future. If you require customizations of this
20
+ * module for your needs, please write us at sales@classyllama.com.
21
+ *
22
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
23
+ *
24
+ * @category CLS
25
+ * @package Paypal
26
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ */
29
+ -->
30
+ <layout>
31
+ <customer_account>
32
+ <reference name="customer_account_navigation">
33
+ <action method="addLink" translate="label" module="cls_paypal">
34
+ <name>customer_stored_cards</name>
35
+ <path>customer/storedcard/</path>
36
+ <label>My Credit Cards</label>
37
+ </action>
38
+ </reference>
39
+ </customer_account>
40
+
41
+ <customer_storedcard_index>
42
+ <update handle="customer_account"/>
43
+ <reference name="my.account.wrapper">
44
+ <block type="cls_paypal/customer_storedcard" name="customer_storedcard" template="cls_paypal/customer/storedcard.phtml"/>
45
+ </reference>
46
+ </customer_storedcard_index>
47
+ </layout>
app/design/frontend/base/default/template/cls_paypal/customer/storedcard.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Customer's stored cards listing
31
+ */
32
+
33
+ /** @var $this CLS_Paypal_Block_Customer_Storedcard */
34
+
35
+ $_storedCardHelper = Mage::helper('cls_paypal/storedcard');
36
+ ?>
37
+ <div class="page-title">
38
+ <h1><?php echo $this->__('Manage saved cards') ?></h1>
39
+ </div>
40
+
41
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
42
+
43
+ <div class="box-account">
44
+ <?php $_storedCards = $this->getStoredCards(); ?>
45
+ <div class="box-head">
46
+ <h2><?php echo $this->__('Credit Cards') ?></h2>
47
+ </div>
48
+ <?php if( $_storedCards && ($_storedCards->count() > 0) ): ?>
49
+ <table class="data-table" id="stored-cards-table">
50
+ <col />
51
+ <col width="1" />
52
+ <col width="1" />
53
+ <col width="1" />
54
+ <thead>
55
+ <tr>
56
+ <th><?php echo $this->__('Credit Card') ?></th>
57
+ <th><?php echo $this->__('Expiration Date') ?></th>
58
+ <th><?php echo $this->__('Last Used') ?></th>
59
+ <th>&nbsp;</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ <?php foreach ($_storedCards as $_storedCard): ?>
64
+ <tr>
65
+ <td><?php echo $_storedCardHelper->translateCcType($_storedCard->getCcType()) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getCcLast4()) ?>)</td>
66
+ <td class="a-center"><span class="nobr"><?php echo $_storedCard->getCcExpMonth() ?>/<?php echo $_storedCard->getCcExpYear() ?></span></td>
67
+ <td class="a-center"><span class="nobr"><?php echo $this->formatDate($this->transformDate($_storedCard->getDate())) ?></span></td>
68
+ <td class="a-center">
69
+ <span class="nobr">
70
+ <a href="<?php echo $this->getDeleteUrl($_storedCard) ?>" onclick="return confirm('<?php echo $this->__('Are you sure?') ?>')"><?php echo $this->__('Delete') ?></a>
71
+ </span>
72
+ </td>
73
+ </tr>
74
+ <?php endforeach; ?>
75
+ </tbody>
76
+ </table>
77
+ <script type="text/javascript">decorateTable('stored-cards-table')</script>
78
+ <?php else: ?>
79
+ <p><?php echo $this->__('No saved cards'); ?></p>
80
+ <?php endif; ?>
81
+ </div>
app/design/frontend/base/default/template/cls_paypal/payment/form/cc.phtml ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Custom credit card payment form
31
+ */
32
+ ?>
33
+ <?php $_code=$this->getMethodCode() ?>
34
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
35
+ <?php /*
36
+ <li>
37
+ <div class="input-box">
38
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
39
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
40
+ </div>
41
+ </li>
42
+ */ ?>
43
+ <li>
44
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
45
+ <div class="input-box">
46
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
47
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
48
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
49
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
50
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
51
+ <?php endforeach ?>
52
+ </select>
53
+ </div>
54
+ </li>
55
+ <li>
56
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
59
+ </div>
60
+ </li>
61
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
62
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
63
+ <div class="input-box">
64
+ <div class="v-fix">
65
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
66
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
67
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
68
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
69
+ <?php endforeach ?>
70
+ </select>
71
+ </div>
72
+ <div class="v-fix">
73
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
74
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
75
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
76
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
77
+ <?php endforeach ?>
78
+ </select>
79
+ </div>
80
+ </div>
81
+ </li>
82
+ <?php echo $this->getChildHtml() ?>
83
+ <?php if($this->hasVerification()): ?>
84
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
85
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
86
+ <div class="input-box">
87
+ <div class="v-fix">
88
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
89
+ </div>
90
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
91
+ </div>
92
+ </li>
93
+ <?php endif; ?>
94
+
95
+ <?php if ($this->isCcSaveAllowed()): ?>
96
+ <li>
97
+ <label for="<?php echo $_code ?>_cc_save_future"><?php echo $this->__('Save this card for future use') ?></label>
98
+ <div class="input-box">
99
+ <div class="v-fix">
100
+ <input type="checkbox" id="<?php echo $_code ?>_cc_save_future" name="payment[cc_save_future]" value="Y" />
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <?php endif; ?>
105
+
106
+ <?php if ($this->hasSsCardType()): ?>
107
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
108
+ <ul class="inner-form">
109
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
110
+ <li>
111
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
112
+ <span class="input-box">
113
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
114
+ </span>
115
+ </li>
116
+
117
+ <li>
118
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
119
+ <div class="input-box">
120
+ <div class="v-fix">
121
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
122
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
123
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
124
+ <?php endforeach ?>
125
+ </select>
126
+ </div>
127
+ <div class="v-fix">
128
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
129
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
130
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
131
+ <?php endforeach ?>
132
+ </select>
133
+ </div>
134
+ </div>
135
+ </li>
136
+ <li class="adv-container">&nbsp;</li>
137
+ </ul>
138
+ <script type="text/javascript">
139
+ //<![CDATA[
140
+ var SSChecked<?php echo $_code ?> = function() {
141
+ var elm = $('<?php echo $_code ?>_cc_type');
142
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
143
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
144
+ } else {
145
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
146
+ }
147
+ };
148
+
149
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
150
+ SSChecked<?php echo $_code ?>();
151
+ //]]>
152
+ </script>
153
+ </li>
154
+ <?php endif; ?>
155
+ </ul>
app/design/frontend/base/default/template/cls_paypal/payment/form/customer_stored.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /** @var $this CLS_Paypal_Block_Paypal_Payment_Form_Customerstored */
30
+
31
+ ?>
32
+ <?php
33
+ $_code=$this->getMethodCode();
34
+ $_storedCards = $this->getStoredCards();
35
+ $_storedCardHelper = Mage::helper('cls_paypal/storedcard');
36
+ ?>
37
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
38
+ <li>
39
+ <div class="input-box">
40
+ <?php if ( $_storedCards && ($_storedCards->count() > 0) ): ?>
41
+ <select id="<?php echo $_code ?>_stored_card_id" name="payment[stored_card_id]" class="required-entry validate-select">
42
+ <?php if ($_storedCards->count() > 1): ?>
43
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
44
+ <?php endif; ?>
45
+ <?php foreach ($_storedCards as $_storedCard): ?>
46
+ <option value="<?php echo $_storedCard->getId() ?>"><?php echo $_storedCardHelper->translateCcType($_storedCard->getData('cc_type')) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getData('cc_last4')) ?>)</option>
47
+ <?php endforeach ?>
48
+ </select>
49
+ <?php endif; ?>
50
+ </div>
51
+ </li>
52
+ </ul>
app/design/frontend/base/default/template/cls_paypal/paypal/payflow/info.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Classy Llama
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 to us at
13
+ * support+paypal@classyllama.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade this module
18
+ * to newer versions in the future. If you require customizations of this
19
+ * module for your needs, please write us at sales@classyllama.com.
20
+ *
21
+ * To report bugs or issues with this module, please email support+paypal@classyllama.com.
22
+ *
23
+ * @category CLS
24
+ * @package Paypal
25
+ * @copyright Copyright (c) 2013 Classy Llama Studios, LLC (http://www.classyllama.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+ ?>
29
+ <?php $_code = $this->getMethodCode() ?>
30
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none" class="form-list">
31
+ <li>
32
+ <?php echo $this->__('You will be required to enter your payment details after you place an order.') ?>
33
+ </li>
34
+
35
+ <?php if ($this->isCcSaveAllowed()): ?>
36
+ <li>
37
+ <div class="input-box">
38
+ <div class="v-fix">
39
+ <input type="checkbox" id="<?php echo $_code ?>_cc_save_future" name="payment[cc_save_future]" value="Y" />
40
+ </div>
41
+ </div>
42
+ <label for="<?php echo $_code ?>_cc_save_future"><?php echo $this->__('Save this card for future use') ?> (<?php echo $this->__('if paid by credit card') ?>)</label>
43
+ </li>
44
+ <?php endif; ?>
45
+ </ul>
app/etc/modules/CLS_Paypal.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <CLS_Paypal>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Paypal />
9
+ <Mage_PaypalUk />
10
+ </depends>
11
+ </CLS_Paypal>
12
+ </modules>
13
+ </config>
app/locale/en_US/CLS_Paypal.csv ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Are you sure?","Are you sure?"
2
+ "Billing Agreement Id","Billing Agreement Id"
3
+ "Billing agreement not found. Order could not be loaded.","Billing agreement not found. Order could not be loaded."
4
+ "Billing Agreement Used on Previous Order","Billing Agreement Used on Previous Order"
5
+ "Create Guest Order","Create Guest Order"
6
+ "Credit Card","Credit Card"
7
+ "Credit Card Used on Previous Order","Credit Card Used on Previous Order"
8
+ "Credit Cards","Credit Cards"
9
+ "Delete","Delete"
10
+ "if paid by credit card","if paid by credit card"
11
+ "Internal error: cannot initialize Payflow payment method.","Internal error: cannot initialize Payflow payment method."
12
+ "Internal error: cannot initialize the payment method.","Internal error: cannot initialize the payment method."
13
+ "Last Used","Last Used"
14
+ "Manage saved cards","Manage saved cards"
15
+ "My Credit Cards","My Credit Cards"
16
+ "New Order from this Payment","New Order from this Payment"
17
+ "No saved cards","No saved cards"
18
+ "Payflow PPREF: #%s.","Payflow PPREF: #%s."
19
+ "PayPal Previous Order Billing Agreement Settings","PayPal Previous Order Billing Agreement Settings"
20
+ "PayPal Previous Order Credit Card Settings","PayPal Previous Order Credit Card Settings"
21
+ "PayPal Saved Credit Card Settings","PayPal Saved Credit Card Settings"
22
+ "Please select valid saved card","Please select valid saved card"
23
+ "Save this card for future use","Save this card for future use"
24
+ "Saved Credit Card","Saved Credit Card"
25
+ "The card had been deleted.","The card had been deleted."
26
+ "Unable to get the stored card data","Unable to get the stored card data"
27
+ "Unable to get the transaction data","Unable to get the transaction data"
28
+ "",""
package.xml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CLS_Paypal_Credit_Card_Tokenization</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>PCI Compliant saved credit cards with PayPal reference transactions. Customers, Admin and Recurring Payments.</summary>
10
+ <description>CLS_Paypal Module Features&#xD;
11
+ ==========================&#xD;
12
+ PCI Compliant saved credit cards with Paypal reference transactions.&#xD;
13
+ &#xD;
14
+ ## Saved Credit Card&#xD;
15
+ &#xD;
16
+ * Customers can save their credit card information during the checkout process and then use the same credit card on future orders. &#xD;
17
+ * Our solution is fully PCI Compliant since it stores a secure token as a reference transaction to the credit card data. Credit card data is not actually stored on the web site.&#xD;
18
+ &#xD;
19
+ ## Billing Agreements&#xD;
20
+ &#xD;
21
+ * Billing agreements are now available with Payflow Pro integration. &#xD;
22
+ * Billing agreements can be created during Express Checkout even for guest or registering customers, for use with the new admin order management features. &#xD;
23
+ &#xD;
24
+ ## Admin Order Management&#xD;
25
+ &#xD;
26
+ * When viewing an order, admins have the option to select "New Order from this Payment." This option allows the same PayPal billing agreement or credit card used on the previous order to be charged on the new order. &#xD;
27
+ * The ability to re-charge the previous PayPal billing agreement or credit card is also available when editing an order.&#xD;
28
+ * To better facilitate the use of the "New Order from this Payment" feature, the admin interface can now be used to create guest orders.&#xD;
29
+ &#xD;
30
+ &#xD;
31
+ # What are PayPal Billing Agreements?&#xD;
32
+ &#xD;
33
+ Billing Agreements allow you to bill customers at regular intervals.&#xD;
34
+ &#xD;
35
+ Set up payments for dues, subscriptions, installments, and more.&#xD;
36
+ &#xD;
37
+ * Automatically bill customers at specified intervals.&#xD;
38
+ * Use automated notifications and reporting to manage billing status.&#xD;
39
+ * Customers can complete transactions without leaving your app, game, or website.&#xD;
40
+ &#xD;
41
+ &#xD;
42
+ # Supported PayPal Solutions&#xD;
43
+ &#xD;
44
+ The features of this module are available for Magento integrations with the following PayPal solutions:&#xD;
45
+ &#xD;
46
+ * Payments Pro&#xD;
47
+ * Payments Advanced&#xD;
48
+ * Payflow Pro&#xD;
49
+ * Payflow Link&#xD;
50
+ * Express Checkout&#xD;
51
+ &#xD;
52
+ &#xD;
53
+ # Magento Compatibility&#xD;
54
+ &#xD;
55
+ * Community 1.7.0.2 and up&#xD;
56
+ * Enterprise 1.12.0.2 and up&#xD;
57
+ &#xD;
58
+ # Configuration Instructions&#xD;
59
+ &#xD;
60
+ Settings for this module's features can be found in System Configuration,&#xD;
61
+ under the various existing PayPal configuration groups. In the Payment Methods&#xD;
62
+ tab, navigate to a specific PayPal solution (Payments Pro, for example)&#xD;
63
+ and open the the solution's Advanced Settings to find the new configuration&#xD;
64
+ areas.&#xD;
65
+ &#xD;
66
+ PayPal Billing Agreement Settings can now be found under Advanced Settings&#xD;
67
+ for Payflow Pro, just as it is found for other solutions.&#xD;
68
+ &#xD;
69
+ For each of the four supported solutions, Advanced Settings now contains&#xD;
70
+ three added groups: PayPal Saved Credit Card Settings, PayPal Previous Order&#xD;
71
+ Credit Card Settings, and PayPal Previous Order Billing Agreement Settings.&#xD;
72
+ Enable the module's various features from these groups, as well as setting&#xD;
73
+ their configuration options independently of the standard credit card&#xD;
74
+ and billing agreement configurations.&#xD;
75
+ </description>
76
+ <notes>Initial release</notes>
77
+ <authors><author><name>Classy Llama</name><user>classyllama</user><email>info@classyllama.com</email></author></authors>
78
+ <date>2013-07-02</date>
79
+ <time>15:06:19</time>
80
+ <contents><target name="magecommunity"><dir name="CLS"><dir name="Paypal"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><file name="Customer.php" hash="bdda7f26580da00836dc14c760ce7bd4"/></dir></dir></dir></dir><dir name="Customer"><file name="Storedcard.php" hash="1f0ea64d4d88d8acc69b491ad157013d"/></dir><dir name="Payment"><dir name="Form"><file name="Cc.php" hash="bd28bf5a1476b6d000f7ddcfc8097520"/></dir></dir><dir name="Paypal"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Location.php" hash="51a66bf4179183e15d74e2dd60867d08"/></dir></dir></dir></dir><dir name="Payflow"><dir name="Advanced"><file name="Form.php" hash="431cc885b585b3a6ae44b3e63b4a3500"/></dir><dir name="Link"><file name="Form.php" hash="803988293c751db8be065174648ea789"/></dir></dir><dir name="Payment"><dir name="Form"><file name="Customerstored.php" hash="705a1066768956fa2757aa6974df6a90"/><dir name="Orderstored"><file name="Agreement.php" hash="51a809dde7da3c5fb7adaccfc94583fe"/></dir><file name="Orderstored.php" hash="aae8127491dcace2d2800879b2743157"/></dir></dir></dir><dir name="Paypaluk"><dir name="Payment"><dir name="Form"><dir name="Orderstored"><file name="Agreement.php" hash="f2cefe3e8fc148a628b8c7275401845d"/></dir></dir></dir></dir></dir><file name="CHANGELOG.txt" hash="f91f8f732f0fbe8bd37f5ff4ec387a65"/><dir name="Helper"><file name="Data.php" hash="0d3f45c57c94284712bd91aa4b19351b"/><dir name="Orderstored"><file name="Agreement.php" hash="d84455b451593c2eaa46522e09834da7"/></dir><dir name="Paypal"><file name="Data.php" hash="f60bf2892eb63645f2eab96bc7dc6b4a"/></dir><file name="Storedcard.php" hash="874a70e486c9b8ed353167245f9ed07a"/></dir><file name="LICENSE.txt" hash="71db18446bebc23ced8dd62644d16b5f"/><dir name="Model"><file name="Customerstored.php" hash="8be7c468362ad43b6a09d4c223d36515"/><file name="Observer.php" hash="b3bef212d6632fe85feb02898a382efc"/><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="cef7500ca76ea7f62ed4ee5843fcf17c"/></dir><file name="Config.php" hash="dc8223a0fc3b8d6659184d1fe6c0330b"/><file name="Direct.php" hash="9f551d5e14e99451ca02f79d2f78f4ab"/><dir name="Express"><file name="Checkout.php" hash="021cbbf4e0985106ab24bfa8bd62abb4"/></dir><file name="Express.php" hash="67b5631bf57b2797050c73c7378aee9c"/><file name="Info.php" hash="d6d8415242d2a63eb831cac84f276701"/><dir name="Method"><dir name="Orderstored"><file name="Agreement.php" hash="dea76e2815bdffc8a7225840574b12ac"/></dir></dir><file name="Payflowadvanced.php" hash="333a909b6b48c6c3c864e591d5ee0a4d"/><file name="Payflowlink.php" hash="98129dfc3d9a5236e8c5a94cddbeb6d3"/><file name="Payflowpro.php" hash="dbfa4f171934f4f26d05515ca5ae36b1"/><dir name="Stored"><file name="Abstract.php" hash="946b41be7b003f821fa091e25974e2e1"/><dir name="Customerstored"><file name="Direct.php" hash="4677b9c142d635c9f77249cd87f51150"/><file name="Payflow.php" hash="0c4cbbac9db29160ff4a7c352bc915f2"/><file name="Payflowadvanced.php" hash="1fffe3ac9b59ca8125c751de9bc2ba03"/><file name="Payflowlink.php" hash="d397df8fa3a6df234a43f0988faac2b1"/><file name="Payflowpro.php" hash="cbcb7c81a3fae18b82cc2f2c0a65a173"/></dir><file name="Customerstored.php" hash="f9fe1df0936372d6abcb30b3129c080b"/><dir name="Orderstored"><file name="Direct.php" hash="403bd0b06c2f235c9480eaf05d449b3b"/><file name="Payflow.php" hash="98fae36789f67423db4a520b7feaa01f"/><file name="Payflowadvanced.php" hash="8130535eed87eb0aa8966e749785de5d"/><file name="Payflowlink.php" hash="77d02f6c566b31cf9cc175ebc8f837ac"/><file name="Payflowpro.php" hash="15dcc930fa278a9eff5ef5b2f335d89c"/></dir><file name="Orderstored.php" hash="2f9b44b951f3f7dfe80ab8153be7f8bc"/><file name="Payflow.php" hash="288f16ab9d9d2b0d8957c8887f528b99"/></dir></dir><dir name="Paypaluk"><dir name="Api"><file name="Nvp.php" hash="ef27f778fde49eab569c6f3944702ec4"/></dir><dir name="Express"><file name="Checkout.php" hash="6a2a85e0acb0645d025c8823a5b3cd2f"/></dir><file name="Express.php" hash="b491f2d6acf89a29f4a23dc573f8e44f"/><dir name="Method"><file name="Agreement.php" hash="c86f295fa6312888b45c0f4a68fd27df"/><dir name="Orderstored"><file name="Agreement.php" hash="8534a919294e533247ef5cebdef434ce"/></dir></dir></dir><dir name="Resource"><dir name="Customerstored"><file name="Collection.php" hash="818889cb1eedd1e2047d09f6270f9b30"/></dir><file name="Customerstored.php" hash="0dd4ba6646ffbd32efbe6e4f0bc4e3c7"/></dir></dir><file name="README.txt" hash="3371344d77a0c17859e4b7e75380b0a7"/><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="CreateController.php" hash="edd90db7fcc89ccfd5519864debed3ad"/></dir></dir></dir><dir name="Customer"><file name="StoredcardController.php" hash="60c3403cd13a9ff1805506f5988cabdb"/></dir><dir name="Paypal"><file name="ExpressController.php" hash="53f83f79f948ffc0eb6abdfc5d8f60b0"/></dir><dir name="PaypalUk"><file name="ExpressController.php" hash="639821dc1c01a0276052579c5507a599"/></dir></dir><dir name="etc"><file name="config.xml" hash="0b90df786bc655c82d49c2200d4c769f"/><file name="system.xml" hash="4d5998c927b5739a52c078c99644bd32"/></dir><dir name="sql"><dir name="cls_paypal_setup"><file name="install-0.0.1.php" hash="33f870045a3cc0da094eed143adaf57b"/><file name="upgrade-0.3.0-0.3.1.php" hash="240dd4eae586f033ec6efad99773fbce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cls_paypal.xml" hash="6747dd281152c450e1511f9d551c9766"/></dir><dir name="template"><dir name="cls_paypal"><dir name="payment"><dir name="form"><file name="cc.phtml" hash="a23359ef60f0cf4041f4dd406c1cb286"/><file name="customer_stored.phtml" hash="6004f23604bb7de0a409494bb0c0c439"/><file name="order_stored.phtml" hash="7620eacd6d2351df7e827eb168d03236"/></dir></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="form"><file name="address.phtml" hash="a452ddc2a6e812f0872e82ad931b9dac"/></dir></dir></dir><dir name="payment"><dir name="form"><dir name="orderstored"><file name="agreement.phtml" hash="5a080925e336f505381cba5e43f70e07"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cls_paypal.xml" hash="0e2a6af1135e6fb29dda4b267797a6bd"/></dir><dir name="template"><dir name="cls_paypal"><dir name="customer"><file name="storedcard.phtml" hash="4756af996c65fb83a09ab0312a66bd1f"/></dir><dir name="payment"><dir name="form"><file name="cc.phtml" hash="bd55fa445bea026721116b29dfadbb73"/><file name="customer_stored.phtml" hash="591d82906294e37f5c2e317f71144a0f"/></dir></dir><dir name="paypal"><dir name="payflow"><file name="info.phtml" hash="548f1b761782c2351482dd1d1f44a7af"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CLS_Paypal.xml" hash="9e629aac18f2e5f2c9feb266985c912f"/></dir></target><target name="magelocale"><dir name="en_US"><file name="CLS_Paypal.csv" hash="ab57482877d914bb1d02021d95c65520"/></dir></target></contents>
81
+ <compatible/>
82
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
83
+ </package>