PaysonCheckout2 - Version 1.0.0.1

Version Notes

New modul paysonCheckout2

Download this release

Release Info

Developer Oscar Villegas
Extension PaysonCheckout2
Version 1.0.0.1
Comparing to
See all releases


Code changes from version 1.0.0.0 to 1.0.0.1

Files changed (29) hide show
  1. app/code/community/Payson/Payson/Block/Form.php +0 -11
  2. app/code/community/Payson/Payson/Block/Invoice/Form.php +0 -11
  3. app/code/community/Payson/Payson/Block/Order/Totals/Fee.php +0 -22
  4. app/code/community/Payson/Payson/Block/Standard/Form.php +0 -11
  5. app/code/community/Payson/Payson/Helper/Api.php +0 -1328
  6. app/code/community/Payson/Payson/Helper/Api/Response/Interface.php +0 -20
  7. app/code/community/Payson/Payson/Helper/Api/Response/Standard.php +0 -131
  8. app/code/community/Payson/Payson/Helper/Api/Response/Standard/Parameters.php +0 -66
  9. app/code/community/Payson/Payson/Helper/Api/Response/Validate.php +0 -46
  10. app/code/community/Payson/Payson/Helper/Data.php +0 -6
  11. app/code/community/Payson/Payson/Helper/FundingConstraint.php +0 -36
  12. app/code/community/Payson/Payson/Model/Config.php +0 -218
  13. app/code/community/Payson/Payson/Model/Method/Abstract.php +0 -148
  14. app/code/community/Payson/Payson/Model/Method/Invoice.php +0 -65
  15. app/code/community/Payson/Payson/Model/Method/Standard.php +0 -80
  16. app/code/community/Payson/Payson/Model/Mysql4/Setup.php +0 -6
  17. app/code/community/Payson/Payson/Model/Order/Creditmemo/Total/Invoice.php +0 -41
  18. app/code/community/Payson/Payson/Model/Order/Invoice/Total/Invoice.php +0 -42
  19. app/code/community/Payson/Payson/Model/Quote/Address/Total/Invoice.php +0 -44
  20. app/code/community/Payson/Payson/Model/Standard.php +0 -108
  21. app/code/community/Payson/Payson/Model/System/Config/Source/Paysondirectmethod.php +0 -52
  22. app/code/community/Payson/Payson/controllers/Adminhtml/Sales/Order/ShipmentController.php +0 -23
  23. app/code/community/Payson/Payson/controllers/CheckoutController.php +0 -238
  24. app/code/community/Payson/Payson/controllers/IpnController.php +0 -25
  25. app/code/community/Payson/Payson/etc/config.xml +0 -167
  26. app/code/community/Payson/Payson/etc/system.xml +0 -166
  27. app/code/community/Payson/Payson/sql/payson_setup/mysql4-install-0.1.0.php +0 -32
  28. app/code/community/Payson/Payson/sql/payson_setup/mysql4-upgrade-0.1.0-0.1.2.php +0 -8
  29. package.xml +12 -8
app/code/community/Payson/Payson/Block/Form.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Block_Form extends Mage_Payment_Block_Form {
4
-
5
- protected function _construct() {
6
- $this->setTemplate('Payson/Payson/form.phtml');
7
- parent::_construct();
8
- }
9
-
10
- }
11
-
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Block/Invoice/Form.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Block_Invoice_Form extends Mage_Payment_Block_Form {
4
-
5
- protected function _construct() {
6
- $this->setTemplate('Payson/Payson/standard_form.phtml');
7
- parent::_construct();
8
- }
9
-
10
- }
11
-
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Block/Order/Totals/Fee.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Block_Order_Totals_Fee extends Mage_Core_Block_Abstract {
4
-
5
- public function initTotals() {
6
- $parent = $this->getParentBlock();
7
- $this->_order = $parent->getOrder();
8
-
9
- if ($this->_order->getPayment()->getMethod() === 'payson_invoice') {
10
- $parent->addTotalBefore(new Varien_Object(array
11
- (
12
- 'code' => 'payson_invoice',
13
- 'label' => Mage::helper('payson')->__('Invoice fee'),
14
- 'value' => $this->_order->getPaysonInvoiceFee()
15
- )), 'tax');
16
- }
17
-
18
- return $this;
19
- }
20
-
21
- }
22
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Block/Standard/Form.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Block_Standard_Form extends Mage_Payment_Block_Form {
4
-
5
- protected function _construct() {
6
- $this->setTemplate('Payson/Payson/standard_form.phtml');
7
- parent::_construct();
8
- }
9
-
10
- }
11
-
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Api.php DELETED
@@ -1,1328 +0,0 @@
1
- <?php
2
-
3
- include 'FundingConstraint.php';
4
-
5
- class Payson_Payson_Helper_Api {
6
- /*
7
- * Constants
8
- */
9
-
10
- var $invoiceAmountMinLimit = 30;
11
-
12
- const DEBUG_MODE = false;
13
- const API_CALL_PAY = '%s://%sapi.payson.%s/%s/Pay/';
14
- const API_CALL_VALIDATE = '%s://%sapi.payson.%s/%s/Validate/';
15
- const API_CALL_PAYMENT_DETAILS = '%s://%sapi.payson.%s/%s/%sDetails/';
16
- const API_CALL_PAYMENT_UPDATE = '%s://%sapi.payson.%s/%s/%sUpdate/';
17
- const PAY_FORWARD_URL = '%s://%s%s.payson.%s/paySecure/';
18
- const APPLICATION_ID = 'Magento';
19
- const MODULE_NAME = 'Payson_AllinOne';
20
- const MODULE_VERSION = '1.8.3.3';
21
- const DEBUG_MODE_MAIL = 'testagent-checkout2@payson.se';
22
- const DEBUG_MODE_AGENT_ID = '4';
23
- const DEBUG_MODE_MD5 = '2acab30d-fe50-426f-90d7-8c60a7eb31d4';
24
- const STATUS_CREATED = 'CREATED';
25
- const STATUS_PENDING = 'PENDING';
26
- const STATUS_PROCESSING = 'PROCESSING';
27
- const STATUS_COMPLETED = 'COMPLETED';
28
- const STATUS_CREDITED = 'CREDITED';
29
- const STATUS_INCOMPLETE = 'INCOMPLETE';
30
- const STATUS_ERROR = 'ERROR';
31
- const STATUS_DENIED = 'DENIED';
32
- const STATUS_ABORTED = 'ABORTED';
33
- const STATUS_CANCELED = 'CANCELED';
34
- const STATUS_EXPIRED = 'EXPIRED';
35
- const STATUS_REVERSALERROR = 'REVERSALERROR';
36
- const PAYMENT_METHOD_BANK = 'BANK';
37
- const PAYMENT_METHOD_CREDITCARD = 'CREDITCARD';
38
- const PAYMENT_METHOD_INVOICE = 'INVOICE';
39
- const PAYMENT_METHOD_SMS = 'SMS';
40
- const GUARANTEE_STATUS_WAITINGFORSEND = 'WAITINGFORSEND';
41
- const GUARANTEE_STATUS_WAITINGFORACCEPTANCE = 'WAITINGFORACCEPTANCE';
42
- const GUARANTEE_STATUS_WAITINGFORRETURN = 'WAITINGFORRETURN';
43
- const GUARANTEE_STATUS_WAITINGFORRETURNACCEPTANCE = 'WAITINGFORRETURNACCEPTANCE';
44
- const GUARANTEE_STATUS_RETURNNOTACCEPTED = 'RETURNNOTACCEPTED';
45
- const GUARANTEE_STATUS_NOTRECEIVED = 'NOTRECEIVED';
46
- const GUARANTEE_STATUS_RETURNNOTRECEIVED = 'RETURNNOTRECEIVED';
47
- const GUARANTEE_STATUS_MONEYRETURNEDTOSENDER = 'MONEYRETURNEDTOSENDER';
48
- const GUARANTEE_STATUS_RETURNACCEPTED = 'RETURNACCEPTED';
49
- const INVOICE_STATUS_PENDING = 'PENDING';
50
- const INVOICE_STATUS_ORDERCREATED = 'ORDERCREATED';
51
- const INVOICE_STATUS_ORDERCANCELLED = 'ORDERCANCELLED';
52
- const INVOICE_STATUS_SHIPPED = 'SHIPPED';
53
- const INVOICE_STATUS_DONE = 'DONE';
54
- const UPDATE_ACTION_CANCELORDER = 'CANCELORDER';
55
- const UPDATE_ACTION_SHIPORDER = 'SHIPORDER';
56
- const UPDATE_ACTION_CREDITORDER = 'CREDITORDER';
57
- const UPDATE_ACTION_REFUNDORDER = 'REFUND';
58
- const GUARANTEE_REQUIRED = 'REQUIRED';
59
- const GUARANTEE_OPTIONAL = 'OPTIONAL';
60
- const GUARANTEE_NO = 'NO';
61
-
62
- //const PMETHOD ='';
63
-
64
- /*
65
- * Private properties
66
- */
67
- private $discountType;
68
- private $numberofItems;
69
- private $discountVat = 0.0;
70
- private $_order = null;
71
- private $response;
72
- private $order_discount_item = 0.0;
73
- /* @var $_config Payson_Payson_Model_Config */
74
- private $_config;
75
- /* @var $_helper Payson_Payson_Helper_Data */
76
- private $_helper;
77
- private $_products = array();
78
-
79
- /*
80
- * Private methods
81
- */
82
-
83
- public function __construct() {
84
- $this->_config = Mage::getModel('payson/config');
85
- $this->_helper = Mage::helper('payson');
86
- $this->_invoice = Mage::getModel('payson/method/invoice');
87
- }
88
-
89
- private function getHttpClient($url) {
90
-
91
- $client = new Varien_Http_Client();
92
-
93
- $client->setUri($url)
94
- ->setMethod(Zend_Http_Client::POST)
95
- ->setHeaders(array
96
- (
97
- 'PAYSON-SECURITY-USERID' => $this->_config->get('test_mode') ? self::DEBUG_MODE_AGENT_ID : $this->_config->Get('agent_id'),
98
- 'PAYSON-SECURITY-PASSWORD' => $this->_config->get('test_mode') ? self::DEBUG_MODE_MD5 : $this->_config->Get('md5_key'),
99
- 'PAYSON-APPLICATION-ID' => self::APPLICATION_ID,
100
- 'PAYSON-MODULE-INFO' => self::MODULE_NAME . '|' . self::MODULE_VERSION . '|' . Mage::getVersion()
101
- )
102
- );
103
-
104
- return $client->resetParameters();
105
- }
106
-
107
- private function setResponse(
108
- Payson_Payson_Helper_Api_Response_Interface $response) {
109
- $this->response = $response;
110
-
111
- return $this;
112
- }
113
-
114
- //Private functions for Swedish discount and vat calculations
115
- private function setAverageVat($vat) {
116
- $this->discountVat = $vat;
117
- }
118
-
119
- private function getAverageVat() {
120
- return $this->discountVat;
121
- }
122
-
123
- private function setDiscountType($type) {
124
- $this->discountType = $type;
125
- }
126
-
127
- private function getDiscountType() {
128
- return $this->discountType;
129
- }
130
-
131
- private function setNumberOfItems($items) {
132
- $this->numberofItems = $items;
133
- }
134
-
135
- private function getNumberOfItems() {
136
- return $this->numberofItems;
137
- }
138
-
139
- private function getStoreCountry() {
140
- $countryCode = Mage::getStoreConfig('general/country/default');
141
- $country = Mage::getModel('directory/country')->loadByCode($countryCode);
142
- return $country->country_id;
143
- }
144
-
145
- private function setSwedishDiscountItem($item, &$total, $orderitems, $order) {
146
-
147
- /*
148
- * Discount types $item->getAppliedRuleIds():
149
- * Fixed discount amount for the entire cart
150
- * Precentage discount for the entire cart
151
- * Fixed discount amount for each article in cart
152
- */
153
- $rule = Mage::getModel('salesrule/rule')->load($item->getAppliedRuleIds());
154
- $total -= $item->getDiscountAmount();
155
- $numberOfItem = floor($order->getData('total_qty_ordered'));
156
- $items = 0;
157
-
158
- $discountAmount = $item->getDiscountAmount();
159
- for ($i = 0; $i <= $numberOfItem; $i++) {
160
- $orderVat = $orderitems['orderItemList.orderItem(' . $i . ').taxPercentage'];
161
- $moms += $orderVat;
162
- //counting number of tax rows that is not zero
163
- if ($orderVat != 0) {
164
- $items++;
165
- }
166
- }
167
- $this->setNumberOfItems($numberOfItem);
168
- $this->setDiscountType($rule->simple_action);
169
- $totalMoms = $moms / $items;
170
-
171
- $this->setAverageVat($totalMoms);
172
-
173
- $this->order_discount_item += $discountAmount;
174
- }
175
-
176
- private function setInternationalDiscountItem($item, &$total) {
177
- $total -= $item->getDiscountAmount();
178
- $this->order_discount_item += $item->getDiscountAmount();
179
- }
180
-
181
- /**
182
- * Helper for Pay()
183
- *
184
- * @param Mage_Sales_Model_Order_Item $item
185
- * @param int $total
186
- * @return array
187
- */
188
- private function getProductOptions($id) {
189
- $product = new Mage_Catalog_Model_Product();
190
- $product->load($id);
191
- $product->getTypeInstance(true)->setStoreFilter(Mage::app()->getStore(), $product);
192
- return $product;
193
-
194
- }
195
- private function prepareOrderItemData($item, &$total, $order) {
196
- /* @var $product Mage_Catalog_Model_Product */
197
- $product = Mage::getModel('catalog/product')
198
- ->load($item->getProductId());
199
-
200
- $attributesString = "";
201
- $quoteItems = Mage::getModel('sales/quote_item')->getCollection();
202
- $quoteItems->addFieldToFilter('quote_id', $order->quote_id);
203
- $quoteItems->addFieldToFilter('product_type', 'bundle');
204
-
205
-
206
- if (($children = $item->getChildrenItems()) != null && !$product->isConfigurable()) {
207
- $args = array();
208
- $product = $this->getProductOptions($item->getProductId());
209
-
210
- if ($item->getProductType() != 'bundle'||$product->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) {
211
- $this->prepareProductData($item->getName(), $item->getSku(), $item->getQtyOrdered(), 0, 0);
212
- }
213
- foreach ($children as $child) {
214
- $this->prepareOrderItemData($child, $total, $order);
215
- }
216
- //checks if there are bundles items is present and if it is dynamic
217
- if (($quoteItems->getSize() < 1)) {
218
- return;
219
- } elseif ($product->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC && $item->getProductType() == 'bundle') {
220
- return;
221
- }
222
- }
223
-
224
- $productOptions = $item->getProductOptions();
225
-
226
- if (array_key_exists('attributes_info', $productOptions)) {
227
- foreach ($productOptions['attributes_info'] as $attribute) {
228
- $attributesString .= $attribute['label'] . ": " . $attribute['value'] . ", ";
229
- }
230
-
231
- if ($attributesString != "") {
232
- $attributesString = substr($attributesString, 0, strlen($attributesString) - 2);
233
- }
234
- }
235
-
236
- $name = $item->getName() . ($attributesString != "" ? " - " . $attributesString : "");
237
- $sku = $item->getSku();
238
- $tax_mod = (float) $item->getTaxPercent();
239
- $tax_mod /= 100;
240
- $tax_mod = round($tax_mod, 5);
241
-
242
- $qty = (float) $item->getQtyOrdered();
243
- $qty = round($qty, 2);
244
-
245
- $price = (float) $item->getRowTotalInclTax();
246
-
247
- $base_price = (($price / (1 + $tax_mod)) / $qty);
248
- $base_price = round($base_price, 3);
249
-
250
- $total += (($base_price * (1 + $tax_mod)) * $qty);
251
-
252
- $this->prepareProductData($name, $sku, $qty, $base_price, $tax_mod);
253
- }
254
-
255
- private function generateProductDataForPayson(array $args) {
256
- $productData = array();
257
- for ($i = 0; $i < sizeof($this->_products); $i++) {
258
- $productData += array
259
- (
260
- 'orderItemList.orderItem(' . $i . ').description' =>
261
- $this->_products[$i]['Description'],
262
- 'orderItemList.orderItem(' . $i . ').sku' =>
263
- $this->_products[$i]['Sku'],
264
- 'orderItemList.orderItem(' . $i . ').quantity' =>
265
- $this->_products[$i]['Quantity'],
266
- 'orderItemList.orderItem(' . $i . ').unitPrice' =>
267
- $this->_products[$i]['Price'],
268
- 'orderItemList.orderItem(' . $i . ').taxPercentage' =>
269
- $this->_products[$i]['Tax']
270
- );
271
- $args += $productData;
272
- }
273
-
274
- return $args;
275
- }
276
-
277
- private function prepareProductData($description, $sku, $qty, $base_price, $tax_mod) {
278
- $description = strlen($description) <= 128 ? $description : substr($description, 128);
279
- $sku = strlen($sku) <= 128 ? $sku : substr($sku, 128);
280
- $this->_products[] = array("Description" => $description, "Sku" => $sku,
281
- "Quantity" => $qty, "Price" => $base_price, "Tax" => $tax_mod);
282
- }
283
-
284
- /**
285
- * Helper for Pay()
286
- *
287
- * @param object $order
288
- * @param object $customer
289
- * @param object $store
290
- * @param int $i
291
- * @param int $total
292
- */
293
- private function prepareOrderShippingData($order, $customer, $store, &$total) {
294
- $tax_calc = Mage::getSingleton('tax/calculation');
295
-
296
- $tax_rate_req = $tax_calc->getRateRequest(
297
- $order->getShippingAddress(), $order->getBillingAddress(), $customer->getTaxClassId(), $store);
298
-
299
- if (($price = (float) $order->getShippingInclTax()) > 0) {
300
- $tax_mod = $tax_calc->getRate($tax_rate_req->setProductClassId(
301
- Mage::getStoreConfig('tax/classes/shipping_tax_class')));
302
- $tax_mod /= 100;
303
- $tax_mod = round($tax_mod, 5);
304
-
305
- $price -= (float) $order->getShippingDiscountAmount();
306
-
307
- $base_price = ($price / (1 + $tax_mod));
308
- $base_price = round($base_price, 3);
309
-
310
- $total += ($base_price * (1 + $tax_mod));
311
-
312
- $this->prepareProductData($order->getShippingDescription(), $order->getShippingMethod(), 1, $base_price, $tax_mod);
313
- }
314
- }
315
-
316
- /*
317
- * Public methods
318
- */
319
-
320
- /**
321
- * Get API response
322
- *
323
- * @return object
324
- */
325
- public function GetResponse() {
326
- return $this->response;
327
- }
328
-
329
- /**
330
- * Get forward/redirect url after a successful Pay() call
331
- *
332
- * @return string
333
- */
334
- public function GetPayForwardUrl() {
335
- $url = vsprintf(self::PAY_FORWARD_URL . '?token=' . $this->GetResponse()->TOKEN, $this->getFormatIfTest(null, true));
336
- return $url;
337
- }
338
-
339
- /**
340
- * http://api.payson.se/#title8
341
- *
342
- * @param object $order
343
- * @return object
344
- */
345
- public function showReceiptPage() {
346
- $Config = (int) $this->_config->get('show_receipt_page');
347
- $reciept2 = 'false';
348
- if ($Config === 1) {
349
- $reciept2 = 'true';
350
- }
351
- return $reciept2;
352
- }
353
-
354
- public function vatDiscount() {
355
- $inputValue = (int) $this->_config->Get('vat_discount');
356
- $enableVatDiscount = 'false';
357
- if ($inputValue === 1) {
358
- $enableVatDiscount = 'true';
359
- }
360
- return $enableVatDiscount;
361
- }
362
-
363
- public function Pay(Mage_Sales_Model_Order $order) {
364
-
365
- $payment_method = $order->getPayment()->getMethod();
366
-
367
- /* @var $store Mage_Core_Model_Store */
368
- $store = Mage::app()->getStore($order->getStoreId());
369
- $customer = Mage::getModel('customer/customer')
370
- ->load($order->getCustomerId());
371
- $billing_address = $order->getBillingAddress();
372
-
373
- // Need a two character locale code. This collects the store chosen language
374
- $locale_code = Mage::getSingleton('core/locale')->getLocaleCode();
375
- $locale_code = strtoupper(substr($locale_code, 0, 2));
376
-
377
-
378
- if (!in_array($locale_code, array('SV', 'FI', 'EN'))) {
379
- switch ($locale_code) {
380
- case 'DA':
381
- case 'NO': {
382
- $locale_code = 'SV';
383
- break;
384
- }
385
- default: {
386
- $locale_code = 'EN';
387
- }
388
- }
389
- }
390
-
391
- // $args will contain the arguments of the API request to Payson
392
- $args = array
393
- (
394
- 'returnUrl' =>
395
- Mage::getUrl('payson/checkout/return', array('_secure' => true)),
396
- 'cancelUrl' =>
397
- Mage::getUrl('payson/checkout/cancel', array('_secure' => true)),
398
- 'ipnNotificationUrl' =>
399
- Mage::getUrl('payson/ipn/notify', array('_secure' => true)),
400
- 'localeCode' =>
401
- $locale_code,
402
- 'currencyCode' =>
403
- strtoupper(substr($order->getOrderCurrency()->getCode(), 0, 3)),
404
- 'memo' =>
405
- sprintf($this->_helper->__('Order from %s'), $store->getName()),
406
- 'senderEmail' =>
407
- $order->getCustomerEmail(),
408
- 'senderFirstName' =>
409
- $billing_address->getFirstname(),
410
- 'senderLastName' =>
411
- $billing_address->getLastname(),
412
- 'receiverList.receiver(0).email' =>
413
- $this->_config->get('test_mode') ? self::DEBUG_MODE_MAIL : $this->_config->Get('email'),
414
- 'trackingId' => $order->getRealOrderId(),
415
- 'showReceiptPage' => $this->showReceiptPage()
416
- );
417
-
418
- if (!$this->_config->CanPaymentGuarantee()) {
419
- $args['guaranteeOffered'] = self::GUARANTEE_NO;
420
- }
421
- $isCurrency = strtoupper(Mage::app()->getStore()->getCurrentCurrencyCode());
422
- $paymentMethod = $this->_config->get('payson_All_in_one');
423
- //Get Payson paymentmethod
424
- //Direct Payment
425
- if ($this->_config->CanStandardPayment() && $isCurrency == 'SEK') {
426
- $payment = $this->getConstrains($paymentMethod);
427
- }
428
- //InvoicePayment with check if invoice amount is above minimum
429
- if ($this->_config->CanInvoicePayment() && ($order->getSubtotal() >= $this->invoiceAmountMinLimit) && ($isCurrency == 'SEK')) {
430
- $payment = $this->getConstrains($paymentMethod);
431
- }
432
- //Remove invoice if invoice amount is below minimum amount
433
- if ($this->_config->CanInvoicePayment() && ($order->getSubtotal() < $this->invoiceAmountMinLimit) && ($isCurrency == 'SEK')) {
434
- $disableInvoice = true;
435
- $payment = $this->getConstrains($paymentMethod);
436
- if (in_array(3, $payment)) {
437
- $newArray = array();
438
- foreach ($payment as $pkey) {
439
- if ($pkey != 3)
440
- $newArray[] = $pkey;
441
- }
442
- $payment = $newArray;
443
- }
444
- }
445
- //If other currency than SEK remove payment option Invocie and SMS
446
- if (($this->_config->CanInvoicePayment() || $this->_config->CanStandardPayment()) && ($isCurrency != 'SEK')) {
447
- $payment = $this->getConstrains($paymentMethod);
448
- //Remove Invoice from array
449
- if (in_array(3, $payment)) {
450
- $disableInvoice = true;
451
- $newArray = array();
452
- foreach ($payment as $pkey) {
453
- if ($pkey != 3) {
454
- $newArray[] = $pkey;
455
- }
456
- }
457
- $payment = $newArray;
458
- }
459
- //Remove SMS from array
460
- if (in_array(4, $payment)) {
461
- $newArray = array();
462
- foreach ($payment as $pkey) {
463
- if ($pkey != 4) {
464
- $newArray[] = $pkey;
465
- }
466
- }
467
- $payment = $newArray;
468
- }
469
- }
470
-
471
- $result = (!isset($payment)) ? $payment = '' : $payment;
472
-
473
- define("PMETHOD", serialize($result));
474
- $output = array();
475
- FundingConstraint::addConstraintsToOutput($result, $output);
476
- $args = array_merge($args, $output);
477
-
478
- // Calculate price of each item in the order
479
- $total = 0;
480
- foreach ($order->getAllVisibleItems() as $item) {
481
- $this->prepareOrderItemData($item, $total, $order);
482
- }
483
-
484
- $productItems = $this->generateProductDataForPayson($args);
485
- $customerCountry = $order->getBillingAddress()->country_id;
486
- if ($this->getStoreCountry() == 'SE' && $customerCountry == 'SE' && $this->vatDiscount() == 'true') {
487
-
488
- foreach ($order->getAllVisibleItems() as $item) {
489
- $this->setSwedishDiscountItem($item, $total, $productItems, $order);
490
- }
491
- if ($this->order_discount_item > 0) {
492
- switch ($this->getDiscountType()) {
493
- case Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION:
494
- case Mage_SalesRule_Model_Rule::TO_PERCENT_ACTION:
495
- $this->prepareProductData('Rabatt inkl moms', 'Rabatt', 1, -$this->order_discount_item, $this->getAverageVat());
496
- break;
497
- case Mage_SalesRule_Model_Rule::BY_FIXED_ACTION:
498
- $specialDiscount = $this->order_discount_item / $this->getNumberOfItems();
499
- $this->prepareProductData('Rabatt inkl moms', 'Rabatt', $this->getNumberOfItems(), -$specialDiscount, $this->getAverageVat());
500
- break;
501
- default:
502
- $this->prepareProductData('Rabatt inkl moms', 'Rabatt', 1, -$this->order_discount_item, $this->getAverageVat());
503
- break;
504
- }
505
- }
506
- } else {
507
-
508
- foreach ($order->getAllVisibleItems() as $item) {
509
- $this->setInternationalDiscountItem($item, $total);
510
- }
511
-
512
- if ($this->order_discount_item > 0) {
513
- $this->prepareProductData('discount', 'discount', 1, -$this->order_discount_item, 0.0);
514
- }
515
- }
516
- //
517
-
518
- // Calculate price for shipping
519
- $this->prepareOrderShippingData($order, $customer, $store, $total);
520
- $args = $this->generateProductDataForPayson($args);
521
-
522
- if ($this->_config->CanInvoicePayment() && ($order->getSubtotal() >= $this->invoiceAmountMinLimit) && !$disableInvoice) {
523
-
524
- if ($order->getPaysonInvoiceFee() > 0) {
525
-
526
- $fee = $order->getPaysonInvoiceFee();
527
-
528
- $args['invoiceFee'] = round((float) $fee, 3);
529
- $total += $fee;
530
- }
531
- }
532
- $roundedTotal = round($total, 2);
533
- if ($this->getStoreCountry() == 'SE' && $customerCountry == 'SE' && $this->vatDiscount() == 'true') {
534
- if ($this->order_discount_item > 0) {
535
- switch ($this->getDiscountType()) {
536
- case Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION:
537
- case Mage_SalesRule_Model_Rule::TO_PERCENT_ACTION:
538
- case Mage_SalesRule_Model_Rule::BY_FIXED_ACTION:
539
- case Mage_SalesRule_Model_Rule::CART_FIXED_ACTION:
540
- $roundedTotal = $roundedTotal - ($this->order_discount_item * $this->getAverageVat());
541
- break;
542
-
543
- default:
544
- break;
545
- }
546
- }
547
- }
548
- $args['receiverList.receiver(0).amount'] = $roundedTotal;
549
-
550
- $url = vsprintf(self::API_CALL_PAY, $this->getFormatIfTest($order->getStoreId()));
551
-
552
- $client = $this->getHttpClient($url)
553
- ->setParameterPost($args);
554
-
555
- $response = Payson_Payson_Helper_Api_Response_Standard
556
- ::FromHttpBody($client->request('POST')->getBody());
557
- $this->setResponse($response);
558
-
559
-
560
- $resource = Mage::getSingleton('core/resource');
561
- $db = $resource->getConnection('core_write');
562
-
563
- $order_table = $resource->getTableName('payson_order');
564
- $order_log_table = $resource->getTableName('payson_order_log');
565
-
566
- $db->insert($order_table, array
567
- (
568
- 'order_id' => $order->getRealOrderId(),
569
- 'added' => new Zend_Db_Expr('NOW()'),
570
- 'updated' => new Zend_Db_Expr('NOW()'),
571
- 'valid' => (int) $response->IsValid(),
572
- 'token' => (isset($response->TOKEN) ? $response->TOKEN :
573
- new Zend_Db_Expr('NULL')),
574
- 'store_id' => $order->getStoreId()
575
- ));
576
-
577
- $payson_order_id = $db->lastInsertId();
578
-
579
- $db->insert($order_log_table, array
580
- (
581
- 'payson_order_id' => $payson_order_id,
582
- 'added' => new Zend_Db_Expr('NOW()'),
583
- 'api_call' => 'pay',
584
- 'valid' => (int) $response->IsValid(),
585
- 'response' => serialize($response->ToArray())
586
- ));
587
-
588
- if (!$response->IsValid()) {
589
-
590
- throw new Mage_Core_Exception(sprintf($this->_helper->__(
591
- 'Failed to initialize payment. Payson replied: %s'), $response->GetError()), $response->GetErrorId());
592
- }
593
-
594
- return $this;
595
- }
596
-
597
- public function PaymentMethod() {
598
-
599
- }
600
-
601
- private function getConstrains($paymentMethod) {
602
-
603
- $constraints = array();
604
- $opts = array(
605
- -1 => array(''),
606
- 0 => array('sms'),
607
- 1 => array('bank'),
608
- 2 => array('card'),
609
- 3 => array('bank', 'sms'),
610
- 4 => array('card', 'sms'),
611
- 5 => array('card', 'bank'),
612
- 6 => array('card', 'bank', 'sms'),
613
- 7 => array(''),
614
- 8 => array('invoice'),
615
- 9 => array('invoice', 'sms'),
616
- 10 => array('invoice', 'bank'),
617
- 11 => array('invoice', 'card'),
618
- 12 => array('invoice', 'bank', 'sms'),
619
- 13 => array('invoice', 'card', 'sms'),
620
- 14 => array('invoice', 'card', 'bank'),
621
- 15 => array('invoice', 'card', 'bank', 'sms'),
622
- );
623
- $optsStrings = array('' => FundingConstraint::NONE, 'bank' => FundingConstraint::BANK, 'card' => FundingConstraint::CREDITCARD, 'invoice' => FundingConstraint::INVOICE, 'sms' => FundingConstraint::SMS);
624
- if ($opts[$paymentMethod]) {
625
- foreach ($opts[$paymentMethod] as $methodStringName) {
626
- $constraints[] = $optsStrings[$methodStringName];
627
- }
628
- }
629
- return $constraints;
630
- }
631
-
632
- /**
633
- * Implements the IPN procedure
634
- *
635
- * http://api.payson.se/#title11
636
- *
637
- * @param string $http_body
638
- * @param string $content_type
639
- * @return object $this
640
- */
641
- public function confirmationEmail($entityId) {
642
- $resource = Mage::getSingleton('core/resource');
643
- $db = $resource->getConnection('core_write');
644
- $order_table = $resource->getTableName('sales_flat_order');
645
- $status = $db->fetchRow(
646
- 'SELECT status FROM `' . $order_table . '` WHERE
647
- entity_id = ? LIMIT 0,1', $entityId);
648
-
649
- return $status;
650
- }
651
-
652
- public function Validate($http_body, $content_type) {
653
-
654
- // Parse request done by Payson to our IPN controller
655
- $ipn_response = Payson_Payson_Helper_Api_Response_Standard
656
- ::FromHttpBody($http_body);
657
- // Get the database connection
658
- $resource = Mage::getSingleton('core/resource');
659
- $db = $resource->getConnection('core_write');
660
-
661
- $order_table = $resource->getTableName('payson_order');
662
- $order_log_table = $resource->getTableName('payson_order_log');
663
-
664
-
665
- /* Save data sent by Payson, log entry as invalid by default, this
666
- value will be changed later in this method if successful. No payson
667
- order id is set, because we dont have one yet */
668
- $db->insert($order_log_table, array
669
- (
670
- 'added' => new Zend_Db_Expr('NOW()'),
671
- 'api_call' => 'validate',
672
- 'valid' => 0,
673
- 'response' => serialize($ipn_response->ToArray())
674
- ));
675
-
676
- $order_log_id = $db->lastInsertId();
677
-
678
- /* Save fetch mode so that we can reset it and not mess up Magento
679
- functionality */
680
- $old_fetch_mode = $db->getFetchMode();
681
- $db->setFetchMode(Zend_Db::FETCH_OBJ);
682
-
683
- // Get payson order information and validate token
684
- $payson_order = $db->fetchRow(
685
- 'SELECT
686
- id,
687
- order_id,
688
- store_id
689
- FROM
690
- `' . $order_table . '`
691
- WHERE
692
- valid = 1
693
- AND
694
- token = ?
695
- LIMIT
696
- 0,1', $ipn_response->token);
697
-
698
- if ($payson_order === false) {
699
- Mage::throwException('Invalid token');
700
- }
701
-
702
- // Do the validate API call
703
- $client = $this->getHttpClient(vsprintf(self::API_CALL_VALIDATE, $this->getFormatIfTest($payson_order->store_id)))
704
- ->setRawData($http_body, $content_type);
705
-
706
- $response = Payson_Payson_Helper_Api_Response_Validate
707
- ::FromHttpBody($client->request('POST')->getBody());
708
-
709
- $this->setResponse($response);
710
-
711
- if (!$response->IsValid()) {
712
- Mage::throwException('Validate call was unsuccessful');
713
- }
714
-
715
-
716
-
717
- // Update order log with payson order id
718
- $db->update($order_log_table, array
719
- (
720
- 'payson_order_id' => $payson_order->id
721
- ), array
722
- (
723
- 'id = ?' => $order_log_id
724
- ));
725
-
726
- // the order model does not expect FETCH_OBJ!
727
- $db->setFetchMode($old_fetch_mode);
728
-
729
- /**
730
- * @var Mage_Sales_Model_Order
731
- */
732
- $order = Mage::getModel('sales/order')
733
- ->loadByIncrementId($payson_order->order_id);
734
-
735
- // Stop if order dont exist
736
- if (is_null($order->getId())) {
737
- Mage::throwException('Invalid order');
738
- }
739
-
740
- if ($order->getState() === Mage_Sales_Model_Order::STATE_COMPLETE) {
741
- Mage::throwException('Order is no longer active');
742
- }
743
- $sendEmail = $this->confirmationEmail($order->getEntityId());
744
- $receivers = $ipn_response->receiverList->receiver->ToArray();
745
- $investigatefee = $order['base_payson_invoice_fee'];
746
-
747
- $new_receivers = array();
748
- foreach ($receivers as $item) {
749
- foreach ($item as $key => $value) {
750
- $new_receivers[$key] = $value;
751
- }
752
- }
753
- $currentAmount = $new_receivers['amount'];
754
- $newAmount = $currentAmount += $investigatefee;
755
-
756
- /* Verify payment amount. floor() since there might be a precision
757
- difference */
758
- switch ($ipn_response->status) {
759
- case self::STATUS_COMPLETED: {
760
- //Changes the status of the order from pending_payment to processing
761
- if ($sendEmail['status'] == 'pending_payment') {
762
- $order->sendNewOrderEmail()->save();
763
- }
764
- $order->setState(
765
- Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test completed the order payment') : $this->_helper->__('Payson completed the order payment'));
766
- $order['payson_invoice_fee'] = 0;
767
- $order['base_payson_invoice_fee'] = 0;
768
- //It creates the invoice to the order
769
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
770
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
771
- $invoice->register();
772
- $transactionSave = Mage::getModel('core/resource_transaction')
773
- ->addObject($invoice)
774
- ->addObject($invoice->getOrder());
775
- $transactionSave->save();
776
-
777
- break;
778
- }
779
- case self::STATUS_CREATED:
780
- case self::STATUS_PENDING:
781
- case self::STATUS_PROCESSING:
782
- case self::STATUS_CREDITED: {
783
- if (($ipn_response->status === self::STATUS_PENDING) &&
784
- ($ipn_response->type === self::PAYMENT_METHOD_INVOICE) &&
785
- ($ipn_response->invoiceStatus ===
786
- self::INVOICE_STATUS_ORDERCREATED)) {
787
- if ($sendEmail['status'] == 'pending_payment') {
788
- $order->sendNewOrderEmail()->save();
789
- }
790
- //Changes the status of the order from pending to processing
791
- $order->setState(
792
- Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test created an invoice') : $this->_helper->__('Payson created an invoice'));
793
- $order->setBaseGrandTotal($newAmount);
794
- $order->setGrandTotal($newAmount);
795
- $order->setTotalDue($newAmount);
796
- $order->save();
797
-
798
-
799
- if (isset($ipn_response->shippingAddress)) {
800
- $address_info = $ipn_response->shippingAddress
801
- ->ToArray();
802
-
803
- $address = $order->getShippingAddress();
804
-
805
- if (isset($address_info['name'])) {
806
- $address->setFirstname($address_info['name']);
807
- $address->setMiddlename('');
808
- $address->setLastname('');
809
- }
810
-
811
- if (isset($address_info['streetAddress'])) {
812
- $address->setStreet($address_info['streetAddress']);
813
- }
814
-
815
- if (isset($address_info['postalCode'])) {
816
- $address->setPostcode($address_info['streetAddress']);
817
- }
818
-
819
- if (isset($address_info['city'])) {
820
- $address->setCity($address_info['city']);
821
- }
822
-
823
- if (isset($address_info['country'])) {
824
-
825
- $foo = array
826
- (
827
- 'afghanistan' => 'AF',
828
- 'albania' => 'AL',
829
- 'algeria' => 'DZ',
830
- 'american samoa' => 'AS',
831
- 'andorra' => 'AD',
832
- 'angola' => 'AO',
833
- 'anguilla' => 'AI',
834
- 'antarctica' => 'AQ',
835
- 'antigua and barbuda' => 'AG',
836
- 'argentina' => 'AR',
837
- 'armenia' => 'AM',
838
- 'aruba' => 'AW',
839
- 'australia' => 'AU',
840
- 'austria' => 'AT',
841
- 'azerbaijan' => 'AZ',
842
- 'bahamas' => 'BS',
843
- 'bahrain' => 'BH',
844
- 'bangladesh' => 'BD',
845
- 'barbados' => 'BB',
846
- 'belarus' => 'BY',
847
- 'belgium' => 'BE',
848
- 'belize' => 'BZ',
849
- 'benin' => 'BJ',
850
- 'bermuda' => 'BM',
851
- 'bhutan' => 'BT',
852
- 'bolivia' => 'BO',
853
- 'bosnia and herzegovina' => 'BA',
854
- 'botswana' => 'BW',
855
- 'bouvet island' => 'BV',
856
- 'brazil' => 'BR',
857
- 'british indian ocean territory' => 'IO',
858
- 'brunei darussalam' => 'BN',
859
- 'bulgaria' => 'BG',
860
- 'burkina faso' => 'BF',
861
- 'burundi' => 'BI',
862
- 'cambodia' => 'KH',
863
- 'cameroon' => 'CM',
864
- 'canada' => 'CA',
865
- 'cape verde' => 'CV',
866
- 'cayman islands' => 'KY',
867
- 'central african republic' => 'CF',
868
- 'chad' => 'TD',
869
- 'chile' => 'CL',
870
- 'china' => 'CN',
871
- 'christmas island' => 'CX',
872
- 'cocos (keeling) islands' => 'CC',
873
- 'colombia' => 'CO',
874
- 'comoros' => 'KM',
875
- 'congo' => 'CG',
876
- 'congo, the democratic republic of the' => 'CD',
877
- 'cook islands' => 'CK',
878
- 'costa rica' => 'CR',
879
- 'cote d ivoire' => 'CI',
880
- 'croatia' => 'HR',
881
- 'cuba' => 'CU',
882
- 'cyprus' => 'CY',
883
- 'czech republic' => 'CZ',
884
- 'denmark' => 'DK',
885
- 'djibouti' => 'DJ',
886
- 'dominica' => 'DM',
887
- 'dominican republic' => 'DO',
888
- 'east timor' => 'TP',
889
- 'ecuador' => 'EC',
890
- 'egypt' => 'EG',
891
- 'el salvador' => 'SV',
892
- 'equatorial guinea' => 'GQ',
893
- 'eritrea' => 'ER',
894
- 'estonia' => 'EE',
895
- 'ethiopia' => 'ET',
896
- 'falkland islands (malvinas)' => 'FK',
897
- 'faroe islands' => 'FO',
898
- 'fiji' => 'FJ',
899
- 'finland' => 'FI',
900
- 'france' => 'FR',
901
- 'french guiana' => 'GF',
902
- 'french polynesia' => 'PF',
903
- 'french southern territories' => 'TF',
904
- 'gabon' => 'GA',
905
- 'gambia' => 'GM',
906
- 'georgia' => 'GE',
907
- 'germany' => 'DE',
908
- 'ghana' => 'GH',
909
- 'gibraltar' => 'GI',
910
- 'greece' => 'GR',
911
- 'greenland' => 'GL',
912
- 'grenada' => 'GD',
913
- 'guadeloupe' => 'GP',
914
- 'guam' => 'GU',
915
- 'guatemala' => 'GT',
916
- 'guinea' => 'GN',
917
- 'guinea-bissau' => 'GW',
918
- 'guyana' => 'GY',
919
- 'haiti' => 'HT',
920
- 'heard island and mcdonald islands' => 'HM',
921
- 'holy see (vatican city state)' => 'VA',
922
- 'honduras' => 'HN',
923
- 'hong kong' => 'HK',
924
- 'hungary' => 'HU',
925
- 'iceland' => 'IS',
926
- 'india' => 'IN',
927
- 'indonesia' => 'ID',
928
- 'iran, islamic republic of' => 'IR',
929
- 'iraq' => 'IQ',
930
- 'ireland' => 'IE',
931
- 'israel' => 'IL',
932
- 'italy' => 'IT',
933
- 'jamaica' => 'JM',
934
- 'japan' => 'JP',
935
- 'jordan' => 'JO',
936
- 'kazakstan' => 'KZ',
937
- 'kenya' => 'KE',
938
- 'kiribati' => 'KI',
939
- 'korea democratic peoples republic of' => 'KP',
940
- 'korea republic of' => 'KR',
941
- 'kuwait' => 'KW',
942
- 'kyrgyzstan' => 'KG',
943
- 'lao peoples democratic republic' => 'LA',
944
- 'latvia' => 'LV',
945
- 'lebanon' => 'LB',
946
- 'lesotho' => 'LS',
947
- 'liberia' => 'LR',
948
- 'libyan arab jamahiriya' => 'LY',
949
- 'liechtenstein' => 'LI',
950
- 'lithuania' => 'LT',
951
- 'luxembourg' => 'LU',
952
- 'macau' => 'MO',
953
- 'macedonia, the former yugoslav republic of' => 'MK',
954
- 'madagascar' => 'MG',
955
- 'malawi' => 'MW',
956
- 'malaysia' => 'MY',
957
- 'maldives' => 'MV',
958
- 'mali' => 'ML',
959
- 'malta' => 'MT',
960
- 'marshall islands' => 'MH',
961
- 'martinique' => 'MQ',
962
- 'mauritania' => 'MR',
963
- 'mauritius' => 'MU',
964
- 'mayotte' => 'YT',
965
- 'mexico' => 'MX',
966
- 'micronesia, federated states of' => 'FM',
967
- 'moldova, republic of' => 'MD',
968
- 'monaco' => 'MC',
969
- 'mongolia' => 'MN',
970
- 'montserrat' => 'MS',
971
- 'morocco' => 'MA',
972
- 'mozambique' => 'MZ',
973
- 'myanmar' => 'MM',
974
- 'namibia' => 'NA',
975
- 'nauru' => 'NR',
976
- 'nepal' => 'NP',
977
- 'netherlands' => 'NL',
978
- 'netherlands antilles' => 'AN',
979
- 'new caledonia' => 'NC',
980
- 'new zealand' => 'NZ',
981
- 'nicaragua' => 'NI',
982
- 'niger' => 'NE',
983
- 'nigeria' => 'NG',
984
- 'niue' => 'NU',
985
- 'norfolk island' => 'NF',
986
- 'northern mariana islands' => 'MP',
987
- 'norway' => 'NO',
988
- 'oman' => 'OM',
989
- 'pakistan' => 'PK',
990
- 'palau' => 'PW',
991
- 'palestinian territory, occupied' => 'PS',
992
- 'panama' => 'PA',
993
- 'papua new guinea' => 'PG',
994
- 'paraguay' => 'PY',
995
- 'peru' => 'PE',
996
- 'philippines' => 'PH',
997
- 'pitcairn' => 'PN',
998
- 'poland' => 'PL',
999
- 'portugal' => 'PT',
1000
- 'puerto rico' => 'PR',
1001
- 'qatar' => 'QA',
1002
- 'reunion' => 'RE',
1003
- 'romania' => 'RO',
1004
- 'russian federation' => 'RU',
1005
- 'rwanda' => 'RW',
1006
- 'saint helena' => 'SH',
1007
- 'saint kitts and nevis' => 'KN',
1008
- 'saint lucia' => 'LC',
1009
- 'saint pierre and miquelon' => 'PM',
1010
- 'saint vincent and the grenadines' => 'VC',
1011
- 'samoa' => 'WS',
1012
- 'san marino' => 'SM',
1013
- 'sao tome and principe' => 'ST',
1014
- 'saudi arabia' => 'SA',
1015
- 'senegal' => 'SN',
1016
- 'seychelles' => 'SC',
1017
- 'sierra leone' => 'SL',
1018
- 'singapore' => 'SG',
1019
- 'slovakia' => 'SK',
1020
- 'slovenia' => 'SI',
1021
- 'solomon islands' => 'SB',
1022
- 'somalia' => 'SO',
1023
- 'south africa' => 'ZA',
1024
- 'south georgia and the south sandwich islands' => 'GS',
1025
- 'spain' => 'ES',
1026
- 'sri lanka' => 'LK',
1027
- 'sudan' => 'SD',
1028
- 'suriname' => 'SR',
1029
- 'svalbard and jan mayen' => 'SJ',
1030
- 'swaziland' => 'SZ',
1031
- 'sweden' => 'SE',
1032
- 'switzerland' => 'CH',
1033
- 'syrian arab republic' => 'SY',
1034
- 'taiwan, province of china' => 'TW',
1035
- 'tajikistan' => 'TJ',
1036
- 'tanzania, united republic of' => 'TZ',
1037
- 'thailand' => 'TH',
1038
- 'togo' => 'TG',
1039
- 'tokelau' => 'TK',
1040
- 'tonga' => 'TO',
1041
- 'trinidad and tobago' => 'TT',
1042
- 'tunisia' => 'TN',
1043
- 'turkey' => 'TR',
1044
- 'turkmenistan' => 'TM',
1045
- 'turks and caicos islands' => 'TC',
1046
- 'tuvalu' => 'TV',
1047
- 'uganda' => 'UG',
1048
- 'ukraine' => 'UA',
1049
- 'united arab emirates' => 'AE',
1050
- 'united kingdom' => 'GB',
1051
- 'united states' => 'US',
1052
- 'united states minor outlying islands' => 'UM',
1053
- 'uruguay' => 'UY',
1054
- 'uzbekistan' => 'UZ',
1055
- 'vanuatu' => 'VU',
1056
- 'venezuela' => 'VE',
1057
- 'viet nam' => 'VN',
1058
- 'virgin islands, british' => 'VG',
1059
- 'virgin islands, u.s.' => 'VI',
1060
- 'wallis and futuna' => 'WF',
1061
- 'western sahara' => 'EH',
1062
- 'yemen' => 'YE',
1063
- 'yugoslavia' => 'YU',
1064
- 'zambia' => 'ZM',
1065
- 'zimbabwe' => 'ZW'
1066
- );
1067
-
1068
- $address_info['country'] = strtolower(
1069
- $address_info['country']);
1070
-
1071
- if (isset($foo[$address_info['country']])) {
1072
- $address->setCountryId(
1073
- $foo[$address_info['country']]);
1074
- }
1075
- }
1076
-
1077
- $address->save();
1078
- $order->addStatusHistoryComment(sprintf($this->_helper->__(
1079
- 'Payson updated the shipping address')));
1080
- }
1081
- } else {
1082
- $order['payson_invoice_fee'] = 0;
1083
- $order['base_payson_invoice_fee'] = 0;
1084
- $order->addStatusHistoryComment(sprintf(
1085
- $this->_helper->__('Payson pinged the order with status %s'), $ipn_response->status));
1086
- }
1087
-
1088
- break;
1089
- }
1090
-
1091
- case self::STATUS_ERROR:
1092
- case self::STATUS_DENIED:
1093
-
1094
- $order->cancel();
1095
-
1096
-
1097
- $order->addStatusHistoryComment($this->_helper->__('The order was denied by Payson.'));
1098
-
1099
- break;
1100
-
1101
- case self::STATUS_INCOMPLETE:
1102
- case self::STATUS_EXPIRED:
1103
- case self::STATUS_CANCELED:
1104
- case self::STATUS_ABORTED:
1105
- $order->cancel();
1106
-
1107
- $order->addStatusHistoryComment($this->_helper->__('The order was canceled or not completed within allocated time'));
1108
- break;
1109
-
1110
- case self::STATUS_REVERSALERROR:
1111
- default: {
1112
- $order->cancel();
1113
- }
1114
- }
1115
-
1116
- $order->save();
1117
- $db->update($order_log_table, array
1118
- (
1119
- 'valid' => 1
1120
- ), array
1121
- (
1122
- 'id = ?' => $order_log_id
1123
- ));
1124
-
1125
- $db->update($order_table, array
1126
- (
1127
- 'ipn_status' => $ipn_response->status
1128
- ), array
1129
- (
1130
- 'id = ?' => $payson_order->id
1131
- ));
1132
-
1133
-
1134
- return $this;
1135
- }
1136
-
1137
- public function PaymentDetails($order_id) {
1138
-
1139
- // Get the database connection
1140
- $resource = Mage::getSingleton('core/resource');
1141
- $db = $resource->getConnection('core_write');
1142
-
1143
- $order_table = $resource->getTableName('payson_order');
1144
- $order_log_table = $resource->getTableName('payson_order_log');
1145
- /* Save fetch mode so that we can reset it and not mess up Magento
1146
- functionality */
1147
- $old_fetch_mode = $db->getFetchMode();
1148
- $db->setFetchMode(Zend_Db::FETCH_OBJ);
1149
-
1150
- // Get payson order information and validate token
1151
- $payson_order = $db->fetchRow(
1152
- 'SELECT
1153
- id,
1154
- token,
1155
- store_id
1156
- FROM
1157
- `' . $order_table . '`
1158
- WHERE
1159
- valid = 1
1160
- AND
1161
- order_id = ?
1162
- LIMIT
1163
- 0,1', $order_id);
1164
-
1165
- try {
1166
- $payson_order !== false;
1167
- } catch (Exception $e) {
1168
- Mage::throwException('Invalid order id (' . $order_id . ')' . $e->getMessage());
1169
- }
1170
- $db->setFetchMode($old_fetch_mode);
1171
-
1172
- $args = array
1173
- (
1174
- 'token' => $payson_order->token
1175
- );
1176
- $url = vsprintf(self::API_CALL_PAYMENT_DETAILS, $this->getFormatIfTest($payson_order->store_id));
1177
-
1178
- $client = $this->getHttpClient($url)
1179
- ->setParameterPost($args);
1180
-
1181
- $response = Payson_Payson_Helper_Api_Response_Standard
1182
- ::FromHttpBody($client->request('POST')->getBody());
1183
-
1184
- $this->setResponse($response);
1185
-
1186
- $db->insert($order_log_table, array
1187
- (
1188
- 'payson_order_id' => $payson_order->id,
1189
- 'added' => new Zend_Db_Expr('NOW()'),
1190
- 'api_call' => 'payment_details',
1191
- 'valid' => (int) $response->IsValid(),
1192
- 'response' => serialize($response->ToArray())
1193
- ));
1194
-
1195
- $payson_validator = $db->fetchRow(
1196
- 'SELECT ipn_status, token FROM `' . $order_table . '` WHERE order_id = ? LIMIT 0,1', $order_id);
1197
- if ((!$response->IsValid()) && ($payson_validator->ipn_status == NULL && $payson_validator->token == NULL)) {
1198
-
1199
- $sales_flat_order = 'sales_flat_order';
1200
- if ($order_id !== null && $payson_order !== false) {
1201
- $new_order_id = Mage::getModel('sales/order')->loadByIncrementId($order_id)->getEntityId();
1202
- $db->update($sales_flat_order, array('state' => 'canceled', 'status' => 'canceled'), array('entity_id = ?' => $new_order_id));
1203
- }
1204
- }
1205
-
1206
- if (!$response->IsValid()) {
1207
- $redirectUrl = Mage::getUrl('checkout/cart');
1208
- Mage::getSingleton('checkout/session')->setRedirectUrl($redirectUrl);
1209
- }
1210
-
1211
- return $this;
1212
- }
1213
-
1214
- /**
1215
- * http://api.payson.se/#title13
1216
- *
1217
- * @params int $order_id Real order id
1218
- * @params string $action
1219
- * @return object $this
1220
- */
1221
- public function PaymentUpdate($order_id, $action) {
1222
-
1223
- // Get the database connection
1224
- $resource = Mage::getSingleton('core/resource');
1225
- $db = $resource->getConnection('core_write');
1226
-
1227
- $order_table = $resource->getTableName('payson_order');
1228
- $order_log_table = $resource->getTableName('payson_order_log');
1229
-
1230
- /* Save fetch mode so that we can reset it and not mess up Magento
1231
- functionality */
1232
- $old_fetch_mode = $db->getFetchMode();
1233
- $db->setFetchMode(Zend_Db::FETCH_OBJ);
1234
-
1235
- // Get payson order information and validate token
1236
- $payson_order = $db->fetchRow(
1237
- 'SELECT
1238
- id,
1239
- token,
1240
- store_id
1241
- FROM
1242
- `' . $order_table . '`
1243
- WHERE
1244
- valid = 1
1245
- AND
1246
- order_id = ?
1247
- LIMIT
1248
- 0,1', $order_id);
1249
-
1250
-
1251
-
1252
- try {
1253
- $payson_order !== false;
1254
- } catch (Exception $e) {
1255
- Mage::throwException('Invalid order id (' . $order_id . ')' . $e->getMessage());
1256
- }
1257
-
1258
- $db->setFetchMode($old_fetch_mode);
1259
-
1260
- $args = array
1261
- (
1262
- 'token' => $payson_order->token,
1263
- 'action' => $action
1264
- );
1265
-
1266
- $client = $this->getHttpClient(vsprintf(self::API_CALL_PAYMENT_UPDATE, $this->getFormatIfTest($payson_order->store_id)))
1267
- ->setParameterPost($args);
1268
-
1269
- $response = Payson_Payson_Helper_Api_Response_Standard
1270
- ::FromHttpBody($client->request('POST')->getBody());
1271
-
1272
- $this->setResponse($response);
1273
-
1274
- $db->insert($order_log_table, array
1275
- (
1276
- 'payson_order_id' => $payson_order->id,
1277
- 'added' => new Zend_Db_Expr('NOW()'),
1278
- 'api_call' => 'payment_update',
1279
- 'valid' => (int) $response->IsValid(),
1280
- 'response' => serialize($response->ToArray())
1281
- ));
1282
-
1283
- return $this;
1284
- }
1285
-
1286
- private function getFormatIfTest($storeID = null, $isForwardURL = FALSE) {
1287
-
1288
- $stack = array();
1289
- /* @var $isTest bool */
1290
- $isTest = ($this->_config->get('test_mode', $storeID) == "1");
1291
-
1292
- array_push($stack, self::DEBUG_MODE ? "http" : "https");
1293
- array_push($stack, $isTest && !self::DEBUG_MODE ? "test-" : (self::DEBUG_MODE && !$isForwardURL ? "mvc" : ""));
1294
-
1295
- if ($isForwardURL == true) {
1296
- array_push($stack, self::DEBUG_MODE ? "app" : "www");
1297
- }
1298
-
1299
- array_push($stack, self::DEBUG_MODE ? "local" : "se");
1300
- array_push($stack, self::DEBUG_MODE ? "Payment" : "1.0");
1301
-
1302
- array_push($stack, self::DEBUG_MODE ? "" : "Payment");
1303
- return $stack;
1304
- }
1305
-
1306
- public function getIpnStatus($order_id) {
1307
- $resource = Mage::getSingleton('core/resource');
1308
- $db = $resource->getConnection('core_write');
1309
- $order_table = $resource->getTableName('payson_order');
1310
- $query = 'SELECT ipn_status FROM `' . $order_table . '` WHERE order_id = ' . $order_id;
1311
- return $db->fetchRow($query);
1312
- }
1313
-
1314
- public function paysonApiError($error) {
1315
- $error_code = '<html>
1316
- <head>
1317
- <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
1318
- <script type="text/javascript">
1319
- alert("' . $error . '");
1320
- window.location="' . ('/index.php') . '";
1321
- </script>
1322
- </head>
1323
- </html>';
1324
- echo $error_code;
1325
- exit;
1326
- }
1327
-
1328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Api/Response/Interface.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
-
3
- interface Payson_Payson_Helper_Api_Response_Interface {
4
-
5
- /**
6
- * Construct a response object from a string
7
- *
8
- * @param string $body
9
- * @return object
10
- */
11
- public static function FromHttpBody($body);
12
-
13
- /**
14
- * Whether this response is valid
15
- *
16
- * @return bool
17
- */
18
- public function IsValid();
19
- }
20
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Api/Response/Standard.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Helper_Api_Response_Standard extends Payson_Payson_Helper_Api_Response_Standard_Parameters implements Payson_Payson_Helper_Api_Response_Interface {
4
- /*
5
- * Constants
6
- */
7
-
8
- const ACK_SUCCESS = 'SUCCESS';
9
- const ACK_FAILURE = 'FAILURE';
10
-
11
- /*
12
- * Public methods
13
- */
14
-
15
- /**
16
- * Parse response object and instantiate
17
- *
18
- * @param string $response
19
- * @return object
20
- */
21
- static public function FromHttpBody($body) {
22
- $params = array();
23
- parse_str($body, $params);
24
-
25
- foreach ($params as $key => $value) {
26
- $sub_key = strtok($key, '_');
27
-
28
- if ($sub_key === $key) {
29
- continue;
30
- }
31
-
32
- $current = &$params;
33
-
34
- do {
35
- $matches = array();
36
-
37
- if (preg_match('/\((\d)\)$/', $sub_key, $matches) === 1) {
38
- $sub_key = substr($sub_key, 0, -3);
39
-
40
- if (!strlen($sub_key)) {
41
- continue;
42
- }
43
- }
44
-
45
- if (!isset($current[$sub_key]) || !is_array($current[$sub_key])) {
46
- $current[$sub_key] = array();
47
- }
48
-
49
- $current = &$current[$sub_key];
50
-
51
- if (isset($matches[1])) {
52
- if (!isset($current[$matches[1]]) ||
53
- !is_array($current[$matches[1]])) {
54
- $current[$matches[1]] = array();
55
- }
56
-
57
- $current = &$current[$matches[1]];
58
- }
59
- } while (($sub_key = strtok('_')) !== false);
60
-
61
- $current = $value;
62
-
63
- unset($params[$key]);
64
- }
65
-
66
- return new self($params);
67
- }
68
-
69
- /**
70
- * Populate parameters
71
- *
72
- * @param array $params
73
- * @return void
74
- */
75
- public function __construct(array $params) {
76
- if (empty($params)) {
77
- Mage::throwException('Invalid response');
78
- }
79
-
80
- parent::__construct($params);
81
- }
82
-
83
- /**
84
- * @inheritDoc
85
- */
86
- public function IsValid() {
87
- return (isset($this->responseEnvelope->ack) &&
88
- ($this->responseEnvelope->ack === self::ACK_SUCCESS));
89
- }
90
-
91
- /**
92
- * Compile all errors into a string
93
- *
94
- * @return string
95
- */
96
- public function GetError() {
97
- $ret = '';
98
-
99
- if (isset($this->errorList->error)) {
100
- foreach ($this->errorList->error->ToArray() as $error) {
101
- if (isset($error['parameter'])) {
102
- $ret .= $error['parameter'] . ' ';
103
- }
104
-
105
- $ret .= '(' . $error['errorId'] . ') ' .
106
- $error['message'] . ' ';
107
- }
108
- }
109
-
110
- return rtrim($ret);
111
- }
112
-
113
- /**
114
- * Get first error id
115
- *
116
- * @return int|null
117
- */
118
- public function GetErrorId() {
119
- if (isset($this->errorList->error)) {
120
- foreach ($this->errorList->error->ToArray() as $error) {
121
- if (isset($error['errorId'])) {
122
- return (int) $error['errorId'];
123
- }
124
- }
125
- }
126
-
127
- return null;
128
- }
129
-
130
- }
131
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Api/Response/Standard/Parameters.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Helper_Api_Response_Standard_Parameters {
4
- /*
5
- * Protected properties
6
- */
7
-
8
- /**
9
- * Multi-dimensional array containing parameters from the response
10
- *
11
- * @var array
12
- */
13
- protected $params = array();
14
-
15
- /*
16
- * Public methods
17
- */
18
-
19
- /**
20
- * Constructor!
21
- *
22
- * @param arary $params
23
- * @return void
24
- */
25
- public function __construct(array $params) {
26
- foreach ($params as $key => $value) {
27
- if (is_array($value)) {
28
- $this->params[$key] = new self($value);
29
- } else {
30
- $this->params[$key] = $value;
31
- }
32
- }
33
- }
34
-
35
- public function __get($name) {
36
- return (isset($this->params[$name]) ? $this->params[$name] : null);
37
- }
38
-
39
- public function __set($name, $value) {
40
- $this->params[$name] = $value;
41
- }
42
-
43
- public function __isset($name) {
44
- return isset($this->params[$name]);
45
- }
46
-
47
- /**
48
- * Compile the parameters into an array
49
- *
50
- * @return array
51
- */
52
- public function ToArray() {
53
- foreach ($this->params as $key => $value) {
54
- if ($value instanceof
55
- Payson_Payson_Helper_Api_Response_Standard_Parameters) {
56
- $arr[$key] = $value->ToArray();
57
- } else {
58
- $arr[$key] = $value;
59
- }
60
- }
61
-
62
- return $arr;
63
- }
64
-
65
- }
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Api/Response/Validate.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Helper_Api_Response_Validate implements Payson_Payson_Helper_Api_Response_Interface {
4
- /*
5
- * Constants
6
- */
7
-
8
- const VERIFIED = 'VERIFIED';
9
- const INVALID = 'INVALID';
10
-
11
- /*
12
- * Private properties
13
- */
14
-
15
- private $data;
16
-
17
- /*
18
- * Public methods
19
- */
20
-
21
- /**
22
- * @inheritDoc
23
- */
24
- static public function FromHttpBody($data) {
25
- return new self($data);
26
- }
27
-
28
- /**
29
- * Constructor!
30
- *
31
- * @param string $data
32
- * @return void
33
- */
34
- public function __construct($data) {
35
- $this->data = $data;
36
- }
37
-
38
- /**
39
- * @inheritDoc
40
- */
41
- public function IsValid() {
42
- return ($this->data === self::VERIFIED);
43
- }
44
-
45
- }
46
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/Data.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Helper_Data extends Mage_Core_Helper_Abstract {
4
-
5
- }
6
-
 
 
 
 
 
 
app/code/community/Payson/Payson/Helper/FundingConstraint.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- class FundingConstraint {
4
-
5
- const NONE = 0;
6
- const CREDITCARD = 1;
7
- const BANK = 2;
8
- const INVOICE = 3;
9
- const SMS = 4;
10
-
11
- public static function addConstraintsToOutput($fundingConstraints, &$output) {
12
- $formatString = "fundingList.fundingConstraint(%d).constraint";
13
-
14
- $i = 0;
15
- foreach ($fundingConstraints as $constraint) {
16
- if ($constraint != self::NONE) {
17
- $output[sprintf($formatString, $i)] = self::ConstantToString($constraint);
18
- $i++;
19
- }
20
- }
21
- }
22
-
23
- public static function ConstantToString($value) {
24
- switch ($value) {
25
- case self::BANK:
26
- return "BANK";
27
- case self::CREDITCARD:
28
- return "CREDITCARD";
29
- case self::INVOICE:
30
- return "INVOICE";
31
- case self::SMS:
32
- return "SMS";
33
- }
34
- }
35
-
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Config.php DELETED
@@ -1,218 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Config {
4
- /*
5
- * Constants
6
- */
7
-
8
- //const PAYMENT_GUARANTEE = 'payment_guarantee';
9
-
10
- const PAYMENT_GUARANTEE = 'NO';
11
- const DIRECT_PAYMENT = 'direct_payment';
12
- const CREDIT_CARD_PAYMENT = 'credit_card_payment';
13
- const INVOICE_PAYMENT = 'invoice_payment';
14
-
15
- /*
16
- * Private properties
17
- */
18
-
19
- /**
20
- * Default store id used in GetConfig()
21
- *
22
- * @var int
23
- */
24
- private $default_store_id;
25
-
26
- /**
27
- * Supported currency codes
28
- *
29
- * @var array
30
- */
31
- private $supported_currencies = array
32
- (
33
- 'SEK', 'EUR'
34
- );
35
-
36
- /*
37
- * Public methods
38
- */
39
-
40
- /**
41
- * Constructor!
42
- *
43
- * @return void
44
- */
45
-
46
- public function __construct() {
47
- $this->SetDefaultStoreId(Mage::app()->getStore()->getId());
48
- }
49
-
50
- /**
51
- * Set default store id
52
- *
53
- * @param int $store
54
- * @return object $this
55
- */
56
- public function SetDefaultStoreId($store) {
57
-
58
- $this->default_store_id = $store;
59
-
60
- return $this;
61
- }
62
-
63
- /**
64
- * Get default store id
65
- *
66
- * @return int
67
- */
68
- public function GetDefaultStoreId() {
69
-
70
- return $this->default_store_id;
71
- }
72
-
73
- /**
74
- * Whether $currency is supported
75
- *
76
- * @param string $currency
77
- * @return bool
78
- */
79
- public function IsCurrencySupported($currency) {
80
- return in_array(strtoupper($currency), $this->supported_currencies);
81
- }
82
-
83
- /**
84
- * Get configuration value
85
- *
86
- * @param mixed $name
87
- * @param int|null $store [optional]
88
- * @param mixed $default [optional]
89
- * @param string $prefix [optional]
90
- */
91
- public function GetConfig($name, $store = null, $default = null, $prefix = 'payment/payson_standard/') {
92
- if (!isset($store)) {
93
- $store = $this->GetDefaultStoreId();
94
- }
95
-
96
- $name = $prefix . $name;
97
- $value = Mage::getStoreConfig($name, $store);
98
-
99
- return (isset($value) ? $value : $default);
100
- }
101
-
102
- /**
103
- * @see GetConfig
104
- */
105
- public function Get($name, $store = null, $default = null, $prefix = 'payment/payson_standard/') {
106
- return $this->GetConfig($name, $store, $default, $prefix);
107
- }
108
-
109
- /**
110
- * Get Payson specific invoice fee excluding tax
111
- *
112
- * @param object $order
113
- * @return float
114
- */
115
- public function GetInvoiceFee($order) {
116
- $currency = $order->getBaseCurrencyCode();
117
- $currency = strtolower($currency);
118
-
119
- if (!$this->IsCurrencySupported($currency)) {
120
- return 0;
121
- }
122
-
123
- $store = Mage::app()->getStore($order->getStoreId());
124
-
125
- $fee = $this->GetConfig('invoice_fee_' . $currency, $store->getId(), 0, 'payment/payson_invoice/');
126
- $fee = round((float) $fee, 3);
127
-
128
- return $fee;
129
- }
130
-
131
- /**
132
- * Get Payson specific invoice fee including tax
133
- *
134
- * @param object $order
135
- * @return float
136
- */
137
- public function GetInvoiceFeeInclTax($order) {
138
- $fee = $this->GetInvoiceFee($order);
139
- $fee *= (1 + $this->GetInvoiceFeeTaxMod($order));
140
- $fee = round($fee, 3);
141
-
142
- return $fee;
143
- }
144
-
145
- /**
146
- * Get Payson specific invoice fee tax modifier
147
- *
148
- * @param object $order
149
- * @return float
150
- */
151
- public function GetInvoiceFeeTaxMod($order) {
152
- $store = Mage::app()->getStore($order->getStoreId());
153
-
154
- $tax_calc = Mage::getSingleton('tax/calculation');
155
- $customer = Mage::getModel('customer/customer')
156
- ->load($order->getCustomerId());
157
- $tax_class = $this->GetConfig('invoice_fee_tax', $store->getId(), 0, 'payment/payson_invoice/');
158
-
159
- $tax_rate_req = $tax_calc->getRateRequest(
160
- $order->getShippingAddress(), $order->getBillingAddress(), $customer->getTaxClassId(), $store)
161
- ->setProductClassId($tax_class);
162
-
163
- $tax_mod = (float) $tax_calc->getRate($tax_rate_req);
164
- $tax_mod /= 100;
165
- $tax_mod = round($tax_mod, 5);
166
-
167
- return $tax_mod;
168
- }
169
-
170
- /**
171
- * Does this store support payment guarantee?
172
- *
173
- * @param int|null $store [optional]
174
- * @return bool
175
- */
176
- public function CanPaymentGuarantee($store = null) {
177
- return (bool) $this->GetConfig(self::PAYMENT_GUARANTEE, $store, false);
178
- }
179
-
180
- /**
181
- * Is invoice payment enabled?
182
- *
183
- * @param int|null $store [optional]
184
- * @return bool
185
- */
186
-
187
- public function CanInvoicePayment($store = null) {
188
-
189
- return $this->GetConfig('active_invoice', $store, false, 'payment/payson_invoice/');
190
- }
191
- /**
192
- * Is standard payment enabled?
193
- *
194
- * @param int|null $store [optional]
195
- * @return bool
196
- */
197
- public function CanStandardPayment($store = null) {
198
- return $this->GetConfig('active', $store, false, 'payment/payson_standard/');
199
- }
200
-
201
- public function restoreCartOnCancel($store = null) {
202
- if (!$store)
203
- $store = Mage::app()->getStore()->getId();
204
- $configValue = $this->GetConfig("restore_on_cancel", $store);
205
-
206
- return $configValue == 1;
207
- }
208
-
209
- public function restoreCartOnError($store = null) {
210
- if (!$store)
211
- $store = Mage::app()->getStore()->getId();
212
- $configValue = $this->GetConfig("restore_on_error", $store);
213
-
214
- return $configValue == 1;
215
- }
216
-
217
- }
218
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Method/Abstract.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
-
3
- abstract class Payson_Payson_Model_Method_Abstract extends Mage_Payment_Model_Method_Abstract {
4
-
5
- /**
6
- * @inheritDoc
7
- */
8
- protected $_isGateway = false;
9
- protected $_canAuthorize = false;
10
- protected $_canCapture = false;
11
- protected $_canCapturePartial = false;
12
- protected $_canRefund = false;
13
- protected $_canRefundInvoicePartial = false;
14
- protected $_canVoid = false;
15
- protected $_canUseInternal = false; // true
16
- protected $_canUseCheckout = true; // true
17
- protected $_canUseForMultishipping = false; // true
18
- protected $_isInitializeNeeded = false;
19
- protected $_canFetchTransactionInfo = false;
20
- protected $_canReviewPayment = false;
21
- protected $_canCreateBillingAgreement = false;
22
- protected $_canManageRecurringProfiles = false; // true
23
-
24
- /**
25
- * @inheritDoc
26
- */
27
- protected $_canCancelInvoice = true;
28
-
29
- /*
30
- * Protected methods
31
- */
32
-
33
- protected function GetCheckout() {
34
- return Mage::getSingleton('checkout/session');
35
- }
36
-
37
- protected function GetQuote() {
38
- return $this->GetCheckout()->getQuote();
39
- }
40
-
41
- /*
42
- * Public methods
43
- */
44
-
45
- /**
46
- * Redirect url when user place order
47
- *
48
- * @return string
49
- */
50
- public function getOrderPlaceRedirectUrl() {
51
- return Mage::getUrl('payson/checkout/redirect', array('_secure' => true));
52
- }
53
-
54
- /**
55
- * @inheritDoc
56
- */
57
- /* public function initialize($payment_action, $state_object)
58
- {
59
- $state_object->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
60
- $state_object->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
61
- $state_object->setIsNotified(false);
62
-
63
- return $this;
64
- } */
65
-
66
- /**
67
- * Whether this paymend method is available for specified currency
68
- *
69
- * @param string $currency
70
- * @return bool
71
- */
72
- public function canUseForCurrency($currency) {
73
- return Mage::getModel('payson/config')->IsCurrencySupported(Mage::app()->getStore()->getCurrentCurrencyCode());
74
- }
75
-
76
- /**
77
- * @inheritDoc
78
- */
79
- public function refund(Varien_Object $payment, $amount) {
80
-
81
- /* @var $order Mage_Sales_Model_Order */
82
- $order = $payment->getOrder();
83
-
84
- $method = $payment->getMethod();
85
-
86
- if ($order->getBaseGrandTotal() != $amount) {
87
- Mage::throwException('Invalid amount');
88
- }
89
-
90
- $helper = Mage::helper('payson');
91
- $order_id = $order->getData('increment_id');
92
- $api = Mage::helper('payson/api');
93
- if ($method == "payson_standard") {
94
- $paysonPaymethod = $method;
95
- }if ($method == "payson_invoice") {
96
- $paysonPaymethod = $method;
97
- }
98
- $api->PaymentUpdate($order_id, $paysonPaymethod ?
99
- Payson_Payson_Helper_Api::UPDATE_ACTION_CREDITORDER :
100
- Payson_Payson_Helper_Api::UPDATE_ACTION_REFUNDORDER);
101
-
102
- $order->addStatusHistoryComment($helper->__(
103
- 'Payment was credited at Payson'));
104
-
105
- return $this;
106
- }
107
-
108
- /**
109
- * @inheritDoc
110
- */
111
- public function void(Varien_Object $payment) {
112
- $payment->setTransactionId('auth')
113
- ->setIsTransactionClosed(0);
114
- return $this;
115
- }
116
-
117
- /**
118
- * @inheritDoc
119
- */
120
- public function cancel(Varien_Object $payment) {
121
- $order = $payment->getOrder();
122
- $order_id = $order->getData('increment_id');
123
-
124
- $api = Mage::helper('payson/api');
125
- $helper = Mage::helper('payson');
126
- $api->PaymentDetails($order_id);
127
- $details = $api->GetResponse();
128
-
129
-
130
-
131
- if (($details->type === Payson_Payson_Helper_Api::PAYMENT_METHOD_INVOICE) ||
132
- ($details->invoiceStatus === Payson_Payson_Helper_Api::INVOICE_STATUS_ORDERCREATED) ||
133
- ($details->type !== Payson_Payson_Helper_Api::PAYMENT_METHOD_INVOICE && $details->status === Payson_Payson_Helper_Api::STATUS_CREATED) ||
134
- $order->getState() === Mage_Sales_Model_Order::STATE_PROCESSING) {
135
- $api->PaymentUpdate($order_id, Payson_Payson_Helper_Api::UPDATE_ACTION_CANCELORDER);
136
-
137
- $order->addStatusHistoryComment($helper->__(
138
- 'Order was canceled at Payson'));
139
-
140
- $payment->setTransactionId('auth')
141
- ->setIsTransactionClosed(1);
142
- } else {
143
- Mage::throwException($helper->__('Payson is not ready to cancel the order. Please try again later.'));
144
- }
145
- return $this;
146
- }
147
-
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Method/Invoice.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Method_Invoice extends Payson_Payson_Model_Method_Abstract {
4
- /*
5
- * Protected properties
6
- */
7
-
8
- /**
9
- * @inheritDoc
10
- */
11
- protected $_code = 'payson_invoice';
12
-
13
- /**
14
- * @inheritDoc
15
- */
16
- protected $_canCapture = true;
17
- protected $_canRefund = true;
18
- protected $_canVoid = true;
19
- protected $_canUseCheckout = false;
20
- protected $_canCancelInvoice = true;
21
-
22
- /*
23
- * Public methods
24
- */
25
-
26
- /**
27
- * @inheritDoc
28
- */
29
- public function capture(Varien_Object $payment, $amount) {
30
- $order = $payment->getOrder();
31
- $method = $order->getPayment()->getMethod();
32
- if (($method !== 'payson_standard') || ($method == "payson_invoice")) {
33
- return $this;
34
- }
35
- $order_id = $order->getData('increment_id');
36
-
37
- $api = Mage::helper('payson/api');
38
- $helper = Mage::helper('payson');
39
- $api->PaymentDetails($order_id);
40
- $details = $api->GetResponse();
41
-
42
- if (($details->type ===
43
- Payson_Payson_Helper_Api::PAYMENT_METHOD_INVOICE) ||
44
- ($details->invoiceStatus ===
45
- Payson_Payson_Helper_Api::INVOICE_STATUS_ORDERCREATED)) {
46
- $api->PaymentUpdate($order_id, Payson_Payson_Helper_Api::UPDATE_ACTION_SHIPORDER);
47
-
48
- $order->addStatusHistoryComment($helper->__(
49
- 'Order was activated at Payson'));
50
- } else {
51
- Mage::throwException($helper->__('Payson is not ready to create an invoice. Please try again later.'));
52
- }
53
- return $this;
54
- }
55
-
56
- public function authorize(Varien_Object $payment, $amount) {
57
- $order = $payment->getOrder();
58
- $method = $order->getPayment()->getMethod();
59
- if (($method !== 'payson_standard') || ($method == "payson_invoice")) {
60
- return $this;
61
- }
62
- $payment->setTransactionId('auth')->setIsTransactionClosed(0);
63
- return $this;
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Method/Standard.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Method_Standard extends Payson_Payson_Model_Method_Abstract {
4
- /*
5
- * Protected properties
6
- */
7
-
8
- protected $_canCapture = true;
9
- protected $_canRefund = true;
10
- protected $_canVoid = true;
11
- protected $_canCancelInvoice = true;
12
-
13
- /**
14
- * @inheritDoc
15
- */
16
- protected $_code = 'payson_standard';
17
- protected $_formBlockType = 'payson/standard_form';
18
-
19
- /*
20
- * Public methods
21
- */
22
-
23
- /**
24
- * @inheritDoc
25
- */
26
- public function getTitle() {
27
- $this->_config = Mage::getModel('payson/config');
28
- $order = Mage::registry('current_order');
29
- if (!isset($order) && ($invoice = Mage::registry('current_invoice'))) {
30
- $order = $invoice->getOrder();
31
- }
32
-
33
- if (isset($order)) {
34
- $invoice_fee = $order->getPaysonInvoiceFee();
35
-
36
- if ($invoice_fee) {
37
- $invoice_fee = $order->formatPrice($invoice_fee);
38
- }
39
- } else {
40
- $invoice_fee = Mage::getModel('payson/config')
41
- ->GetInvoiceFeeInclTax($this->getQuote());
42
-
43
- if ($invoice_fee) {
44
- $invoice_fee = Mage::app()->getStore()
45
- ->formatPrice($invoice_fee);
46
- }
47
- }
48
-
49
- $invoice_fee = strip_tags($invoice_fee);
50
- if($this->_config->CanInvoicePayment()){
51
- return sprintf(Mage::helper('payson')->__('Checkout with Payson. If invoice is choosen as payment method an %s invoice fee will be added.'), ($invoice_fee));
52
- }else{
53
- return Mage::helper('payson')->__('Checkout with Payson');
54
- }
55
-
56
- }
57
-
58
- /**
59
- * @inheritDoc
60
- */
61
- public function authorize(Varien_Object $payment, $amount) {
62
- $payment->setTransactionId('auth')->setIsTransactionClosed(0);
63
-
64
- return $this;
65
- }
66
- public function canUseCheckout() {
67
- $this->_config = Mage::getModel('payson/config');
68
-
69
- if ($this->_config->CanInvoicePayment()){
70
- return true;
71
- }
72
- if($this->_config->CanStandardPayment()){
73
- return true;
74
- }else{
75
- return false;
76
- }
77
-
78
- }
79
-
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Mysql4/Setup.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup {
4
-
5
- }
6
-
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Order/Creditmemo/Total/Invoice.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Order_Creditmemo_Total_Invoice extends
4
- Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
5
-
6
- protected $_code = 'payson_invoice';
7
- public function collect(Mage_Sales_Model_Order_Creditmemo $invoice) {
8
- $order = $invoice->getOrder();
9
- $this->_config = Mage::getModel('payson/config');
10
- $method = $order->getPayment()->getMethod();
11
-
12
- if(!$this->_config->CanInvoicePayment()){
13
- return $this;
14
- }
15
- if (($method !== 'payson_standard')||($method == "payson_invoice")) {
16
- return $this;
17
- }
18
-
19
- $base_fee = $order->getBasePaysonInvoiceFee();
20
- $fee = $order->getPaysonInvoiceFee();
21
-
22
- if (!$base_fee || !$fee) {
23
- return $this;
24
- }
25
-
26
- $base_grand_total = $invoice->getBaseGrandTotal();
27
- $base_grand_total += $base_fee;
28
- $grand_total = $invoice->getGrandTotal();
29
- $grand_total += $fee;
30
-
31
- $invoice->setBasePaysonInvoiceFee($base_fee);
32
- $invoice->setPaysonInvoiceFee($fee);
33
-
34
- $invoice->setBaseGrandTotal($base_grand_total);
35
- $invoice->setGrandTotal($grand_total);
36
-
37
- return $this;
38
- }
39
-
40
- }
41
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Order/Invoice/Total/Invoice.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Order_Invoice_Total_Invoice extends
4
- Mage_Sales_Model_Order_Invoice_Total_Abstract {
5
-
6
- protected $_code = 'payson_standard';
7
- public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
8
- $order = $invoice->getOrder();
9
- $this->_config = Mage::getModel('payson/config');
10
- if (!$this->_config->CanInvoicePayment()) {
11
- return $this;
12
- }
13
- $method = $order->getPayment()->getMethodInstance()->getCode();
14
- if (($method !== 'payson_standard')||($method == "payson_invoice")) {
15
- return $this;
16
- }
17
- if ($order->hasInvoices() == 0) {
18
- return $this;
19
- }
20
-
21
- $base_fee = $order->getBasePaysonInvoiceFee();
22
- $fee = $order->getPaysonInvoiceFee();
23
-
24
- if (!$base_fee || !$fee) {
25
- return $this;
26
- }
27
-
28
- $base_grand_total = $invoice->getBaseGrandTotal();
29
- $base_grand_total += $base_fee;
30
- $grand_total = $invoice->getGrandTotal();
31
- $grand_total += $fee;
32
-
33
- $invoice->setBasePaysonInvoiceFee($base_fee);
34
- $invoice->setPaysonInvoiceFee($fee);
35
-
36
- $invoice->setBaseGrandTotal($base_grand_total);
37
- $invoice->setGrandTotal($grand_total);
38
-
39
- return $this;
40
- }
41
-
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Quote/Address/Total/Invoice.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Quote_Address_Total_Invoice extends Mage_Sales_Model_Quote_Address_Total_Abstract {
4
-
5
- protected $_code = 'payson_invoice';
6
-
7
- public function collect(Mage_Sales_Model_Quote_Address $address) {
8
- if ($address->getAddressType() !== 'shipping') {
9
- return $this;
10
- }
11
- $this->_config = Mage::getModel('payson/config');
12
- $address->setBasePaysonInvoiceFee(0);
13
- $address->setPaysonInvoiceFee(0);
14
- $quote = $address->getQuote();
15
-
16
- $method = $address->getQuote()->getPayment()->getMethod();
17
- if (is_null($quote->getId())) {
18
- return $this;
19
- }
20
- if (!$this->_config->CanInvoicePayment()) {
21
- return $this;
22
- }
23
- if (($method !== 'payson_standard')||($method == "payson_invoice")) {
24
- return $this;
25
- }
26
-
27
-
28
- $store = $quote->getStore();
29
- $config = Mage::getModel('payson/config');
30
-
31
- $fee = $config->GetInvoiceFeeInclTax($quote);
32
-
33
- $base_grand_total = $address->getBaseGrandTotal();
34
-
35
- $address->setBasePaysonInvoiceFee($fee);
36
- $address->setPaysonInvoiceFee($store->convertPrice($fee, false));
37
-
38
- $address->setBaseGrandTotal($base_grand_total);
39
- $address->setGrandTotal($store->convertPrice($base_grand_total, false));
40
-
41
- return $this;
42
- }
43
-
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/Standard.php DELETED
@@ -1,108 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_Model_Standard extends Mage_Payment_Model_Method_Abstract {
4
- /*
5
- * Protected properties
6
- */
7
-
8
- /**
9
- * @inheritDoc
10
- */
11
- protected $_code = 'payson';
12
- protected $_formBlockType = 'payson/form';
13
- //protected $_infoBlockType = 'payson/info';
14
-
15
- /**
16
- * @inheritDoc
17
- */
18
- protected $_isGateway = false;
19
- protected $_canAuthorize = false;
20
- protected $_canCapture = true;
21
- protected $_canCapturePartial = false;
22
- protected $_canRefund = false;
23
- protected $_canRefundInvoicePartial = false;
24
- protected $_canVoid = false;
25
- protected $_canUseInternal = true;
26
- protected $_canUseCheckout = true;
27
- protected $_canUseForMultishipping = false;
28
- protected $_isInitializeNeeded = false;
29
- protected $_canFetchTransactionInfo = false;
30
- protected $_canReviewPayment = false;
31
- protected $_canCreateBillingAgreement = false;
32
- protected $_canManageRecurringProfiles = false;
33
-
34
- /**
35
- * @inheritDoc
36
- */
37
- protected $_canCancelInvoice = true;
38
-
39
- /*
40
- * Public methods
41
- */
42
-
43
- /**
44
- * @inheritDoc
45
- */
46
- public function initialize($payment_action, $state_object) {
47
- $state_object->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
48
- $state_object->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
49
- $state_object->setIsNotified(false);
50
- return $this;
51
- }
52
-
53
- /**
54
- * @inheritDoc
55
- */
56
- public function capture(Varien_Object $payment, $amount) {
57
- $order = $payment->getOrder();
58
- $order_id = $order->getData('increment_id');
59
-
60
- $api = Mage::helper('payson/api');
61
-
62
- $api->PaymentDetails($order_id);
63
- $details = $api->GetResponse();
64
-
65
- if (($details->type ===
66
- Payson_Payson_Helper_Api::PAYMENT_METHOD_INVOICE) ||
67
- ($details->invoiceStatus ===
68
- Payson_Payson_Helper_Api::INVOICE_STATUS_ORDERCREATED)) {
69
- $api->PaymentUpdate($order_id, Payson_Payson_Helper_Api::UPDATE_ACTION_SHIPORDER);
70
- }
71
-
72
- return $this;
73
- }
74
-
75
- /**
76
- * Redirect url when user place order
77
- *
78
- * @return string
79
- */
80
- public function getOrderPlaceRedirectUrl() {
81
- return Mage::getUrl('payson/checkout/redirect', array('_secure' => true));
82
- }
83
-
84
- /**
85
- * Whether this paymend method is available for specified currency
86
- *
87
- * @param string $currency
88
- * @return bool
89
- */
90
- public function canUseForCurrency($currency) {
91
- return Mage::getModel('payson/config')->IsCurrencySupported($currency);
92
- }
93
-
94
- /**
95
- * @inheritDoc
96
- */
97
- public function getTitle() {
98
- $order = Mage::registry('current_order');
99
- $invoice_fee = $order->getPaysonInvoiceFee();
100
- $text_invoice_fee = strip_tags($invoice_fee);
101
- if ($this->_config->CanStandardPayment()) {
102
- return sprintf(Mage::helper('payson')->__('Checkout with Payson. If invoice is choosen as payment method an %s invoice fee will be added.'), ($text_invoice_fee));
103
- } elseif ($this->_config->CanStandardPayment()) {
104
- return Mage::helper('payson')->__('Checkout with Payson');
105
- }
106
- }
107
-
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/Model/System/Config/Source/Paysondirectmethod.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * My own options
5
- *
6
- */
7
-
8
- class Payson_Payson_Model_System_Config_Source_Paysondirectmethod {
9
-
10
- /**
11
- * Options getter
12
- *
13
- * @return array
14
- *
15
- */
16
-
17
- public function toOptionArray() {
18
-
19
- $this->_config = Mage::getModel('payson/config');
20
-
21
-
22
- $paysonInvoice = array(
23
- array('value' => 7, 'label' => Mage::helper('adminhtml')->__('')),
24
- array('value' => 8, 'label' => Mage::helper('adminhtml')->__('INVOICE')),
25
- array('value' => 9, 'label' => Mage::helper('adminhtml')->__('INVOICE / SMS')),
26
- array('value' => 10, 'label' => Mage::helper('adminhtml')->__('INVOICE / BANK')),
27
- array('value' => 11, 'label' => Mage::helper('adminhtml')->__('INVOICE / CREDITCARD')),
28
- array('value' => 12, 'label' => Mage::helper('adminhtml')->__('INVOICE / BANK / SMS')),
29
- array('value' => 13, 'label' => Mage::helper('adminhtml')->__('INVOICE / CREDITCARD / SMS')),
30
- array('value' => 14, 'label' => Mage::helper('adminhtml')->__('INVOICE / CREDITCARD / BANK')),
31
- array('value' => 15, 'label' => Mage::helper('adminhtml')->__('INVOICE / CREDITCARD / BANK / SMS'))
32
-
33
- );
34
- $paysonDirect = array(
35
- array('value' => -1, 'label' => Mage::helper('adminhtml')->__('')),
36
- array('value' => 0, 'label' => Mage::helper('adminhtml')->__('SMS')),
37
- array('value' => 1, 'label' => Mage::helper('adminhtml')->__('BANK')),
38
- array('value' => 2, 'label' => Mage::helper('adminhtml')->__('CREDITCARD')),
39
- array('value' => 3, 'label' => Mage::helper('adminhtml')->__('BANK / SMS')),
40
- array('value' => 4, 'label' => Mage::helper('adminhtml')->__('CREDITCARD / SMS')),
41
- array('value' => 5, 'label' => Mage::helper('adminhtml')->__('CREDITCARD / BANK')),
42
- array('value' => 6, 'label' => Mage::helper('adminhtml')->__('CREDITCARD / BANK / SMS'))
43
-
44
- );
45
- if ($this->_config->CanInvoicePayment()) {
46
- return $paysonInvoice;
47
- } elseif ($this->_config->CanStandardPayment()) {
48
- return $paysonDirect;
49
- }
50
- }
51
-
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/controllers/Adminhtml/Sales/Order/ShipmentController.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
4
-
5
- class Payson_Payson_Adminhtml_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController {
6
-
7
- public function saveAction() {
8
-
9
- $order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
10
-
11
- if (($order->getPayment()->getMethodInstance()->getCode() == "payson_standard")||($order->getPayment()->getMethodInstance()->getCode() == "payson_invoice")) {
12
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
13
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
14
- $invoice->register();
15
- $transactionSave = Mage::getModel('core/resource_transaction')
16
- ->addObject($invoice)
17
- ->addObject($invoice->getOrder());
18
- $transactionSave->save();
19
- }
20
- parent::saveAction();
21
- }
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/controllers/CheckoutController.php DELETED
@@ -1,238 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action {
4
- /*
5
- * Private properties
6
- */
7
-
8
- private $_session;
9
- private $_order = null;
10
- /* @var $_config Payson_Payson_Model_Config */
11
- private $_config;
12
- /* @var $_helper Payson_Payson_Helper_Data */
13
- private $_helper;
14
-
15
- /*
16
- * Private methods
17
- */
18
-
19
- public function _construct() {
20
- $this->_config = Mage::getModel('payson/config');
21
- $this->_helper = Mage::helper('payson');
22
- }
23
-
24
- /*
25
- * Private methods
26
- */
27
-
28
- private function getSession() {
29
- if (!isset($this->_session)) {
30
- $this->_session = Mage::getSingleton('checkout/session');
31
- }
32
-
33
- return $this->_session;
34
- }
35
-
36
- /**
37
- *
38
- * @return Mage_Sales_Model_Order
39
- */
40
- private function getOrder() {
41
- if (!isset($this->_order)) {
42
- $increment_id = $this->getSession()->getData('last_real_order_id');
43
-
44
- if ($increment_id) {
45
- $this->_order = Mage::getModel('sales/order')
46
- ->loadByIncrementId($increment_id);
47
-
48
- if (is_null($this->_order->getId())) {
49
- $this->_order = null;
50
- }
51
- }
52
- }
53
-
54
- return $this->_order;
55
- }
56
-
57
- private function cancelOrder($message = '') {
58
-
59
- $order = $this->getOrder();
60
-
61
- if (!is_null($order = $this->getOrder())) {
62
- $order->cancel();
63
-
64
- if ($message != '') {
65
- $order->addStatusHistoryComment($message);
66
- }
67
- }
68
-
69
- $order->save();
70
- return $this;
71
- }
72
-
73
- public function redirectAction() {
74
-
75
- $order = $this->getOrder();
76
-
77
- if (is_null($order)) {
78
- $this->_redirect('checkout/cart');
79
-
80
- return;
81
- }
82
-
83
- try {
84
- $api = Mage::helper('payson/api')->Pay($order);
85
-
86
- $order->addStatusHistoryComment(Mage::helper('payson')->__(
87
- 'The customer was redirected to Payson'))
88
- ->save();
89
-
90
- $this->GetResponse()->setRedirect($api->GetPayForwardUrl());
91
- } catch (Exception $e) {
92
- $this->cancelOrder($e->getMessage());
93
-
94
- if ($this->_config->restoreCartOnError()) {
95
- $this->restoreCart();
96
- }
97
-
98
- Mage::logException($e);
99
-
100
- Mage::getSingleton('core/session')->addError($e->getMessage());
101
- $this->_redirect('checkout/cart');
102
- }
103
- }
104
-
105
- public function returnAction() {
106
- $api = Mage::helper('payson/api');
107
- $order = $this->getOrder();
108
- $paymentDetailsResponse = Mage::helper('payson/api')->PaymentDetails(Mage::getSingleton('checkout/session')->getLastRealOrderId())->getResponse();
109
- $paymentStatus = $paymentDetailsResponse->status;
110
- $InvoiceStatus = $paymentDetailsResponse->invoiceStatus;
111
- isset($InvoiceStatus) ? $InvoiceStatus : 'NONE';
112
- $paymentDetails = $paymentDetailsResponse->receiverList->receiver->ToArray();
113
- $new_paymentDetails = array();
114
- foreach ($paymentDetails as $item) {
115
- foreach ($item as $key => $value) {
116
- $new_paymentDetails[$key] = $value;
117
- }
118
- }
119
-
120
- $sendEmail = $api->confirmationEmail($order->getEntityId());
121
- $investigatefee = $order['base_payson_invoice_fee'];
122
- $currentAmount = $new_paymentDetails['amount'];
123
- $newAmount = $currentAmount += $investigatefee;
124
- switch ($paymentStatus) {
125
- case 'COMPLETED':
126
- case 'PENDING':
127
- case 'PROCESSING':
128
- case 'CREDITED': {
129
-
130
- //$paymentDetails->getInvoiceStatus() == 'ORDERCREATED'
131
- if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'COMPLETED') {
132
- if ($sendEmail['status'] == 'pending_payment') {
133
- $order->sendNewOrderEmail()->save();
134
- }
135
-
136
- $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
137
- Mage::helper('payson')->__('Either an bank, card or SMS payment was choosen as payment method');
138
- $order['payson_invoice_fee'] = 0;
139
- $order['base_payson_invoice_fee'] = 0;
140
-
141
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
142
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
143
- $invoice->register();
144
- $transactionSave = Mage::getModel('core/resource_transaction')
145
- ->addObject($invoice)
146
- ->addObject($invoice->getOrder());
147
-
148
- $transactionSave->save();
149
- $this->_redirect('checkout/onepage/success');
150
- break;
151
- }
152
- if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'PROCESSING') {
153
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
154
- Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Your payment is being processed by Payson')));
155
- $order['payson_invoice_fee'] = 0;
156
- $order['base_payson_invoice_fee'] = 0;
157
- $this->_redirect('checkout/onepage/success');
158
- break;
159
- }
160
- if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'PENDING') {
161
- Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Something went wrong with the payment. Please, try a different payment method')));
162
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
163
- $order['payson_invoice_fee'] = 0;
164
- $order['base_payson_invoice_fee'] = 0;
165
- $this->_redirect('checkout/onepage/failure');
166
- break;
167
- }
168
- if ($paymentDetailsResponse->type === 'INVOICE' && $InvoiceStatus === 'PENDING') {
169
- Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Your payment is being processed by Payson')));
170
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
171
- $this->_redirect('checkout/onepage/failure');
172
- break;
173
- }
174
- //Update the order with the true amount
175
- if ($paymentDetailsResponse->type === 'INVOICE' && $paymentDetailsResponse->type !== 'TRANSFER') {
176
- if ($sendEmail['status'] == 'pending_payment') {
177
- $order->sendNewOrderEmail()->save();
178
- }
179
- $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
180
- Mage::helper('payson')->__('Invoice payment was choosen as payment method');
181
- $order->sendNewOrderEmail()->save();
182
- $order->setBaseGrandTotal($newAmount);
183
- $order->setGrandTotal($newAmount);
184
- $order->setTotalDue($newAmount);
185
- $order->save();
186
- $this->_redirect('checkout/onepage/success');
187
- break;
188
- }
189
- }
190
- case 'ERROR':
191
- case 'DENIED': {
192
- $errorMessage = Mage::helper('payson')->__('The payment was denied by Payson. Please, try a different payment method');
193
- Mage::getSingleton('core/session')->addError($errorMessage);
194
- $this->cancelOrder($errorMessage);
195
- $this->_redirect('checkout');
196
- break;
197
- }
198
- case 'ABORTED':
199
- case 'CANCELED': {
200
- $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true);
201
- $cancelMessage = Mage::helper('payson')->__('Order was canceled at Payson');
202
- $this->cancelOrder($cancelMessage);
203
- if ($this->_config->restoreCartOnCancel()) {
204
- $this->restoreCart();
205
- }
206
- $this->_redirect('checkout');
207
- }
208
-
209
-
210
- default: {
211
- Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Something went wrong with the payment. Please, try a different payment method')));
212
- $this->_redirect('checkout');
213
- break;
214
- }
215
- }
216
- }
217
-
218
- public function cancelAction() {
219
-
220
- $cancelMessage = Mage::helper('payson')->__('Order was canceled at Payson');
221
-
222
- $this->cancelOrder($cancelMessage);
223
-
224
- if ($this->_config->restoreCartOnCancel()) {
225
- $this->restoreCart();
226
- }
227
-
228
- $this->_redirect('checkout');
229
- }
230
-
231
- private function restoreCart() {
232
-
233
- $quoteId = $this->getOrder()->getQuoteId();
234
- $quote = Mage::getModel('sales/quote')->load($quoteId);
235
- $quote->setIsActive(true)->save();
236
- }
237
-
238
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/controllers/IpnController.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- class Payson_Payson_IpnController extends Mage_Core_Controller_Front_Action {
4
-
5
- public function notifyAction() {
6
- $request = $this->getRequest();
7
- $response = $this->getResponse();
8
-
9
- if (!$request->isPost()) {
10
- $response->setHttpResponseCode(503)->setBody('No!');
11
-
12
- return;
13
- }
14
-
15
- try {
16
- $api = Mage::helper('payson/api')->Validate($request->getRawBody(), $request->getHeader('Content-Type'));
17
- } catch (Exception $e) {
18
- $response->setHttpResponseCode(503)->setBody($e->getMessage());
19
-
20
- return;
21
- }
22
- }
23
-
24
- }
25
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/etc/config.xml DELETED
@@ -1,167 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <Payson_Payson>
5
- <version>1.8.3</version>
6
- </Payson_Payson>
7
- </modules>
8
- <admin>
9
- <routers>
10
- <adminhtml>
11
- <args>
12
- <modules>
13
- <Payson_Payson before="Mage_Adminhtml">Payson_Payson_Adminhtml</Payson_Payson>
14
- </modules>
15
- </args>
16
- </adminhtml>
17
- </routers>
18
- </admin>
19
- <global>
20
- <blocks>
21
- <payson>
22
- <class>Payson_Payson_Block</class>
23
- </payson>
24
- </blocks>
25
- <models>
26
- <payson>
27
- <class>Payson_Payson_Model</class>
28
- </payson>
29
- </models>
30
- <helpers>
31
- <payson>
32
- <class>Payson_Payson_Helper</class>
33
- </payson>
34
- </helpers>
35
- <resources>
36
- <payson_setup>
37
- <setup>
38
- <module>Payson_Payson</module>
39
- <class>Payson_Payson_Model_Mysql4_Setup</class>
40
- </setup>
41
- <connection>
42
- <use>core_setup</use>
43
- </connection>
44
- </payson_setup>
45
- <payson_write>
46
- <connection>
47
- <use>core_write</use>
48
- </connection>
49
- </payson_write>
50
- <payson_read>
51
- <connection>
52
- <use>core_read</use>
53
- </connection>
54
- </payson_read>
55
- </resources>
56
- <sales>
57
- <quote>
58
- <totals>
59
- <payson_invoice>
60
- <class>payson/quote_address_total_invoice</class>
61
- <after>subtotal,discount,shipping</after>
62
- <before>tax,grand_total</before>
63
- </payson_invoice>
64
- </totals>
65
- </quote>
66
- <order_invoice>
67
- <totals>
68
- <payson_invoice>
69
- <class>payson/order_invoice_total_invoice</class>
70
- <after>subtotal,discount,shipping</after>
71
- <before>tax,grand_total</before>
72
- </payson_invoice>
73
- </totals>
74
- </order_invoice>
75
- <order_creditmemo>
76
- <totals>
77
- <payson_invoice>
78
- <class>payson/order_creditmemo_total_invoice</class>
79
- <after>subtotal,discount,shipping</after>
80
- <before>tax,grand_total</before>
81
- </payson_invoice>
82
- </totals>
83
- </order_creditmemo>
84
- </sales>
85
- <fieldsets>
86
- <sales_convert_quote_address>
87
- <base_payson_invoice_fee>
88
- <to_order>*</to_order>
89
- </base_payson_invoice_fee>
90
- <payson_invoice_fee>
91
- <to_order>*</to_order>
92
- </payson_invoice_fee>
93
- </sales_convert_quote_address>
94
- </fieldsets>
95
- </global>
96
- <frontend>
97
- <secure_url>
98
- <payson_checkout>/payson/checkout</payson_checkout>
99
- </secure_url>
100
- <routers>
101
- <payson>
102
- <use>standard</use>
103
- <args>
104
- <module>Payson_Payson</module>
105
- <frontName>payson</frontName>
106
- </args>
107
- </payson>
108
- </routers>
109
- <translate>
110
- <modules>
111
- <Payson_Payson>
112
- <files>
113
- <default>Payson_Payson.csv</default>
114
- </files>
115
- </Payson_Payson>
116
- </modules>
117
- </translate>
118
- <layout>
119
- <updates>
120
- <Payson_Payson>
121
- <file>Payson.xml</file>
122
- </Payson_Payson>
123
- </updates>
124
- </layout>
125
- </frontend>
126
- <adminhtml>
127
- <translate>
128
- <modules>
129
- <Payson_Payson>
130
- <files>
131
- <default>Payson_Payson.csv</default>
132
- </files>
133
- </Payson_Payson>
134
- </modules>
135
- </translate>
136
- <layout>
137
- <updates>
138
- <Payson_Payson>
139
- <file>Payson.xml</file>
140
- </Payson_Payson>
141
- </updates>
142
- </layout>
143
- </adminhtml>
144
- <default>
145
- <payment>
146
- <payson_standard>
147
- <test_mode>0</test_mode>
148
- <active>0</active>
149
- <model>payson/method_standard</model>
150
- <payment_action>authorize</payment_action>
151
- <order_status>pending_payment</order_status>
152
- <payment_guarantee>1</payment_guarantee>
153
- <restore_on_cancel>1</restore_on_cancel>
154
- <restore_on_error>1</restore_on_error>
155
- </payson_standard>
156
- <payson_invoice>
157
- <active>0</active>
158
- <activate_invoice>1</activate_invoice>
159
- <model>payson/method_invoice</model>
160
- <payment_action>authorize</payment_action>
161
- <order_status>pending</order_status>
162
- <invoice_fee_sek>0</invoice_fee_sek>
163
- </payson_invoice>
164
- </payment>
165
- </default>
166
- </config>
167
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/etc/system.xml DELETED
@@ -1,166 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <payson_standard translate="label" module="payson">
7
- <label>Payson All in one Payment</label>
8
- <comment><![CDATA[Payson Invoice requires a separate contract. Please contact Payson for more information<a href="http://payson.se" target="_blank">Click here</a>]]></comment>
9
- <sort_order>-100</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
- <test_mode translate="label,comment">
15
- <label>Test mode</label>
16
- <comment>Enable/disable test mode.</comment>
17
- <frontend_type>select</frontend_type>
18
- <source_model>adminhtml/system_config_source_yesno</source_model>
19
- <sort_order>5</sort_order>
20
- <show_in_default>1</show_in_default>
21
- <show_in_website>1</show_in_website>
22
- <show_in_store>1</show_in_store>
23
- </test_mode>
24
- <active translate="label,comment">
25
- <label>Enabled</label>
26
- <comment>Enable/disable payment with Payson.</comment>
27
- <frontend_type>select</frontend_type>
28
- <source_model>adminhtml/system_config_source_yesno</source_model>
29
- <sort_order>10</sort_order>
30
- <show_in_default>1</show_in_default>
31
- <show_in_website>1</show_in_website>
32
- <show_in_store>1</show_in_store>
33
- </active>
34
- <email translate="label,comment">
35
- <label>Email</label>
36
- <comment>Email address bound to your Payson account.</comment>
37
- <frontend_type>text</frontend_type>
38
- <validate>validate-email</validate>
39
- <sort_order>20</sort_order>
40
- <show_in_default>1</show_in_default>
41
- <show_in_website>0</show_in_website>
42
- <show_in_store>0</show_in_store>
43
- </email>
44
- <agent_id translate="label,comment">
45
- <label>Agent ID</label>
46
- <comment>Agent ID is found on your Payson profile page.</comment>
47
- <frontend_type>text</frontend_type>
48
- <sort_order>30</sort_order>
49
- <show_in_default>1</show_in_default>
50
- <show_in_website>0</show_in_website>
51
- <show_in_store>0</show_in_store>
52
- </agent_id>
53
- <md5_key translate="label,comment">
54
- <label>API key</label>
55
- <comment>API key is found on your Payson profile page.</comment>
56
- <frontend_type>text</frontend_type>
57
- <sort_order>40</sort_order>
58
- <show_in_default>1</show_in_default>
59
- <show_in_website>0</show_in_website>
60
- <show_in_store>0</show_in_store>
61
- </md5_key>
62
- <payson_All_in_one translate="label">
63
- <label>Please select the payment method</label>
64
- <comment>Choose your prefered Payson payment</comment>
65
- <frontend_type>select</frontend_type>
66
- <source_model>payson/system_config_source_paysondirectmethod</source_model>
67
- <sort_order>45</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>1</show_in_store>
71
- </payson_All_in_one>
72
- <payment_guarantee translate="label,comment">
73
- <label>Enable payment guarantee</label>
74
- <comment>Enable/disable payment guarantee.</comment>
75
- <frontend_type>select</frontend_type>
76
- <source_model>adminhtml/system_config_source_yesno</source_model>
77
- <sort_order>50</sort_order>
78
- <show_in_default>0</show_in_default>
79
- <show_in_website>0</show_in_website>
80
- <show_in_store>0</show_in_store>
81
- </payment_guarantee>
82
- <restore_on_cancel translate="label,comment">
83
- <label>Restore cart on cancel</label>
84
- <comment>Restore cart when customer cancel the payment</comment>
85
- <frontend_type>select</frontend_type>
86
- <source_model>adminhtml/system_config_source_yesno</source_model>
87
- <sort_order>100</sort_order>
88
- <show_in_default>1</show_in_default>
89
- <show_in_website>1</show_in_website>
90
- <show_in_store>1</show_in_store>
91
- </restore_on_cancel>
92
- <restore_on_error translate="label,comment">
93
- <label>Restore cart on error</label>
94
- <comment>Restore cart when status from Payson is error</comment>
95
- <frontend_type>select</frontend_type>
96
- <source_model>adminhtml/system_config_source_yesno</source_model>
97
- <sort_order>150</sort_order>
98
- <show_in_default>1</show_in_default>
99
- <show_in_website>1</show_in_website>
100
- <show_in_store>1</show_in_store>
101
- </restore_on_error>
102
- <show_receipt_page translate="label,comment">
103
- <label>Show receipt page</label>
104
- <comment>Here you can enable or disable our receipt page</comment>
105
- <frontend_type>select</frontend_type>
106
- <source_model>adminhtml/system_config_source_yesno</source_model>
107
- <sort_order>200</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>0</show_in_website>
110
- <show_in_store>0</show_in_store>
111
- </show_receipt_page>
112
- <vat_discount translate="label,comment">
113
- <label>Enable average vat on discount</label>
114
- <comment>Enable/disable average vat on discount</comment>
115
- <frontend_type>select</frontend_type>
116
- <source_model>adminhtml/system_config_source_yesno</source_model>
117
- <sort_order>250</sort_order>
118
- <show_in_default>1</show_in_default>
119
- <show_in_website>0</show_in_website>
120
- <show_in_store>0</show_in_store>
121
- </vat_discount>
122
- </fields>
123
- </payson_standard>
124
- <payson_invoice translate="label" module="payson">
125
- <label>Payson invoice setup</label>
126
- <sort_order>-99</sort_order>
127
- <show_in_default>1</show_in_default>
128
- <show_in_website>1</show_in_website>
129
- <show_in_store>1</show_in_store>
130
- <comment><![CDATA[Payson Invoice requires a separate contract. Please contact Payson for more information<a href="http://payson.se" target="_blank">Click here</a>]]></comment>
131
- <fields>
132
- <active_invoice translate="label,comment">
133
- <label>Enabled</label>
134
- <comment>Enable/disable invoice payment with Payson.</comment>
135
- <frontend_type>select</frontend_type>
136
- <source_model>adminhtml/system_config_source_yesno</source_model>
137
- <sort_order>10</sort_order>
138
- <show_in_default>1</show_in_default>
139
- <show_in_website>1</show_in_website>
140
- <show_in_store>1</show_in_store>
141
- </active_invoice>
142
- <invoice_fee_tax translate="label,comment">
143
- <label>Invoice fee tax</label>
144
- <comment>Tax class for invoice fees.</comment>
145
- <frontend_type>select</frontend_type>
146
- <source_model>adminhtml/system_config_source_shipping_taxclass</source_model>
147
- <sort_order>20</sort_order>
148
- <show_in_default>1</show_in_default>
149
- <show_in_website>1</show_in_website>
150
- <show_in_store>1</show_in_store>
151
- </invoice_fee_tax>
152
- <invoice_fee_sek translate="label,comment">
153
- <label>Invoice fee (SEK)</label>
154
- <comment>Input an invoice fee within the intervall of 0-40 including Vat.</comment>
155
- <frontend_type>text</frontend_type>
156
- <sort_order>30</sort_order>
157
- <show_in_default>1</show_in_default>
158
- <show_in_website>1</show_in_website>
159
- <show_in_store>1</show_in_store>
160
- </invoice_fee_sek>
161
- </fields>
162
- </payson_invoice>
163
- </groups>
164
- </payment>
165
- </sections>
166
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/sql/payson_setup/mysql4-install-0.1.0.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->run('
5
- CREATE TABLE IF NOT EXISTS `' . $this->getTable('payson_order') . '`
6
- (
7
- `id` INT NOT NULL AUTO_INCREMENT,
8
- `order_id` INT NOT NULL,
9
- `added` DATETIME DEFAULT NULL,
10
- `updated` DATETIME DEFAULT NULL,
11
- `valid` TINYINT(1) NOT NULL,
12
- `ipn_status` VARCHAR(32) DEFAULT NULL,
13
- `token` VARCHAR(255) DEFAULT NULL,
14
- PRIMARY KEY (`id`)
15
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
-
17
- CREATE TABLE IF NOT EXISTS `' . $this->getTable('payson_order_log') . '`
18
- (
19
- `id` INT NOT NULL AUTO_INCREMENT,
20
- `payson_order_id` INT DEFAULT NULL,
21
- `added` DATETIME DEFAULT NULL,
22
- `api_call` VARCHAR(32) NOT NULL,
23
- `valid` TINYINT(1) NOT NULL,
24
- `response` TEXT NOT NULL,
25
- PRIMARY KEY (`id`)
26
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
27
-
28
- $this->addAttribute('order', 'payson_invoice_fee', array('type' => 'decimal', 'grid' => false));
29
- $this->addAttribute('order', 'base_payson_invoice_fee', array('type' => 'decimal', 'grid' => false));
30
-
31
- $this->endSetup();
32
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Payson/Payson/sql/payson_setup/mysql4-upgrade-0.1.0-0.1.2.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->run('alter table `' . $this->getTable('payson_order') . '` add store_id int;
5
- ');
6
-
7
- $this->endSetup();
8
-
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PaysonCheckout2</name>
4
- <version>1.0.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Official Payson module for Magento.</summary>
10
- <description>Payson offers a simple way to receive payments from your customers using Visa, MasterCard, Direct bank transfer and WyWallet with one contract.</description>
11
- <notes>New modul PaysonCheckout2</notes>
 
 
 
 
12
  <authors><author><name>Oscar</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
13
- <date>2016-11-29</date>
14
- <time>14:16:15</time>
15
- <contents><target name="magecommunity"><dir name="Payson"><dir name="Checkout2"><dir name="Block"><dir name="Form"><file name="Checkout2.php" hash="2b67b75d9478b60388df76b60cbee459"/></dir><dir name="Info"><file name="Checkout2.php" hash="d577097f022794f5cd7a12fa88b17933"/></dir><file name="Payment.php" hash="9d9fd75b69580db7cccd60b225553690"/></dir><dir name="Helper"><file name="Data.php" hash="766f354fc4bccd415301b787b0fbd4f9"/><file name="Order.php" hash="9ca9486999de387069556bf4777cbfdf"/></dir><dir name="Model"><file name="Config.php" hash="98791c265d914dfc8fa2d3bde5cbbdc1"/><dir name="Method"><file name="Checkout2.php" hash="d68ba56d9de974b77cc23a38df10c5a2"/></dir><file name="Notification.php" hash="7f7466bb8ce9ecdfc84f53a986c040c4"/><file name="Observer.php" hash="d5bc3717b51265d4b7b335debd23395c"/><file name="Order.php" hash="7caf0306a00499dbce2c756eeb7fdbc0"/><file name="Themes.php" hash="30c39fad25db4883bfbed8c79687958f"/><file name="VerificationTypes.php" hash="e8a9bccb0203a2af8140b3858684be56"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="1c8aeb17a1e55816fd1736d26224bb58"/></dir></dir></dir><file name="ExpressController.php" hash="4f7871835f0cdad74455a77a4150d56e"/><file name="NotificationController.php" hash="f3cba6067ac6fe9cc5060f1ce52eca6a"/><file name="PaymentController.php" hash="e70cfe80ef6aed32f6aba51d03a092ee"/></dir><dir name="etc"><file name="config.xml" hash="908d9295cdcdf73d85462f1d09e7eea6"/><file name="system.xml" hash="d2b161347c5c7cd4cf5d22080e141f26"/></dir><dir name="sql"><dir name="payson_checkout2_setup"><file name="mysql4-install-1.0.0.php" hash="c4139a6d4e830aa554b6d7cd106e4e25"/></dir></dir></dir><dir name="Payson"><dir name="Block"><file name="Form.php" hash="74a8967879fbb6af999f0e513bc91323"/><dir name="Invoice"><file name="Form.php" hash="88a008948e1231b135ba8a798eeb1c66"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="3e8566e634d68d8df9bb70f597916980"/></dir></dir><dir name="Standard"><file name="Form.php" hash="c715cbec95494a9a26d261992429dff0"/></dir></dir><dir name="Helper"><dir name="Api"><dir name="Response"><file name="Interface.php" hash="51d0ffe7eefaa12eb9b4f2551e9f4259"/><dir name="Standard"><file name="Parameters.php" hash="6965b8259867c23a5e1e682e14491eb2"/></dir><file name="Standard.php" hash="cef827896629364fee49671af879adc3"/><file name="Validate.php" hash="34fb6626af3a6ac06e987c9e10a95796"/></dir></dir><file name="Api.php" hash="3331e8965dfe60b18609a794fbe4c498"/><file name="Data.php" hash="83ff59b1588c0b0ff8d2f7341589ea59"/><file name="FundingConstraint.php" hash="64cb684a5d30dd237e90d5e835ccddd3"/></dir><dir name="Model"><file name="Config.php" hash="7de7a2257df64a5e039de977edbc5492"/><dir name="Method"><file name="Abstract.php" hash="dadd8d3120cd0a187af661f54ecae0f7"/><file name="Invoice.php" hash="d3825c5f72d355d0ac0798c89e2087fa"/><file name="Standard.php" hash="136579912fb4971ebd2279d29a85afc3"/></dir><dir name="Mysql4"><file name="Setup.php" hash="3075fa047af3d56d6eac609004e6e1cc"/></dir><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Invoice.php" hash="19fadd6df40cd03528fb9c211c34a8bc"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Invoice.php" hash="87899d88d04362bc148eb51a0a9a076e"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Invoice.php" hash="44eef552e2dd3869c3181f3f939ac355"/></dir></dir></dir><file name="Standard.php" hash="233cf9d7ebe15137d98a8e1b23125a51"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Paysondirectmethod.php" hash="5f0a8584217204a638d11dbf61891779"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="068143a443700a95395bdb28ae39f170"/></dir></dir></dir><file name="CheckoutController.php" hash="0bdda7fc1e239d2182b51099d777cf2f"/><file name="IpnController.php" hash="e7b092cdd0011a3a1359a084bbaf14ad"/></dir><dir name="etc"><file name="config.xml" hash="c3a06f230d79b12d3d57f4c7404dfef0"/><file name="system.xml" hash="8f0a4d417de513c9f37a5feb993b4c46"/></dir><dir name="sql"><dir name="payson_setup"><file name="mysql4-install-0.1.0.php" hash="21cd9fd3436ba1eb2fc20eaaadb42106"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="5bbcb930748e3a87a220c0e9f8448a15"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payson_checkout2.xml" hash="22b3bc15951f0c383c5e6f96d7949fad"/></dir><dir name="template"><dir name="payson"><dir name="checkout2"><dir name="elements"><file name="button.phtml" hash="1f63ccf569ff10d35e51616a413955d7"/><file name="minicartbutton.phtml" hash="a575c64a333be672cb8fc6aec89382d8"/></dir><dir name="form"><file name="checkout2.phtml" hash="99419617856e6c5ea93c3cf88ae4d490"/><file name="review.phtml" hash="2908826635a38b1dfd5640a1c6feba54"/><file name="shipping.phtml" hash="abd612bee8e11baf89c8468f76b00615"/></dir><dir name="page"><file name="blank.phtml" hash="509893c584213ad7d78e17a1a53249d1"/></dir><dir name="payment"><file name="confirmation.phtml" hash="d73bb16ae4b6d2b1d333079e84aa9b55"/><file name="express.phtml" hash="6d2757865efe818d2ab213992ffe40f3"/><file name="standard.phtml" hash="0da3b1e0080df8f31d808061939b430e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Checkout2.xml" hash="dcbe0d3d1f1cad514c719d0a79f213e0"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="payson_checkout2.csv" hash="4555f2b2f86dffe56ccbe8e7ad373866"/></dir></target><target name="magelib"><dir name="Payson"><dir name="Checkout2"><dir name="PaysonCheckout2PHP"><file name="README.md" hash="bb8c8d92c7e18353d4d9d5a496a566da"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><dir name="example"><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="config.php" hash="45966251b3cef234834cc1d2dc966e90"/><file name="confirmation.php" hash="7a50c9e9772ccc123c6d84cc8e2fe7f3"/><file name="index.php" hash="1b3081faa0d1835641c7259db5cf3837"/><file name="notification.php" hash="d80a0d41e083fb43cce844c7d23b7338"/><file name="update_order.php" hash="ad2367147e72a88428808dfaab231366"/><file name="validate.php" hash="436f44544aa97ef039e28977ca1f6380"/></dir><dir name="lib"><file name="account.php" hash="22acb8e56a837dfaf200252d99bc023f"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="confirmation.php" hash="e23740168f2941741ffeb308cfa6aaa9"/><file name="customer.php" hash="34f1f9d76b729938118e72721cacd8af"/><file name="gui.php" hash="e234c46d3a046fd0989ecd535c1d9eb1"/><file name="index.php" hash="eb59320117f2668f615a19ee892fcf09"/><file name="orderitem.php" hash="3081930512e0d0ae705b361a5a5c104b"/><file name="paydata.php" hash="718479d8f056d6393e89c3de85d7526e"/><file name="paysonapi.php" hash="44665885f35c04edf78405159d01a4ff"/><file name="paysonapierror.php" hash="e3712bd19b64c3fbb5b64015ce944563"/><file name="paysonapiexception.php" hash="ee5a2ddad8fc7870b5dc121386ac3ef0"/><file name="paysoncheckout.php" hash="31efedcb1d197b3e230fcea9a9deef93"/><file name="paysonmerchant.php" hash="126ad5956d6efebedf4c2d6b35de1dff"/><file name="update_order.php" hash="500f71b5fb1fb31660626e4e12d113c7"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="payson"><dir name="checkout2"><file name="express.js" hash="8185c0ef8c7f4bd006e561df0602e3c2"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="payson_checkout2"><file name="style.css" hash="f70e8d8d166a189383d5795620c162e3"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="."><file name="modman" hash=""/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PaysonCheckout2</name>
4
+ <version>1.0.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Payson offers a simple way to receive payments from your customers using Visa, MasterCard, Direct bank transfer and WyWallet with one contract.</summary>
10
+ <description>Payson offers a simple way to receive payments from your customers using Visa, MasterCard, Direct bank transfer and WyWallet with one contract. You may additionally apply for the Payson Invoice service to give Swedish customers the opportunity to pay later and in installments as Payson will handle the whole process of credit checks, invoice delivery, reminders, etc. Payments can be processed in SEK and EUR and the services are available in Swedish, Finnish and English. Each transaction will be registered to your Payson account immediately and you may withdraw the funds in your Payson account balance to your bank account at any time for a small charge. &#xD;
11
+ &#xD;
12
+ There are currently two versions of the PaysonCheckout available, the first (1.0) will let the customer choose payment method with corresponding buttons and can be modified with the payment methods you decide. The second one (2.0) will also manage the customer address and will present the quickest payment option for that customer. This version requires all payment methods to be enabled with Payson. &#xD;
13
+ &#xD;
14
+ For more information please contact Payson or look to the Payson Terms / Agreement.</description>
15
+ <notes>New modul paysonCheckout2</notes>
16
  <authors><author><name>Oscar</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
17
+ <date>2016-12-06</date>
18
+ <time>13:48:17</time>
19
+ <contents><target name="magecommunity"><dir name="Payson"><dir name="Checkout2"><dir name="Block"><dir name="Form"><file name="Checkout2.php" hash="2b67b75d9478b60388df76b60cbee459"/></dir><dir name="Info"><file name="Checkout2.php" hash="d577097f022794f5cd7a12fa88b17933"/></dir><file name="Payment.php" hash="9d9fd75b69580db7cccd60b225553690"/></dir><dir name="Helper"><file name="Data.php" hash="766f354fc4bccd415301b787b0fbd4f9"/><file name="Order.php" hash="9ca9486999de387069556bf4777cbfdf"/></dir><dir name="Model"><file name="Config.php" hash="98791c265d914dfc8fa2d3bde5cbbdc1"/><dir name="Method"><file name="Checkout2.php" hash="d68ba56d9de974b77cc23a38df10c5a2"/></dir><file name="Notification.php" hash="7f7466bb8ce9ecdfc84f53a986c040c4"/><file name="Observer.php" hash="d5bc3717b51265d4b7b335debd23395c"/><file name="Order.php" hash="7caf0306a00499dbce2c756eeb7fdbc0"/><file name="Themes.php" hash="30c39fad25db4883bfbed8c79687958f"/><file name="VerificationTypes.php" hash="e8a9bccb0203a2af8140b3858684be56"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="1c8aeb17a1e55816fd1736d26224bb58"/></dir></dir></dir><file name="ExpressController.php" hash="4f7871835f0cdad74455a77a4150d56e"/><file name="NotificationController.php" hash="f3cba6067ac6fe9cc5060f1ce52eca6a"/><file name="PaymentController.php" hash="e70cfe80ef6aed32f6aba51d03a092ee"/></dir><dir name="etc"><file name="config.xml" hash="908d9295cdcdf73d85462f1d09e7eea6"/><file name="system.xml" hash="d2b161347c5c7cd4cf5d22080e141f26"/></dir><dir name="sql"><dir name="payson_checkout2_setup"><file name="mysql4-install-1.0.0.php" hash="c4139a6d4e830aa554b6d7cd106e4e25"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payson_checkout2.xml" hash="22b3bc15951f0c383c5e6f96d7949fad"/></dir><dir name="template"><dir name="payson"><dir name="checkout2"><dir name="elements"><file name="button.phtml" hash="1f63ccf569ff10d35e51616a413955d7"/><file name="minicartbutton.phtml" hash="a575c64a333be672cb8fc6aec89382d8"/></dir><dir name="form"><file name="checkout2.phtml" hash="99419617856e6c5ea93c3cf88ae4d490"/><file name="review.phtml" hash="2908826635a38b1dfd5640a1c6feba54"/><file name="shipping.phtml" hash="abd612bee8e11baf89c8468f76b00615"/></dir><dir name="page"><file name="blank.phtml" hash="509893c584213ad7d78e17a1a53249d1"/></dir><dir name="payment"><file name="confirmation.phtml" hash="d73bb16ae4b6d2b1d333079e84aa9b55"/><file name="express.phtml" hash="6d2757865efe818d2ab213992ffe40f3"/><file name="standard.phtml" hash="0da3b1e0080df8f31d808061939b430e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Checkout2.xml" hash="dcbe0d3d1f1cad514c719d0a79f213e0"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="payson_checkout2.csv" hash="4555f2b2f86dffe56ccbe8e7ad373866"/></dir></target><target name="magelib"><dir name="Payson"><dir name="Checkout2"><dir name="PaysonCheckout2PHP"><file name="README.md" hash="bb8c8d92c7e18353d4d9d5a496a566da"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><dir name="example"><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="config.php" hash="45966251b3cef234834cc1d2dc966e90"/><file name="confirmation.php" hash="7a50c9e9772ccc123c6d84cc8e2fe7f3"/><file name="index.php" hash="1b3081faa0d1835641c7259db5cf3837"/><file name="notification.php" hash="d80a0d41e083fb43cce844c7d23b7338"/><file name="update_order.php" hash="ad2367147e72a88428808dfaab231366"/><file name="validate.php" hash="436f44544aa97ef039e28977ca1f6380"/></dir><dir name="lib"><file name="account.php" hash="22acb8e56a837dfaf200252d99bc023f"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="confirmation.php" hash="e23740168f2941741ffeb308cfa6aaa9"/><file name="customer.php" hash="34f1f9d76b729938118e72721cacd8af"/><file name="gui.php" hash="e234c46d3a046fd0989ecd535c1d9eb1"/><file name="index.php" hash="eb59320117f2668f615a19ee892fcf09"/><file name="orderitem.php" hash="3081930512e0d0ae705b361a5a5c104b"/><file name="paydata.php" hash="718479d8f056d6393e89c3de85d7526e"/><file name="paysonapi.php" hash="44665885f35c04edf78405159d01a4ff"/><file name="paysonapierror.php" hash="e3712bd19b64c3fbb5b64015ce944563"/><file name="paysonapiexception.php" hash="ee5a2ddad8fc7870b5dc121386ac3ef0"/><file name="paysoncheckout.php" hash="31efedcb1d197b3e230fcea9a9deef93"/><file name="paysonmerchant.php" hash="126ad5956d6efebedf4c2d6b35de1dff"/><file name="update_order.php" hash="500f71b5fb1fb31660626e4e12d113c7"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="payson"><dir name="checkout2"><file name="express.js" hash="8185c0ef8c7f4bd006e561df0602e3c2"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="payson_checkout2"><file name="style.css" hash="f70e8d8d166a189383d5795620c162e3"/></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
+ <dependencies><required><php><min>5.3.0</min><max>5.6.28</max></php></required></dependencies>
22
  </package>