Version Notes
Release version
Download this release
Release Info
Developer | Alex |
Extension | cps_payments_module |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/MagentoCenter/Cps/Block/Form.php +11 -0
- app/code/community/MagentoCenter/Cps/Block/Info.php +9 -0
- app/code/community/MagentoCenter/Cps/Block/Redirect.php +30 -0
- app/code/community/MagentoCenter/Cps/Helper/Data.php +8 -0
- app/code/community/MagentoCenter/Cps/Model/Checkout.php +123 -0
- app/code/community/MagentoCenter/Cps/controllers/RedirectController.php +131 -0
- app/code/community/MagentoCenter/Cps/etc/config.xml +101 -0
- app/code/community/MagentoCenter/Cps/etc/system.xml +79 -0
- app/design/adminhtml/default/default/template/cps/form.phtml +3 -0
- app/design/adminhtml/default/default/template/cps/info.phtml +5 -0
- app/design/frontend/base/default/template/cps/form.phtml +3 -0
- app/design/frontend/base/default/template/cps/info.phtml +5 -0
- app/design/frontend/default/default/template/cps/form.phtml +3 -0
- app/design/frontend/default/default/template/cps/info.phtml +5 -0
- app/etc/modules/MagentoCenter_Cps.xml +14 -0
- app/locale/en_US/MagentoCenter_Cps.csv +2 -0
- package.xml +18 -0
app/code/community/MagentoCenter/Cps/Block/Form.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class MagentoCenter_Cps_Block_Form extends Mage_Payment_Block_Form
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->setTemplate('cps/form.phtml');
|
10 |
+
}
|
11 |
+
}
|
app/code/community/MagentoCenter/Cps/Block/Info.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MagentoCenter_Cps_Block_Info extends Mage_Payment_Block_Info {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('cps/info.phtml');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/MagentoCenter/Cps/Block/Redirect.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class MagentoCenter_Cps_Block_Redirect extends Mage_Core_Block_Abstract
|
5 |
+
{
|
6 |
+
protected function _toHtml()
|
7 |
+
{
|
8 |
+
$cps = Mage::getModel('cps/checkout');
|
9 |
+
|
10 |
+
$form = new Varien_Data_Form();
|
11 |
+
$form->setAction($cps->getCpsUrl())
|
12 |
+
->setId('pay')
|
13 |
+
->setName('pay')
|
14 |
+
->setMethod('POST')
|
15 |
+
->setUseContainer(true);
|
16 |
+
foreach ($cps->getCpsCheckoutFormFields() as $field=>$value) {
|
17 |
+
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
18 |
+
}
|
19 |
+
|
20 |
+
$html = '<html><body>';
|
21 |
+
$html.= $this->__('Redirecting to checkout page ...');
|
22 |
+
$html.= '<hr>';
|
23 |
+
$html.= $form->toHtml();
|
24 |
+
$html.= '<script type="text/javascript">document.getElementById("pay").submit();</script>';
|
25 |
+
$html.= '</body></html>';
|
26 |
+
|
27 |
+
|
28 |
+
return $html;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/MagentoCenter/Cps/Helper/Data.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class MagentoCenter_Cps_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/MagentoCenter/Cps/Model/Checkout.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class MagentoCenter_Cps_Model_Checkout extends Mage_Payment_Model_Method_Abstract {
|
5 |
+
|
6 |
+
protected $_code = 'cps';
|
7 |
+
protected $_formBlockType = 'cps/form';
|
8 |
+
protected $_infoBlockType = 'cps/info';
|
9 |
+
protected $_order;
|
10 |
+
|
11 |
+
const USERNAME = 'payment/cps/cps_username';
|
12 |
+
const KEYFILE = 'payment/cps/cps_keyfile';
|
13 |
+
const KEYPASS = 'payment/cps/cps_keypass';
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
public function getCheckout() {
|
19 |
+
return Mage::getSingleton('checkout/session');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getOrderPlaceRedirectUrl() {
|
23 |
+
return Mage::getUrl('cps/redirect', array('_secure' => true));
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getCpsUrl() {
|
27 |
+
$url = 'https://3ds.cps.lv/GatorServo/request';
|
28 |
+
return $url;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getLocale()
|
32 |
+
{
|
33 |
+
return Mage::app()->getLocale()->getLocaleCode();
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getCpsCheckoutFormFields() {
|
37 |
+
|
38 |
+
//set parameters
|
39 |
+
$order_id = $this->getCheckout()->getLastRealOrderId();
|
40 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
41 |
+
if ($order->getBillingAddress()->getEmail()) {
|
42 |
+
$email = $order->getBillingAddress()->getEmail();
|
43 |
+
} else {
|
44 |
+
$email = $order->getCustomerEmail();
|
45 |
+
}
|
46 |
+
$user = Mage::getStoreConfig(MagentoCenter_Cps_Model_Checkout::USERNAME);
|
47 |
+
$key = Mage::getStoreConfig(MagentoCenter_Cps_Model_Checkout::KEYFILE);
|
48 |
+
$kpass = Mage::getStoreConfig(MagentoCenter_Cps_Model_Checkout::KEYPASS);
|
49 |
+
$redirectUrl = Mage::getUrl('cps/redirect/success', array('transaction_id' => $order_id));
|
50 |
+
$firstName = $order->getBillingAddress()->getFirstname();
|
51 |
+
$lastName = $order->getBillingAddress()->getLastname();
|
52 |
+
$street = $order->getBillingAddress()->getStreet();
|
53 |
+
$zip = $order->getBillingAddress()->getPostcode();
|
54 |
+
$city = $order->getBillingAddress()->getCity();
|
55 |
+
$country = $order->getBillingAddress()->getCountry();
|
56 |
+
$value = trim(round($order->getGrandTotal(), 2))*100;
|
57 |
+
$currency = $order->getOrderCurrencyCode();
|
58 |
+
$productName = Mage::helper('cps')->__('Payment for order #').$order_id;
|
59 |
+
$ip = $_SERVER["REMOTE_ADDR"];
|
60 |
+
$product_url = 'http://'.$_SERVER['HTTP_HOST'];
|
61 |
+
|
62 |
+
//create digital signature
|
63 |
+
$signature = null;
|
64 |
+
$pemkey = null;
|
65 |
+
$toSign = "sendForAuth" . $user . $order_id . $value . $currency . $productName;
|
66 |
+
$p12cert = array();
|
67 |
+
$file = 'app/code/community/MagentoCenter/Cps/Model/'.$key;
|
68 |
+
$fd = fopen($file, 'rb');
|
69 |
+
$p12buf = fread($fd, filesize($file));
|
70 |
+
fclose($fd);
|
71 |
+
openssl_pkcs12_read($p12buf, $p12cert, $kpass);
|
72 |
+
openssl_pkey_export($p12cert['pkey'], $pemkey);
|
73 |
+
openssl_sign($toSign, $signature, $pemkey, OPENSSL_ALGO_SHA1);
|
74 |
+
openssl_free_key($pemkey);
|
75 |
+
$base64_sig = base64_encode($signature);
|
76 |
+
|
77 |
+
//prepare xml
|
78 |
+
$send_xml = "<?xml version='1.0' encoding='UTF-8'?>
|
79 |
+
<cpsxml xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
|
80 |
+
xsi:schemaLocation='http://www.cps.lv/xml/ns/cpsxml
|
81 |
+
https://3ds.cps.lv/GatorServo/Gator_SendForAuth.xsd'
|
82 |
+
xmlns='http://www.cps.lv/xml/ns/cpsxml'>
|
83 |
+
<header xmlns=''>
|
84 |
+
<responsetype>direct</responsetype>
|
85 |
+
<user>$user</user>
|
86 |
+
<type>sendForAuth</type>
|
87 |
+
<transType>DB</transType>
|
88 |
+
<digiSignature>$base64_sig</digiSignature>
|
89 |
+
<redirectUrl>$redirectUrl</redirectUrl>
|
90 |
+
</header>
|
91 |
+
<request xmlns=''>
|
92 |
+
<orderNumber>$order_id</orderNumber>
|
93 |
+
<cardholder>
|
94 |
+
<firstName>$firstName</firstName>
|
95 |
+
<lastName>$lastName</lastName>
|
96 |
+
<street>$street</street>
|
97 |
+
<zip>$zip</zip>
|
98 |
+
<city>$city</city>
|
99 |
+
<country>$country</country>
|
100 |
+
<email>$email</email>
|
101 |
+
<ip>$ip</ip>
|
102 |
+
</cardholder>
|
103 |
+
<amount>
|
104 |
+
<value>$value</value>
|
105 |
+
<currency>$currency</currency>
|
106 |
+
</amount>
|
107 |
+
<product>
|
108 |
+
<productName>$productName</productName>
|
109 |
+
<productUrl>$product_url</productUrl>
|
110 |
+
</product>
|
111 |
+
</request>
|
112 |
+
</cpsxml>";
|
113 |
+
|
114 |
+
//load request paramaters in an array
|
115 |
+
$params = array(
|
116 |
+
'type' => 'sendForAuth',
|
117 |
+
'xml' => $send_xml,
|
118 |
+
);
|
119 |
+
return $params;
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
app/code/community/MagentoCenter/Cps/controllers/RedirectController.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class MagentoCenter_Cps_RedirectController extends Mage_Core_Controller_Front_Action {
|
5 |
+
|
6 |
+
protected $_order;
|
7 |
+
|
8 |
+
protected function _expireAjax() {
|
9 |
+
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
10 |
+
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
protected function _getCheckout()
|
15 |
+
{
|
16 |
+
return Mage::getSingleton('checkout/session');
|
17 |
+
}
|
18 |
+
|
19 |
+
public function indexAction() {
|
20 |
+
$this->getResponse()
|
21 |
+
->setHeader('Content-type', 'text/html; charset=utf8')
|
22 |
+
->setBody($this->getLayout()
|
23 |
+
->createBlock('cps/redirect')
|
24 |
+
->toHtml());
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
public function successAction() {
|
29 |
+
//get cps gateway response parameters
|
30 |
+
$strResult = $_REQUEST['responseXml'];
|
31 |
+
$strResult = stripslashes($strResult);
|
32 |
+
|
33 |
+
$doc = new DOMDocument();
|
34 |
+
$doc->loadXML($strResult);
|
35 |
+
|
36 |
+
$result = $doc->getElementsByTagName( "result" );
|
37 |
+
foreach( $result as $value )
|
38 |
+
{
|
39 |
+
$resultCode = $value->getElementsByTagName( "resultCode" );
|
40 |
+
$resCode = $resultCode->item(0)->nodeValue;
|
41 |
+
|
42 |
+
$resultMessage = $value->getElementsByTagName( "resultMessage" );
|
43 |
+
$resMessage = $resultMessage->item(0)->nodeValue;
|
44 |
+
|
45 |
+
$resultText = $value->getElementsByTagName( "resultText" );
|
46 |
+
$resText = $resultText->item(0)->nodeValue;
|
47 |
+
}
|
48 |
+
|
49 |
+
//forward to failure page if payment is unsuccessful
|
50 |
+
if($resMessage != 'Captured'){
|
51 |
+
$this->_forward('failure');
|
52 |
+
}
|
53 |
+
//payment successful
|
54 |
+
elseif($resMessage == 'Captured')
|
55 |
+
{
|
56 |
+
//retrieve order id
|
57 |
+
$event = $this->getRequest()->getParams();
|
58 |
+
$transaction_id= $event['transaction_id'];
|
59 |
+
|
60 |
+
//add note about successful payment to order in the backoffice
|
61 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($transaction_id);
|
62 |
+
|
63 |
+
$order->addStatusToHistory(
|
64 |
+
$order->getStatus(),
|
65 |
+
Mage::helper('cps')->__("Customer's credit card was successfuly charged by CPS.")
|
66 |
+
);
|
67 |
+
|
68 |
+
//send email about the order to customer
|
69 |
+
$order->sendNewOrderEmail()->setEmailSent(true)->save();
|
70 |
+
|
71 |
+
//create invoice for successful payment
|
72 |
+
if(!$order->canInvoice())
|
73 |
+
{
|
74 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
75 |
+
}
|
76 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
77 |
+
if (!$invoice->getTotalQty()) {
|
78 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
|
79 |
+
}
|
80 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
81 |
+
$invoice->register();
|
82 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
83 |
+
->addObject($invoice)
|
84 |
+
->addObject($invoice->getOrder());
|
85 |
+
$transactionSave->save();
|
86 |
+
|
87 |
+
//set order status to "Processing" and save order
|
88 |
+
$order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
89 |
+
$order->save();
|
90 |
+
|
91 |
+
//redirect to success page
|
92 |
+
$this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
|
93 |
+
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
public function failureAction()
|
100 |
+
{
|
101 |
+
//retrieve order id
|
102 |
+
$event = $this->getRequest()->getParams();
|
103 |
+
$transaction_id= $event['transaction_id'];
|
104 |
+
|
105 |
+
//add note about unsuccessful payment to order in the backoffice
|
106 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($transaction_id);
|
107 |
+
$order->addStatusToHistory(
|
108 |
+
$order->getStatus(),
|
109 |
+
Mage::helper('cps')->__('Payment rejected by CPS.')
|
110 |
+
);
|
111 |
+
$order->cancel();
|
112 |
+
$order->save();
|
113 |
+
|
114 |
+
//send email to customer that the order's been canceled
|
115 |
+
$order->sendOrderUpdateEmail()->setEmailSent(true)->save();
|
116 |
+
|
117 |
+
//keep session in order to have all the products back in the cart
|
118 |
+
$quoteId = $this->_getCheckout()->getQuoteId();
|
119 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
120 |
+
$quote->getId();
|
121 |
+
$quote->setIsActive(true)->save();
|
122 |
+
|
123 |
+
//redirect back to cart and display error message
|
124 |
+
$this->_getCheckout()->addError(Mage::helper('cps')->__('Sorry, your payment was declined. Order #').$transaction_id);
|
125 |
+
$this->_redirect('checkout/cart');
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
?>
|
app/code/community/MagentoCenter/Cps/etc/config.xml
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<MagentoCenter_Cps>
|
6 |
+
<version>0.0.1</version>
|
7 |
+
</MagentoCenter_Cps>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
|
12 |
+
<models>
|
13 |
+
<cps>
|
14 |
+
<class>MagentoCenter_Cps_Model</class>
|
15 |
+
</cps>
|
16 |
+
</models>
|
17 |
+
|
18 |
+
<blocks>
|
19 |
+
<cps>
|
20 |
+
<class>MagentoCenter_Cps_Block</class>
|
21 |
+
</cps>
|
22 |
+
</blocks>
|
23 |
+
|
24 |
+
<resources>
|
25 |
+
<cps_setup>
|
26 |
+
<setup>
|
27 |
+
<module>MagentoCenter_Cps</module>
|
28 |
+
</setup>
|
29 |
+
<connection>
|
30 |
+
<use>core_setup</use>
|
31 |
+
</connection>
|
32 |
+
</cps_setup>
|
33 |
+
<cps_write>
|
34 |
+
<connection>
|
35 |
+
<use>core_write</use>
|
36 |
+
</connection>
|
37 |
+
</cps_write>
|
38 |
+
<cps_read>
|
39 |
+
<connection>
|
40 |
+
<use>core_read</use>
|
41 |
+
</connection>
|
42 |
+
</cps_read>
|
43 |
+
</resources>
|
44 |
+
<helpers>
|
45 |
+
<cps>
|
46 |
+
<class>MagentoCenter_Cps_Helper</class>
|
47 |
+
</cps>
|
48 |
+
</helpers>
|
49 |
+
</global>
|
50 |
+
|
51 |
+
|
52 |
+
<frontend>
|
53 |
+
<secure_url>
|
54 |
+
<cps_redirect>/cps/redirect/00</cps_redirect>
|
55 |
+
</secure_url>
|
56 |
+
<routers>
|
57 |
+
<cps>
|
58 |
+
<use>standard</use>
|
59 |
+
<args>
|
60 |
+
<module>MagentoCenter_Cps</module>
|
61 |
+
<frontName>cps</frontName>
|
62 |
+
</args>
|
63 |
+
</cps>
|
64 |
+
</routers>
|
65 |
+
<translate>
|
66 |
+
<modules>
|
67 |
+
<MagentoCenter_Cps>
|
68 |
+
<files>
|
69 |
+
<default>MagentoCenter_Cps.csv</default>
|
70 |
+
</files>
|
71 |
+
</MagentoCenter_Cps>
|
72 |
+
</modules>
|
73 |
+
</translate>
|
74 |
+
</frontend>
|
75 |
+
|
76 |
+
|
77 |
+
<adminhtml>
|
78 |
+
<translate>
|
79 |
+
<modules>
|
80 |
+
<MagentoCenter_Cps>
|
81 |
+
<files>
|
82 |
+
<default>MagentoCenter_Cps.csv</default>
|
83 |
+
</files>
|
84 |
+
</MagentoCenter_Cps>
|
85 |
+
</modules>
|
86 |
+
</translate>
|
87 |
+
</adminhtml>
|
88 |
+
|
89 |
+
<default>
|
90 |
+
<payment>
|
91 |
+
<cps>
|
92 |
+
<active>0</active>
|
93 |
+
<model>cps/checkout</model>
|
94 |
+
<title>Complete Payment Systems</title>
|
95 |
+
<cps_username></cps_username>
|
96 |
+
<cps_keyfile></cps_keyfile>
|
97 |
+
<cps_keypass></cps_keypass>
|
98 |
+
</cps>
|
99 |
+
</payment>
|
100 |
+
</default>
|
101 |
+
</config>
|
app/code/community/MagentoCenter/Cps/etc/system.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<cps translate="label" module="cps">
|
7 |
+
<label>Complete Payment Systems</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>3</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>0</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label,comment">
|
24 |
+
<label>Title</label>
|
25 |
+
<comment><![CDATA[ <a href="http://www.cps.lv" target="_blank"> cps.lv </a>]]></comment>
|
26 |
+
<frontend_type>text</frontend_type>
|
27 |
+
<sort_order>2</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>1</show_in_store>
|
31 |
+
</title>
|
32 |
+
<cps_username translate="label">
|
33 |
+
<label>CPS user name</label>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>3</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>0</show_in_store>
|
39 |
+
</cps_username>
|
40 |
+
<cps_keyfile translate="label">
|
41 |
+
<label>CPS key file name (*.p12)</label>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<sort_order>4</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>0</show_in_store>
|
47 |
+
</cps_keyfile>
|
48 |
+
<cps_keypass translate="label">
|
49 |
+
<label>CPS key file password</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>5</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
</cps_keypass>
|
56 |
+
<allowspecific translate="label">
|
57 |
+
<label>Payment from applicable countries</label>
|
58 |
+
<frontend_type>allowspecific</frontend_type>
|
59 |
+
<sort_order>50</sort_order>
|
60 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</allowspecific>
|
65 |
+
<specificcountry translate="label">
|
66 |
+
<label>Payment from Specific countries</label>
|
67 |
+
<frontend_type>multiselect</frontend_type>
|
68 |
+
<sort_order>51</sort_order>
|
69 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
</specificcountry>
|
74 |
+
</fields>
|
75 |
+
</cps>
|
76 |
+
</groups>
|
77 |
+
</payment>
|
78 |
+
</sections>
|
79 |
+
</config>
|
app/design/adminhtml/default/default/template/cps/form.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//echo $this->__('When you place an order you will be redirected to secure checkout page.')
|
3 |
+
?>
|
app/design/adminhtml/default/default/template/cps/info.phtml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo '<a href="http://www.cps.lv" target="_blank"> cps.lv </a>';
|
3 |
+
?>
|
4 |
+
|
5 |
+
|
app/design/frontend/base/default/template/cps/form.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//echo $this->__('When you place an order you will be redirected to secure checkout page.')
|
3 |
+
?>
|
app/design/frontend/base/default/template/cps/info.phtml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo '<a href="http://www.cps.lv" target="_blank"> cps.lv </a>';
|
3 |
+
?>
|
4 |
+
|
5 |
+
|
app/design/frontend/default/default/template/cps/form.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo $this->__('When you place an order you will be redirected to secure checkout page.')
|
3 |
+
?>
|
app/design/frontend/default/default/template/cps/info.phtml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo '<a href="http://www.cps.lv" target="_blank"> cps.lv </a>';
|
3 |
+
?>
|
4 |
+
|
5 |
+
|
app/etc/modules/MagentoCenter_Cps.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MagentoCenter_Cps>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Paygate/>
|
9 |
+
<Mage_Checkout/>
|
10 |
+
<Mage_Sales/>
|
11 |
+
</depends>
|
12 |
+
</MagentoCenter_Cps>
|
13 |
+
</modules>
|
14 |
+
</config>
|
app/locale/en_US/MagentoCenter_Cps.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
"Sorry, your payment was declined. Order #","Sorry, your payment was declined. Order #"
|
2 |
+
"Redirecting to checkout page ...","Redirecting to checkout page ..."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>cps_payments_module</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Payment extension for Magento</summary>
|
10 |
+
<description>Allows to quickly connect to Magento shopping cart with CPS merchant account.</description>
|
11 |
+
<notes>Release version</notes>
|
12 |
+
<authors><author><name>Alex</name><user>ksers</user><email>aleksanderm@inbox.lv</email></author></authors>
|
13 |
+
<date>2012-08-30</date>
|
14 |
+
<time>11:21:51</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="MagentoCenter"><dir name="Cps"><dir name="Block"><file name="Form.php" hash="da6005e88ed9a79136f6ee9c543c1d48"/><file name="Info.php" hash="4fbc2d5ab98c74bdfdc3ef1a352ba2f6"/><file name="Redirect.php" hash="79aae257a4484a4b52d8f8471f97bbd9"/></dir><dir name="Helper"><file name="Data.php" hash="c86062f8307567afb19bda1044ee61d5"/></dir><dir name="Model"><file name="Checkout.php" hash="e14d6d13dedae7e2bdf479034b8ce5e0"/></dir><dir name="controllers"><file name="RedirectController.php" hash="863fdeec6c83344ada2bf88c4c79228e"/></dir><dir name="etc"><file name="config.xml" hash="8990016fc7bdb9198a05e6a7727ba43e"/><file name="system.xml" hash="eb45585622caaf709a0fcd451e65b071"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cps"><file name="form.phtml" hash="0e77ab8ce069f514977b158312b86631"/><file name="info.phtml" hash="e92c8339684085303d4f8164b896c6bd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cps"><file name="form.phtml" hash="0e77ab8ce069f514977b158312b86631"/><file name="info.phtml" hash="e92c8339684085303d4f8164b896c6bd"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="cps"><file name="form.phtml" hash="bf67ab5319e573c3565e319756463f3d"/><file name="info.phtml" hash="e92c8339684085303d4f8164b896c6bd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MagentoCenter_Cps.xml" hash="5606e8b2466eec0a62c6eab828cb526a"/></dir></target><target name="magelocale"><dir name="en_US"><file name="MagentoCenter_Cps.csv" hash="6aae2ea71a316dcc77d2759150483924"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|