Version Notes
Checkout.com Payment Gateway first release 0.0.1
Download this release
Release Info
| Developer | EvoPin |
| Extension | Checkout_Payment |
| Version | 0.0.1 |
| Comparing to | |
| See all releases | |
Version 0.0.1
- app/code/community/Evopin/Checkoutcom/Block/Form/Paymentform.php +11 -0
- app/code/community/Evopin/Checkoutcom/Helper/Data.php +5 -0
- app/code/community/Evopin/Checkoutcom/Model/Payment.php +278 -0
- app/code/community/Evopin/Checkoutcom/Model/Source/Cctype.php +8 -0
- app/code/community/Evopin/Checkoutcom/Model/Source/PaymentAction.php +18 -0
- app/code/community/Evopin/Checkoutcom/etc/config.xml +68 -0
- app/code/community/Evopin/Checkoutcom/etc/system.xml +89 -0
- app/design/frontend/base/default/template/evopin/checkoutcom/form/paymentform.phtml +60 -0
- package.xml +18 -0
app/code/community/Evopin/Checkoutcom/Block/Form/Paymentform.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Evopin_Checkoutcom_Block_Form_Paymentform extends Mage_Payment_Block_Form_Cc
|
| 4 |
+
{
|
| 5 |
+
function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->setTemplate('evopin/checkoutcom/form/paymentform.phtml');
|
| 9 |
+
}
|
| 10 |
+
}
|
| 11 |
+
?>
|
app/code/community/Evopin/Checkoutcom/Helper/Data.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Evopin_Checkoutcom_Helper_Data extends Mage_Payment_Helper_Data
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
}
|
app/code/community/Evopin/Checkoutcom/Model/Payment.php
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Evopin_Checkoutcom_Model_Payment extends Mage_Payment_Model_Method_Cc
|
| 4 |
+
{
|
| 5 |
+
protected $_code = 'checkoutcom';
|
| 6 |
+
|
| 7 |
+
const PAYMENTMODULE_API_URL_UAT = 'https://api.checkout.com/process/gateway.aspx';
|
| 8 |
+
const PAYMENTMODULE_API_URL_LIVE = 'https://api.checkout.com/process/gateway.aspx';
|
| 9 |
+
const PAYMENTMODULE_TRANS_TYPE_SALE = '1';
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Availability options
|
| 14 |
+
*/
|
| 15 |
+
protected $_isGateway = true;
|
| 16 |
+
protected $_canAuthorize = false;
|
| 17 |
+
protected $_canCapture = true;
|
| 18 |
+
protected $_canCapturePartial = false;
|
| 19 |
+
protected $_canRefund = false;
|
| 20 |
+
protected $_canVoid = false;
|
| 21 |
+
protected $_canUseInternal = true;
|
| 22 |
+
protected $_canUseCheckout = true;
|
| 23 |
+
protected $_canUseForMultishipping = true;
|
| 24 |
+
protected $_canSaveCc = false;
|
| 25 |
+
protected $_isInitializeNeeded = false;
|
| 26 |
+
|
| 27 |
+
protected $_allowCurrencyCode = array('AUD', 'CAD', 'CHF', 'DKK', 'EUR', 'GBP', 'HKD', 'JPY', 'NOK', 'NZD', 'SEK', 'USD', 'ZAR');
|
| 28 |
+
|
| 29 |
+
protected $_formBlockType = 'checkoutcom/form_paymentform';
|
| 30 |
+
|
| 31 |
+
private $errorDetails;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Check method for processing with base currency
|
| 35 |
+
*
|
| 36 |
+
* @param string $currencyCode
|
| 37 |
+
* @return boolean
|
| 38 |
+
*/
|
| 39 |
+
// public function canUseForCurrency($currencyCode)
|
| 40 |
+
// {
|
| 41 |
+
// if (!in_array($currencyCode, $this->_allowCurrencyCode)) {
|
| 42 |
+
// return false;
|
| 43 |
+
// }
|
| 44 |
+
// return true;
|
| 45 |
+
// }
|
| 46 |
+
|
| 47 |
+
private function getApiUrl()
|
| 48 |
+
{
|
| 49 |
+
if (!$this->getConfigData('gateway_url')) {
|
| 50 |
+
return self::PAYMENTMODULE_API_URL;
|
| 51 |
+
}
|
| 52 |
+
return $this->getConfigData('gateway_url');
|
| 53 |
+
}
|
| 54 |
+
private function getHeaders()
|
| 55 |
+
{
|
| 56 |
+
return array("MIME-Version: 1.0", "Content-type: application/x-www-form-urlencoded", "Contenttransfer-encoding: text");
|
| 57 |
+
}
|
| 58 |
+
private function getNVPArray(Varien_Object $payment, $method,$action)
|
| 59 |
+
{
|
| 60 |
+
$order = $payment->getOrder();
|
| 61 |
+
$billing = $payment->getOrder()->getBillingAddress();
|
| 62 |
+
$shipping = $order->getShippingAddress();
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
$post_XML= '<request>' .
|
| 67 |
+
'<merchantid>' . Mage::helper('core')->decrypt($this->getConfigData('user_name')) . '</merchantid>' .
|
| 68 |
+
'<password>' . Mage::helper('core')->decrypt($this->getConfigData('password')) . '</password>' .
|
| 69 |
+
'<action>'. $action . '</action>' .
|
| 70 |
+
'<trackid>' . $order->getIncrementId() . '</trackid>' .
|
| 71 |
+
'<bill_currencycode>' . $order->getBaseCurrencyCode() . '</bill_currencycode>' .
|
| 72 |
+
'<bill_cardholder>' . $payment->getCcOwner() . '</bill_cardholder>' .
|
| 73 |
+
'<bill_cc_type>' . CC . '</bill_cc_type>' .
|
| 74 |
+
'<bill_cc_brand></bill_cc_brand>' .
|
| 75 |
+
'<bill_cc>' . $payment->getCcNumber() . '</bill_cc>' .
|
| 76 |
+
'<bill_expmonth>' . $payment->getCcExpMonth() . '</bill_expmonth>' .
|
| 77 |
+
'<bill_expyear>' . $payment->getCcExpYear() . '</bill_expyear>' .
|
| 78 |
+
'<bill_cvv2>' . $payment->getCcCid() . '</bill_cvv2>' .
|
| 79 |
+
'<bill_address>' . $billing->getStreet(1) . '</bill_address>' .
|
| 80 |
+
'<bill_address2></bill_address2>' .
|
| 81 |
+
'<bill_postal>' . $billing->getPostcode() . '</bill_postal>' .
|
| 82 |
+
'<bill_city>' . $billing->getCity() . '</bill_city>' .
|
| 83 |
+
'<bill_state>' . $billing->getRegion() . '</bill_state>' .
|
| 84 |
+
'<bill_email>' . $order->getCustomerEmail() . '</bill_email>' .
|
| 85 |
+
'<bill_country>' . $billing->getCountry() . '</bill_country>' .
|
| 86 |
+
'<bill_amount>' . $payment->getAmount() . '</bill_amount>' .
|
| 87 |
+
'<bill_phone>' . $billing->getTelephone() . '</bill_phone>' .
|
| 88 |
+
'<bill_fax>' . '' . '</bill_fax>' .
|
| 89 |
+
'<bill_customerip>' . $billing->getCustomerId() . '</bill_customerip>' .
|
| 90 |
+
'<bill_merchantip>' . $order->getRemoteIp() . '</bill_merchantip>';
|
| 91 |
+
if (!empty($shipping))
|
| 92 |
+
{
|
| 93 |
+
$post_XML = $post_XML .'<ship_address>' . $shipping->getStreet(1) . '</ship_address>' .
|
| 94 |
+
'<ship_email>' . '' . '</ship_email>' .
|
| 95 |
+
'<ship_postal>' . $shipping->getPostcode() . '</ship_postal>' .
|
| 96 |
+
'<ship_address2></ship_address2>' .
|
| 97 |
+
'<ship_type>' . '' . '</ship_type>' .
|
| 98 |
+
'<ship_city>' . $shipping->getCity() . '</ship_city>' .
|
| 99 |
+
'<ship_state>' . $shipping->getRegion() . '</ship_state>' .
|
| 100 |
+
'<ship_phone>' . '' . '</ship_phone>' .
|
| 101 |
+
'<ship_country>' . $shipping->getCountry() . '</ship_country>' .
|
| 102 |
+
'<ship_fax>' . '' . '</ship_fax>' ;
|
| 103 |
+
}
|
| 104 |
+
$post_XML = $post_XML . '<udf1></udf1>' .
|
| 105 |
+
'<udf2></udf2>' .
|
| 106 |
+
'<udf3></udf3>' .
|
| 107 |
+
'<udf4></udf4>' .
|
| 108 |
+
'<udf5></udf5>' .
|
| 109 |
+
'</request>';
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
return $post_XML;
|
| 113 |
+
|
| 114 |
+
}
|
| 115 |
+
private function getNVPRequest(Varien_Object $payment, $method)
|
| 116 |
+
{
|
| 117 |
+
$nvpArray = $this->getNVPArray($payment, $method);
|
| 118 |
+
$nvp = '';
|
| 119 |
+
foreach ($nvpArray as $k => $v) {
|
| 120 |
+
$nvp .= $k . '=' . urlencode($v) . '&';
|
| 121 |
+
}
|
| 122 |
+
$nvp = rtrim($nvp, '&');
|
| 123 |
+
return $nvp;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
private function processPayment($npvStr) {
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
if($this->getConfigData('test') == '1')
|
| 131 |
+
{
|
| 132 |
+
$gateway_url=self::PAYMENTMODULE_API_URL_UAT;
|
| 133 |
+
}else
|
| 134 |
+
{
|
| 135 |
+
$gateway_url=self::PAYMENTMODULE_API_URL_LIVE;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
$http = new Varien_Http_Adapter_Curl();
|
| 141 |
+
$config = array('timeout' => 60);
|
| 142 |
+
$http->setConfig($config);
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
$http->write(Zend_Http_Client::POST, $gateway_url, '1.1', array(), $npvStr);
|
| 146 |
+
$response = $http->read();
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
if ($http->getErrno()) {
|
| 152 |
+
$http->close();
|
| 153 |
+
$this->errorDetails = array(
|
| 154 |
+
'type' => 'CURL',
|
| 155 |
+
'code' => $http->getErrno(),
|
| 156 |
+
'message' => $http->getError()
|
| 157 |
+
);
|
| 158 |
+
return false;
|
| 159 |
+
}
|
| 160 |
+
$http->close();
|
| 161 |
+
|
| 162 |
+
$response = preg_split('/^\r?$/m', $response, 2);
|
| 163 |
+
$response = trim($response[1]);
|
| 164 |
+
|
| 165 |
+
return($response);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* this method is called if we are just authorising
|
| 170 |
+
* a transaction
|
| 171 |
+
*/
|
| 172 |
+
public function authorize (Varien_Object $payment, $amount)
|
| 173 |
+
{
|
| 174 |
+
$error = false;
|
| 175 |
+
$payment->setAmount($amount);
|
| 176 |
+
|
| 177 |
+
$nvpStr = $this->getNVPArray($payment, $method,'4');
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
$response = $this->processPayment($nvpStr);
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
if (!$response) {
|
| 185 |
+
$error = Mage::helper('checkoutcom')->__('Gateway request error: %s', $this->errorDetails['message']);
|
| 186 |
+
}
|
| 187 |
+
else {
|
| 188 |
+
$result = @simplexml_load_string($response);
|
| 189 |
+
$gwerror = $result->{'error_text'};
|
| 190 |
+
|
| 191 |
+
if(!$gwerror){
|
| 192 |
+
if (!$result) {
|
| 193 |
+
$error = Mage::helper('checkoutcom')->__('Cannot process your payment. Please try again.');
|
| 194 |
+
}
|
| 195 |
+
elseif ($result->{'responsecode'} != '0') {
|
| 196 |
+
$error = Mage::helper('checkoutcom')->__("Cannot process your payment, error: %s (%s). Please try again.", $result->{'result'},$result->{'responsecode'}, $response);
|
| 197 |
+
}
|
| 198 |
+
}else
|
| 199 |
+
{
|
| 200 |
+
$error = Mage::helper('checkoutcom')->__("Cannot process your payment, error: %s. Please try again.", $gwerror, $response);
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
if ($error !== false) {
|
| 204 |
+
Mage::throwException($error);
|
| 205 |
+
}
|
| 206 |
+
else {
|
| 207 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
| 208 |
+
$payment->setLastTransId($result->{'tranid'});
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
return $this;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* this method is called if we are authorising AND
|
| 216 |
+
* capturing a transaction
|
| 217 |
+
*/
|
| 218 |
+
public function capture (Varien_Object $payment, $amount)
|
| 219 |
+
{
|
| 220 |
+
|
| 221 |
+
$error = false;
|
| 222 |
+
$payment->setAmount($amount);
|
| 223 |
+
|
| 224 |
+
$nvpStr = $this->getNVPArray($payment, $method,'1');
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
$response = $this->processPayment($nvpStr);
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
if (!$response) {
|
| 232 |
+
$error = Mage::helper('checkoutcom')->__('Gateway request error: %s', $this->errorDetails['message']);
|
| 233 |
+
}
|
| 234 |
+
else {
|
| 235 |
+
$result = @simplexml_load_string($response);
|
| 236 |
+
$gwerror = $result->{'error_text'};
|
| 237 |
+
|
| 238 |
+
if(!$gwerror){
|
| 239 |
+
if (!$result) {
|
| 240 |
+
$error = Mage::helper('checkoutcom')->__('Cannot process your payment. Please try again.');
|
| 241 |
+
}
|
| 242 |
+
elseif ($result->{'responsecode'} != '0') {
|
| 243 |
+
$error = Mage::helper('checkoutcom')->__("Cannot process your payment, error: %s (%s). Please try again.", $result->{'result'},$result->{'responsecode'}, $response);
|
| 244 |
+
}
|
| 245 |
+
}else
|
| 246 |
+
{
|
| 247 |
+
$error = Mage::helper('checkoutcom')->__("Cannot process your payment, error: %s. Please try again.", $gwerror, $response);
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
if ($error !== false) {
|
| 251 |
+
Mage::throwException($error);
|
| 252 |
+
}
|
| 253 |
+
else {
|
| 254 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
| 255 |
+
$payment->setLastTransId($result->{'tranid'});
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
return $this;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/**
|
| 262 |
+
* called if refunding
|
| 263 |
+
*/
|
| 264 |
+
public function refund (Varien_Object $payment, $amount)
|
| 265 |
+
{
|
| 266 |
+
Mage::throwException("Refund not Supported.");
|
| 267 |
+
return $this;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
/**
|
| 271 |
+
* called if voiding a payment
|
| 272 |
+
*/
|
| 273 |
+
public function void (Varien_Object $payment)
|
| 274 |
+
{
|
| 275 |
+
Mage::throwException("Voi not Supported.");
|
| 276 |
+
return $this;
|
| 277 |
+
}
|
| 278 |
+
}
|
app/code/community/Evopin/Checkoutcom/Model/Source/Cctype.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Evopin_Checkoutcom_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
| 3 |
+
{
|
| 4 |
+
public function getAllowedTypes()
|
| 5 |
+
{
|
| 6 |
+
return array('VI', 'MC');
|
| 7 |
+
}
|
| 8 |
+
}
|
app/code/community/Evopin/Checkoutcom/Model/Source/PaymentAction.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Evopin_Checkoutcom_Model_Source_PaymentAction
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array(
|
| 9 |
+
'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE,
|
| 10 |
+
'label' => Mage::helper('checkoutcom')->__('Authorize Only')
|
| 11 |
+
),
|
| 12 |
+
array(
|
| 13 |
+
'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE,
|
| 14 |
+
'label' => Mage::helper('checkoutcom')->__('Authorize and Capture')
|
| 15 |
+
),
|
| 16 |
+
);
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/community/Evopin/Checkoutcom/etc/config.xml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Evopin_Checkoutcom>
|
| 5 |
+
<version>0.0.1</version>
|
| 6 |
+
</Evopin_Checkoutcom>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<models>
|
| 10 |
+
<checkoutcom>
|
| 11 |
+
<class>Evopin_Checkoutcom_Model</class>
|
| 12 |
+
<resourceModel>checkoutcom_mysql4</resourceModel>
|
| 13 |
+
</checkoutcom>
|
| 14 |
+
<checkoutcom_mysql4>
|
| 15 |
+
<class>Evopin_Checkoutcom_Model_Mysql4</class>
|
| 16 |
+
<entities>
|
| 17 |
+
<checkoutcom_debug><table></table></checkoutcom_debug>
|
| 18 |
+
</entities>
|
| 19 |
+
</checkoutcom_mysql4>
|
| 20 |
+
</models>
|
| 21 |
+
<resources>
|
| 22 |
+
<checkoutcom_setup>
|
| 23 |
+
<setup>
|
| 24 |
+
<module>Evopin_Checkoutcom</module>
|
| 25 |
+
</setup>
|
| 26 |
+
<connection>
|
| 27 |
+
<use>core_setup</use>
|
| 28 |
+
</connection>
|
| 29 |
+
</checkoutcom_setup>
|
| 30 |
+
<checkoutcom_write>
|
| 31 |
+
<connection>
|
| 32 |
+
<use>core_write</use>
|
| 33 |
+
</connection>
|
| 34 |
+
</checkoutcom_write>
|
| 35 |
+
<checkoutcom_read>
|
| 36 |
+
<connection>
|
| 37 |
+
<use>core_read</use>
|
| 38 |
+
</connection>
|
| 39 |
+
</checkoutcom_read>
|
| 40 |
+
</resources>
|
| 41 |
+
<helpers>
|
| 42 |
+
<checkoutcom>
|
| 43 |
+
<class>Evopin_Checkoutcom_Helper</class>
|
| 44 |
+
</checkoutcom>
|
| 45 |
+
</helpers>
|
| 46 |
+
<blocks>
|
| 47 |
+
<checkoutcom>
|
| 48 |
+
<class>Evopin_Checkoutcom_Block</class>
|
| 49 |
+
</checkoutcom>
|
| 50 |
+
</blocks>
|
| 51 |
+
</global>
|
| 52 |
+
<default>
|
| 53 |
+
<payment>
|
| 54 |
+
<checkoutcom>
|
| 55 |
+
<active>0</active>
|
| 56 |
+
<model>checkoutcom/payment</model>
|
| 57 |
+
<order_status>pending</order_status>
|
| 58 |
+
<title>Checkout.com payment gateway</title>
|
| 59 |
+
<user_name>demo</user_name>
|
| 60 |
+
<password>demo</password>
|
| 61 |
+
<cctypes>VI,MC</cctypes>
|
| 62 |
+
<payment_action>authorize</payment_action>
|
| 63 |
+
<order_status>1</order_status>
|
| 64 |
+
<gateway_url>http://test.checkoutcom.com/SmartPayments/transact.asmx/ProcessCreditCard</gateway_url>
|
| 65 |
+
</checkoutcom>
|
| 66 |
+
</payment>
|
| 67 |
+
</default>
|
| 68 |
+
</config>
|
app/code/community/Evopin/Checkoutcom/etc/system.xml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<payment>
|
| 5 |
+
<groups>
|
| 6 |
+
<checkoutcom translate="label" module="checkoutcom">
|
| 7 |
+
<label>Checkout.com payment gateway</label>
|
| 8 |
+
<sort_order>11</sort_order>
|
| 9 |
+
<show_in_default>1</show_in_default>
|
| 10 |
+
<show_in_website>1</show_in_website>
|
| 11 |
+
<show_in_store>1</show_in_store>
|
| 12 |
+
<fields>
|
| 13 |
+
<active translate="label">
|
| 14 |
+
<label>Enabled</label>
|
| 15 |
+
<frontend_type>select</frontend_type>
|
| 16 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 17 |
+
<sort_order>1</sort_order>
|
| 18 |
+
<show_in_default>1</show_in_default>
|
| 19 |
+
<show_in_website>1</show_in_website>
|
| 20 |
+
<show_in_store>0</show_in_store>
|
| 21 |
+
</active>
|
| 22 |
+
<title translate="label">
|
| 23 |
+
<label>Title</label>
|
| 24 |
+
<frontend_type>text</frontend_type>
|
| 25 |
+
<sort_order>2</sort_order>
|
| 26 |
+
<show_in_default>1</show_in_default>
|
| 27 |
+
<show_in_website>1</show_in_website>
|
| 28 |
+
<show_in_store>0</show_in_store>
|
| 29 |
+
</title>
|
| 30 |
+
<user_name translate="label">
|
| 31 |
+
<label>Merchant Code</label>
|
| 32 |
+
<frontend_type>obscure</frontend_type>
|
| 33 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 34 |
+
<sort_order>3</sort_order>
|
| 35 |
+
<show_in_default>1</show_in_default>
|
| 36 |
+
<show_in_website>1</show_in_website>
|
| 37 |
+
<show_in_store>0</show_in_store>
|
| 38 |
+
</user_name>
|
| 39 |
+
<password translate="label">
|
| 40 |
+
<label>Merchant Password</label>
|
| 41 |
+
<frontend_type>obscure</frontend_type>
|
| 42 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 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 |
+
</password>
|
| 48 |
+
<test translate="label">
|
| 49 |
+
<label>Test Mode</label>
|
| 50 |
+
<frontend_type>select</frontend_type>
|
| 51 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 52 |
+
<sort_order>5</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>0</show_in_store>
|
| 56 |
+
</test>
|
| 57 |
+
<cctypes translate="label">
|
| 58 |
+
<label>Credit Card Types</label>
|
| 59 |
+
<frontend_type>multiselect</frontend_type>
|
| 60 |
+
<source_model>checkoutcom/source_cctype</source_model>
|
| 61 |
+
<sort_order>15</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>0</show_in_store>
|
| 65 |
+
</cctypes>
|
| 66 |
+
<payment_action translate="label">
|
| 67 |
+
<label>Trans Type</label>
|
| 68 |
+
<frontend_type>select</frontend_type>
|
| 69 |
+
<source_model>checkoutcom/source_paymentAction</source_model>
|
| 70 |
+
<sort_order>5</sort_order>
|
| 71 |
+
<show_in_default>1</show_in_default>
|
| 72 |
+
<show_in_website>1</show_in_website>
|
| 73 |
+
<show_in_store>0</show_in_store>
|
| 74 |
+
</payment_action>
|
| 75 |
+
<order_status translate="label">
|
| 76 |
+
<label>New Order Status</label>
|
| 77 |
+
<frontend_type>select</frontend_type>
|
| 78 |
+
<source_model>adminhtml/system_config_source_order_status_processing</source_model>
|
| 79 |
+
<sort_order>5</sort_order>
|
| 80 |
+
<show_in_default>1</show_in_default>
|
| 81 |
+
<show_in_website>1</show_in_website>
|
| 82 |
+
<show_in_store>0</show_in_store>
|
| 83 |
+
</order_status>
|
| 84 |
+
</fields>
|
| 85 |
+
</checkoutcom>
|
| 86 |
+
</groups>
|
| 87 |
+
</payment>
|
| 88 |
+
</sections>
|
| 89 |
+
</config>
|
app/design/frontend/base/default/template/evopin/checkoutcom/form/paymentform.phtml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<fieldset class="form-list">
|
| 2 |
+
<?php $_code=$this->getMethodCode() ?>
|
| 3 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
| 4 |
+
<li>
|
| 5 |
+
<div class="input-box">
|
| 6 |
+
<label for="<?php echo $_code ?>_cc_owner"><?php echo $this->__('Name on Card') ?> <span class="required">*</span></label><br/>
|
| 7 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="required-entry input-text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
|
| 8 |
+
</div>
|
| 9 |
+
</li>
|
| 10 |
+
<li>
|
| 11 |
+
<div class="input-box">
|
| 12 |
+
<label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Credit Card Type') ?> <span class="required">*</span></label><br />
|
| 13 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
|
| 14 |
+
<option value=""><?php echo $this->__('--Please Select--')?></option>
|
| 15 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
| 16 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
| 17 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
| 18 |
+
<?php endforeach ?>
|
| 19 |
+
</select>
|
| 20 |
+
</div>
|
| 21 |
+
</li>
|
| 22 |
+
<li>
|
| 23 |
+
<div class="input-box">
|
| 24 |
+
<label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label><br/>
|
| 25 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
|
| 26 |
+
</div>
|
| 27 |
+
</li>
|
| 28 |
+
<li>
|
| 29 |
+
<div class="input-box">
|
| 30 |
+
<label for="<?php echo $_code ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label><br />
|
| 31 |
+
<div class="v-fix">
|
| 32 |
+
<select id="<?php echo $_code ?>_expiration" style="width:140px;" name="payment[cc_exp_month]" class="required-entry">
|
| 33 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
| 34 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
| 35 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
| 36 |
+
<?php endforeach ?>
|
| 37 |
+
</select>
|
| 38 |
+
</div>
|
| 39 |
+
<div class="v-fix" style="padding-left:5px;">
|
| 40 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
| 41 |
+
<select id="<?php echo $_code ?>_expiration_yr" style="width:103px;" name="payment[cc_exp_year]" class="required-entry">
|
| 42 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
| 43 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
| 44 |
+
<?php endforeach ?>
|
| 45 |
+
</select>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</li>
|
| 49 |
+
<?php if($this->hasVerification()): ?>
|
| 50 |
+
<li>
|
| 51 |
+
<div class="input-box">
|
| 52 |
+
<label for="<?php echo $_code ?>_cc_cid"><?php echo $this->__('Card Verification Number') ?> <span class="required">*</span></label><br />
|
| 53 |
+
<div class="v-fix"><input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" style="width:3em;" value="" /></div>
|
| 54 |
+
|
| 55 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
| 56 |
+
</div>
|
| 57 |
+
</li>
|
| 58 |
+
<?php endif; ?>
|
| 59 |
+
</ul>
|
| 60 |
+
</fieldset>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Checkout_Payment</name>
|
| 4 |
+
<version>0.0.1</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This extension will allow your customers to use Checkout.com payment gateway.</summary>
|
| 10 |
+
<description>This payment module allow you to integrate your store with Checkout.com, your customers will be able to use checkout.com to complete their orders.</description>
|
| 11 |
+
<notes>Checkout.com Payment Gateway first release 0.0.1 </notes>
|
| 12 |
+
<authors><author><name>EvoPin</name><user>EvoPin</user><email>evopin@gmail.com</email></author></authors>
|
| 13 |
+
<date>2014-01-19</date>
|
| 14 |
+
<time>10:20:40</time>
|
| 15 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="evopin"><dir name="checkoutcom"><dir name="form"><file name="paymentform.phtml" hash="16d0f09bf93ebcd9d1c9e468cad8e412"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Evopin"><dir name="Checkoutcom"><dir name="Block"><dir name="Form"><file name="Paymentform.php" hash="4e644a739bce461568e0ae494d8056ec"/></dir></dir><dir name="etc"><file name="config.xml" hash="749ea8a6c605622da48e91733f5afef7"/><file name="system.xml" hash="dba92630937a3c5cdcddb8627a295818"/></dir><dir name="Helper"><file name="Data.php" hash="2640d7a044fc5a05588da422df827ce9"/></dir><dir name="Model"><file name="Payment.php" hash="d85260e92750f643573a6ecc4667ab80"/><dir name="Source"><file name="Cctype.php" hash="41b4e749a1b05a68d190160cb5edabdc"/><file name="PaymentAction.php" hash="fc9543a98585a5848cb0193916e2ba05"/></dir></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
