Version Notes
* Invoice will not be available in checkout on purchases below 30SEK or for customers with a delivery address outside of sweden.
* An issue with the cancel URL has been fixed
* When selecting test mode the module will be using test credentials automatically
Download this release
Release Info
Developer | Oscar Villegas |
Extension | Payson |
Version | 0.1.3 |
Comparing to | |
See all releases |
Code changes from version 0.1.2 to 0.1.3
- app/code/community/Payson/Payson/Helper/Api.php +102 -18
- app/code/community/Payson/Payson/Model/Config.php +2 -2
- app/code/community/Payson/Payson/Model/Method/Invoice.php +30 -2
- app/code/community/Payson/Payson/Model/Order/Invoice/Total/Invoice.php +1 -1
- app/code/community/Payson/Payson/Model/Standard.php +1 -1
- app/code/community/Payson/Payson/controllers/CheckoutController.php +29 -9
- app/code/community/Payson/Payson/etc/config.xml +1 -1
- app/code/community/Payson/Payson/etc/system.xml +12 -2
- app/design/frontend/base/default/template/Payson/Payson/invoice_form.phtml +7 -1
- app/etc/modules/Payson_Payson.xml +1 -1
- app/locale/sv_SE/Payson_Payson.csv +5 -2
- package.xml +10 -7
app/code/community/Payson/Payson/Helper/Api.php
CHANGED
@@ -13,9 +13,13 @@ class Payson_Payson_Helper_Api
|
|
13 |
|
14 |
const PAY_FORWARD_URL = '%s://%s%s.payson.%s/paySecure/';
|
15 |
|
16 |
-
const APPLICATION_ID = 'Magento Module 0.1.
|
17 |
const MODULE_NAME = 'payson_magento';
|
18 |
-
const MODULE_VERSION = '1.
|
|
|
|
|
|
|
|
|
19 |
|
20 |
const STATUS_CREATED = 'CREATED';
|
21 |
const STATUS_PENDING = 'PENDING';
|
@@ -61,6 +65,8 @@ class Payson_Payson_Helper_Api
|
|
61 |
*/
|
62 |
|
63 |
private $response;
|
|
|
|
|
64 |
|
65 |
/*
|
66 |
* Private methods
|
@@ -75,12 +81,12 @@ class Payson_Payson_Helper_Api
|
|
75 |
$http_client->setMethod(Zend_Http_Client::POST)
|
76 |
->setHeaders(array
|
77 |
(
|
78 |
-
'PAYSON-SECURITY-USERID' => $config->Get('agent_id'),
|
79 |
-
'PAYSON-SECURITY-PASSWORD' => $config->Get('md5_key'),
|
80 |
'PAYSON-APPLICATION-ID' => self::APPLICATION_ID,
|
81 |
'PAYSON-MODULE-INFO' => self::MODULE_NAME.'|'.self::MODULE_VERSION.'|'.Mage::getVersion()
|
82 |
));
|
83 |
-
|
84 |
return $http_client->resetParameters();
|
85 |
}
|
86 |
|
@@ -91,6 +97,13 @@ class Payson_Payson_Helper_Api
|
|
91 |
|
92 |
return $this;
|
93 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
/**
|
96 |
* Helper for Pay()
|
@@ -140,7 +153,11 @@ class Payson_Payson_Helper_Api
|
|
140 |
$qty = round($qty, 2);
|
141 |
|
142 |
$price = (float)$item->getData('row_total_incl_tax');
|
143 |
-
|
|
|
|
|
|
|
|
|
144 |
|
145 |
$base_price = (($price / (1 + $tax_mod)) / $qty);
|
146 |
$base_price = round($base_price, 3);
|
@@ -156,7 +173,7 @@ class Payson_Payson_Helper_Api
|
|
156 |
'orderItemList.orderItem(' . $i . ').quantity' =>
|
157 |
$qty,
|
158 |
'orderItemList.orderItem(' . $i . ').unitPrice' =>
|
159 |
-
$base_price,
|
160 |
'orderItemList.orderItem(' . $i . ').taxPercentage' =>
|
161 |
$tax_mod
|
162 |
);
|
@@ -213,7 +230,6 @@ class Payson_Payson_Helper_Api
|
|
213 |
$tax_mod
|
214 |
);
|
215 |
}
|
216 |
-
|
217 |
return $args;
|
218 |
}
|
219 |
|
@@ -306,8 +322,8 @@ class Payson_Payson_Helper_Api
|
|
306 |
'senderLastName' =>
|
307 |
$billing_address->getLastname(),
|
308 |
'receiverList.receiver(0).email' =>
|
309 |
-
$config->Get('email'),
|
310 |
-
'
|
311 |
);
|
312 |
|
313 |
if(!$config->CanPaymentGuarantee())
|
@@ -334,11 +350,32 @@ class Payson_Payson_Helper_Api
|
|
334 |
{
|
335 |
$args += $this->GetOrderItemInfo($item, $i++, $total);
|
336 |
}
|
337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
// Calculate price for shipping
|
339 |
$args += $this->GetOrderShippingInfo($order, $customer, $store, $i++,
|
340 |
$total);
|
341 |
-
|
|
|
|
|
342 |
if($order->getPaysonInvoiceFee() > 0)
|
343 |
{
|
344 |
$fee = $order->getPaysonInvoiceFee();
|
@@ -406,6 +443,7 @@ class Payson_Payson_Helper_Api
|
|
406 |
|
407 |
if(!$response->IsValid())
|
408 |
{
|
|
|
409 |
throw new Mage_Core_Exception(sprintf($helper->__(
|
410 |
'Failed to initialize payment. Payson replied: %s'),
|
411 |
$response->GetError()), $response->GetErrorId());
|
@@ -549,7 +587,8 @@ LIMIT
|
|
549 |
$order->setState(
|
550 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
551 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
552 |
-
|
|
|
553 |
|
554 |
//It creates the invoice to the order
|
555 |
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
@@ -606,10 +645,11 @@ catch(Exception $e)
|
|
606 |
$order->setState(
|
607 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
608 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
609 |
-
|
|
|
610 |
|
611 |
//It creates the invoice to the order
|
612 |
-
if($config->ActivateInvoiceOnPurchase())
|
613 |
{
|
614 |
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
615 |
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
@@ -618,7 +658,7 @@ catch(Exception $e)
|
|
618 |
->addObject($invoice)
|
619 |
->addObject($invoice->getOrder());
|
620 |
$transactionSave->save();
|
621 |
-
}
|
622 |
|
623 |
if(isset($ipn_response->shippingAddress))
|
624 |
{
|
@@ -919,8 +959,26 @@ catch(Exception $e)
|
|
919 |
|
920 |
break;
|
921 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
922 |
case self::STATUS_INCOMPLETE:
|
923 |
-
case self::STATUS_ERROR:
|
924 |
case self::STATUS_EXPIRED:
|
925 |
case self::STATUS_REVERSALERROR:
|
926 |
default:
|
@@ -1011,6 +1069,7 @@ LIMIT
|
|
1011 |
'token' => $payson_order->token
|
1012 |
);
|
1013 |
$url = vsprintf(self::API_CALL_PAYMENT_DETAILS, $this->GetFormatIfTest($payson_order->store_id));
|
|
|
1014 |
$client = $this->GetHttpClient($url)
|
1015 |
->setParameterPost($args);
|
1016 |
|
@@ -1136,10 +1195,35 @@ LIMIT
|
|
1136 |
array_push($stack, self::DEBUG_MODE ? "Payment" : "1.0");
|
1137 |
|
1138 |
array_push($stack, self::DEBUG_MODE ? "" : "Payment");
|
1139 |
-
|
1140 |
return $stack;
|
1141 |
|
1142 |
|
1143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1144 |
}
|
1145 |
|
13 |
|
14 |
const PAY_FORWARD_URL = '%s://%s%s.payson.%s/paySecure/';
|
15 |
|
16 |
+
const APPLICATION_ID = 'Magento Module 0.1.3';
|
17 |
const MODULE_NAME = 'payson_magento';
|
18 |
+
const MODULE_VERSION = '0.1.3';
|
19 |
+
|
20 |
+
const DEBUG_MODE_MAIL = 'testagent-1@payson.se';
|
21 |
+
const DEBUG_MODE_AGENT_ID = '1';
|
22 |
+
const DEBUG_MODE_MD5 = 'fddb19ac-7470-42b6-a91d-072cb1495f0a';
|
23 |
|
24 |
const STATUS_CREATED = 'CREATED';
|
25 |
const STATUS_PENDING = 'PENDING';
|
65 |
*/
|
66 |
|
67 |
private $response;
|
68 |
+
|
69 |
+
private $order_discount_item = 0.0;
|
70 |
|
71 |
/*
|
72 |
* Private methods
|
81 |
$http_client->setMethod(Zend_Http_Client::POST)
|
82 |
->setHeaders(array
|
83 |
(
|
84 |
+
'PAYSON-SECURITY-USERID' => $config->get('test_mode') ? self::DEBUG_MODE_AGENT_ID : $config->Get('agent_id'),
|
85 |
+
'PAYSON-SECURITY-PASSWORD' => $config->get('test_mode') ? self::DEBUG_MODE_MD5 : $config->Get('md5_key'),
|
86 |
'PAYSON-APPLICATION-ID' => self::APPLICATION_ID,
|
87 |
'PAYSON-MODULE-INFO' => self::MODULE_NAME.'|'.self::MODULE_VERSION.'|'.Mage::getVersion()
|
88 |
));
|
89 |
+
|
90 |
return $http_client->resetParameters();
|
91 |
}
|
92 |
|
97 |
|
98 |
return $this;
|
99 |
}
|
100 |
+
|
101 |
+
private function SetOrderDiscountItem($item, &$total)
|
102 |
+
{
|
103 |
+
$total -= $item->getData('discount_amount');
|
104 |
+
$this->order_discount_item += $item->getData('discount_amount');
|
105 |
+
|
106 |
+
}
|
107 |
|
108 |
/**
|
109 |
* Helper for Pay()
|
153 |
$qty = round($qty, 2);
|
154 |
|
155 |
$price = (float)$item->getData('row_total_incl_tax');
|
156 |
+
/* print_r($item->getData('base_price'));
|
157 |
+
echo '<br />';
|
158 |
+
echo '<br />';
|
159 |
+
print_r($item);exit;*/
|
160 |
+
//$price -= (float)$item->getData('discount_amount');
|
161 |
|
162 |
$base_price = (($price / (1 + $tax_mod)) / $qty);
|
163 |
$base_price = round($base_price, 3);
|
173 |
'orderItemList.orderItem(' . $i . ').quantity' =>
|
174 |
$qty,
|
175 |
'orderItemList.orderItem(' . $i . ').unitPrice' =>
|
176 |
+
$item->getData('base_price'),
|
177 |
'orderItemList.orderItem(' . $i . ').taxPercentage' =>
|
178 |
$tax_mod
|
179 |
);
|
230 |
$tax_mod
|
231 |
);
|
232 |
}
|
|
|
233 |
return $args;
|
234 |
}
|
235 |
|
322 |
'senderLastName' =>
|
323 |
$billing_address->getLastname(),
|
324 |
'receiverList.receiver(0).email' =>
|
325 |
+
$config->get('test_mode') ? self::DEBUG_MODE_MAIL : $config->Get('email'),
|
326 |
+
'trackingId' => $order->getRealOrderId()
|
327 |
);
|
328 |
|
329 |
if(!$config->CanPaymentGuarantee())
|
350 |
{
|
351 |
$args += $this->GetOrderItemInfo($item, $i++, $total);
|
352 |
}
|
353 |
+
|
354 |
+
foreach($order->getAllVisibleItems() as $item)
|
355 |
+
{
|
356 |
+
$this->SetOrderDiscountItem($item, $total);
|
357 |
+
}
|
358 |
+
if($this->order_discount_item >> 0){
|
359 |
+
$args += array
|
360 |
+
(
|
361 |
+
'orderItemList.orderItem(' . $i . ').description' =>
|
362 |
+
'discount',
|
363 |
+
'orderItemList.orderItem(' . $i . ').sku' =>
|
364 |
+
'discount',
|
365 |
+
'orderItemList.orderItem(' . $i . ').quantity' =>
|
366 |
+
1,
|
367 |
+
'orderItemList.orderItem(' . $i . ').unitPrice' =>
|
368 |
+
-$this->order_discount_item,
|
369 |
+
'orderItemList.orderItem(' . $i . ').taxPercentage' =>
|
370 |
+
0.0
|
371 |
+
);
|
372 |
+
}
|
373 |
// Calculate price for shipping
|
374 |
$args += $this->GetOrderShippingInfo($order, $customer, $store, $i++,
|
375 |
$total);
|
376 |
+
/* echo '<pre>';
|
377 |
+
print_r($args);
|
378 |
+
echo '</pre>';exit;*/
|
379 |
if($order->getPaysonInvoiceFee() > 0)
|
380 |
{
|
381 |
$fee = $order->getPaysonInvoiceFee();
|
443 |
|
444 |
if(!$response->IsValid())
|
445 |
{
|
446 |
+
|
447 |
throw new Mage_Core_Exception(sprintf($helper->__(
|
448 |
'Failed to initialize payment. Payson replied: %s'),
|
449 |
$response->GetError()), $response->GetErrorId());
|
587 |
$order->setState(
|
588 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
589 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
590 |
+
//$helper->__('Payson completed the order payment XXXXXXX'));
|
591 |
+
$config->get('test_mode') ? $helper->__('Payson test completed the order payment') : $helper->__('Payson completed the order payment'));
|
592 |
|
593 |
//It creates the invoice to the order
|
594 |
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
645 |
$order->setState(
|
646 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
647 |
Mage_Sales_Model_Order::STATE_PROCESSING,
|
648 |
+
//$helper->__('Payson created an invoice'));
|
649 |
+
$config->get('test_mode') ? $helper->__('Payson test created an invoice'): $helper->__('Payson created an invoice'));
|
650 |
|
651 |
//It creates the invoice to the order
|
652 |
+
/*if($config->ActivateInvoiceOnPurchase())
|
653 |
{
|
654 |
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
655 |
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
658 |
->addObject($invoice)
|
659 |
->addObject($invoice->getOrder());
|
660 |
$transactionSave->save();
|
661 |
+
}*/
|
662 |
|
663 |
if(isset($ipn_response->shippingAddress))
|
664 |
{
|
959 |
|
960 |
break;
|
961 |
}
|
962 |
+
|
963 |
+
|
964 |
+
|
965 |
+
case self::STATUS_ERROR:
|
966 |
+
// throw new Mage_Core_Exception(sprintf($helper->__('Denaid.')));
|
967 |
+
|
968 |
+
//Mage::throwException('Invalid order id (' . $order->getId() . ')');
|
969 |
+
|
970 |
+
$order->setState(
|
971 |
+
Mage_Sales_Model_Order::STATE_CANCELED,
|
972 |
+
Mage_Sales_Model_Order::STATE_CANCELED,
|
973 |
+
sprintf($helper->__(
|
974 |
+
'Ther order was denied by Payson.')))
|
975 |
+
->cancel();
|
976 |
+
//throw new Mage_Core_Exception(sprintf($helper->__('Denaid.')));
|
977 |
+
break;
|
978 |
+
|
979 |
+
|
980 |
+
|
981 |
case self::STATUS_INCOMPLETE:
|
|
|
982 |
case self::STATUS_EXPIRED:
|
983 |
case self::STATUS_REVERSALERROR:
|
984 |
default:
|
1069 |
'token' => $payson_order->token
|
1070 |
);
|
1071 |
$url = vsprintf(self::API_CALL_PAYMENT_DETAILS, $this->GetFormatIfTest($payson_order->store_id));
|
1072 |
+
print_r($url);exit;
|
1073 |
$client = $this->GetHttpClient($url)
|
1074 |
->setParameterPost($args);
|
1075 |
|
1195 |
array_push($stack, self::DEBUG_MODE ? "Payment" : "1.0");
|
1196 |
|
1197 |
array_push($stack, self::DEBUG_MODE ? "" : "Payment");
|
1198 |
+
//print_r($stack);exit;
|
1199 |
return $stack;
|
1200 |
|
1201 |
|
1202 |
}
|
1203 |
+
|
1204 |
+
public function getIpnStatus($order_id)
|
1205 |
+
{
|
1206 |
+
$resource = Mage::getSingleton('core/resource');
|
1207 |
+
$db = $resource->getConnection('core_write');
|
1208 |
+
$order_table = $resource->getTableName('payson_order');
|
1209 |
+
$query = 'SELECT ipn_status FROM `' . $order_table . '` WHERE order_id = ' . $order_id;
|
1210 |
+
return $db->fetchRow($query);
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
public function paysonApiError($error)
|
1214 |
+
{
|
1215 |
+
$error_code = '<html>
|
1216 |
+
<head>
|
1217 |
+
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
|
1218 |
+
<script type="text/javascript">
|
1219 |
+
alert("'.$error.'");
|
1220 |
+
window.location="'.('/index.php').'";
|
1221 |
+
</script>
|
1222 |
+
</head>
|
1223 |
+
</html>';
|
1224 |
+
echo $error_code;
|
1225 |
+
exit;
|
1226 |
+
|
1227 |
+
}
|
1228 |
}
|
1229 |
|
app/code/community/Payson/Payson/Model/Config.php
CHANGED
@@ -224,11 +224,11 @@ class Payson_Payson_Model_Config
|
|
224 |
'payment/payson_invoice/');
|
225 |
}
|
226 |
|
227 |
-
|
228 |
{
|
229 |
return $this->GetConfig('activate_invoice', $store, false,
|
230 |
'payment/payson_invoice/');
|
231 |
-
}
|
232 |
|
233 |
|
234 |
}
|
224 |
'payment/payson_invoice/');
|
225 |
}
|
226 |
|
227 |
+
/* public function ActivateInvoiceOnPurchase($store = null)
|
228 |
{
|
229 |
return $this->GetConfig('activate_invoice', $store, false,
|
230 |
'payment/payson_invoice/');
|
231 |
+
}*/
|
232 |
|
233 |
|
234 |
}
|
app/code/community/Payson/Payson/Model/Method/Invoice.php
CHANGED
@@ -18,6 +18,8 @@ class Payson_Payson_Model_Method_Invoice
|
|
18 |
protected $_canCapture = true;
|
19 |
protected $_canRefund = true;
|
20 |
protected $_canVoid = true;
|
|
|
|
|
21 |
|
22 |
/*
|
23 |
* Public methods
|
@@ -72,6 +74,8 @@ class Payson_Payson_Model_Method_Invoice
|
|
72 |
*/
|
73 |
public function getTitle()
|
74 |
{
|
|
|
|
|
75 |
$order = Mage::registry('current_order');
|
76 |
|
77 |
if(!isset($order) && ($invoice = Mage::registry('current_invoice')))
|
@@ -103,8 +107,32 @@ class Payson_Payson_Model_Method_Invoice
|
|
103 |
$invoice_fee = strip_tags($invoice_fee);
|
104 |
|
105 |
return sprintf(Mage::helper('payson')
|
106 |
-
->__('Checkout with Payson invoice %s'),
|
107 |
-
($invoice_fee ? '
|
108 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
18 |
protected $_canCapture = true;
|
19 |
protected $_canRefund = true;
|
20 |
protected $_canVoid = true;
|
21 |
+
//protected $_canUseCheckout = true;
|
22 |
+
private $invoiceAmountMinLimit = 30;
|
23 |
|
24 |
/*
|
25 |
* Public methods
|
74 |
*/
|
75 |
public function getTitle()
|
76 |
{
|
77 |
+
//if(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal() >> 30)
|
78 |
+
// echo Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal(); //$this->_canUseCheckout = false;
|
79 |
$order = Mage::registry('current_order');
|
80 |
|
81 |
if(!isset($order) && ($invoice = Mage::registry('current_invoice')))
|
107 |
$invoice_fee = strip_tags($invoice_fee);
|
108 |
|
109 |
return sprintf(Mage::helper('payson')
|
110 |
+
->__('Checkout with Payson invoice %s invoice fee'),
|
111 |
+
($invoice_fee ? '+' . $invoice_fee : ''));
|
112 |
}
|
113 |
+
|
114 |
+
public function canUseCheckout()
|
115 |
+
{
|
116 |
+
if($this->isSweden()){
|
117 |
+
if(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal() < $this->invoiceAmountMinLimit)
|
118 |
+
return false;
|
119 |
+
else
|
120 |
+
return true;
|
121 |
+
|
122 |
+
}
|
123 |
+
return false;
|
124 |
+
}
|
125 |
+
|
126 |
+
public function isSweden()
|
127 |
+
{
|
128 |
+
$checkout = Mage::getSingleton('checkout/session')->getQuote();
|
129 |
+
$billing = $checkout->getBillingAddress();
|
130 |
+
//$shipping = $checkout->getShippingAddress();
|
131 |
+
if(strtoupper($billing->getCountry()) != 'SE')
|
132 |
+
return false;
|
133 |
+
else
|
134 |
+
return true;
|
135 |
+
|
136 |
+
}
|
137 |
}
|
138 |
|
app/code/community/Payson/Payson/Model/Order/Invoice/Total/Invoice.php
CHANGED
@@ -15,7 +15,7 @@ class Payson_Payson_Model_Order_Invoice_Total_Invoice extends
|
|
15 |
return $this;
|
16 |
}
|
17 |
|
18 |
-
if($order->hasInvoices()
|
19 |
{
|
20 |
return $this;
|
21 |
}
|
15 |
return $this;
|
16 |
}
|
17 |
|
18 |
+
if($order->hasInvoices() == 0)
|
19 |
{
|
20 |
return $this;
|
21 |
}
|
app/code/community/Payson/Payson/Model/Standard.php
CHANGED
@@ -25,7 +25,7 @@ class Payson_Payson_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
25 |
protected $_canUseInternal = true;
|
26 |
protected $_canUseCheckout = true;
|
27 |
protected $_canUseForMultishipping = false;
|
28 |
-
protected $_isInitializeNeeded =
|
29 |
protected $_canFetchTransactionInfo = false;
|
30 |
protected $_canReviewPayment = false;
|
31 |
protected $_canCreateBillingAgreement = 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;
|
app/code/community/Payson/Payson/controllers/CheckoutController.php
CHANGED
@@ -53,12 +53,11 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
|
|
53 |
|
54 |
if(!is_null($order = $this->GetOrder()))
|
55 |
{
|
56 |
-
|
57 |
Mage_Sales_Model_Order::STATE_CANCELED,
|
58 |
Mage_Sales_Model_Order::STATE_CANCELED,
|
59 |
$message)
|
60 |
-
->cancel()->save()
|
61 |
-
$order->cancel()->save();
|
62 |
}
|
63 |
|
64 |
return $this;
|
@@ -70,7 +69,7 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
|
|
70 |
|
71 |
public function redirectAction()
|
72 |
{
|
73 |
-
|
74 |
|
75 |
if(is_null($order))
|
76 |
{
|
@@ -102,14 +101,35 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
|
|
102 |
|
103 |
public function returnAction()
|
104 |
{
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
public function cancelAction()
|
112 |
{
|
113 |
-
|
114 |
}
|
115 |
}
|
53 |
|
54 |
if(!is_null($order = $this->GetOrder()))
|
55 |
{
|
56 |
+
$order->setState(
|
57 |
Mage_Sales_Model_Order::STATE_CANCELED,
|
58 |
Mage_Sales_Model_Order::STATE_CANCELED,
|
59 |
$message)
|
60 |
+
->cancel()->save();
|
|
|
61 |
}
|
62 |
|
63 |
return $this;
|
69 |
|
70 |
public function redirectAction()
|
71 |
{
|
72 |
+
$order = $this->GetOrder();
|
73 |
|
74 |
if(is_null($order))
|
75 |
{
|
101 |
|
102 |
public function returnAction()
|
103 |
{
|
104 |
+
|
105 |
+
$ipnStatus = Mage::helper('payson/api')->getIpnStatus(Mage::getSingleton('checkout/session')->getLastRealOrderId());
|
106 |
+
//print_r($ipnStatus);exit;
|
107 |
+
switch($ipnStatus['ipn_status'])
|
108 |
+
{
|
109 |
+
case 'COMPLETED':
|
110 |
+
case 'PENDING':
|
111 |
+
case 'PROCESSING':
|
112 |
+
case 'CREDITED':
|
113 |
+
{
|
114 |
+
$this->GetOrder()->sendNewOrderEmail();
|
115 |
+
$this->_redirect('checkout/onepage/success');
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
case 'ERROR':
|
119 |
+
{
|
120 |
+
Mage::helper('payson/api')->paysonApiError(sprintf(Mage::helper('payson')->__('The payment was denied by Payson. Please, try a different payment method')));
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
default:
|
124 |
+
{
|
125 |
+
Mage::helper('payson/api')->paysonApiError(sprintf(Mage::helper('payson')->__('Something went wrong with the payment. Please, try a different payment method')));
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
}
|
129 |
}
|
130 |
|
131 |
public function cancelAction()
|
132 |
{
|
133 |
+
$this->CancelOrder()->_redirect('checkout/cart');
|
134 |
}
|
135 |
}
|
app/code/community/Payson/Payson/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Payson_Payson>
|
5 |
-
<version>0.1.
|
6 |
</Payson_Payson>
|
7 |
</modules>
|
8 |
<admin>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Payson_Payson>
|
5 |
+
<version>0.1.3</version>
|
6 |
</Payson_Payson>
|
7 |
</modules>
|
8 |
<admin>
|
app/code/community/Payson/Payson/etc/system.xml
CHANGED
@@ -87,7 +87,7 @@
|
|
87 |
<show_in_website>1</show_in_website>
|
88 |
<show_in_store>1</show_in_store>
|
89 |
</active>
|
90 |
-
|
91 |
<label>Activate invoice on purchase</label>
|
92 |
<comment>Enable this to send Payson invoice to customer instantly after purchase. Disabling this means you have to mark the goods as Shipped in Admin to activate the invoice</comment>
|
93 |
<frontend_type>select</frontend_type>
|
@@ -96,7 +96,7 @@
|
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
<show_in_store>1</show_in_store>
|
99 |
-
</activate_invoice
|
100 |
<invoice_fee_tax translate="label,comment">
|
101 |
<label>Invoice fee tax</label>
|
102 |
<comment>Tax class for invoice fees.</comment>
|
@@ -125,6 +125,16 @@
|
|
125 |
<show_in_website>1</show_in_website>
|
126 |
<show_in_store>1</show_in_store>
|
127 |
</invoice_fee_eur>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
</fields>
|
129 |
</payson_invoice>
|
130 |
</groups>
|
87 |
<show_in_website>1</show_in_website>
|
88 |
<show_in_store>1</show_in_store>
|
89 |
</active>
|
90 |
+
<!--<activate_invoice translate="label,comment">
|
91 |
<label>Activate invoice on purchase</label>
|
92 |
<comment>Enable this to send Payson invoice to customer instantly after purchase. Disabling this means you have to mark the goods as Shipped in Admin to activate the invoice</comment>
|
93 |
<frontend_type>select</frontend_type>
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
<show_in_store>1</show_in_store>
|
99 |
+
</activate_invoice>-->
|
100 |
<invoice_fee_tax translate="label,comment">
|
101 |
<label>Invoice fee tax</label>
|
102 |
<comment>Tax class for invoice fees.</comment>
|
125 |
<show_in_website>1</show_in_website>
|
126 |
<show_in_store>1</show_in_store>
|
127 |
</invoice_fee_eur>
|
128 |
+
|
129 |
+
<!--<invoice_minimum_amount translate="label,comment">
|
130 |
+
<label>Invoice minimum amount (SEK)</label>
|
131 |
+
<comment>Invoice minimum amount</comment>
|
132 |
+
<frontend_type>text</frontend_type>
|
133 |
+
<sort_order>42</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>1</show_in_website>
|
136 |
+
<show_in_store>1</show_in_store>
|
137 |
+
</invoice_minimum_amount>-->
|
138 |
</fields>
|
139 |
</payson_invoice>
|
140 |
</groups>
|
app/design/frontend/base/default/template/Payson/Payson/invoice_form.phtml
CHANGED
@@ -4,6 +4,12 @@
|
|
4 |
?>
|
5 |
<fieldset class="form-list">
|
6 |
<label for="p_method_<?php echo($code); ?>" style="float: none"><img src="<?php echo(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)); ?>frontend/base/default/Payson/Payson/payson_faktura.png" alt="Payson" style="margin: 10px 0; display: block" /></label>
|
7 |
-
<p id="payment_form_<?php echo($code); ?>" style="display: none"
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</fieldset>
|
9 |
|
4 |
?>
|
5 |
<fieldset class="form-list">
|
6 |
<label for="p_method_<?php echo($code); ?>" style="float: none"><img src="<?php echo(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)); ?>frontend/base/default/Payson/Payson/payson_faktura.png" alt="Payson" style="margin: 10px 0; display: block" /></label>
|
7 |
+
<p id="payment_form_<?php echo($code); ?>" style="display: none">
|
8 |
+
<?php
|
9 |
+
echo($helper->__('You will be redirected to Payson\'s website.'));
|
10 |
+
echo '<br /><br />';
|
11 |
+
echo($helper->__('If you choose to pay by Paysoninvoice so there is a fee. Payment terms are 10 days and the invoice will be sent separately by email to the email address you specify. To pay by Paysoninvoice You must be 18 years old and be registered in Sweden as well as authorized in the credit assessment carried out at purchase.'));
|
12 |
+
?>
|
13 |
+
</p>
|
14 |
</fieldset>
|
15 |
|
app/etc/modules/Payson_Payson.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Payson_Payson>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
<version>0.1.
|
8 |
<depends>
|
9 |
<Mage_Payment />
|
10 |
</depends>
|
4 |
<Payson_Payson>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
<version>0.1.3</version>
|
8 |
<depends>
|
9 |
<Mage_Payment />
|
10 |
</depends>
|
app/locale/sv_SE/Payson_Payson.csv
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
"Checkout with Payson","Betala med Payson"
|
2 |
-
"You will be redirected to Payson's website.","Du kommer att skickas vidare till Paysons webbplats
|
3 |
|
4 |
-
"Checkout with Payson invoice %s","Betala med Payson faktura %s"
|
5 |
"Invoice fee","Fakturaavgift"
|
|
|
|
|
|
|
6 |
|
7 |
"Order was activated at Payson","Order aktiverades hos Payson"
|
8 |
"Payment was credited at Payson","Betalningen krediterades hos Payson"
|
1 |
"Checkout with Payson","Betala med Payson"
|
2 |
+
"You will be redirected to Payson's website.","Du kommer att skickas vidare till Paysons webbplats"
|
3 |
|
4 |
+
"Checkout with Payson invoice %s invoice fee","Betala med Payson faktura %s fakturaavgift"
|
5 |
"Invoice fee","Fakturaavgift"
|
6 |
+
"If you choose to pay by Paysoninvoice so there is a fee. Payment terms are 10 days and the invoice will be sent separately by email to the email address you specify. To pay by Paysoninvoice You must be 18 years old and be registered in Sweden as well as authorized in the credit assessment carried out at purchase.", "Om du väljer att betala med Paysonfaktura så tillkommer ovanstående avgift. Betalningsvillkor är 10 dagar och fakturan kommer att sändas separat med e-post till den e-postadress Du anger. För att betala mot Paysonfaktura måste Du ha fyllt 18 år och vara folkbokförd i Sverige samt godkännas i den kreditprövning som genomförs vid köpet."
|
7 |
+
"The payment was denied by Payson. Please, try a different payment method", "Betalningen blev nekad. Vänligen, försök med en annan betalningsmetod."
|
8 |
+
"Something went wrong with the payment. Please, try a different payment method", "Något gick fel med betalningen. Vänligen, försök en annan betalningsmetod."
|
9 |
|
10 |
"Order was activated at Payson","Order aktiverades hos Payson"
|
11 |
"Payment was credited at Payson","Betalningen krediterades hos Payson"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Payson</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>BSD</license>
|
7 |
<channel>community</channel>
|
@@ -12,13 +12,16 @@
|
|
12 |
<description>Make it easy to charge your customers. Chose Payson.
|
13 |

|
14 |
This module integrates with Payson and allows you to charge your customers via Invoice, Card and direct bank transfers.</description>
|
15 |
-
<notes>*
|
16 |
-
|
17 |
-
*
|
|
|
|
|
|
|
18 |
<authors><author><name>Daniel Hansen</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
|
19 |
-
<date>2013-
|
20 |
-
<time>
|
21 |
-
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Payson"><dir name="Payson"><dir name="Block"><file name="Form.php" hash="7a7c6e5ae4e2e8e72fa2c40a22c88440"/><dir name="Invoice"><file name="Form.php" hash="11483752cd4555f47445a92371e7c1b5"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="808261ee19df9146756160cb6cd53b6a"/></dir></dir><dir name="Standard"><file name="Form.php" hash="9d013602be74f2c74de0ccdb6dbf8675"/></dir></dir><dir name="Helper"><dir name="Api"><dir name="Response"><file name="Interface.php" hash="9e4776fe054757f2d2739bcd9616e2fb"/><dir name="Standard"><file name="Parameters.php" hash="626604b19b85f17d1be40f3623cedc43"/></dir><file name="Standard.php" hash="06999c14ae62726117b0c37a0e974b5f"/><file name="Validate.php" hash="aa3a364583c8d75c2faa22f43142db19"/></dir></dir><file name="Api.php" hash="
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Payson</name>
|
4 |
+
<version>0.1.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>BSD</license>
|
7 |
<channel>community</channel>
|
12 |
<description>Make it easy to charge your customers. Chose Payson.
|
13 |

|
14 |
This module integrates with Payson and allows you to charge your customers via Invoice, Card and direct bank transfers.</description>
|
15 |
+
<notes>* Invoice will not be available in checkout on purchases below 30SEK or for customers with a delivery address outside of sweden.
|
16 |
+
<br />
|
17 |
+
* An issue with the cancel URL has been fixed
|
18 |
+
<br />
|
19 |
+
* When selecting test mode the module will be using test credentials automatically
|
20 |
+
</notes>
|
21 |
<authors><author><name>Daniel Hansen</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
|
22 |
+
<date>2013-04-09</date>
|
23 |
+
<time>03:48:40</time>
|
24 |
+
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Payson"><dir name="Payson"><dir name="Block"><file name="Form.php" hash="7a7c6e5ae4e2e8e72fa2c40a22c88440"/><dir name="Invoice"><file name="Form.php" hash="11483752cd4555f47445a92371e7c1b5"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="808261ee19df9146756160cb6cd53b6a"/></dir></dir><dir name="Standard"><file name="Form.php" hash="9d013602be74f2c74de0ccdb6dbf8675"/></dir></dir><dir name="Helper"><dir name="Api"><dir name="Response"><file name="Interface.php" hash="9e4776fe054757f2d2739bcd9616e2fb"/><dir name="Standard"><file name="Parameters.php" hash="626604b19b85f17d1be40f3623cedc43"/></dir><file name="Standard.php" hash="06999c14ae62726117b0c37a0e974b5f"/><file name="Validate.php" hash="aa3a364583c8d75c2faa22f43142db19"/></dir></dir><file name="Api.php" hash="f02aa052f1d383cc273cc5e834a80fd4"/><file name="Data.php" hash="89f829357cfdbefdabb46dff8d52228c"/></dir><dir name="Model"><file name="Config.php" hash="28a902246b058cfe772a05e8da631011"/><dir name="Method"><file name="Abstract.php" hash="c4b83dd7d16e2a409d4be0345e6f30e5"/><file name="Invoice.php" hash="28a54397e43394116b0088e836ca6c45"/><file name="Standard.php" hash="a0d41d559429cf7713ee6bba59733cb9"/></dir><dir name="Mysql4"><file name="Setup.php" hash="9023463718548c8a5ed7faed6aa40a3c"/></dir><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Invoice.php" hash="86748e75794e73df7d0b25091a19fbad"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Invoice.php" hash="050af7c18f19f6e036b582c2bb56f332"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Invoice.php" hash="09522f6537a78461cf737e232317463e"/></dir></dir></dir><file name="Standard.php" hash="2f44109bfcc19c28764e1e9acd6e6422"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="56118704e788b2b53086f7c9be71c996"/></dir></dir></dir><file name="CheckoutController.php" hash="443622cc8a285dbdbb05951c195fa611"/><file name="IpnController.php" hash="48e3d7683632647568817548c9bd0a66"/></dir><dir name="etc"><file name="config.xml" hash="b3c5d3d97413eeb81a670321265fd4b9"/><file name="system.xml" hash="bd6e55c97130c0569b187a7cbf9779b7"/></dir><dir name="sql"><dir name="payson_setup"><file name="mysql4-install-0.1.0.php" hash="98b5bdd98a21255e334b843ecd998dc3"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="a18c999031bce6579e6fc0add977ea04"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="Payson"><dir name="Payson"><file name="total.phtml" hash="a6f06816114cda260573492e4db22238"/></dir></dir><dir name="layout"><file name="Payson.xml" hash=""/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="Payson"><dir name="Payson"><file name="invoice_form.phtml" hash="8084033612634d80aca0d2526b356f4f"/><file name="standard_form.phtml" hash="5b9a8817c94fcbced0ce06edbaf5c3b9"/></dir></dir></dir><dir name="layout"><file name="Payson.xml" hash=""/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Payson_Payson.xml" hash=""/></dir></dir><dir name="locale"><dir name="sv_SE"><file name="Payson_Payson.csv" hash=""/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="Payson"><dir name="Payson"><file name="payson.gif" hash="638d0055cbc1a4bdc32e9fa1156b722a"/><file name="payson.png" hash="308916345711a4520313c94218c5bda7"/><file name="payson_faktura.png" hash="fa218c9949c05c6f3452d9f4c541da2c"/></dir></dir></dir></dir></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
</package>
|