paymentwall_magento_module - Version 1.2.5

Version Notes

Update 3D Secure for Brick

Download this release

Release Info

Developer Paymentwall
Extension paymentwall_magento_module
Version 1.2.5
Comparing to
See all releases


Code changes from version 1.2.4 to 1.2.5

app/code/community/Paymentwall/Paymentwall/Block/Checkout/Form/Method/Abstract.php CHANGED
@@ -1,56 +1,56 @@
1
- <?php
2
-
3
- if (!class_exists('Paymentwall_Config'))
4
- require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
-
6
- /**
7
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
8
- * @package Paymentwall\ThirdpartyIntegration\Magento
9
- *
10
- * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
11
- */
12
- class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract extends Mage_Payment_Block_Form
13
- {
14
- private $modelName;
15
- private $paymentModel;
16
-
17
- /**
18
- * Get total amount of current order
19
- * @return mixed|null
20
- */
21
- public function getTotal()
22
- {
23
- return $this->getOrder() ? $this->getOrder()->getGrandTotal() : null;
24
- }
25
-
26
- /**
27
- * Get currency code of current order
28
- * @return string|null
29
- */
30
- public function getOrderCurrencyCode()
31
- {
32
- return $this->getOrder() ? $this->getOrder()->getOrderCurrencyCode() : null;
33
- }
34
-
35
- /**
36
- * Set payment model name
37
- * @param $name
38
- */
39
- public function setPaymentModelName($name)
40
- {
41
- $this->modelName = $name;
42
- }
43
-
44
- /**
45
- * Get Payment Model
46
- * @return false|Mage_Core_Model_Abstract
47
- */
48
- public function getPaymentModel()
49
- {
50
- if (!$this->paymentModel) {
51
- $this->paymentModel = Mage::getModel('paymentwall/method_' . $this->modelName);
52
- }
53
-
54
- return $this->paymentModel;
55
- }
56
  }
1
+ <?php
2
+
3
+ if (!class_exists('Paymentwall_Config'))
4
+ require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
+
6
+ /**
7
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
8
+ * @package Paymentwall\ThirdpartyIntegration\Magento
9
+ *
10
+ * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
11
+ */
12
+ class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract extends Mage_Payment_Block_Form
13
+ {
14
+ private $modelName;
15
+ private $paymentModel;
16
+
17
+ /**
18
+ * Get total amount of current order
19
+ * @return mixed|null
20
+ */
21
+ public function getTotal()
22
+ {
23
+ return $this->getOrder() ? $this->getOrder()->getGrandTotal() : null;
24
+ }
25
+
26
+ /**
27
+ * Get currency code of current order
28
+ * @return string|null
29
+ */
30
+ public function getOrderCurrencyCode()
31
+ {
32
+ return $this->getOrder() ? $this->getOrder()->getOrderCurrencyCode() : null;
33
+ }
34
+
35
+ /**
36
+ * Set payment model name
37
+ * @param $name
38
+ */
39
+ public function setPaymentModelName($name)
40
+ {
41
+ $this->modelName = $name;
42
+ }
43
+
44
+ /**
45
+ * Get Payment Model
46
+ * @return false|Mage_Core_Model_Abstract
47
+ */
48
+ public function getPaymentModel()
49
+ {
50
+ if (!$this->paymentModel) {
51
+ $this->paymentModel = Mage::getModel('paymentwall/method_' . $this->modelName);
52
+ }
53
+
54
+ return $this->paymentModel;
55
+ }
56
  }
app/code/community/Paymentwall/Paymentwall/Block/Checkout/Form/Method/Pwbrick.php CHANGED
@@ -1,71 +1,71 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- *
7
- * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwbrick
8
- */
9
- class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwbrick extends Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
10
- {
11
- /**
12
- * Set template for block
13
- * @return void
14
- */
15
- protected function _construct()
16
- {
17
- parent::_construct();
18
- $this->setPaymentModelName('pwbrick');
19
- $this->setTemplate('paymentwall/checkout/form/method/pwbrick.phtml');
20
- }
21
-
22
- /**
23
- * Get merchant public key from configuration
24
- * @return string|null
25
- */
26
- public function getPublicKey()
27
- {
28
- if ($this->getPaymentModel()) {
29
- return $this->getPaymentModel()->getConfigData('paymentwall_public_key');
30
- }
31
- return null;
32
- }
33
-
34
- /**
35
- * Get private key from configuration
36
- * @return string|null
37
- */
38
- public function getPrivateKey()
39
- {
40
- if ($this->getMethod()) {
41
- return $this->getPaymentModel()->getConfigData('paymentwall_private_key');
42
- }
43
- return null;
44
- }
45
-
46
-
47
- /**
48
- * Retrieve payment configuration object
49
- *
50
- * @return Mage_Payment_Model_Config
51
- */
52
- protected function _getConfig()
53
- {
54
- return Mage::getSingleton('payment/config');
55
- }
56
-
57
- /**
58
- * Retrieve availables credit card types
59
- *
60
- * @return array
61
- */
62
- public function getCcAvailableTypes()
63
- {
64
- $type = $this->_getConfig()->getCcTypes();
65
- unset($type['OT']);
66
- unset($type['SM']);
67
- unset($type['SO']);
68
- return $type;
69
- }
70
-
71
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ *
7
+ * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwbrick
8
+ */
9
+ class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwbrick extends Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
10
+ {
11
+ /**
12
+ * Set template for block
13
+ * @return void
14
+ */
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ $this->setPaymentModelName('pwbrick');
19
+ $this->setTemplate('paymentwall/checkout/form/method/pwbrick.phtml');
20
+ }
21
+
22
+ /**
23
+ * Get merchant public key from configuration
24
+ * @return string|null
25
+ */
26
+ public function getPublicKey()
27
+ {
28
+ if ($this->getPaymentModel()) {
29
+ return $this->getPaymentModel()->getConfigData('paymentwall_public_key');
30
+ }
31
+ return null;
32
+ }
33
+
34
+ /**
35
+ * Get private key from configuration
36
+ * @return string|null
37
+ */
38
+ public function getPrivateKey()
39
+ {
40
+ if ($this->getMethod()) {
41
+ return $this->getPaymentModel()->getConfigData('paymentwall_private_key');
42
+ }
43
+ return null;
44
+ }
45
+
46
+
47
+ /**
48
+ * Retrieve payment configuration object
49
+ *
50
+ * @return Mage_Payment_Model_Config
51
+ */
52
+ protected function _getConfig()
53
+ {
54
+ return Mage::getSingleton('payment/config');
55
+ }
56
+
57
+ /**
58
+ * Retrieve availables credit card types
59
+ *
60
+ * @return array
61
+ */
62
+ public function getCcAvailableTypes()
63
+ {
64
+ $type = $this->_getConfig()->getCcTypes();
65
+ unset($type['OT']);
66
+ unset($type['SM']);
67
+ unset($type['SO']);
68
+ return $type;
69
+ }
70
+
71
  }
app/code/community/Paymentwall/Paymentwall/Block/Checkout/Form/Method/Pwlocal.php CHANGED
@@ -1,68 +1,68 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- *
7
- * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Local
8
- */
9
- class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwlocal extends Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
10
- {
11
- /**
12
- * Set template for block
13
- * @return void
14
- */
15
- protected function _construct()
16
- {
17
- parent::_construct();
18
- $this->setPaymentModelName('pwlocal');
19
- }
20
-
21
- function getWidget()
22
- {
23
- $order = $this->getOrder();
24
- $return = array(
25
- 'content' => '',
26
- 'status' => false
27
- );
28
-
29
- if ($order) {
30
- try {
31
- $model = $this->getPaymentModel();
32
- $widget = $model->getPaymentWidget($order);
33
-
34
- // Get widget iframe
35
- $return['content'] = $widget->getHtmlCode(array(
36
- 'frameborder' => '0',
37
- 'width' => '100%',
38
- 'height' => '600'
39
- ));
40
- $return['status'] = true;
41
- } catch (Exception $e) {
42
- Mage::logException($e);
43
- $return['content'] = Mage::helper('paymentwall')->__('Errors, Please try again!');
44
- }
45
- } else {
46
- $return['content'] = Mage::helper('paymentwall')->__('Order invalid'); //should redirect back to homepage
47
- }
48
-
49
- return $return;
50
- }
51
-
52
- /**
53
- * Get last order
54
- */
55
- protected function getOrder()
56
- {
57
- if (!$this->_order) {
58
- $session = Mage::getSingleton('checkout/session');
59
- $this->_order = $this->loadOrderById($session->getLastRealOrderId());
60
- }
61
- return $this->_order;
62
- }
63
-
64
- protected function loadOrderById($orderId)
65
- {
66
- return Mage::getModel('sales/order')->loadByIncrementId($orderId);
67
- }
68
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ *
7
+ * Class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Local
8
+ */
9
+ class Paymentwall_Paymentwall_Block_Checkout_Form_Method_Pwlocal extends Paymentwall_Paymentwall_Block_Checkout_Form_Method_Abstract
10
+ {
11
+ /**
12
+ * Set template for block
13
+ * @return void
14
+ */
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ $this->setPaymentModelName('pwlocal');
19
+ }
20
+
21
+ function getWidget()
22
+ {
23
+ $order = $this->getOrder();
24
+ $return = array(
25
+ 'content' => '',
26
+ 'status' => false
27
+ );
28
+
29
+ if ($order) {
30
+ try {
31
+ $model = $this->getPaymentModel();
32
+ $widget = $model->getPaymentWidget($order);
33
+
34
+ // Get widget iframe
35
+ $return['content'] = $widget->getHtmlCode(array(
36
+ 'frameborder' => '0',
37
+ 'width' => '100%',
38
+ 'height' => '600'
39
+ ));
40
+ $return['status'] = true;
41
+ } catch (Exception $e) {
42
+ Mage::logException($e);
43
+ $return['content'] = Mage::helper('paymentwall')->__('Errors, Please try again!');
44
+ }
45
+ } else {
46
+ $return['content'] = Mage::helper('paymentwall')->__('Order invalid'); //should redirect back to homepage
47
+ }
48
+
49
+ return $return;
50
+ }
51
+
52
+ /**
53
+ * Get last order
54
+ */
55
+ protected function getOrder()
56
+ {
57
+ if (!$this->_order) {
58
+ $session = Mage::getSingleton('checkout/session');
59
+ $this->_order = $this->loadOrderById($session->getLastRealOrderId());
60
+ }
61
+ return $this->_order;
62
+ }
63
+
64
+ protected function loadOrderById($orderId)
65
+ {
66
+ return Mage::getModel('sales/order')->loadByIncrementId($orderId);
67
+ }
68
  }
app/code/community/Paymentwall/Paymentwall/Block/Checkout/Info/Method/Pwbrick.php CHANGED
@@ -1,23 +1,15 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- *
7
- * Class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwbrick
8
- */
9
- class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwbrick extends Mage_Payment_Block_Info
10
- {
11
- protected function _construct()
12
- {
13
- parent::_construct();
14
- $this->setTemplate('paymentwall/checkout/info/method/pwbrick.phtml');
15
- }
16
-
17
- public function setInfo($info)
18
- {
19
- $this->setData('info', $info);
20
- $this->setData('method', $info->getMethodInstance());
21
- return $this;
22
- }
23
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ *
7
+ * Class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwbrick
8
+ */
9
+ class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwbrick extends Mage_Payment_Block_Info
10
+ {
11
+ protected function _construct()
12
+ {
13
+ parent::_construct();
14
+ }
 
 
 
 
 
 
 
 
15
  }
app/code/community/Paymentwall/Paymentwall/Block/Checkout/Info/Method/Pwlocal.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- *
7
- * Class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Local
8
- */
9
- class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwlocal extends Mage_Payment_Block_Info
10
- {
11
- protected function _construct()
12
- {
13
- parent::_construct();
14
- }
15
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ *
7
+ * Class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Local
8
+ */
9
+ class Paymentwall_Paymentwall_Block_Checkout_Info_Method_Pwlocal extends Mage_Payment_Block_Info
10
+ {
11
+ protected function _construct()
12
+ {
13
+ parent::_construct();
14
+ }
15
  }
app/code/community/Paymentwall/Paymentwall/Helper/Data.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- */
7
- class Paymentwall_Paymentwall_Helper_Data extends Mage_Core_Helper_Abstract
8
- {
9
-
10
- }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ */
7
+ class Paymentwall_Paymentwall_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+
10
+ }
app/code/community/Paymentwall/Paymentwall/Model/Method/Abstract.php CHANGED
@@ -1,203 +1,204 @@
1
- <?php
2
-
3
- if (!class_exists('Paymentwall_Config'))
4
- require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
-
6
- /**
7
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
8
- * @package Paymentwall_Paymentwall
9
- */
10
-
11
- /**
12
- * Class Paymentwall_Paymentwall_Model_Method_Abstract
13
- */
14
- class Paymentwall_Paymentwall_Model_Method_Abstract extends Mage_Payment_Model_Method_Abstract {
15
-
16
- protected $_code;
17
- protected $_logFile = 'paymentwall.log';
18
-
19
- /**
20
- * @param string $code
21
- */
22
- public function __construct($code = '') {
23
- if ($code) {
24
- $this->_code = 'paymentwall_' . $code;
25
- }
26
-
27
- $this->_formBlockType = 'paymentwall/checkout_form_method_' . $code;
28
- $this->_infoBlockType = 'paymentwall/checkout_info_method_' . $code;
29
- $this->setData('original_code', $code);
30
- }
31
-
32
- /**
33
- * Init paymentwall configs
34
- */
35
- public function initPaymentwallConfig() {
36
- Paymentwall_Config::getInstance()->set(array(
37
- 'api_type' => Paymentwall_Config::API_GOODS,
38
- 'public_key' => $this->getConfigData('paymentwall_public_key'),
39
- 'private_key' => $this->getConfigData('paymentwall_private_key')
40
- ));
41
- }
42
-
43
- public function getMethodCode() {
44
- return $this->_code;
45
- }
46
-
47
- /**
48
- * @param $order
49
- * @return array
50
- */
51
- protected function prepareUserProfile(Mage_Sales_Model_Order $order) {
52
- $billing = $order->getBillingAddress();
53
- $data = array(
54
- 'customer[city]' => $billing->getCity(),
55
- 'customer[state]' => $billing->getRegion(),
56
- 'customer[address]' => $billing->getStreetFull(),
57
- 'customer[country]' => $billing->getCountry(),
58
- 'customer[zip]' => $billing->getPostcode(),
59
- );
60
-
61
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
62
- // Load the customer's data
63
- $customer = Mage::getSingleton('customer/session')->getCustomer();
64
- $data = array_merge($data, array(
65
- 'customer[birthday]' => $customer->getDob() ? strtotime($customer->getDob()) : '',
66
- 'customer[sex]' => $customer->getGender() ? $customer->getGender() : '',
67
- 'customer[username]' => $customer->getEntityId(),
68
- 'customer[firstname]' => $customer->getFirstname(),
69
- 'customer[lastname]' => $customer->getLastname(),
70
- 'email' => $customer->getEmail(),
71
- 'history[registration_email]' => $customer->getEmail(),
72
- 'history[registration_email_verified]' => $customer->getIsActive(),
73
- 'history[registration_date]' => $customer->getCreatedAtTimestamp(),
74
- ));
75
- } else {
76
- $data = array_merge($data, array(
77
- 'customer[username]' => $billing->getEmail(),
78
- 'customer[firstname]' => $billing->getFirstname(),
79
- 'customer[lastname]' => $billing->getLastname(),
80
- ));
81
- }
82
-
83
- return $data;
84
- }
85
-
86
- public function callDeliveryApi($ref) {
87
- $this->initPaymentwallConfig();
88
- if ($this->getConfigData('paymentwall_delivery')) {
89
- $delivery = new Paymentwall_GenerericApiObject('delivery');
90
- $response = $delivery->post($this->prepareDeliveryData($this->getCurrentOrder(), $ref));
91
- }
92
- }
93
-
94
- /**
95
- * @param Mage_Sales_Model_Order $order
96
- * @param $ref
97
- * @return array
98
- */
99
- private function prepareDeliveryData(Mage_Sales_Model_Order $order, $ref) {
100
- $billing = $order->getBillingAddress();
101
- $shipping = $order->getShippingAddress();
102
-
103
- return array(
104
- 'payment_id' => $ref,
105
- 'type' => 'digital',
106
- 'status' => 'delivered',
107
- 'estimated_delivery_datetime' => date('Y/m/d H:i:s'),
108
- 'estimated_update_datetime' => date('Y/m/d H:i:s'),
109
- 'refundable' => 'yes',
110
- 'details' => 'Item will be delivered via email by ' . date('Y/m/d H:i:s'),
111
- 'shipping_address[email]' => $billing->getEmail(),
112
- 'shipping_address[firstname]' => $shipping->getFirstname(),
113
- 'shipping_address[lastname]' => $shipping->getLastname(),
114
- 'shipping_address[country]' => $shipping->getCountry(),
115
- 'shipping_address[street]' => $shipping->getStreetFull(),
116
- 'shipping_address[state]' => $shipping->getRegion(),
117
- 'shipping_address[phone]' => $shipping->getTelephone(),
118
- 'shipping_address[zip]' => $shipping->getPostcode(),
119
- 'shipping_address[city]' => $shipping->getCity(),
120
- 'reason' => 'none',
121
- 'is_test' => $this->getConfigData('paymentwall_istest') ? 1 : 0,
122
- );
123
- }
124
-
125
- /**
126
- * Make invoice for paid order
127
- * @param $pingback
128
- * @throws Exception
129
- * @throws bool
130
- */
131
- public function makeInvoice($pingback) {
132
- $order = $this->getCurrentOrder();
133
- if ($order) {
134
-
135
- $payment = $order->getPayment();
136
- $payment->setTransactionId($pingback->getReferenceId())
137
- ->setPreparedMessage('Invoice created by Paymentwall module')
138
- ->setShouldCloseParentTransaction(true)
139
- ->setIsTransactionClosed(0)
140
- ->capture(null);
141
- $order->save();
142
-
143
- // notify customer
144
- $invoice = $payment->getCreatedInvoice();
145
- if ($invoice && !$order->getEmailSent()) {
146
- $order->sendNewOrderEmail()
147
- ->addStatusHistoryComment(Mage::helper('paymentwall')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))
148
- ->setIsCustomerNotified(true)
149
- ->save();
150
- }
151
- }
152
- }
153
-
154
- /**
155
- * @param $pingback
156
- * @param $invoice
157
- */
158
- public function payInvoice(Paymentwall_Pingback $pingback, Mage_Sales_Model_Order_Invoice $invoice) {
159
- $order = $this->getCurrentOrder();
160
- if ($order) {
161
- $payment = $order->getPayment();
162
- $message = Mage::helper('sales')->__('Captured amount of %s online.', $order->getBaseCurrency()->formatTxt($invoice->getBaseGrandTotal()));
163
-
164
- $invoice->setTransactionId($pingback->getReferenceId())
165
- ->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
166
- $invoice->getOrder()->setIsInProcess(true);
167
- $invoice->getOrder()->addStatusHistoryComment($message)->setIsCustomerNotified(true);
168
-
169
- $payment->setTransactionId($pingback->getReferenceId())
170
- ->setLastTransId($pingback->getReferenceId())
171
- ->setCurrencyCode($order->getOrderCurrencyCode())
172
- ->setPreparedMessage('Payment approved by Paymentwall')
173
- ->setShouldCloseParentTransaction(true)
174
- ->setIsTransactionClosed(0)
175
- ->registerCaptureNotification();
176
- $invoice->pay();
177
- $order->setState('processing', true, "Payment has been received", false)->save();
178
-
179
- // notify customer
180
- if ($invoice && !$order->getEmailSent()) {
181
- $order->sendNewOrderEmail()
182
- ->addStatusHistoryComment(Mage::helper('paymentwall')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))
183
- ->setIsCustomerNotified(true)
184
- ->save();
185
- }
186
- }
187
- }
188
-
189
- /**
190
- * Log Function
191
- * @param $message
192
- */
193
- public function log($message, $section = '') {
194
- if ($this->getConfigData('debug_mode')) {
195
- if (!is_string($message)) {
196
- $message = var_export($message, true);
197
- }
198
- $message = "\n/********** " . $this->getCode() . ($section ? " " . $section : "") . " **********/\n" . $message;
199
- Mage::log($message, null, $this->_logFile);
200
- }
201
- }
202
-
 
203
  }
1
+ <?php
2
+
3
+ if (!class_exists('Paymentwall_Config'))
4
+ require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
+
6
+ /**
7
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
8
+ * @package Paymentwall_Paymentwall
9
+ */
10
+
11
+ /**
12
+ * Class Paymentwall_Paymentwall_Model_Method_Abstract
13
+ */
14
+ class Paymentwall_Paymentwall_Model_Method_Abstract extends Mage_Payment_Model_Method_Abstract {
15
+
16
+ protected $_code;
17
+ protected $_logFile = 'paymentwall.log';
18
+
19
+ /**
20
+ * @param string $code
21
+ */
22
+ public function __construct($code = '') {
23
+ if ($code) {
24
+ $this->_code = 'paymentwall_' . $code;
25
+ }
26
+
27
+ $this->_formBlockType = 'paymentwall/checkout_form_method_' . $code;
28
+ $this->_infoBlockType = 'paymentwall/checkout_info_method_' . $code;
29
+ $this->setData('original_code', $code);
30
+ }
31
+
32
+ /**
33
+ * Init paymentwall configs
34
+ */
35
+ public function initPaymentwallConfig() {
36
+ Paymentwall_Config::getInstance()->set(array(
37
+ 'api_type' => Paymentwall_Config::API_GOODS,
38
+ 'public_key' => $this->getConfigData('paymentwall_public_key'),
39
+ 'private_key' => $this->getConfigData('paymentwall_private_key')
40
+ ));
41
+ }
42
+
43
+ public function getMethodCode() {
44
+ return $this->_code;
45
+ }
46
+
47
+ /**
48
+ * @param $order
49
+ * @return array
50
+ */
51
+ protected function prepareUserProfile(Mage_Sales_Model_Order $order) {
52
+ $billing = $order->getBillingAddress();
53
+ $data = array(
54
+ 'customer[city]' => $billing->getCity(),
55
+ 'customer[state]' => $billing->getRegion(),
56
+ 'customer[address]' => $billing->getStreetFull(),
57
+ 'customer[country]' => $billing->getCountry(),
58
+ 'customer[zip]' => $billing->getPostcode(),
59
+ );
60
+
61
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
62
+ // Load the customer's data
63
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
64
+ $data = array_merge($data, array(
65
+ 'customer[birthday]' => $customer->getDob() ? strtotime($customer->getDob()) : '',
66
+ 'customer[sex]' => $customer->getGender() ? $customer->getGender() : '',
67
+ 'customer[username]' => $customer->getEntityId(),
68
+ 'customer[firstname]' => $customer->getFirstname(),
69
+ 'customer[lastname]' => $customer->getLastname(),
70
+ 'email' => $customer->getEmail(),
71
+ 'history[registration_email]' => $customer->getEmail(),
72
+ 'history[registration_email_verified]' => $customer->getIsActive(),
73
+ 'history[registration_date]' => $customer->getCreatedAtTimestamp(),
74
+ ));
75
+ } else {
76
+ $data = array_merge($data, array(
77
+ 'customer[username]' => $billing->getEmail(),
78
+ 'customer[firstname]' => $billing->getFirstname(),
79
+ 'customer[lastname]' => $billing->getLastname(),
80
+ ));
81
+ }
82
+
83
+ return $data;
84
+ }
85
+
86
+ public function callDeliveryApi($ref) {
87
+ $this->initPaymentwallConfig();
88
+ if ($this->getConfigData('paymentwall_delivery')) {
89
+ $delivery = new Paymentwall_GenerericApiObject('delivery');
90
+ $response = $delivery->post($this->prepareDeliveryData($this->getCurrentOrder(), $ref));
91
+ }
92
+ }
93
+
94
+ /**
95
+ * @param Mage_Sales_Model_Order $order
96
+ * @param $ref
97
+ * @return array
98
+ */
99
+ private function prepareDeliveryData(Mage_Sales_Model_Order $order, $ref) {
100
+ $billing = $order->getBillingAddress();
101
+ $shipping = $order->getShippingAddress();
102
+
103
+ return array(
104
+ 'payment_id' => $ref,
105
+ 'type' => 'digital',
106
+ 'status' => 'delivered',
107
+ 'estimated_delivery_datetime' => date('Y/m/d H:i:s'),
108
+ 'estimated_update_datetime' => date('Y/m/d H:i:s'),
109
+ 'refundable' => 'yes',
110
+ 'details' => 'Item will be delivered via email by ' . date('Y/m/d H:i:s'),
111
+ 'shipping_address[email]' => $billing->getEmail(),
112
+ 'shipping_address[firstname]' => $shipping->getFirstname(),
113
+ 'shipping_address[lastname]' => $shipping->getLastname(),
114
+ 'shipping_address[country]' => $shipping->getCountry(),
115
+ 'shipping_address[street]' => $shipping->getStreetFull(),
116
+ 'shipping_address[state]' => $shipping->getRegion(),
117
+ 'shipping_address[phone]' => $shipping->getTelephone(),
118
+ 'shipping_address[zip]' => $shipping->getPostcode(),
119
+ 'shipping_address[city]' => $shipping->getCity(),
120
+ 'reason' => 'none',
121
+ 'is_test' => $this->getConfigData('paymentwall_istest') ? 1 : 0,
122
+ );
123
+ }
124
+
125
+ /**
126
+ * Make invoice for paid order
127
+ * @param $refId
128
+ * @throws Exception
129
+ * @throws bool
130
+ */
131
+ public function makeInvoice($refId) {
132
+ $order = $this->getCurrentOrder();
133
+ if ($order) {
134
+
135
+ $payment = $order->getPayment();
136
+ $payment->setTransactionId($refId)
137
+ ->setPreparedMessage('Invoice created by Paymentwall module')
138
+ ->setShouldCloseParentTransaction(true)
139
+ ->setIsTransactionClosed(0)
140
+ ->capture(null);
141
+ $order->save();
142
+
143
+ // notify customer
144
+ $invoice = $payment->getCreatedInvoice();
145
+ if ($invoice && !$order->getEmailSent() && !Mage::getStoreConfig('system/smtp/disable')) {
146
+ $order->sendNewOrderEmail()
147
+ ->addStatusHistoryComment(Mage::helper('paymentwall')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))
148
+ ->setIsCustomerNotified(true)
149
+ ->save();
150
+ }
151
+ }
152
+ }
153
+
154
+ /**
155
+ * @param $refId
156
+ * @param $invoice
157
+ */
158
+ public function payInvoice($refId, Mage_Sales_Model_Order_Invoice $invoice) {
159
+ $order = $this->getCurrentOrder();
160
+
161
+ if ($order) {
162
+ $payment = $order->getPayment();
163
+ $message = Mage::helper('sales')->__('Captured amount of %s online.', $order->getBaseCurrency()->formatTxt($invoice->getBaseGrandTotal()));
164
+
165
+ $invoice->setTransactionId($refId)
166
+ ->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
167
+ $invoice->getOrder()->setIsInProcess(true);
168
+ $invoice->getOrder()->addStatusHistoryComment($message)->setIsCustomerNotified(true);
169
+
170
+ $payment->setTransactionId($refId)
171
+ ->setLastTransId($refId)
172
+ ->setCurrencyCode($order->getOrderCurrencyCode())
173
+ ->setPreparedMessage('Payment approved by Paymentwall')
174
+ ->setShouldCloseParentTransaction(true)
175
+ ->setIsTransactionClosed(0)
176
+ ->registerCaptureNotification($invoice->getBaseGrandTotal());
177
+ $invoice->pay();
178
+ $order->setState('processing', true, "Payment has been received", false)->save();
179
+
180
+ // notify customer
181
+ if ($invoice && !$order->getEmailSent() && !Mage::getStoreConfig('system/smtp/disable')) {
182
+ $order->sendNewOrderEmail()
183
+ ->addStatusHistoryComment(Mage::helper('paymentwall')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))
184
+ ->setIsCustomerNotified(true)
185
+ ->save();
186
+ }
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Log Function
192
+ * @param $message
193
+ */
194
+ public function log($message, $section = '') {
195
+ if ($this->getConfigData('debug_mode')) {
196
+ if (!is_string($message)) {
197
+ $message = var_export($message, true);
198
+ }
199
+ $message = "\n/********** " . $this->getCode() . ($section ? " " . $section : "") . " **********/\n" . $message;
200
+ Mage::log($message, null, $this->_logFile);
201
+ }
202
+ }
203
+
204
  }
app/code/community/Paymentwall/Paymentwall/Model/Method/Pwbrick.php CHANGED
@@ -1,271 +1,368 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall_Paymentwall
6
- *
7
- * Class Paymentwall_Paymentwall_Model_Method_Pwbrick
8
- */
9
- class Paymentwall_Paymentwall_Model_Method_Pwbrick extends Paymentwall_Paymentwall_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface {
10
-
11
- protected $_isInitializeNeeded = false;
12
- protected $_canUseInternal = false;
13
- protected $_canUseForMultishipping = false;
14
- protected $_canCapture = true;
15
- protected $_canAuthorize = false;
16
- protected $_canVoid = false;
17
- protected $_canReviewPayment = false;
18
- protected $_canCreateBillingAgreement = false;
19
-
20
- /**
21
- * Constructor method.
22
- * Set some internal properties
23
- */
24
- public function __construct() {
25
- parent::__construct('pwbrick');
26
- }
27
-
28
- /**
29
- * Prepare data for payment
30
- * @param $payment
31
- * @return array
32
- */
33
- public function prepareCardInfo($payment) {
34
-
35
- $order = $payment->getOrder();
36
- $info = $this->getInfoInstance();
37
-
38
- $this->setCurrentOrder($order);
39
-
40
- return array(
41
- 'email' => $order->getBillingAddress()->getEmail(),
42
- 'amount' => $order->getGrandTotal(),
43
- 'currency' => $order->getOrderCurrencyCode(),
44
- 'token' => $info->getAdditionalInformation('brick_token'),
45
- 'fingerprint' => $info->getAdditionalInformation('brick_fingerprint'),
46
- 'description' => 'Order #' . $order->getIncrementId(),
47
- 'plan' => $order->getIncrementId(),
48
- );
49
- }
50
-
51
- /**
52
- * @param $data
53
- * @return mixed
54
- */
55
- public function assignData($data) {
56
-
57
- if (!($data instanceof Varien_Object)) {
58
- $data = new Varien_Object($data);
59
- }
60
-
61
- $info = $this->getInfoInstance();
62
- $info->setAdditionalInformation('brick_token', $data->getBrickToken())
63
- ->setAdditionalInformation('brick_fingerprint', $data->getBrickFingerprint());
64
-
65
- return $this;
66
- }
67
-
68
- /**
69
- * @param $payment
70
- * @param $amount
71
- * @return Mage_Payment_Model_Abstract|void
72
- * @throws Mage_Core_Exception
73
- */
74
- public function capture(Varien_Object $payment, $amount) {
75
-
76
- $this->initPaymentwallConfig();
77
-
78
- $payment->setAmount($amount);
79
-
80
- $charge = new Paymentwall_Charge();
81
- $charge->create(array_merge(
82
- $this->prepareCardInfo($payment),
83
- $this->prepareUserProfile($payment->getOrder()), // for User Profile API
84
- $this->getExtraData()
85
- ));
86
-
87
- $response = $charge->getPublicData();
88
- // Debug
89
- $this->log($response, 'Charge response');
90
-
91
- if ($charge->isSuccessful()) {
92
- if ($charge->isCaptured()) {
93
-
94
- $payment->setTransactionId($charge->getId());
95
- $payment->setIsTransactionClosed(0);
96
-
97
- // store token data
98
- $payment->setTransactionAdditionalInfo('saved_token', Mage::helper('core')->encrypt($charge->getCard()->getToken()));
99
- } elseif ($charge->isUnderReview()) {
100
- $payment->setIsTransactionPending(true);
101
- }
102
- } else {
103
- $payment->setIsTransactionPending(true)
104
- ->setIsFraudDetected(true);
105
- $errors = json_decode($response, true);
106
- $this->log($errors, 'Charge error response');
107
- $strErrors = Mage::helper('paymentwall')->__("Brick error(s):");
108
- $strErrors .= "\n - Code #{$errors['error']['code']}: " . Mage::helper('paymentwall')->__($errors['error']['message']);
109
- Mage::throwException($strErrors);
110
- }
111
-
112
- return $this;
113
- }
114
-
115
- /**
116
- * Validate data
117
- *
118
- * @param Mage_Payment_Model_Recurring_Profile $profile
119
- * @throws Mage_Core_Exception
120
- */
121
- public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) {
122
-
123
- }
124
-
125
- /**
126
- * Submit to the gateway
127
- *
128
- * @param Mage_Payment_Model_Recurring_Profile $profile
129
- * @param Mage_Payment_Model_Info $payment
130
- * @throws Exception
131
- */
132
- public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $payment) {
133
-
134
- $this->initPaymentwallConfig();
135
- $quote = Mage::getSingleton('checkout/session')->getQuote();
136
-
137
- $paymentwallSubscription = new Paymentwall_Subscription();
138
- $paymentwallSubscription->create(array_merge(
139
- $this->prepareSubscriptionData($profile, $quote),
140
- $this->prepareUserProfile($payment->getOrder()),
141
- $this->getExtraData()
142
- ));
143
-
144
- $response = json_decode($paymentwallSubscription->GetRawResponseData());
145
- $this->log($response, 'Subscription Response Data');
146
-
147
- if ($paymentwallSubscription->isSuccessful() && $response->object == 'subscription') {
148
-
149
- $profile->setReferenceId($response->id);
150
- if ($response->active) {
151
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
152
- } else {
153
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_PENDING);
154
- }
155
- $profile->save();
156
- } else {
157
- $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_UNKNOWN);
158
- $profile->save();
159
- }
160
- }
161
-
162
- /**
163
- * @param Mage_Payment_Model_Recurring_Profile $profile
164
- * @param $quote
165
- * @return array
166
- */
167
- protected function prepareSubscriptionData(Mage_Payment_Model_Recurring_Profile $profile, $quote) {
168
-
169
- $post = Mage::app()->getRequest()->getPost('payment');
170
-
171
- return array_merge(
172
- array(
173
- 'token' => $post['brick_token'], // Onetime token
174
- 'amount' => $profile->getBillingAmount(),
175
- 'currency' => $profile->getCurrencyCode(),
176
- 'email' => $quote->getBillingAddress()->getEmail(),
177
- 'fingerprint' => $post['brick_fingerprint'],
178
- 'description' => $profile->getScheduleDescription(),
179
- 'plan' => $profile->getInternalReferenceId(),
180
- 'period' => $profile->getPeriodUnit(),
181
- 'period_duration' => $profile->getPeriodFrequency(),
182
- ),
183
- $this->prepareTrialData($profile)
184
- );
185
- }
186
-
187
- /**
188
- * @param Mage_Payment_Model_Recurring_Profile $profile
189
- * @return array
190
- */
191
- protected function prepareTrialData(Mage_Payment_Model_Recurring_Profile $profile) {
192
-
193
- if (!$profile->getTrialPeriodFrequency()) {
194
- return array();
195
- }
196
-
197
- return array(
198
- 'trial[amount]' => $profile->getTrialBillingAmount() ? $profile->getTrialBillingAmount() : 0,
199
- 'trial[currency]' => $profile->getCurrencyCode(),
200
- 'trial[period]' => $profile->getTrialPeriodUnit(),
201
- 'trial[period_duration]' => $profile->getTrialPeriodFrequency(),
202
- );
203
- }
204
-
205
- /**
206
- * Fetch details
207
- *
208
- * @param string $referenceId
209
- * @param Varien_Object $result
210
- * @return Varien_Object
211
- */
212
- public function getRecurringProfileDetails($referenceId, Varien_Object $result) {
213
-
214
- $this->initPaymentwallConfig();
215
-
216
- $paymentwallSubscription = new Paymentwall_Subscription($referenceId);
217
- $paymentwallSubscription->get();
218
-
219
- $subscriptionData = json_decode($paymentwallSubscription->GetRawResponseData());
220
- $result->setData($subscriptionData);
221
-
222
- }
223
-
224
- /**
225
- * Check whether can get recurring profile details
226
- *
227
- * @return bool
228
- */
229
- public function canGetRecurringProfileDetails() {
230
- return true;
231
- }
232
-
233
- /**
234
- * Update data
235
- *
236
- * @param Mage_Payment_Model_Recurring_Profile $profile
237
- */
238
- public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) {
239
- // TODO: Implement updateRecurringProfile() method.
240
- }
241
-
242
- /**
243
- * Manage status
244
- *
245
- * @param Mage_Payment_Model_Recurring_Profile $profile
246
- */
247
- public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) {
248
-
249
- $this->initPaymentwallConfig();
250
-
251
- $paymentwallSubscription = new Paymentwall_Subscription($profile->getReferenceId());
252
-
253
- if ($profile->getNewState() == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED) {
254
- $paymentwallSubscription->cancel();
255
- }
256
- }
257
-
258
- public function getExtraData() {
259
-
260
- $customerId = $_SERVER['REMOTE_ADDR'];
261
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
262
- $customer = Mage::getSingleton('customer/session')->getCustomer();
263
- $customerId = $customer->getId();
264
- }
265
-
266
- return array(
267
- 'custom[integration_module]' => 'magento',
268
- 'uid' => $customerId
269
- );
270
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall_Paymentwall
6
+ *
7
+ * Class Paymentwall_Paymentwall_Model_Method_Pwbrick
8
+ */
9
+ class Paymentwall_Paymentwall_Model_Method_Pwbrick extends Paymentwall_Paymentwall_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface
10
+ {
11
+
12
+ protected $_isInitializeNeeded = false;
13
+ protected $_canUseInternal = false;
14
+ protected $_canUseForMultishipping = false;
15
+ protected $_canCapture = true;
16
+ protected $_canAuthorize = false;
17
+ protected $_canVoid = false;
18
+ protected $_canReviewPayment = false;
19
+ protected $_canCreateBillingAgreement = false;
20
+
21
+ /**
22
+ * Constructor method.
23
+ * Set some internal properties
24
+ */
25
+ public function __construct()
26
+ {
27
+ parent::__construct('pwbrick');
28
+ }
29
+
30
+ /**
31
+ * @return null|string
32
+ * @return null|string
33
+ */
34
+ public function getOrderPlaceRedirectUrl()
35
+ {
36
+ if (!Mage::getModel('core/session')->getHas3DS()) {
37
+ return null;
38
+ }
39
+ return Mage::getUrl('paymentwall/payment/threeds', array('_secure' => true));
40
+ }
41
+
42
+ /**
43
+ * Prepare data for payment
44
+ * @param $payment
45
+ * @return array
46
+ */
47
+ public function prepareCardInfo($payment)
48
+ {
49
+ $order = $payment->getOrder();
50
+ $info = $this->getInfoInstance();
51
+
52
+ $this->setCurrentOrder($order);
53
+
54
+ return array(
55
+ 'email' => $order->getBillingAddress()->getEmail(),
56
+ 'amount' => $order->getGrandTotal(),
57
+ 'currency' => $order->getOrderCurrencyCode(),
58
+ 'token' => $info->getAdditionalInformation('brick_token'),
59
+ 'fingerprint' => $info->getAdditionalInformation('brick_fingerprint'),
60
+ 'description' => 'Order #' . $order->getIncrementId(),
61
+ 'plan' => $order->getIncrementId(),
62
+ );
63
+ }
64
+
65
+ /**
66
+ * @param $data
67
+ * @return mixed
68
+ */
69
+ public function assignData($data)
70
+ {
71
+ if (!($data instanceof Varien_Object)) {
72
+ $data = new Varien_Object($data);
73
+ }
74
+
75
+ $info = $this->getInfoInstance();
76
+ $info->setAdditionalInformation('brick_token', $data->getBrickToken())
77
+ ->setAdditionalInformation('brick_fingerprint', $data->getBrickFingerprint());
78
+
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * @param Varien_Object $payment
84
+ * @param $amount
85
+ * @return Mage_Payment_Model_Abstract|void
86
+ * @throws Mage_Core_Exception
87
+ */
88
+ public function capture(Varien_Object $payment, $amount)
89
+ {
90
+ $this->initPaymentwallConfig();
91
+ $payment->setAmount($amount);
92
+ $order = $payment->getOrder();
93
+
94
+ $charge = new Paymentwall_Charge();
95
+ $chargeData = array_merge(
96
+ $this->prepareCardInfo($payment),
97
+ $this->prepareUserProfile($order), // for User Profile API
98
+ $this->getExtraData()
99
+ );
100
+ $charge->create($chargeData);
101
+
102
+ $rawResponse = json_decode($charge->getRawResponseData(), true);
103
+ $response = $charge->getPublicData();
104
+ // Debug
105
+ $this->log($response, 'Charge response');
106
+
107
+ if ($charge->isSuccessful() && empty($rawResponse['secure'])) {
108
+ if ($charge->isCaptured()) {
109
+
110
+ $payment->setTransactionId($charge->getId());
111
+ $payment->setIsTransactionClosed(0);
112
+
113
+ // store token data
114
+ $payment->setTransactionAdditionalInfo('saved_token', Mage::helper('core')->encrypt($charge->getCard()->getToken()));
115
+ } elseif ($charge->isUnderReview()) {
116
+ $payment->setIsTransactionPending(true);
117
+ }
118
+ } elseif (!empty($rawResponse['secure'])) {
119
+ $payment->setIsTransactionPending(true);
120
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
121
+ 'pending_payment', '3D Secure Auth Now Taking Place')->save();
122
+ Mage::getModel('core/session')
123
+ ->setBrickQuoteId($order->getQuoteId())
124
+ ->setBrickOrderId($order->getId())
125
+ ->setHas3DS(true)
126
+ ->setSecureFormHtml($rawResponse['secure']['formHTML'])
127
+ ->setChargeOrderId($order->getIncrementId())
128
+ ->setChargeData(json_encode($chargeData));
129
+ } else {
130
+ $payment->setIsTransactionPending(true)
131
+ ->setIsFraudDetected(true);
132
+ $errors = json_decode($response, true);
133
+ $this->log($errors, 'Charge error response');
134
+ $strErrors = Mage::helper('paymentwall')->__("Brick error(s):");
135
+ $strErrors .= "\n - Code #{$errors['error']['code']}: " . Mage::helper('paymentwall')->__($errors['error']['message']);
136
+ Mage::throwException($strErrors);
137
+ }
138
+
139
+ return $this;
140
+ }
141
+
142
+ /**
143
+ * Validate data
144
+ *
145
+ * @param Mage_Payment_Model_Recurring_Profile $profile
146
+ * @throws Mage_Core_Exception
147
+ */
148
+ public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
149
+ {
150
+
151
+ }
152
+
153
+ /**
154
+ * Submit to the gateway
155
+ *
156
+ * @param Mage_Payment_Model_Recurring_Profile $profile
157
+ * @param Mage_Payment_Model_Info $payment
158
+ * @throws Exception
159
+ */
160
+ public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $payment)
161
+ {
162
+ $this->initPaymentwallConfig();
163
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
164
+
165
+ $paymentwallSubscription = new Paymentwall_Subscription();
166
+ $paymentwallSubscription->create(array_merge(
167
+ $this->prepareSubscriptionData($profile, $quote),
168
+ $this->prepareUserProfile($payment->getOrder()),
169
+ $this->getExtraData()
170
+ ));
171
+
172
+ $response = json_decode($paymentwallSubscription->GetRawResponseData());
173
+ $this->log($response, 'Subscription Response Data');
174
+
175
+ if ($paymentwallSubscription->isSuccessful() && $response->object == 'subscription') {
176
+ $profile->setReferenceId($response->id);
177
+ if ($response->active) {
178
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
179
+ } else {
180
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_PENDING);
181
+ }
182
+ $profile->save();
183
+ } else {
184
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_UNKNOWN);
185
+ $profile->save();
186
+ }
187
+ }
188
+
189
+ /**
190
+ * @param Mage_Payment_Model_Recurring_Profile $profile
191
+ * @param $quote
192
+ * @return array
193
+ */
194
+ protected function prepareSubscriptionData(Mage_Payment_Model_Recurring_Profile $profile, $quote)
195
+ {
196
+ $post = Mage::app()->getRequest()->getPost('payment');
197
+
198
+ return array_merge(
199
+ array(
200
+ 'token' => $post['brick_token'], // Onetime token
201
+ 'amount' => $profile->getBillingAmount(),
202
+ 'currency' => $profile->getCurrencyCode(),
203
+ 'email' => $quote->getBillingAddress()->getEmail(),
204
+ 'fingerprint' => $post['brick_fingerprint'],
205
+ 'description' => $profile->getScheduleDescription(),
206
+ 'plan' => $profile->getInternalReferenceId(),
207
+ 'period' => $profile->getPeriodUnit(),
208
+ 'period_duration' => $profile->getPeriodFrequency(),
209
+ ),
210
+ $this->prepareTrialData($profile)
211
+ );
212
+ }
213
+
214
+ /**
215
+ * @param Mage_Payment_Model_Recurring_Profile $profile
216
+ * @return array
217
+ */
218
+ protected function prepareTrialData(Mage_Payment_Model_Recurring_Profile $profile)
219
+ {
220
+ if (!$profile->getTrialPeriodFrequency()) {
221
+ return array();
222
+ }
223
+
224
+ return array(
225
+ 'trial[amount]' => $profile->getTrialBillingAmount() ? $profile->getTrialBillingAmount() : 0,
226
+ 'trial[currency]' => $profile->getCurrencyCode(),
227
+ 'trial[period]' => $profile->getTrialPeriodUnit(),
228
+ 'trial[period_duration]' => $profile->getTrialPeriodFrequency(),
229
+ );
230
+ }
231
+
232
+ /**
233
+ * Fetch details
234
+ *
235
+ * @param string $referenceId
236
+ * @param Varien_Object $result
237
+ * @return Varien_Object
238
+ */
239
+ public function getRecurringProfileDetails($referenceId, Varien_Object $result)
240
+ {
241
+ $this->initPaymentwallConfig();
242
+
243
+ $paymentwallSubscription = new Paymentwall_Subscription($referenceId);
244
+ $paymentwallSubscription->get();
245
+
246
+ $subscriptionData = json_decode($paymentwallSubscription->GetRawResponseData());
247
+ $result->setData($subscriptionData);
248
+
249
+ }
250
+
251
+ /**
252
+ * Check whether can get recurring profile details
253
+ *
254
+ * @return bool
255
+ */
256
+ public function canGetRecurringProfileDetails()
257
+ {
258
+ return true;
259
+ }
260
+
261
+ /**
262
+ * Update data
263
+ *
264
+ * @param Mage_Payment_Model_Recurring_Profile $profile
265
+ */
266
+ public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
267
+ {
268
+ // TODO: Implement updateRecurringProfile() method.
269
+ }
270
+
271
+ /**
272
+ * Manage status
273
+ *
274
+ * @param Mage_Payment_Model_Recurring_Profile $profile
275
+ */
276
+ public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
277
+ {
278
+ $this->initPaymentwallConfig();
279
+
280
+ $paymentwallSubscription = new Paymentwall_Subscription($profile->getReferenceId());
281
+
282
+ if ($profile->getNewState() == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED) {
283
+ $paymentwallSubscription->cancel();
284
+ }
285
+ }
286
+
287
+ public function getExtraData()
288
+ {
289
+ $customerId = $_SERVER['REMOTE_ADDR'];
290
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
291
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
292
+ $customerId = $customer->getId();
293
+ }
294
+
295
+ return array(
296
+ 'custom[integration_module]' => 'magento',
297
+ 'uid' => $customerId,
298
+ 'secure_redirect_url' => Mage::getUrl('paymentwall/payment/threeds', array('_secure' => true))
299
+ );
300
+ }
301
+
302
+ /**
303
+ * @param Mage_Sales_Model_Order $order
304
+ * @param $chargeData
305
+ * @return bool
306
+ * @throws Exception
307
+ */
308
+ public function processOrderAfter3Ds($order, $chargeData)
309
+ {
310
+ $this->setCurrentOrder($order);
311
+ $this->initPaymentwallConfig();
312
+
313
+ $charge = new Paymentwall_Charge();
314
+ $charge->create($chargeData);
315
+ $coreSession = Mage::getSingleton('core/session');
316
+
317
+ $response = $charge->getPublicData();
318
+ // Debug
319
+ $this->log($response, 'Charge response');
320
+
321
+ if ($charge->isSuccessful()) {
322
+ if ($charge->isCaptured()) {
323
+ $invoice = $order->getInvoiceCollection()
324
+ ->addAttributeToSort('created_at', 'DSC')
325
+ ->setPage(1, 1)
326
+ ->getFirstItem();
327
+
328
+ if ($invoice->getId()) {
329
+ $this->payInvoice($charge->getId(), $invoice);
330
+ } else {
331
+ $this->makeInvoice($charge->getId());
332
+ }
333
+ } elseif ($charge->isUnderReview()) {
334
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)
335
+ ->save();
336
+ }
337
+
338
+ // Set prepare data for success page
339
+ Mage::getSingleton('checkout/session')
340
+ ->setLastOrderId($coreSession->getBrickOrderId())
341
+ ->setLastQuoteId($coreSession->getBrickQuoteId())
342
+ ->setLastSuccessQuoteId($coreSession->getBrickQuoteId());
343
+
344
+ // Clear session
345
+ $coreSession
346
+ ->setBrickOrderId(null)
347
+ ->setBrickQuoteId(false)
348
+ ->setHas3DS(false)
349
+ ->setSecureFormHtml(null)
350
+ ->setChargeOrderId(null)
351
+ ->setChargeData(null);
352
+ // Debug
353
+ $this->log($response, 'Charge success');
354
+ return true;
355
+ } else {
356
+ $order->getPayment()
357
+ ->setIsTransactionPending(true)
358
+ ->setIsFraudDetected(true);
359
+ $errors = json_decode($response, true);
360
+ $this->log($errors, 'Charge error response');
361
+ $strErrors = Mage::helper('paymentwall')->__("Brick error(s):");
362
+ $strErrors .= "\n - Code #{$errors['error']['code']}: " . Mage::helper('paymentwall')->__($errors['error']['message']);
363
+ Mage::getSingleton('core/session')->addError($strErrors);
364
+ }
365
+
366
+ return false;
367
+ }
368
  }
app/code/community/Paymentwall/Paymentwall/Model/Method/Pwlocal.php CHANGED
@@ -1,70 +1,70 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento\Model\Method
6
- */
7
- class Paymentwall_Paymentwall_Model_Method_Pwlocal extends Paymentwall_Paymentwall_Model_Method_Abstract {
8
-
9
- protected $_isInitializeNeeded = false;
10
- protected $_canUseInternal = false;
11
- protected $_canUseForMultishipping = false;
12
- protected $_canCapture = true;
13
- protected $_canAuthorize = true;
14
- protected $_canVoid = false;
15
- protected $_canReviewPayment = false;
16
- protected $_canCreateBillingAgreement = false;
17
-
18
- /**
19
- * Constructor method.
20
- * Set some internal properties
21
- */
22
- public function __construct() {
23
- parent::__construct('pwlocal');
24
- }
25
-
26
- public function getOrderPlaceRedirectUrl() {
27
- return Mage::getUrl('paymentwall/payment/pwlocal', array('_secure' => true));
28
- }
29
-
30
- /**
31
- * Generate Paymentwall Widget
32
- * @param $order
33
- * @return Paymentwall_Widget
34
- */
35
- public function getPaymentWidget(Mage_Sales_Model_Order $order) {
36
- $this->initPaymentwallConfig();
37
-
38
- $customerId = $_SERVER['REMOTE_ADDR'];
39
-
40
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
41
- $customer = Mage::getSingleton('customer/session')->getCustomer();
42
- $customerId = $customer->getId();
43
- }
44
-
45
- $widget = new Paymentwall_Widget(
46
- $customerId,
47
- $this->getConfigData('paymentwall_widget_code'),
48
- array(
49
- new Paymentwall_Product(
50
- $order->getIncrementId(),
51
- $order->getGrandTotal(),
52
- $order->getOrderCurrencyCode(),
53
- 'Order id #' . $order->getIncrementId(),
54
- Paymentwall_Product::TYPE_FIXED
55
- )
56
- ),
57
- array_merge(
58
- array(
59
- 'email' => $order->getCustomerEmail(),
60
- 'success_url' => $this->getConfigData('paymentwall_url'),
61
- 'test_mode' => (int)$this->getConfigData('paymentwall_istest'),
62
- 'integration_module' => 'magento'
63
- ),
64
- $this->prepareUserProfile($order) // for User Profile API
65
- )
66
- );
67
-
68
- return $widget;
69
- }
70
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento\Model\Method
6
+ */
7
+ class Paymentwall_Paymentwall_Model_Method_Pwlocal extends Paymentwall_Paymentwall_Model_Method_Abstract {
8
+
9
+ protected $_isInitializeNeeded = false;
10
+ protected $_canUseInternal = false;
11
+ protected $_canUseForMultishipping = false;
12
+ protected $_canCapture = true;
13
+ protected $_canAuthorize = true;
14
+ protected $_canVoid = false;
15
+ protected $_canReviewPayment = false;
16
+ protected $_canCreateBillingAgreement = false;
17
+
18
+ /**
19
+ * Constructor method.
20
+ * Set some internal properties
21
+ */
22
+ public function __construct() {
23
+ parent::__construct('pwlocal');
24
+ }
25
+
26
+ public function getOrderPlaceRedirectUrl() {
27
+ return Mage::getUrl('paymentwall/payment/pwlocal', array('_secure' => true));
28
+ }
29
+
30
+ /**
31
+ * Generate Paymentwall Widget
32
+ * @param $order
33
+ * @return Paymentwall_Widget
34
+ */
35
+ public function getPaymentWidget(Mage_Sales_Model_Order $order) {
36
+ $this->initPaymentwallConfig();
37
+
38
+ $customerId = $_SERVER['REMOTE_ADDR'];
39
+
40
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
41
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
42
+ $customerId = $customer->getId();
43
+ }
44
+
45
+ $widget = new Paymentwall_Widget(
46
+ $customerId,
47
+ $this->getConfigData('paymentwall_widget_code'),
48
+ array(
49
+ new Paymentwall_Product(
50
+ $order->getIncrementId(),
51
+ $order->getGrandTotal(),
52
+ $order->getOrderCurrencyCode(),
53
+ 'Order id #' . $order->getIncrementId(),
54
+ Paymentwall_Product::TYPE_FIXED
55
+ )
56
+ ),
57
+ array_merge(
58
+ array(
59
+ 'email' => $order->getCustomerEmail(),
60
+ 'success_url' => $this->getConfigData('paymentwall_url'),
61
+ 'test_mode' => (int)$this->getConfigData('paymentwall_istest'),
62
+ 'integration_module' => 'magento'
63
+ ),
64
+ $this->prepareUserProfile($order) // for User Profile API
65
+ )
66
+ );
67
+
68
+ return $widget;
69
+ }
70
  }
app/code/community/Paymentwall/Paymentwall/Model/Pingback.php CHANGED
@@ -1,135 +1,138 @@
1
- <?php
2
-
3
- if (!class_exists('Paymentwall_Config'))
4
- require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
-
6
- /**
7
- * @author Paymentwall Inc <devsupport@paymentwall.com>
8
- * @package Paymentwall\ThirdpartyIntegration\Magento
9
- */
10
- class Paymentwall_Paymentwall_Model_Pingback extends Mage_Core_Model_Abstract {
11
- const DEFAULT_PINGBACK_RESPONSE = 'OK';
12
-
13
- /**
14
- * Handle pingback
15
- * @return string
16
- */
17
- public function handlePingback() {
18
- // Load paymentwall configs
19
- Mage::getModel('paymentwall/method_pwlocal')->initPaymentwallConfig();
20
-
21
- $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
22
-
23
- if ($pingback->validate()) {
24
-
25
- if ($this->isRecurring($pingback)) {
26
- return $this->processPingbackRecurringProfile($pingback);
27
- } else {
28
- return $this->processPingbackOrder($pingback);
29
- }
30
- } else {
31
- return $pingback->getErrorSummary();
32
- }
33
- return '';
34
- }
35
-
36
- /**
37
- * @param Paymentwall_Pingback $pingback
38
- * @return string
39
- */
40
- protected function processPingbackRecurringProfile(Paymentwall_Pingback $pingback) {
41
- $recurringProfile = Mage::getModel('sales/recurring_profile')->loadByInternalReferenceId($pingback->getProductId());
42
-
43
- if ($recurringProfile->getId()) {
44
- try {
45
- if ($pingback->isDeliverable()) {
46
- $recurringProfile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)->save();
47
- } elseif ($pingback->isCancelable()) {
48
- $recurringProfile->cancel()->save();
49
- }
50
- return self::DEFAULT_PINGBACK_RESPONSE;
51
- } catch (Exception $e) {
52
- Mage::log($e->getMessage());
53
- $result = 'Internal server error';
54
- $result .= ' ' . $e->getMessage();
55
- return $result;
56
- }
57
- } else {
58
- return 'The Recurring Profile is invalid';
59
- }
60
-
61
- }
62
-
63
- /**
64
- * @param Paymentwall_Pingback $pingback
65
- * @return string
66
- */
67
- protected function processPingbackOrder(Paymentwall_Pingback $pingback) {
68
- $order = Mage::getModel('sales/order')->loadByIncrementId($pingback->getProductId());
69
- if ($order->getId()) {
70
-
71
- $payment = $order->getPayment();
72
- $invoice = $order->getInvoiceCollection()
73
- ->addAttributeToSort('created_at', 'DSC')
74
- ->setPage(1, 1)
75
- ->getFirstItem();
76
-
77
- try {
78
- if ($pingback->isDeliverable()) {
79
-
80
- if(
81
- $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
82
- || $order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE
83
- ){
84
- return self::DEFAULT_PINGBACK_RESPONSE;
85
- }
86
-
87
- $paymentModel = $payment->getMethodInstance();
88
- $paymentModel->setCurrentOrder($order)
89
- ->callDeliveryApi($pingback->getReferenceId());
90
-
91
- if ($invoice->getId()) {
92
- $paymentModel->payInvoice($pingback, $invoice);
93
- } else {
94
- $paymentModel->makeInvoice($pingback);
95
- }
96
-
97
- } elseif ($pingback->isCancelable()) {
98
-
99
- $payment->cancel()->save();
100
- if($invoice->getId()){
101
- $invoice->cancel();
102
- $order->setIsInProcess(true);
103
- $transactionSave = Mage::getModel('core/resource_transaction')
104
- ->addObject($invoice)
105
- ->addObject($order)
106
- ->save();
107
- }
108
-
109
- $order->registerCancellation(Mage::helper('sales')->__('Order marked as cancelled by Paymentwall.'))
110
- ->save();
111
-
112
- } elseif ($pingback->isUnderReview()) {
113
- $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)
114
- ->save();
115
- }
116
- return self::DEFAULT_PINGBACK_RESPONSE;
117
- } catch (Exception $e) {
118
- Mage::log($e->getMessage());
119
- $result = 'Internal server error';
120
- $result .= ' ' . $e->getMessage();
121
- return $result;
122
- }
123
- } else {
124
- return 'The Order is invalid';
125
- }
126
- }
127
-
128
- /**
129
- * @param Paymentwall_Pingback $pingback
130
- * @return bool
131
- */
132
- protected function isRecurring(Paymentwall_Pingback $pingback) {
133
- return $pingback->getProductPeriodLength() > 0;
134
- }
 
 
 
135
  }
1
+ <?php
2
+
3
+ if (!class_exists('Paymentwall_Config'))
4
+ require_once Mage::getBaseDir('lib') . '/paymentwall-php/lib/paymentwall.php';
5
+
6
+ /**
7
+ * @author Paymentwall Inc <devsupport@paymentwall.com>
8
+ * @package Paymentwall\ThirdpartyIntegration\Magento
9
+ */
10
+ class Paymentwall_Paymentwall_Model_Pingback extends Mage_Core_Model_Abstract
11
+ {
12
+ const DEFAULT_PINGBACK_RESPONSE = 'OK';
13
+
14
+ /**
15
+ * Handle pingback
16
+ * @return string
17
+ */
18
+ public function handlePingback()
19
+ {
20
+ // Load paymentwall configs
21
+ Mage::getModel('paymentwall/method_pwlocal')->initPaymentwallConfig();
22
+
23
+ $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
24
+
25
+ if ($pingback->validate()) {
26
+
27
+ if ($this->isRecurring($pingback)) {
28
+ return $this->processPingbackRecurringProfile($pingback);
29
+ } else {
30
+ return $this->processPingbackOrder($pingback);
31
+ }
32
+ } else {
33
+ return $pingback->getErrorSummary();
34
+ }
35
+ return '';
36
+ }
37
+
38
+ /**
39
+ * @param Paymentwall_Pingback $pingback
40
+ * @return string
41
+ */
42
+ protected function processPingbackRecurringProfile(Paymentwall_Pingback $pingback)
43
+ {
44
+ $recurringProfile = Mage::getModel('sales/recurring_profile')->loadByInternalReferenceId($pingback->getProductId());
45
+
46
+ if ($recurringProfile->getId()) {
47
+ try {
48
+ if ($pingback->isDeliverable()) {
49
+ $recurringProfile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)->save();
50
+ } elseif ($pingback->isCancelable()) {
51
+ $recurringProfile->cancel()->save();
52
+ }
53
+ return self::DEFAULT_PINGBACK_RESPONSE;
54
+ } catch (Exception $e) {
55
+ Mage::log($e->getMessage());
56
+ $result = 'Internal server error';
57
+ $result .= ' ' . $e->getMessage();
58
+ return $result;
59
+ }
60
+ } else {
61
+ return 'The Recurring Profile is invalid';
62
+ }
63
+
64
+ }
65
+
66
+ /**
67
+ * @param Paymentwall_Pingback $pingback
68
+ * @return string
69
+ */
70
+ protected function processPingbackOrder(Paymentwall_Pingback $pingback)
71
+ {
72
+ $order = Mage::getModel('sales/order')->loadByIncrementId($pingback->getProductId());
73
+ if ($order->getId()) {
74
+
75
+ $payment = $order->getPayment();
76
+ $invoice = $order->getInvoiceCollection()
77
+ ->addAttributeToSort('created_at', 'DSC')
78
+ ->setPage(1, 1)
79
+ ->getFirstItem();
80
+
81
+ try {
82
+ if ($pingback->isDeliverable()) {
83
+ if (
84
+ $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
85
+ || $order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE
86
+ ) {
87
+ return self::DEFAULT_PINGBACK_RESPONSE;
88
+ }
89
+
90
+ $paymentModel = $payment->getMethodInstance();
91
+ $paymentModel->setCurrentOrder($order)
92
+ ->callDeliveryApi($pingback->getReferenceId());
93
+
94
+ if ($invoice->getId()) {
95
+ $paymentModel->payInvoice($pingback->getReferenceId(), $invoice);
96
+ } else {
97
+ $paymentModel->makeInvoice($pingback->getReferenceId());
98
+ }
99
+
100
+ } elseif ($pingback->isCancelable()) {
101
+ $payment->cancel()->save();
102
+ if ($invoice->getId()) {
103
+ $invoice->cancel();
104
+ $order->setIsInProcess(true);
105
+ $transactionSave = Mage::getModel('core/resource_transaction')
106
+ ->addObject($invoice)
107
+ ->addObject($order)
108
+ ->save();
109
+ }
110
+
111
+ $order->registerCancellation(Mage::helper('sales')->__('Order marked as cancelled by Paymentwall.'))
112
+ ->save();
113
+
114
+ } elseif ($pingback->isUnderReview()) {
115
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)
116
+ ->save();
117
+ }
118
+ return self::DEFAULT_PINGBACK_RESPONSE;
119
+ } catch (Exception $e) {
120
+ Mage::log($e->getMessage());
121
+ $result = 'Internal server error';
122
+ $result .= ' ' . $e->getMessage();
123
+ return $result;
124
+ }
125
+ } else {
126
+ return 'The Order is invalid';
127
+ }
128
+ }
129
+
130
+ /**
131
+ * @param Paymentwall_Pingback $pingback
132
+ * @return bool
133
+ */
134
+ protected function isRecurring(Paymentwall_Pingback $pingback)
135
+ {
136
+ return $pingback->getProductPeriodLength() > 0;
137
+ }
138
  }
app/code/community/Paymentwall/Paymentwall/controllers/PaymentController.php CHANGED
@@ -1,70 +1,107 @@
1
- <?php
2
-
3
- /**
4
- * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
- * @package Paymentwall\ThirdpartyIntegration\Magento
6
- */
7
-
8
- /**
9
- * Class Paymentwall_Payment_PaymentController
10
- */
11
- class Paymentwall_Paymentwall_PaymentController extends Mage_Core_Controller_Front_Action
12
- {
13
- const ORDER_STATUS_AFTER_PINGBACK_SUCCESS = 'processing';
14
-
15
- /**
16
- * Action that handles pingback call from paymentwall system
17
- * @return string
18
- */
19
- public function ipnAction()
20
- {
21
- $result = Mage::getModel('paymentwall/pingback')->handlePingback();
22
- die($result);
23
- }
24
-
25
- /**
26
- * Show Paymentwall widget
27
- * For Pw Local
28
- */
29
- public function pwlocalAction()
30
- {
31
- $this->loadLayout();
32
- $this->renderLayout();
33
- }
34
-
35
- /**
36
- * Handle ajax payment listener on Widget page
37
- * For Pw Local
38
- */
39
- public function ajaxPwlocalAction()
40
- {
41
- // Get current order id
42
- $curOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
43
- $response = array(
44
- 'status' => 0,
45
- 'url' => '',
46
- 'message' => ''
47
- );
48
-
49
- if ($curOrderId) {
50
- $order = Mage::getModel('sales/order')->loadByIncrementId($curOrderId);
51
- if ($order->getId()) {
52
- $response['status'] = $order->getStatus() == self::ORDER_STATUS_AFTER_PINGBACK_SUCCESS
53
- ? 1 : 0;
54
- // Get success page redirect url
55
- $response['url'] = '';
56
- } else {
57
- $response['status'] = 2; // Error
58
- $response['message'] = 'Order Invalid';
59
- }
60
- }
61
- if ($response['status'] == 1) {
62
- $response['message'] = "<h3>{$this->__("Payment Processed")}</h3>";
63
- // Clear shopping cart
64
- Mage::getSingleton('checkout/cart')->truncate();
65
- }
66
-
67
- $this->getResponse()->clearHeaders()->setHeader('Content-type', 'application/json', true);
68
- $this->getResponse()->setBody(json_encode($response));
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
1
+ <?php
2
+
3
+ /**
4
+ * @author Paymentwall Inc. <devsupport@paymentwall.com>
5
+ * @package Paymentwall\ThirdpartyIntegration\Magento
6
+ */
7
+
8
+ /**
9
+ * Class Paymentwall_Payment_PaymentController
10
+ */
11
+ class Paymentwall_Paymentwall_PaymentController extends Mage_Core_Controller_Front_Action
12
+ {
13
+ const ORDER_STATUS_AFTER_PINGBACK_SUCCESS = 'processing';
14
+
15
+ /**
16
+ * Action that handles pingback call from paymentwall system
17
+ * @return string
18
+ */
19
+ public function ipnAction()
20
+ {
21
+ $result = Mage::getModel('paymentwall/pingback')->handlePingback();
22
+ $this->getResponse()->setBody($result);
23
+ }
24
+
25
+ /**
26
+ * Show Paymentwall widget
27
+ * For Pw Local
28
+ */
29
+ public function pwlocalAction()
30
+ {
31
+ $this->loadLayout();
32
+ $this->renderLayout();
33
+ }
34
+
35
+ /**
36
+ * 3Ds Processing
37
+ */
38
+ public function threedsAction()
39
+ {
40
+ $chargeId = $this->getRequest()->get('brick_charge_id');
41
+ $secureToken = $this->getRequest()->get('brick_secure_token');
42
+ $orderId = Mage::getModel('core/session')->getChargeOrderId();
43
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
44
+ $chargeData = json_decode(Mage::getModel('core/session')->getChargeData(), true);
45
+
46
+ if (
47
+ $chargeId
48
+ && $secureToken
49
+ && $chargeData
50
+ && $order->getId()
51
+ ) {
52
+ $chargeData['charge_id'] = $chargeId;
53
+ $chargeData['secure_token'] = $secureToken;
54
+
55
+ try {
56
+ if (Mage::getModel('paymentwall/method_pwbrick')->processOrderAfter3Ds($order, $chargeData)) {
57
+ $url = Mage::getUrl('checkout/onepage/success', array('_query' => '_secure=true'));
58
+ Mage::app()->getResponse()->setRedirect($url)->sendResponse();
59
+ die;
60
+ }
61
+ } catch (Mage_Exception $e) {
62
+ Mage::getSingleton('core/session')->addError($e->getMessage());
63
+ }
64
+
65
+ $url = Mage::getUrl('/');
66
+ Mage::app()->getResponse()->setRedirect($url)->sendResponse();
67
+ } elseif ($secureForm = Mage::getModel('core/session')->getSecureFormHtml()) {
68
+ $this->getResponse()->setBody($secureForm);
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Handle ajax payment listener on Widget page
74
+ * For Pw Local
75
+ */
76
+ public function ajaxPwlocalAction()
77
+ {
78
+ // Get current order id
79
+ $curOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
80
+ $response = array(
81
+ 'status' => 0,
82
+ 'url' => '',
83
+ 'message' => ''
84
+ );
85
+
86
+ if ($curOrderId) {
87
+ $order = Mage::getModel('sales/order')->loadByIncrementId($curOrderId);
88
+ if ($order->getId()) {
89
+ $response['status'] = $order->getStatus() == self::ORDER_STATUS_AFTER_PINGBACK_SUCCESS
90
+ ? 1 : 0;
91
+ // Get success page redirect url
92
+ $response['url'] = '';
93
+ } else {
94
+ $response['status'] = 2; // Error
95
+ $response['message'] = 'Order Invalid';
96
+ }
97
+ }
98
+ if ($response['status'] == 1) {
99
+ $response['message'] = "<h3>{$this->__("Payment Processed")}</h3>";
100
+ // Clear shopping cart
101
+ Mage::getSingleton('checkout/cart')->truncate();
102
+ }
103
+
104
+ $this->getResponse()->clearHeaders()->setHeader('Content-type', 'application/json', true);
105
+ $this->getResponse()->setBody(json_encode($response));
106
+ }
107
  }
app/code/community/Paymentwall/Paymentwall/etc/config.xml CHANGED
@@ -1,67 +1,67 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Paymentwall_Paymentwall>
5
- <version>1.2.4</version>
6
- </Paymentwall_Paymentwall>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <paymentwall>
11
- <use>standard</use>
12
- <args>
13
- <module>Paymentwall_Paymentwall</module>
14
- <frontName>paymentwall</frontName>
15
- </args>
16
- </paymentwall>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <paymentwall>
21
- <file>paymentwall.xml</file>
22
- </paymentwall>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <global>
27
- <models>
28
- <paymentwall>
29
- <class>Paymentwall_Paymentwall_Model</class>
30
- </paymentwall>
31
- </models>
32
- <blocks>
33
- <paymentwall>
34
- <class>Paymentwall_Paymentwall_Block</class>
35
- </paymentwall>
36
- </blocks>
37
- <helpers>
38
- <paymentwall>
39
- <class>Paymentwall_Paymentwall_Helper</class>
40
- </paymentwall>
41
- </helpers>
42
- </global>
43
- <default>
44
- <payment>
45
- <paymentwall_pwlocal>
46
- <title>Paymentwall</title>
47
- <active>1</active>
48
- <model>paymentwall/method_pwlocal</model>
49
- <order_status>pending_payment</order_status>
50
- <fee_payer>buyer</fee_payer>
51
- <allowspecific>0</allowspecific>
52
- <paymentwall_istest>0</paymentwall_istest>
53
- <paymentwall_delivery>1</paymentwall_delivery>
54
- <debug_mode>0</debug_mode>
55
- </paymentwall_pwlocal>
56
- <paymentwall_pwbrick>
57
- <title>Credit Card</title>
58
- <model>paymentwall/method_pwbrick</model>
59
- <active>1</active>
60
- <order_status>processing</order_status>
61
- <payment_action>authorize_capture</payment_action>
62
- <allowspecific>0</allowspecific>
63
- <debug_mode>0</debug_mode>
64
- </paymentwall_pwbrick>
65
- </payment>
66
- </default>
67
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Paymentwall_Paymentwall>
5
+ <version>1.2.5</version>
6
+ </Paymentwall_Paymentwall>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <paymentwall>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Paymentwall_Paymentwall</module>
14
+ <frontName>paymentwall</frontName>
15
+ </args>
16
+ </paymentwall>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <paymentwall>
21
+ <file>paymentwall.xml</file>
22
+ </paymentwall>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <models>
28
+ <paymentwall>
29
+ <class>Paymentwall_Paymentwall_Model</class>
30
+ </paymentwall>
31
+ </models>
32
+ <blocks>
33
+ <paymentwall>
34
+ <class>Paymentwall_Paymentwall_Block</class>
35
+ </paymentwall>
36
+ </blocks>
37
+ <helpers>
38
+ <paymentwall>
39
+ <class>Paymentwall_Paymentwall_Helper</class>
40
+ </paymentwall>
41
+ </helpers>
42
+ </global>
43
+ <default>
44
+ <payment>
45
+ <paymentwall_pwlocal>
46
+ <title>Paymentwall</title>
47
+ <active>1</active>
48
+ <model>paymentwall/method_pwlocal</model>
49
+ <order_status>pending_payment</order_status>
50
+ <fee_payer>buyer</fee_payer>
51
+ <allowspecific>0</allowspecific>
52
+ <paymentwall_istest>0</paymentwall_istest>
53
+ <paymentwall_delivery>1</paymentwall_delivery>
54
+ <debug_mode>0</debug_mode>
55
+ </paymentwall_pwlocal>
56
+ <paymentwall_pwbrick>
57
+ <title>Credit Card</title>
58
+ <model>paymentwall/method_pwbrick</model>
59
+ <active>1</active>
60
+ <order_status>pending_payment</order_status>
61
+ <payment_action>authorize_capture</payment_action>
62
+ <allowspecific>0</allowspecific>
63
+ <debug_mode>0</debug_mode>
64
+ </paymentwall_pwbrick>
65
+ </payment>
66
+ </default>
67
+ </config>
app/code/community/Paymentwall/Paymentwall/etc/system.xml CHANGED
@@ -1,167 +1,167 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <paymentwall_pwlocal translate="label" module="paymentwall">
7
- <label>Paymentwall</label>
8
- <frontend_type>text</frontend_type>
9
- <sort_order>103</sort_order>
10
- <show_in_default>1</show_in_default>
11
- <show_in_website>1</show_in_website>
12
- <show_in_store>1</show_in_store>
13
- <fields>
14
- <active translate="label">
15
- <label>Enabled</label>
16
- <frontend_type>select</frontend_type>
17
- <source_model>adminhtml/system_config_source_yesno</source_model>
18
- <sort_order>1</sort_order>
19
- <show_in_default>1</show_in_default>
20
- <show_in_website>1</show_in_website>
21
- <show_in_store>0</show_in_store>
22
- </active>
23
- <title translate="label">
24
- <label>Title</label>
25
- <frontend_type>text</frontend_type>
26
- <sort_order>2</sort_order>
27
- <show_in_default>1</show_in_default>
28
- <show_in_website>1</show_in_website>
29
- <show_in_store>1</show_in_store>
30
- </title>
31
- <paymentwall_public_key translate="label">
32
- <label>Project Key</label>
33
- <frontend_type>text</frontend_type>
34
- <sort_order>3</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>1</show_in_store>
38
- </paymentwall_public_key>
39
- <paymentwall_private_key translate="label">
40
- <label>Secret Key</label>
41
- <frontend_type>text</frontend_type>
42
- <sort_order>4</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- </paymentwall_private_key>
47
- <paymentwall_widget_code translate="label">
48
- <label>Widget Code</label>
49
- <frontend_type>text</frontend_type>
50
- <sort_order>5</sort_order>
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
- </paymentwall_widget_code>
55
- <paymentwall_url translate="label">
56
- <label>Success URL</label>
57
- <frontend_type>text</frontend_type>
58
- <sort_order>6</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>0</show_in_store>
62
- </paymentwall_url>
63
- <paymentwall_istest translate="label">
64
- <label>Test Mode</label>
65
- <frontend_type>select</frontend_type>
66
- <source_model>adminhtml/system_config_source_yesno</source_model>
67
- <sort_order>7</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>0</show_in_store>
71
- </paymentwall_istest>
72
- <paymentwall_delivery translate="label">
73
- <label>Enable Delivery Api</label>
74
- <frontend_type>select</frontend_type>
75
- <source_model>adminhtml/system_config_source_yesno</source_model>
76
- <sort_order>7</sort_order>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>0</show_in_store>
80
- </paymentwall_delivery>
81
- <debug_mode translate="label">
82
- <label>Debug Mode</label>
83
- <frontend_type>select</frontend_type>
84
- <source_model>adminhtml/system_config_source_yesno</source_model>
85
- <sort_order>10</sort_order>
86
- <show_in_default>1</show_in_default>
87
- <show_in_website>1</show_in_website>
88
- <show_in_store>0</show_in_store>
89
- </debug_mode>
90
- </fields>
91
- </paymentwall_pwlocal>
92
- <paymentwall_pwbrick translate="label" module="paymentwall">
93
- <label>Paymentwall Brick</label>
94
- <frontend_type>text</frontend_type>
95
- <sort_order>104</sort_order>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>1</show_in_website>
98
- <show_in_store>1</show_in_store>
99
- <fields>
100
- <active translate="label">
101
- <label>Enabled</label>
102
- <frontend_type>select</frontend_type>
103
- <source_model>adminhtml/system_config_source_yesno</source_model>
104
- <sort_order>10</sort_order>
105
- <show_in_default>1</show_in_default>
106
- <show_in_website>1</show_in_website>
107
- <show_in_store>0</show_in_store>
108
- </active>
109
- <title translate="label">
110
- <label>Title</label>
111
- <frontend_type>text</frontend_type>
112
- <sort_order>20</sort_order>
113
- <show_in_default>1</show_in_default>
114
- <show_in_website>1</show_in_website>
115
- <show_in_store>1</show_in_store>
116
- </title>
117
- <order_status translate="label">
118
- <label>New order status</label>
119
- <frontend_type>select</frontend_type>
120
- <source_model>adminhtml/system_config_source_order_status_processing</source_model>
121
- <sort_order>21</sort_order>
122
- <show_in_default>1</show_in_default>
123
- <show_in_website>1</show_in_website>
124
- <show_in_store>1</show_in_store>
125
- </order_status>
126
- <paymentwall_public_key translate="label">
127
- <label>Public Key</label>
128
- <frontend_type>text</frontend_type>
129
- <comment>Merchant Public API Key</comment>
130
- <sort_order>30</sort_order>
131
- <show_in_default>1</show_in_default>
132
- <show_in_website>1</show_in_website>
133
- <show_in_store>1</show_in_store>
134
- </paymentwall_public_key>
135
- <paymentwall_private_key translate="label">
136
- <label>Private Key</label>
137
- <frontend_type>text</frontend_type>
138
- <comment>Merchant Private Key</comment>
139
- <sort_order>40</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- </paymentwall_private_key>
144
- <allowspecific translate="label">
145
- <label>Payment Applicable From</label>
146
- <frontend_type>select</frontend_type>
147
- <sort_order>50</sort_order>
148
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
149
- <show_in_default>1</show_in_default>
150
- <show_in_website>1</show_in_website>
151
- <show_in_store>0</show_in_store>
152
- </allowspecific>
153
- <debug_mode translate="label">
154
- <label>Debug Mode</label>
155
- <frontend_type>select</frontend_type>
156
- <source_model>adminhtml/system_config_source_yesno</source_model>
157
- <sort_order>60</sort_order>
158
- <show_in_default>1</show_in_default>
159
- <show_in_website>1</show_in_website>
160
- <show_in_store>0</show_in_store>
161
- </debug_mode>
162
- </fields>
163
- </paymentwall_pwbrick>
164
- </groups>
165
- </payment>
166
- </sections>
167
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <paymentwall_pwlocal translate="label" module="paymentwall">
7
+ <label>Paymentwall</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>103</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>1</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>2</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <paymentwall_public_key translate="label">
32
+ <label>Project Key</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>3</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </paymentwall_public_key>
39
+ <paymentwall_private_key translate="label">
40
+ <label>Secret Key</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>4</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </paymentwall_private_key>
47
+ <paymentwall_widget_code translate="label">
48
+ <label>Widget Code</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>5</sort_order>
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
+ </paymentwall_widget_code>
55
+ <paymentwall_url translate="label">
56
+ <label>Success URL</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>6</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>0</show_in_store>
62
+ </paymentwall_url>
63
+ <paymentwall_istest translate="label">
64
+ <label>Test Mode</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>adminhtml/system_config_source_yesno</source_model>
67
+ <sort_order>7</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ </paymentwall_istest>
72
+ <paymentwall_delivery translate="label">
73
+ <label>Enable Delivery Api</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>7</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>0</show_in_store>
80
+ </paymentwall_delivery>
81
+ <debug_mode translate="label">
82
+ <label>Debug Mode</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>10</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>0</show_in_store>
89
+ </debug_mode>
90
+ </fields>
91
+ </paymentwall_pwlocal>
92
+ <paymentwall_pwbrick translate="label" module="paymentwall">
93
+ <label>Paymentwall Brick</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>104</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <fields>
100
+ <active translate="label">
101
+ <label>Enabled</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <sort_order>10</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>0</show_in_store>
108
+ </active>
109
+ <title translate="label">
110
+ <label>Title</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>20</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </title>
117
+ <order_status translate="label">
118
+ <label>New order status</label>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
121
+ <sort_order>21</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ </order_status>
126
+ <paymentwall_public_key translate="label">
127
+ <label>Public Key</label>
128
+ <frontend_type>text</frontend_type>
129
+ <comment>Merchant Public API Key</comment>
130
+ <sort_order>30</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </paymentwall_public_key>
135
+ <paymentwall_private_key translate="label">
136
+ <label>Private Key</label>
137
+ <frontend_type>text</frontend_type>
138
+ <comment>Merchant Private Key</comment>
139
+ <sort_order>40</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </paymentwall_private_key>
144
+ <allowspecific translate="label">
145
+ <label>Payment Applicable From</label>
146
+ <frontend_type>select</frontend_type>
147
+ <sort_order>50</sort_order>
148
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>0</show_in_store>
152
+ </allowspecific>
153
+ <debug_mode translate="label">
154
+ <label>Debug Mode</label>
155
+ <frontend_type>select</frontend_type>
156
+ <source_model>adminhtml/system_config_source_yesno</source_model>
157
+ <sort_order>60</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>0</show_in_store>
161
+ </debug_mode>
162
+ </fields>
163
+ </paymentwall_pwbrick>
164
+ </groups>
165
+ </payment>
166
+ </sections>
167
+ </config>
app/design/frontend/base/default/layout/paymentwall.xml CHANGED
@@ -1,44 +1,44 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <checkout_onepage_index>
4
- <reference name="head">
5
- <action method="addItem">
6
- <type>skin_js</type>
7
- <name>js/paymentwall.js</name>
8
- </action>
9
- <action method="addItem">
10
- <type>skin_css</type>
11
- <name>css/paymentwall.css</name>
12
- </action>
13
- <block type="core/text" name="brick.js">
14
- <action method="setText">
15
- <text><![CDATA[<script src="//api.paymentwall.com/brick/brick.1.3.js"></script>]]></text>
16
- </action>
17
- </block>
18
- </reference>
19
- </checkout_onepage_index>
20
-
21
- <!-- Layout settings for Paymentwall controller -->
22
- <paymentwall_payment_pwlocal>
23
- <reference name="head">
24
- <action method="setTitle">
25
- <title>Paymentwall Widget Checkout</title>
26
- </action>
27
- <action method="addItem">
28
- <type>skin_js</type>
29
- <name>js/paymentwall.js</name>
30
- </action>
31
- </reference>
32
- <reference name="root">
33
- <action method="setTemplate">
34
- <template>page/2columns-right.phtml</template>
35
- </action>
36
- </reference>
37
- <reference name="content">
38
- <block type="paymentwall/checkout_form_method_pwlocal" name="paymentwall_widget"
39
- template="paymentwall/checkout/form/method/pwlocal.phtml">
40
- <label>Paymentwall Widget Checkout</label>
41
- </block>
42
- </reference>
43
- </paymentwall_payment_pwlocal>
44
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <checkout_onepage_index>
4
+ <reference name="head">
5
+ <action method="addItem">
6
+ <type>skin_js</type>
7
+ <name>js/paymentwall.js</name>
8
+ </action>
9
+ <action method="addItem">
10
+ <type>skin_css</type>
11
+ <name>css/paymentwall.css</name>
12
+ </action>
13
+ <block type="core/text" name="brick.js">
14
+ <action method="setText">
15
+ <text><![CDATA[<script src="https://api.paymentwall.com/brick/brick.1.4.js"></script>]]></text>
16
+ </action>
17
+ </block>
18
+ </reference>
19
+ </checkout_onepage_index>
20
+
21
+ <!-- Layout settings for Paymentwall controller -->
22
+ <paymentwall_payment_pwlocal>
23
+ <reference name="head">
24
+ <action method="setTitle">
25
+ <title>Paymentwall Widget Checkout</title>
26
+ </action>
27
+ <action method="addItem">
28
+ <type>skin_js</type>
29
+ <name>js/paymentwall.js</name>
30
+ </action>
31
+ </reference>
32
+ <reference name="root">
33
+ <action method="setTemplate">
34
+ <template>page/2columns-right.phtml</template>
35
+ </action>
36
+ </reference>
37
+ <reference name="content">
38
+ <block type="paymentwall/checkout_form_method_pwlocal" name="paymentwall_widget"
39
+ template="paymentwall/checkout/form/method/pwlocal.phtml">
40
+ <label>Paymentwall Widget Checkout</label>
41
+ </block>
42
+ </reference>
43
+ </paymentwall_payment_pwlocal>
44
  </layout>
app/design/frontend/base/default/template/paymentwall/checkout/form/method/pwbrick.phtml CHANGED
@@ -1,66 +1,66 @@
1
- <ul class="form-list" id="payment_form_paymentwall_pwbrick" style="display: none">
2
- <li>
3
- <label for="paymentwall_pwbrick_cc_type" class="required"><em>*</em><?php echo $this->__('Card Type') ?></label>
4
-
5
- <div class="input-box">
6
- <select id="paymentwall_pwbrick_cc_type"
7
- title="<?php echo $this->__('Card Type') ?>"
8
- class="required-entry validate-cc-type-select">
9
- <option value=""><?php echo $this->__('--Please Select--') ?></option>
10
- <?php $_ccType = $this->getInfoData('cc_type') ?>
11
- <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
12
- <option
13
- value="<?php echo $_typeCode ?>"<?php if ($_typeCode == $_ccType): ?> selected="selected"<?php endif ?>>
14
- <?php echo $_typeName ?>
15
- </option>
16
- <?php endforeach ?>
17
- </select>
18
- </div>
19
- </li>
20
- <li>
21
- <label for="paymentwall_pwbrick_cc_number" class="required">
22
- <em>*</em>
23
- <?php echo $this->__("Card Number") ?>
24
- </label>
25
-
26
- <div class="input-box">
27
- <input type="text" autocomplete="off" id="paymentwall_pwbrick_cc_number"
28
- class="input-text validate-cc-number validate-cc-type" data-brick="card-number"/>
29
- </div>
30
- </li>
31
- <li>
32
- <label for="paymentwall_pwbrick_expiration" class="required">
33
- <em>*</em>
34
- <?php echo $this->__("Card expiration"); ?>
35
- </label>
36
-
37
- <div class="input-box">
38
- <input type="text" id="paymentwall_pwbrick_expiration" autocomplete="off"
39
- class="month validate-cc-exp required-entry" data-brick="card-expiration-month" placeholder="MM"
40
- maxlength="2" size="2"/> /
41
- <input type="text" id="paymentwall_pwbrick_expiration_yr" autocomplete="off"
42
- class="year required-entry" data-brick="card-expiration-year" placeholder="YY" maxlength="4"
43
- size="4"/>
44
- </div>
45
- </li>
46
- <li>
47
- <label for="paymentwall_pwbrick_cc_cid" class="required">
48
- <em>*</em>
49
- <?php echo $this->__("Card CVV") ?>
50
- </label>
51
-
52
- <div class="input-box">
53
- <input type="text" id="paymentwall_pwbrick_cc_cid" autocomplete="off"
54
- class="input-text cvv required-entry validate-cc-cvn"
55
- data-brick="card-cvv" maxlength="4"/>
56
- </div>
57
- <div class="no-display">
58
- <input type="hidden" name="payment[brick_token]" id="paymentwall_pwbrick_token">
59
- <input type="hidden" name="payment[brick_fingerprint]" id="paymentwall_pwbrick_fingerprint">
60
- </div>
61
- </li>
62
- </ul>
63
- <script type="text/javascript">
64
- var brick = PW.initPwBrick('<?php echo $this->getPublicKey(); ?>');
65
- PW.rewriteSavePayment(brick);
66
- </script>
1
+ <ul class="form-list" id="payment_form_paymentwall_pwbrick" style="display: none">
2
+ <li>
3
+ <label for="paymentwall_pwbrick_cc_type" class="required"><em>*</em><?php echo $this->__('Card Type') ?></label>
4
+
5
+ <div class="input-box">
6
+ <select id="paymentwall_pwbrick_cc_type"
7
+ title="<?php echo $this->__('Card Type') ?>"
8
+ class="required-entry validate-cc-type-select">
9
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
10
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
11
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
12
+ <option
13
+ value="<?php echo $_typeCode ?>"<?php if ($_typeCode == $_ccType): ?> selected="selected"<?php endif ?>>
14
+ <?php echo $_typeName ?>
15
+ </option>
16
+ <?php endforeach ?>
17
+ </select>
18
+ </div>
19
+ </li>
20
+ <li>
21
+ <label for="paymentwall_pwbrick_cc_number" class="required">
22
+ <em>*</em>
23
+ <?php echo $this->__("Card Number") ?>
24
+ </label>
25
+
26
+ <div class="input-box">
27
+ <input type="text" autocomplete="off" id="paymentwall_pwbrick_cc_number"
28
+ class="input-text validate-cc-number validate-cc-type" data-brick="card-number"/>
29
+ </div>
30
+ </li>
31
+ <li>
32
+ <label for="paymentwall_pwbrick_expiration" class="required">
33
+ <em>*</em>
34
+ <?php echo $this->__("Card expiration"); ?>
35
+ </label>
36
+
37
+ <div class="input-box">
38
+ <input type="text" id="paymentwall_pwbrick_expiration" autocomplete="off"
39
+ class="month validate-cc-exp required-entry" data-brick="card-expiration-month" placeholder="MM"
40
+ maxlength="2" size="2"/> /
41
+ <input type="text" id="paymentwall_pwbrick_expiration_yr" autocomplete="off"
42
+ class="year required-entry" data-brick="card-expiration-year" placeholder="YY" maxlength="4"
43
+ size="4"/>
44
+ </div>
45
+ </li>
46
+ <li>
47
+ <label for="paymentwall_pwbrick_cc_cid" class="required">
48
+ <em>*</em>
49
+ <?php echo $this->__("Card CVV") ?>
50
+ </label>
51
+
52
+ <div class="input-box">
53
+ <input type="text" id="paymentwall_pwbrick_cc_cid" autocomplete="off"
54
+ class="input-text cvv required-entry validate-cc-cvn"
55
+ data-brick="card-cvv" maxlength="4"/>
56
+ </div>
57
+ <div class="no-display">
58
+ <input type="hidden" name="payment[brick_token]" id="paymentwall_pwbrick_token">
59
+ <input type="hidden" name="payment[brick_fingerprint]" id="paymentwall_pwbrick_fingerprint">
60
+ </div>
61
+ </li>
62
+ </ul>
63
+ <script type="text/javascript">
64
+ var brick = PW.initPwBrick('<?php echo $this->getPublicKey(); ?>');
65
+ PW.rewriteSavePayment(brick);
66
+ </script>
app/design/frontend/base/default/template/paymentwall/checkout/info/method/pwbrick.phtml CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
- $info = $this->getData('info');
3
- $method = $this->getData('method');
4
- ?>
5
- <?php if (!$this->getHideTitle()): ?>
6
- <?php echo $this->escapeHtml($method->getConfigData('title')) ?><br/>
7
  <?php endif; ?>
1
+ <?php
2
+ $info = $this->getData('info');
3
+ $method = $this->getData('method');
4
+ ?>
5
+ <?php if (!$this->getHideTitle()): ?>
6
+ <?php echo $this->escapeHtml($method->getConfigData('title')) ?><br/>
7
  <?php endif; ?>
app/etc/modules/Paymentwall_Paymentwall.xml CHANGED
@@ -1,14 +1,14 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Paymentwall_Paymentwall>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Payment />
9
- <Mage_Sales/>
10
- <Mage_Checkout/>
11
- </depends>
12
- </Paymentwall_Paymentwall>
13
- </modules>
14
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Paymentwall_Paymentwall>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ <Mage_Sales/>
10
+ <Mage_Checkout/>
11
+ </depends>
12
+ </Paymentwall_Paymentwall>
13
+ </modules>
14
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>paymentwall_magento_module</name>
4
- <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
@@ -9,11 +9,11 @@
9
  <summary>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.</summary>
10
  <description>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.&#xD;
11
  </description>
12
- <notes>Fix double amount in downloadable order</notes>
13
  <authors><author><name>Paymentwall</name><user>platforms</user><email>platforms@paymentwall.com</email></author></authors>
14
- <date>2016-01-06</date>
15
- <time>04:26:02</time>
16
- <contents><target name="magecommunity"><dir name="Paymentwall"><dir name="Paymentwall"><dir name="Block"><dir name="Checkout"><dir name="Form"><dir name="Method"><file name="Abstract.php" hash="de9bfa933a6e1757c3bab53768ec4d62"/><file name="Pwbrick.php" hash="c01cabde8670bdff801534fe283b0534"/><file name="Pwlocal.php" hash="2d4a1fb4fdfcaaf5d7cf72eae4231965"/></dir></dir><dir name="Info"><dir name="Method"><file name="Pwbrick.php" hash="4d8bc2a37e04c180896a708dabf9cfa7"/><file name="Pwlocal.php" hash="52d3d7580cbdcc8bf0f98834b9a9e5a0"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4270b082a8264e63f6a82228b3e2c1d2"/></dir><dir name="Model"><dir name="Method"><file name="Abstract.php" hash="1199d11a808150d22139018c8a6cc41d"/><file name="Pwbrick.php" hash="7c95a9d4fcea632c634b55b858e9edbe"/><file name="Pwlocal.php" hash="83e06a61479358f40a26de968dc79b66"/></dir><file name="Pingback.php" hash="e87a9d5fe7328a7c913e2d00fcf01ed2"/></dir><dir name="controllers"><file name="PaymentController.php" hash="6d576fabeef93bc1e36a1dad97a26f9c"/></dir><dir name="etc"><file name="config.xml" hash="e1db0070c00ff7c29299d45546c660ab"/><file name="system.xml" hash="82abac90b5d8edf1b47e72135245b2ea"/></dir></dir></dir></target><target name="magelib"><dir name="paymentwall-php"><file name="LICENSE" hash="001561189374b83bcd6bc7f962daee8a"/><file name="README.md" hash="04122bf55fe20b9954feb14817435da2"/><file name="composer.json" hash="4e7035c64f2d74ba0a5f5cf80effe45e"/><dir name="features"><dir name="bootstrap"><file name="ChargeContext.php" hash="f1d0604f2fc16dd5932535f9c24995a3"/><file name="FeatureContext.php" hash="146d6e79c6704cfb24ee6f2a7b7fba5a"/><file name="PingbackContext.php" hash="b6c86d8f3c9caa21435f47ddb2d5add1"/><file name="WidgetContext.php" hash="70c8d608eb407e346467c2a8f7162732"/></dir><file name="charge.feature" hash="04258fc641535794c48c6c55aad7f94f"/><file name="pingback.feature" hash="05869da8a3e36b6bec0293a22c1a9235"/><file name="widget.feature" hash="198999d8bf357de175f3268cc88337f6"/></dir><dir name="lib"><dir name="Paymentwall"><file name="ApiObject.php" hash="e6ba4d0c3b93adf84ae5819fddecf26c"/><file name="ApiObjectInterface.php" hash="4922ff334356aac33a5b159f8d001b93"/><file name="Base.php" hash="9bdae1c385327dadbd0ca5c9bbbe6107"/><file name="Card.php" hash="d8aa72a3e8ea0cdd132867164c8352c1"/><file name="Charge.php" hash="0ca04683046e9abdf3968f495db625c4"/><file name="Config.php" hash="9253f2afd5523653dd9e5fce2afc15c4"/><file name="GenerericApiObject.php" hash="6016e500c2c6736048c2f27ae8924a1c"/><file name="HttpAction.php" hash="555295426227f26733b7736692345667"/><file name="Instance.php" hash="86422afa5d43aac945021ef694b9bbc1"/><file name="OneTimeToken.php" hash="e3b9c56c34920c9b5ea53609d95acb3b"/><file name="Pingback.php" hash="a77fb2f158a60ab48af4d9f420a22894"/><file name="Product.php" hash="8b382cb28b68f77c9784e5dbc40512cb"/><dir name="Response"><file name="Abstract.php" hash="f59033acb9e14fa7a90cc2f812b6970c"/><file name="Error.php" hash="4554a0b337a2748221fb7dfae2daa8c2"/><file name="Factory.php" hash="7036d21f4682b505d5b1ff04ec79e355"/><file name="Interface.php" hash="e75f22329b3c8cbdf389aee8366ceaf3"/><file name="Success.php" hash="1f3c6c58b4273eadff5ef4b482b65187"/></dir><dir name="Signature"><file name="Abstract.php" hash="dea8f9c03b02db7462d276e3611a3a98"/><file name="Pingback.php" hash="1ab1e00037d395f9bc55bea929397927"/><file name="Widget.php" hash="2e1e2a712a0eca4f54f834838df51a59"/></dir><file name="Subscription.php" hash="7110f0292dbe01e4bc1517b5cc206ed2"/><file name="Widget.php" hash="6a91e8c0f4fe930facde52c2750824da"/></dir><file name="paymentwall.php" hash="6f4ee78ffb0677d2a49d2417dae2c038"/></dir><file name=".git" hash="50da8e1bb8ed3a4d1e1413fe2d6c0d68"/><file name=".gitignore" hash="d22fe2936066c576100994c62f32761e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="paymentwall.css" hash="408b3eb269441b27d262c3abc6da78f3"/></dir><dir name="js"><file name="paymentwall.js" hash="d10a03a2130a5cdb87106a3eaa0cd30a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="paymentwall.xml" hash="15713872f2239c9b3cb615291b36e54b"/></dir><dir name="template"><dir name="paymentwall"><dir name="checkout"><dir name="form"><dir name="method"><file name="pwbrick.phtml" hash="95f073505e84b3c75607ff52538c01c7"/><file name="pwlocal.phtml" hash="b964770e54bb91fca23a49951e3c744c"/></dir></dir><dir name="info"><dir name="method"><file name="pwbrick.phtml" hash="b23472e15332c427456e9d92619eecff"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paymentwall_Paymentwall.xml" hash="a5ef063119f4c0d274cc2f7a72699538"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>paymentwall_magento_module</name>
4
+ <version>1.2.5</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
9
  <summary>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.</summary>
10
  <description>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.&#xD;
11
  </description>
12
+ <notes>Update 3D Secure for Brick</notes>
13
  <authors><author><name>Paymentwall</name><user>platforms</user><email>platforms@paymentwall.com</email></author></authors>
14
+ <date>2016-03-25</date>
15
+ <time>11:51:58</time>
16
+ <contents><target name="magecommunity"><dir name="Paymentwall"><dir name="Paymentwall"><dir name="Block"><dir name="Checkout"><dir name="Form"><dir name="Method"><file name="Abstract.php" hash="f2d6ab9e2d3fe8ad1659a3bff216a3d6"/><file name="Pwbrick.php" hash="1c160f01004150d68ce154b7a87066fc"/><file name="Pwlocal.php" hash="4ddb1e8c27fde7fa94e176f7c80e20d7"/></dir></dir><dir name="Info"><dir name="Method"><file name="Pwbrick.php" hash="8544bd6cd4a5cfc13d1cbd55cb069417"/><file name="Pwlocal.php" hash="94f0b0a8de67881ce7b1417473fd4857"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="228b69871c84dded1808aae3748b9f02"/></dir><dir name="Model"><dir name="Method"><file name="Abstract.php" hash="f13829d21fb441fb7688d2d5059c8bb6"/><file name="Pwbrick.php" hash="fc5b9801ae494176b7de4965b237242e"/><file name="Pwlocal.php" hash="4e6ba24d9c6c0d50d91b60f3b0a24c69"/></dir><file name="Pingback.php" hash="e27d91f07316026e5e0336bda618c096"/></dir><dir name="controllers"><file name="PaymentController.php" hash="148947e19495e5b871d5ce51f6ebbeb6"/></dir><dir name="etc"><file name="config.xml" hash="e51c42e8cf96a69c704937e6a75ef057"/><file name="system.xml" hash="a0df3d99fa0de7fd297b408ce05c67c5"/></dir></dir></dir></target><target name="magelib"><dir name="paymentwall-php"><file name="LICENSE" hash="001561189374b83bcd6bc7f962daee8a"/><file name="README.md" hash="04122bf55fe20b9954feb14817435da2"/><file name="composer.json" hash="4e7035c64f2d74ba0a5f5cf80effe45e"/><dir name="features"><dir name="bootstrap"><file name="ChargeContext.php" hash="f1d0604f2fc16dd5932535f9c24995a3"/><file name="FeatureContext.php" hash="146d6e79c6704cfb24ee6f2a7b7fba5a"/><file name="PingbackContext.php" hash="b6c86d8f3c9caa21435f47ddb2d5add1"/><file name="WidgetContext.php" hash="70c8d608eb407e346467c2a8f7162732"/></dir><file name="charge.feature" hash="04258fc641535794c48c6c55aad7f94f"/><file name="pingback.feature" hash="05869da8a3e36b6bec0293a22c1a9235"/><file name="widget.feature" hash="198999d8bf357de175f3268cc88337f6"/></dir><dir name="lib"><dir name="Paymentwall"><file name="ApiObject.php" hash="e6ba4d0c3b93adf84ae5819fddecf26c"/><file name="ApiObjectInterface.php" hash="4922ff334356aac33a5b159f8d001b93"/><file name="Base.php" hash="9bdae1c385327dadbd0ca5c9bbbe6107"/><file name="Card.php" hash="d8aa72a3e8ea0cdd132867164c8352c1"/><file name="Charge.php" hash="0ca04683046e9abdf3968f495db625c4"/><file name="Config.php" hash="9253f2afd5523653dd9e5fce2afc15c4"/><file name="GenerericApiObject.php" hash="6016e500c2c6736048c2f27ae8924a1c"/><file name="HttpAction.php" hash="555295426227f26733b7736692345667"/><file name="Instance.php" hash="86422afa5d43aac945021ef694b9bbc1"/><file name="OneTimeToken.php" hash="e3b9c56c34920c9b5ea53609d95acb3b"/><file name="Pingback.php" hash="a77fb2f158a60ab48af4d9f420a22894"/><file name="Product.php" hash="8b382cb28b68f77c9784e5dbc40512cb"/><dir name="Response"><file name="Abstract.php" hash="f59033acb9e14fa7a90cc2f812b6970c"/><file name="Error.php" hash="4554a0b337a2748221fb7dfae2daa8c2"/><file name="Factory.php" hash="7036d21f4682b505d5b1ff04ec79e355"/><file name="Interface.php" hash="e75f22329b3c8cbdf389aee8366ceaf3"/><file name="Success.php" hash="1f3c6c58b4273eadff5ef4b482b65187"/></dir><dir name="Signature"><file name="Abstract.php" hash="dea8f9c03b02db7462d276e3611a3a98"/><file name="Pingback.php" hash="1ab1e00037d395f9bc55bea929397927"/><file name="Widget.php" hash="2e1e2a712a0eca4f54f834838df51a59"/></dir><file name="Subscription.php" hash="7110f0292dbe01e4bc1517b5cc206ed2"/><file name="Widget.php" hash="6a91e8c0f4fe930facde52c2750824da"/></dir><file name="paymentwall.php" hash="6f4ee78ffb0677d2a49d2417dae2c038"/></dir><file name=".git" hash="50da8e1bb8ed3a4d1e1413fe2d6c0d68"/><file name=".gitignore" hash="d22fe2936066c576100994c62f32761e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="paymentwall.css" hash="408b3eb269441b27d262c3abc6da78f3"/></dir><dir name="js"><file name="paymentwall.js" hash="fbfb8183e3d3d807247a8e3676d17f7d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="paymentwall.xml" hash="a491093acc23b6b143e47412cdfd462b"/></dir><dir name="template"><dir name="paymentwall"><dir name="checkout"><dir name="form"><dir name="method"><file name="pwbrick.phtml" hash="4cfde237be456528f8cd01c200f21957"/><file name="pwlocal.phtml" hash="b964770e54bb91fca23a49951e3c744c"/></dir></dir><dir name="info"><dir name="method"><file name="pwbrick.phtml" hash="39d5b2f270187162bcb467f6330ff33a"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paymentwall_Paymentwall.xml" hash="38a35e1b2234d0f9cba7c240a8df21d5"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
skin/frontend/base/default/js/paymentwall.js CHANGED
@@ -1,95 +1,95 @@
1
- var PW = {
2
- "rewritePayment": false,
3
- "initPwBrick": function (publicKey) {
4
- return new Brick({
5
- public_key: publicKey,
6
- form: {formatter: false}
7
- }, 'custom');
8
- },
9
- "prepareBrickData": function () {
10
- return {
11
- card_number: $('paymentwall_pwbrick_cc_number').value,
12
- card_expiration_month: $('paymentwall_pwbrick_expiration').value,
13
- card_expiration_year: $('paymentwall_pwbrick_expiration_yr').value,
14
- card_cvv: $('paymentwall_pwbrick_cc_cid').value
15
- }
16
- },
17
- "ajaxPwLocalListener": function (pwlocalUrl, stopintervalcallback) {
18
- return new Ajax.Request(pwlocalUrl, {
19
- method: 'post',
20
- onSuccess: function (transport) {
21
- try {
22
- if (transport.responseText.isJSON()) {
23
- var response = transport.responseText.evalJSON();
24
- switch (response.status) {
25
- case 1: // Payment processed
26
- $$('.paymentwall-widget')[0].innerHTML = response.message;
27
- if (stopintervalcallback) {
28
- stopintervalcallback();
29
- }
30
- // Redirect to success page after x seconds
31
- if (response.url) {
32
- window.setTimeout(function () {
33
- window.location.href = response.url;
34
- }, 3000);
35
- }
36
- break;
37
- case 2: // Payment fail or error
38
- $$('.paymentwall-widget').innerHTML = response.message;
39
- default :
40
- break;
41
- }
42
- } else {
43
- alert(transport.responseText);
44
- if (stopintervalcallback) {
45
- stopintervalcallback();
46
- }
47
- }
48
- }
49
- catch (e) {
50
- alert(transport.responseText);
51
- if (stopintervalcallback) {
52
- stopintervalcallback();
53
- }
54
- }
55
- }
56
- });
57
- },
58
- "rewriteSavePayment": function (brick) {
59
-
60
- // Check second load
61
- if (this.rewritePayment) {
62
- return false;
63
- }
64
-
65
- this.rewritePayment = true;
66
- Payment.prototype.save = Payment.prototype.save.wrap(function (origin_save) {
67
- if ($('p_method_paymentwall_pwbrick').checked) {
68
-
69
- // Check payment method selected
70
- var validator = new Validation(this.form);
71
-
72
- if (this.validate() && validator.validate()) {
73
- brick.tokenizeCard(
74
- PW.prepareBrickData(),
75
- function (response) {
76
- // handle errors
77
- if (response.type == 'Error') {
78
- alert("Brick Error(s):\nCode [" + response.code + "]: " + response.error);
79
- return false;
80
- } else {
81
- $('paymentwall_pwbrick_token').value = response.token;
82
- $('paymentwall_pwbrick_fingerprint').value = Brick.getFingerprint();
83
- // Call origin function
84
- origin_save();
85
- return true;
86
- }
87
- });
88
- }
89
- } else {
90
- // Call origin function
91
- origin_save();
92
- }
93
- });
94
- }
95
  };
1
+ var PW = {
2
+ "rewritePayment": false,
3
+ "initPwBrick": function (publicKey) {
4
+ return new Brick({
5
+ public_key: publicKey,
6
+ form: {formatter: false}
7
+ }, 'custom');
8
+ },
9
+ "prepareBrickData": function () {
10
+ return {
11
+ card_number: $('paymentwall_pwbrick_cc_number').value,
12
+ card_expiration_month: $('paymentwall_pwbrick_expiration').value,
13
+ card_expiration_year: $('paymentwall_pwbrick_expiration_yr').value,
14
+ card_cvv: $('paymentwall_pwbrick_cc_cid').value
15
+ }
16
+ },
17
+ "ajaxPwLocalListener": function (pwlocalUrl, stopintervalcallback) {
18
+ return new Ajax.Request(pwlocalUrl, {
19
+ method: 'post',
20
+ onSuccess: function (transport) {
21
+ try {
22
+ if (transport.responseText.isJSON()) {
23
+ var response = transport.responseText.evalJSON();
24
+ switch (response.status) {
25
+ case 1: // Payment processed
26
+ $$('.paymentwall-widget')[0].innerHTML = response.message;
27
+ if (stopintervalcallback) {
28
+ stopintervalcallback();
29
+ }
30
+ // Redirect to success page after x seconds
31
+ if (response.url) {
32
+ window.setTimeout(function () {
33
+ window.location.href = response.url;
34
+ }, 3000);
35
+ }
36
+ break;
37
+ case 2: // Payment fail or error
38
+ $$('.paymentwall-widget').innerHTML = response.message;
39
+ default :
40
+ break;
41
+ }
42
+ } else {
43
+ alert(transport.responseText);
44
+ if (stopintervalcallback) {
45
+ stopintervalcallback();
46
+ }
47
+ }
48
+ }
49
+ catch (e) {
50
+ alert(transport.responseText);
51
+ if (stopintervalcallback) {
52
+ stopintervalcallback();
53
+ }
54
+ }
55
+ }
56
+ });
57
+ },
58
+ "rewriteSavePayment": function (brick) {
59
+
60
+ // Check second load
61
+ if (this.rewritePayment) {
62
+ return false;
63
+ }
64
+
65
+ this.rewritePayment = true;
66
+ Payment.prototype.save = Payment.prototype.save.wrap(function (origin_save) {
67
+ if ($('p_method_paymentwall_pwbrick').checked) {
68
+
69
+ // Check payment method selected
70
+ var validator = new Validation(this.form);
71
+
72
+ if (this.validate() && validator.validate()) {
73
+ brick.tokenizeCard(
74
+ PW.prepareBrickData(),
75
+ function (response) {
76
+ // handle errors
77
+ if (response.type == 'Error') {
78
+ alert("Brick Error(s):\nCode [" + response.code + "]: " + response.error);
79
+ return false;
80
+ } else {
81
+ $('paymentwall_pwbrick_token').value = response.token;
82
+ $('paymentwall_pwbrick_fingerprint').value = Brick.getFingerprint();
83
+ // Call origin function
84
+ origin_save();
85
+ return true;
86
+ }
87
+ });
88
+ }
89
+ } else {
90
+ // Call origin function
91
+ origin_save();
92
+ }
93
+ });
94
+ }
95
  };