Version Notes
Onsite Payment module. Install through Magento connect upload or via Magento connect extension key
Download this release
Release Info
| Developer | Collins Harper |
| Extension | Payfirma_Onsite_Payment_Gateway |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Collinsharper/Payfirma/Block/Form.php +22 -0
- app/code/community/Collinsharper/Payfirma/Helper/Data.php +18 -0
- app/code/community/Collinsharper/Payfirma/Model/Api.php +216 -0
- app/code/community/Collinsharper/Payfirma/Model/Payment.php +197 -0
- app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/Cctype.php +9 -0
- app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/Currency.php +18 -0
- app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/PaymentAction.php +18 -0
- app/code/community/Collinsharper/Payfirma/etc/config.xml +62 -0
- app/code/community/Collinsharper/Payfirma/etc/system.xml +228 -0
- app/design/frontend/base/default/template/chpayfirma/logo.phtml +5 -0
- app/etc/modules/Collinsharper_Payfirma.xml +12 -0
- package.xml +18 -0
- skin/frontend/base/default/images/chpayfirma_logo.png +0 -0
app/code/community/Collinsharper/Payfirma/Block/Form.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Block_Form extends Mage_Payment_Block_Form_Cc
|
| 4 |
+
{
|
| 5 |
+
protected function _toHtml()
|
| 6 |
+
{
|
| 7 |
+
$html = parent::_toHtml();
|
| 8 |
+
|
| 9 |
+
// Find the last </ul> in the template, so we can sneak our logo in before it
|
| 10 |
+
$lastUlPos = strrpos($html, '</ul>');
|
| 11 |
+
if ($lastUlPos !== false) {
|
| 12 |
+
$logoHtml = $this->getLayout()->createBlock('core/template')
|
| 13 |
+
->setTemplate('chpayfirma/logo.phtml')
|
| 14 |
+
->toHtml();
|
| 15 |
+
|
| 16 |
+
// Insert our logo HTML before the last </ul>
|
| 17 |
+
$html = substr_replace($html, $logoHtml, $lastUlPos, 0);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
return $html;
|
| 21 |
+
}
|
| 22 |
+
}
|
app/code/community/Collinsharper/Payfirma/Helper/Data.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function log($message)
|
| 6 |
+
{
|
| 7 |
+
if ($this->getConfig('is_debug_mode')) {
|
| 8 |
+
Mage::log($message, Zend_Log::DEBUG, 'payment_chpayfirma.log');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
return $this;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
public function getConfig($code)
|
| 15 |
+
{
|
| 16 |
+
return Mage::getStoreConfig('payment/chpayfirma/' . $code);
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/community/Collinsharper/Payfirma/Model/Api.php
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Model_Api extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
protected $_apiUrl;
|
| 6 |
+
|
| 7 |
+
public function __construct($storeId)
|
| 8 |
+
{
|
| 9 |
+
parent::__construct(array('store_id' => $storeId));
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function sale($amount, $cardNumber, $expiryMonth, $expiryYear, $cvv = null, $additional = array())
|
| 13 |
+
{
|
| 14 |
+
$this->_init();
|
| 15 |
+
|
| 16 |
+
$apiUrl = $this->_apiUrl . '/sale';
|
| 17 |
+
$payload = array(
|
| 18 |
+
'merchant_id' => $this->getMerchantId(),
|
| 19 |
+
'key' => $this->getApiKey(),
|
| 20 |
+
'amount' => $amount, // TODO: Should we round/format this, or leave it plain? For all below!
|
| 21 |
+
'card_number' => $cardNumber,
|
| 22 |
+
'card_expiry_month' => $expiryMonth,
|
| 23 |
+
'card_expiry_year' => $expiryYear,
|
| 24 |
+
'do_not_store' => 'true'
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
if ($cvv !== null) {
|
| 28 |
+
$payload['cvv2'] = $cvv;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
$additional = (array) $additional;
|
| 32 |
+
if ($additional) {
|
| 33 |
+
// Merge in this order so $additional can't overwrite anything already in $payload
|
| 34 |
+
$payload = array_merge($additional, $payload);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
if ($this->getIsTestMode()) {
|
| 38 |
+
$payload['test_mode'] = 'true';
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
return $this->_executeRequest($apiUrl, $payload);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public function authorize($amount, $cardNumber, $expiryMonth, $expiryYear, $cvv = null, $additional = array())
|
| 45 |
+
{
|
| 46 |
+
$this->_init();
|
| 47 |
+
|
| 48 |
+
$apiUrl = $this->_apiUrl . '/authorize';
|
| 49 |
+
$payload = array(
|
| 50 |
+
'merchant_id' => $this->getMerchantId(),
|
| 51 |
+
'key' => $this->getApiKey(),
|
| 52 |
+
'amount' => $amount,
|
| 53 |
+
'card_number' => $cardNumber,
|
| 54 |
+
'card_expiry_month' => $expiryMonth,
|
| 55 |
+
'card_expiry_year' => $expiryYear,
|
| 56 |
+
'do_not_store' => 'true'
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
if ($cvv !== null) {
|
| 60 |
+
$payload['cvv2'] = $cvv;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
$additional = (array) $additional;
|
| 64 |
+
if ($additional) {
|
| 65 |
+
// Merge in this order so $additional can't overwrite anything already in $payload
|
| 66 |
+
$payload = array_merge($additional, $payload);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
if ($this->getIsTestMode()) {
|
| 70 |
+
$payload['test_mode'] = 'true';
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return $this->_executeRequest($apiUrl, $payload);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* @todo possibly take metadata so we can save invoice id
|
| 78 |
+
*/
|
| 79 |
+
public function capture($amount, $transactionId)
|
| 80 |
+
{
|
| 81 |
+
$this->_init();
|
| 82 |
+
|
| 83 |
+
$apiUrl = $this->_apiUrl . '/capture/' . $transactionId;
|
| 84 |
+
$payload = array(
|
| 85 |
+
'merchant_id' => $this->getMerchantId(),
|
| 86 |
+
'key' => $this->getApiKey(),
|
| 87 |
+
'amount' => $amount
|
| 88 |
+
);
|
| 89 |
+
|
| 90 |
+
if ($this->getIsTestMode()) {
|
| 91 |
+
$payload['test_mode'] = 'true';
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return $this->_executeRequest($apiUrl, $payload);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
public function refund($amount, $transactionId)
|
| 98 |
+
{
|
| 99 |
+
$this->_init();
|
| 100 |
+
|
| 101 |
+
$apiUrl = $this->_apiUrl . '/refund/' . $transactionId;
|
| 102 |
+
$payload = array(
|
| 103 |
+
'merchant_id' => $this->getMerchantId(),
|
| 104 |
+
'key' => $this->getApiKey(),
|
| 105 |
+
'amount' => $amount
|
| 106 |
+
);
|
| 107 |
+
|
| 108 |
+
if ($this->getIsTestMode()) {
|
| 109 |
+
$payload['test_mode'] = 'true';
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
return $this->_executeRequest($apiUrl, $payload);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
public function retrieve($transactionId)
|
| 116 |
+
{
|
| 117 |
+
$this->_init();
|
| 118 |
+
|
| 119 |
+
$apiUrl = $this->_apiUrl . '/transaction/' . $transactionId;
|
| 120 |
+
$payload = array(
|
| 121 |
+
'merchant_id' => $this->getMerchantId(),
|
| 122 |
+
'key' => $this->getApiKey(),
|
| 123 |
+
'method' => 'GET'
|
| 124 |
+
);
|
| 125 |
+
|
| 126 |
+
// TODO: Not sure if test_mode applies for this endpoint.
|
| 127 |
+
if ($this->getIsTestMode()) {
|
| 128 |
+
$payload['test_mode'] = 'true';
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
return $this->_executeRequest($apiUrl, $payload);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
public function getMerchantId()
|
| 135 |
+
{
|
| 136 |
+
if (!$this->hasMerchantId()) {
|
| 137 |
+
$this->_init();
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
return $this->getData('merchant_id');
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
public function getApiKey()
|
| 144 |
+
{
|
| 145 |
+
if (!$this->hasApiKey()) {
|
| 146 |
+
$this->_init();
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
return $this->getData('api_key');
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
public function getIsTestMode()
|
| 153 |
+
{
|
| 154 |
+
if (!$this->hasIsTestMode()) {
|
| 155 |
+
$this->_init();
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
return $this->getData('is_test_mode');
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
public function log($message)
|
| 162 |
+
{
|
| 163 |
+
Mage::helper('chpayfirma')->log($message);
|
| 164 |
+
return $this;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
protected function _executeRequest($apiUrl, $payload)
|
| 168 |
+
{
|
| 169 |
+
$this->log("Request to Payfirma API at " . var_export($apiUrl, true));
|
| 170 |
+
$this->log("Payload: " . print_r($payload, true));
|
| 171 |
+
|
| 172 |
+
$ch = curl_init();
|
| 173 |
+
curl_setopt($ch, CURLOPT_URL, $apiUrl);
|
| 174 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
| 175 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
| 176 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
| 177 |
+
|
| 178 |
+
// TODO: Not ideal, but can we get them to do anything about this?
|
| 179 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
| 180 |
+
|
| 181 |
+
$response = curl_exec($ch);
|
| 182 |
+
curl_close($ch);
|
| 183 |
+
|
| 184 |
+
$this->log("RAW Response from Payfirma API: " . var_export($response, true));
|
| 185 |
+
|
| 186 |
+
$result = Zend_Json::decode($response);
|
| 187 |
+
if (isset($result['error'])) {
|
| 188 |
+
$this->log("***** ENCOUNTERED AN API ERROR *****");
|
| 189 |
+
Mage::throwException($result['error']);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
$this->log("PARSED Response from Payfirma API: " . print_r($result, true));
|
| 193 |
+
|
| 194 |
+
return $result;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
protected function _init()
|
| 198 |
+
{
|
| 199 |
+
if (is_array($this->getStoreId()) || (!$this->getStoreId() && $this->getStoreId() !== 0)) {
|
| 200 |
+
Mage::throwException("Payfirma API handler requires a valid store_id, but currently has '{$this->getStoreId()}'.");
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
$apiUrl = Mage::getStoreConfig('payment/chpayfirma/api_url', $this->getStoreId());
|
| 204 |
+
$this->_apiUrl = $apiUrl;
|
| 205 |
+
|
| 206 |
+
$merchantId = Mage::getStoreConfig('payment/chpayfirma/merchant_id', $this->getStoreId());
|
| 207 |
+
$apiKey = Mage::getStoreConfig('payment/chpayfirma/api_key', $this->getStoreId());
|
| 208 |
+
$isTestMode = Mage::getStoreConfig('payment/chpayfirma/is_test_mode', $this->getStoreId());
|
| 209 |
+
|
| 210 |
+
$this->setData('merchant_id', $merchantId)
|
| 211 |
+
->setData('api_key', $apiKey)
|
| 212 |
+
->setData('is_test_mode', $isTestMode);
|
| 213 |
+
|
| 214 |
+
return $this;
|
| 215 |
+
}
|
| 216 |
+
}
|
app/code/community/Collinsharper/Payfirma/Model/Payment.php
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Model_Payment extends Mage_Payment_Model_Method_Cc
|
| 4 |
+
{
|
| 5 |
+
protected $_code = 'chpayfirma';
|
| 6 |
+
|
| 7 |
+
protected $_formBlockType = 'chpayfirma/form';
|
| 8 |
+
|
| 9 |
+
protected $_isGateway = true;
|
| 10 |
+
protected $_canAuthorize = true;
|
| 11 |
+
protected $_canCapture = true;
|
| 12 |
+
protected $_canCapturePartial = true;
|
| 13 |
+
protected $_canRefund = true;
|
| 14 |
+
protected $_canRefundInvoicePartial = true;
|
| 15 |
+
|
| 16 |
+
protected $_api;
|
| 17 |
+
|
| 18 |
+
public function authorize(Varien_Object $payment, $amount)
|
| 19 |
+
{
|
| 20 |
+
parent::authorize($payment, $amount);
|
| 21 |
+
|
| 22 |
+
$this->log("AUTHORIZE");
|
| 23 |
+
|
| 24 |
+
$order = $payment->getOrder();
|
| 25 |
+
$address = $order->getBillingAddress();
|
| 26 |
+
$additional = array(
|
| 27 |
+
'email' => (string) $address->getEmail(),
|
| 28 |
+
'first_name' => (string) $address->getFirstname(),
|
| 29 |
+
'last_name' => (string) $address->getLastname(),
|
| 30 |
+
'address1' => (string) $address->getStreet(1),
|
| 31 |
+
'address2' => (string) $address->getStreet(2),
|
| 32 |
+
'city' => (string) $address->getCity(),
|
| 33 |
+
'province' => (string) $address->getRegion(),
|
| 34 |
+
'country' => (string) $address->getCountryId(),
|
| 35 |
+
'postal_code' => (string) $address->getPostcode(),
|
| 36 |
+
'company' => (string) $address->getCompany(),
|
| 37 |
+
'telephone' => (string) $address->getTelephone(),
|
| 38 |
+
'currency' => (string) $this->_convertCurrencyCodeForApi($order->getOrderCurrencyCode()),
|
| 39 |
+
'order_id' => (string) $order->getIncrementId()
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
$result = $this->_getApi()->authorize(
|
| 43 |
+
$this->_formatMoney($amount, $order->getOrderCurrencyCode()),
|
| 44 |
+
$payment->getCcNumber(),
|
| 45 |
+
$payment->getCcExpMonth(),
|
| 46 |
+
$payment->getCcExpYear(),
|
| 47 |
+
$this->hasVerification() ? $payment->getCcCid() : null,
|
| 48 |
+
$additional
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
if (!$result['result_bool']) {
|
| 52 |
+
Mage::throwException(Mage::helper('chpayfirma')->__("Payment authorization was declined."));
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
$payment->setTransactionId($result['transaction_id']);
|
| 56 |
+
$payment->setIsTransactionClosed(false);
|
| 57 |
+
|
| 58 |
+
$this->log("DONE Authorized with Transaction ID: " . var_export($result['transaction_id'], true));
|
| 59 |
+
|
| 60 |
+
return $this;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
public function capture(Varien_Object $payment, $amount)
|
| 64 |
+
{
|
| 65 |
+
parent::capture($payment, $amount);
|
| 66 |
+
|
| 67 |
+
$order = $payment->getOrder();
|
| 68 |
+
$authTransactionId = $payment->getParentTransactionId();
|
| 69 |
+
if ($authTransactionId) {
|
| 70 |
+
$this->log("CAPTURE (capture)");
|
| 71 |
+
$result = $this->_getApi()->capture(
|
| 72 |
+
$this->_formatMoney($amount, $order->getOrderCurrencyCode()),
|
| 73 |
+
$authTransactionId
|
| 74 |
+
);
|
| 75 |
+
} else {
|
| 76 |
+
$this->log("CAPTURE (sale)");
|
| 77 |
+
|
| 78 |
+
// TODO: Maybe break all this out into a separate method, since it is shared with auth()
|
| 79 |
+
$address = $order->getBillingAddress();
|
| 80 |
+
$additional = array(
|
| 81 |
+
'email' => (string) $address->getEmail(),
|
| 82 |
+
'first_name' => (string) $address->getFirstname(),
|
| 83 |
+
'last_name' => (string) $address->getLastname(),
|
| 84 |
+
'address1' => (string) $address->getStreet(1),
|
| 85 |
+
'address2' => (string) $address->getStreet(2),
|
| 86 |
+
'city' => (string) $address->getCity(),
|
| 87 |
+
'province' => (string) $address->getRegion(),
|
| 88 |
+
'country' => (string) $address->getCountryId(),
|
| 89 |
+
'postal_code' => (string) $address->getPostcode(),
|
| 90 |
+
'company' => (string) $address->getCompany(),
|
| 91 |
+
'telephone' => (string) $address->getTelephone(),
|
| 92 |
+
'currency' => (string) $this->_convertCurrencyCodeForApi($order->getOrderCurrencyCode()),
|
| 93 |
+
'order_id' => (string) $order->getIncrementId()
|
| 94 |
+
);
|
| 95 |
+
|
| 96 |
+
$result = $this->_getApi()->sale(
|
| 97 |
+
$this->_formatMoney($amount, $order->getOrderCurrencyCode()),
|
| 98 |
+
$payment->getCcNumber(),
|
| 99 |
+
$payment->getCcExpMonth(),
|
| 100 |
+
$payment->getCcExpYear(),
|
| 101 |
+
$this->hasVerification() ? $payment->getCcCid() : null,
|
| 102 |
+
$additional
|
| 103 |
+
);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
if (!$result['result_bool']) {
|
| 107 |
+
Mage::throwException(Mage::helper('chpayfirma')->__("Payment capture was declined."));
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
$payment->setTransactionId($result['transaction_id']);
|
| 111 |
+
$payment->setCcTransId($result['transaction_id']);
|
| 112 |
+
|
| 113 |
+
$this->log("DONE Captured with Transaction ID: " . var_export($result['transaction_id'], true));
|
| 114 |
+
|
| 115 |
+
return $this;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
public function refund(Varien_Object $payment, $amount)
|
| 119 |
+
{
|
| 120 |
+
parent::refund($payment, $amount);
|
| 121 |
+
|
| 122 |
+
$this->log("REFUND");
|
| 123 |
+
|
| 124 |
+
$order = $payment->getOrder();
|
| 125 |
+
$result = $this->_getApi()->refund(
|
| 126 |
+
$this->_formatMoney($amount, $order->getOrderCurrencyCode()),
|
| 127 |
+
$payment->getParentTransactionId()
|
| 128 |
+
);
|
| 129 |
+
if (!$result['result_bool']) {
|
| 130 |
+
Mage::throwException(Mage::helper('chpayfirma')->__("Payment refund was declined."));
|
| 131 |
+
}
|
| 132 |
+
$payment->setTransactionId($result['transaction_id']);
|
| 133 |
+
|
| 134 |
+
$this->log("DONE Refunded with Transaction ID: " . var_export($result['transaction_id'], true));
|
| 135 |
+
|
| 136 |
+
return $this;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
// TODO: shall we do anything with fetchTransactionInfo() ?
|
| 140 |
+
|
| 141 |
+
public function canUseForCurrency($currencyCode)
|
| 142 |
+
{
|
| 143 |
+
$currencies = explode(',', $this->getConfigData('accepted_currency'));
|
| 144 |
+
if (!in_array($currencyCode, $currencies)) {
|
| 145 |
+
return false;
|
| 146 |
+
}
|
| 147 |
+
return true;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
public function log($message)
|
| 151 |
+
{
|
| 152 |
+
Mage::helper('chpayfirma')->log($message);
|
| 153 |
+
return $this;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
public function getDebugFlag()
|
| 157 |
+
{
|
| 158 |
+
return $this->getConfigData('is_debug_mode');
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
protected function _convertCurrencyCodeForApi($currencyCode)
|
| 162 |
+
{
|
| 163 |
+
switch ($currencyCode) {
|
| 164 |
+
case 'CAD':
|
| 165 |
+
return 'CA$';
|
| 166 |
+
case 'USD':
|
| 167 |
+
return 'US$';
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
return '';
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
protected function _formatMoney($amount, $currencyCode)
|
| 174 |
+
{
|
| 175 |
+
return Mage::getModel('directory/currency')->load($currencyCode)
|
| 176 |
+
->format($amount, array('display' => Zend_Currency::NO_SYMBOL), false);
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* @return Collinsharper_Payfirma_Model_Api
|
| 181 |
+
*/
|
| 182 |
+
protected function _getApi()
|
| 183 |
+
{
|
| 184 |
+
if (!$this->_api) {
|
| 185 |
+
$this->_api = Mage::getModel('chpayfirma/api', $this->getStore());
|
| 186 |
+
}
|
| 187 |
+
return $this->_api;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* @return Collinsharper_Payfirma_Helper_Data
|
| 192 |
+
*/
|
| 193 |
+
protected function _getHelper()
|
| 194 |
+
{
|
| 195 |
+
return Mage::helper('chpayfirma');
|
| 196 |
+
}
|
| 197 |
+
}
|
app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/Cctype.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Model_System_Config_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
| 4 |
+
{
|
| 5 |
+
public function getAllowedTypes()
|
| 6 |
+
{
|
| 7 |
+
return array('VI', 'MC', 'AE', 'DI', 'JCB');
|
| 8 |
+
}
|
| 9 |
+
}
|
app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/Currency.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Model_System_Config_Source_Currency
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray($isMultiselect)
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array(
|
| 9 |
+
'label' => Mage::helper('chpayfirma')->__("Canadian Dollar"),
|
| 10 |
+
'value' => 'CAD'
|
| 11 |
+
),
|
| 12 |
+
array(
|
| 13 |
+
'label' => Mage::helper('chpayfirma')->__("US Dollar"),
|
| 14 |
+
'value' => 'USD'
|
| 15 |
+
)
|
| 16 |
+
);
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/community/Collinsharper/Payfirma/Model/System/Config/Source/PaymentAction.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Collinsharper_Payfirma_Model_System_Config_Source_PaymentAction
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array(
|
| 9 |
+
'value' => Collinsharper_Payfirma_Model_Payment::ACTION_AUTHORIZE,
|
| 10 |
+
'label' => Mage::helper('chpayfirma')->__("Authorize Only")
|
| 11 |
+
),
|
| 12 |
+
array(
|
| 13 |
+
'value' => Collinsharper_Payfirma_Model_Payment::ACTION_AUTHORIZE_CAPTURE,
|
| 14 |
+
'label' => Mage::helper('chpayfirma')->__("Sale")
|
| 15 |
+
)
|
| 16 |
+
);
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/community/Collinsharper/Payfirma/etc/config.xml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Collinsharper_Payfirma>
|
| 5 |
+
<version>1.0.0</version>
|
| 6 |
+
</Collinsharper_Payfirma>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<default>
|
| 10 |
+
<payment>
|
| 11 |
+
<chpayfirma>
|
| 12 |
+
<!-- TODO: Remove empty defaults. -->
|
| 13 |
+
<model>chpayfirma/payment</model>
|
| 14 |
+
<active>0</active>
|
| 15 |
+
<title>Payfirma by CollinsHarper</title>
|
| 16 |
+
<payment_action>authorize</payment_action>
|
| 17 |
+
<order_status>processing</order_status>
|
| 18 |
+
<cctypes>AE,VI,MC,DI,JCB</cctypes>
|
| 19 |
+
<useccv>1</useccv>
|
| 20 |
+
<allowspecific>0</allowspecific>
|
| 21 |
+
<specificcountry></specificcountry>
|
| 22 |
+
|
| 23 |
+
<merchant_id></merchant_id>
|
| 24 |
+
<api_key></api_key>
|
| 25 |
+
<is_test_mode>0</is_test_mode>
|
| 26 |
+
<accepted_currency>CAD,USD</accepted_currency>
|
| 27 |
+
<is_debug_mode>0</is_debug_mode>
|
| 28 |
+
|
| 29 |
+
<api_url><![CDATA[https://ecom.payfirma.com]]></api_url>
|
| 30 |
+
</chpayfirma>
|
| 31 |
+
</payment>
|
| 32 |
+
</default>
|
| 33 |
+
|
| 34 |
+
<global>
|
| 35 |
+
<blocks>
|
| 36 |
+
<chpayfirma>
|
| 37 |
+
<class>Collinsharper_Payfirma_Block</class>
|
| 38 |
+
</chpayfirma>
|
| 39 |
+
</blocks>
|
| 40 |
+
<helpers>
|
| 41 |
+
<chpayfirma>
|
| 42 |
+
<class>Collinsharper_Payfirma_Helper</class>
|
| 43 |
+
</chpayfirma>
|
| 44 |
+
</helpers>
|
| 45 |
+
<models>
|
| 46 |
+
<chpayfirma>
|
| 47 |
+
<class>Collinsharper_Payfirma_Model</class>
|
| 48 |
+
</chpayfirma>
|
| 49 |
+
</models>
|
| 50 |
+
|
| 51 |
+
<resources>
|
| 52 |
+
<chpayfirma_setup>
|
| 53 |
+
<setup>
|
| 54 |
+
<module>Collinsharper_Payfirma</module>
|
| 55 |
+
</setup>
|
| 56 |
+
<connection>
|
| 57 |
+
<use>core_setup</use>
|
| 58 |
+
</connection>
|
| 59 |
+
</chpayfirma_setup>
|
| 60 |
+
</resources>
|
| 61 |
+
</global>
|
| 62 |
+
</config>
|
app/code/community/Collinsharper/Payfirma/etc/system.xml
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<payment>
|
| 5 |
+
<groups>
|
| 6 |
+
<chpayfirma translate="label" module="chpayfirma">
|
| 7 |
+
<label>Payfirma</label>
|
| 8 |
+
<sort_order>100</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>10</sort_order>
|
| 18 |
+
<show_in_default>1</show_in_default>
|
| 19 |
+
<show_in_website>1</show_in_website>
|
| 20 |
+
<show_in_store>1</show_in_store>
|
| 21 |
+
</active>
|
| 22 |
+
<title translate="label">
|
| 23 |
+
<label>Title</label>
|
| 24 |
+
<frontend_type>text</frontend_type>
|
| 25 |
+
<sort_order>20</sort_order>
|
| 26 |
+
<show_in_default>1</show_in_default>
|
| 27 |
+
<show_in_website>1</show_in_website>
|
| 28 |
+
<show_in_store>1</show_in_store>
|
| 29 |
+
</title>
|
| 30 |
+
<merchant_id translate="label">
|
| 31 |
+
<label>Merchant ID</label>
|
| 32 |
+
<frontend_type>text</frontend_type>
|
| 33 |
+
<sort_order>30</sort_order>
|
| 34 |
+
<show_in_default>1</show_in_default>
|
| 35 |
+
<show_in_website>1</show_in_website>
|
| 36 |
+
<show_in_store>1</show_in_store>
|
| 37 |
+
</merchant_id>
|
| 38 |
+
<api_key translate="label">
|
| 39 |
+
<label>API Key</label>
|
| 40 |
+
<frontend_type>text</frontend_type>
|
| 41 |
+
<sort_order>40</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>1</show_in_store>
|
| 45 |
+
</api_key>
|
| 46 |
+
<is_test_mode translate="label comment">
|
| 47 |
+
<label>Test Mode</label>
|
| 48 |
+
<comment><![CDATA[Odd dollar amounts (e.g. $51.00) will be approved and even dollar amounts (e.g. $52.00) will be declined. Cents are ignored.]]></comment>
|
| 49 |
+
<frontend_type>select</frontend_type>
|
| 50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 51 |
+
<sort_order>50</sort_order>
|
| 52 |
+
<show_in_default>1</show_in_default>
|
| 53 |
+
<show_in_website>1</show_in_website>
|
| 54 |
+
<show_in_store>1</show_in_store>
|
| 55 |
+
</is_test_mode>
|
| 56 |
+
<payment_action translate="label">
|
| 57 |
+
<label>Payment Action</label>
|
| 58 |
+
<frontend_type>select</frontend_type>
|
| 59 |
+
<source_model>chpayfirma/system_config_source_paymentAction</source_model>
|
| 60 |
+
<sort_order>60</sort_order>
|
| 61 |
+
<show_in_default>1</show_in_default>
|
| 62 |
+
<show_in_website>1</show_in_website>
|
| 63 |
+
<show_in_store>1</show_in_store>
|
| 64 |
+
</payment_action>
|
| 65 |
+
<order_status translate="label">
|
| 66 |
+
<label>Order Status</label>
|
| 67 |
+
<frontend_type>select</frontend_type>
|
| 68 |
+
<source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
|
| 69 |
+
<sort_order>70</sort_order>
|
| 70 |
+
<show_in_default>1</show_in_default>
|
| 71 |
+
<show_in_website>1</show_in_website>
|
| 72 |
+
<show_in_store>1</show_in_store>
|
| 73 |
+
</order_status>
|
| 74 |
+
<accepted_currency translate="label">
|
| 75 |
+
<label>Accepted Currency</label>
|
| 76 |
+
<frontend_type>multiselect</frontend_type>
|
| 77 |
+
<source_model>chpayfirma/system_config_source_currency</source_model>
|
| 78 |
+
<sort_order>80</sort_order>
|
| 79 |
+
<show_in_default>1</show_in_default>
|
| 80 |
+
<show_in_website>1</show_in_website>
|
| 81 |
+
<show_in_store>1</show_in_store>
|
| 82 |
+
</accepted_currency>
|
| 83 |
+
<cctypes translate="label">
|
| 84 |
+
<label>Accepted Credit Cards</label>
|
| 85 |
+
<frontend_type>multiselect</frontend_type>
|
| 86 |
+
<source_model>chpayfirma/system_config_source_cctype</source_model>
|
| 87 |
+
<sort_order>90</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 |
+
</cctypes>
|
| 92 |
+
<!-- <useccv translate="label">
|
| 93 |
+
<label>Credit Card Verification</label>
|
| 94 |
+
<frontend_type>select</frontend_type>
|
| 95 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 96 |
+
<sort_order>100</sort_order>
|
| 97 |
+
<show_in_default>1</show_in_default>
|
| 98 |
+
<show_in_website>1</show_in_website>
|
| 99 |
+
<show_in_store>1</show_in_store>
|
| 100 |
+
</useccv> -->
|
| 101 |
+
<allowspecific translate="label">
|
| 102 |
+
<label>Allow Payment From</label>
|
| 103 |
+
<frontend_type>select</frontend_type>
|
| 104 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 105 |
+
<sort_order>110</sort_order>
|
| 106 |
+
<show_in_default>1</show_in_default>
|
| 107 |
+
<show_in_website>1</show_in_website>
|
| 108 |
+
<show_in_store>1</show_in_store>
|
| 109 |
+
</allowspecific>
|
| 110 |
+
<specificcountry translate="label">
|
| 111 |
+
<label>Allow Specific Countries</label>
|
| 112 |
+
<frontend_type>multiselect</frontend_type>
|
| 113 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 114 |
+
<depends>
|
| 115 |
+
<allowspecific>1</allowspecific>
|
| 116 |
+
</depends>
|
| 117 |
+
<sort_order>120</sort_order>
|
| 118 |
+
<show_in_default>1</show_in_default>
|
| 119 |
+
<show_in_website>1</show_in_website>
|
| 120 |
+
<show_in_store>1</show_in_store>
|
| 121 |
+
</specificcountry>
|
| 122 |
+
<min_order_total translate="label">
|
| 123 |
+
<label>Minimum Order Total</label>
|
| 124 |
+
<frontend_type>text</frontend_type>
|
| 125 |
+
<sort_order>130</sort_order>
|
| 126 |
+
<show_in_default>1</show_in_default>
|
| 127 |
+
<show_in_website>1</show_in_website>
|
| 128 |
+
<show_in_store>1</show_in_store>
|
| 129 |
+
</min_order_total>
|
| 130 |
+
<max_order_total translate="label">
|
| 131 |
+
<label>Maximum Order Total</label>
|
| 132 |
+
<frontend_type>text</frontend_type>
|
| 133 |
+
<sort_order>140</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 |
+
</max_order_total>
|
| 138 |
+
<is_debug_mode translate="label comment">
|
| 139 |
+
<label>Debug Mode</label>
|
| 140 |
+
<comment><![CDATA[Enables verbose debug logging (for developers).]]></comment>
|
| 141 |
+
<frontend_type>select</frontend_type>
|
| 142 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 143 |
+
<sort_order>150</sort_order>
|
| 144 |
+
<show_in_default>1</show_in_default>
|
| 145 |
+
<show_in_website>1</show_in_website>
|
| 146 |
+
<show_in_store>1</show_in_store>
|
| 147 |
+
</is_debug_mode>
|
| 148 |
+
|
| 149 |
+
<!-- <respsuccess translate="label">
|
| 150 |
+
<label>The Resp code returned must be in this list to be a successful transaction.</label>
|
| 151 |
+
<frontend_type>text</frontend_type>
|
| 152 |
+
<sort_order>120</sort_order>
|
| 153 |
+
<show_in_default>1</show_in_default>
|
| 154 |
+
<show_in_website>1</show_in_website>
|
| 155 |
+
<show_in_store>1</show_in_store>
|
| 156 |
+
</respsuccess> -->
|
| 157 |
+
|
| 158 |
+
<!-- <ccrespsuccess translate="label">
|
| 159 |
+
<label>The CC_Resp code returned must be in this list to be a successful transaction.</label>
|
| 160 |
+
<frontend_type>text</frontend_type>
|
| 161 |
+
<sort_order>130</sort_order>
|
| 162 |
+
<show_in_default>1</show_in_default>
|
| 163 |
+
<show_in_website>1</show_in_website>
|
| 164 |
+
<show_in_store>1</show_in_store>
|
| 165 |
+
</ccrespsuccess> -->
|
| 166 |
+
|
| 167 |
+
<!-- <avsactive translate="label">
|
| 168 |
+
<label>Use Avs Verification</label>
|
| 169 |
+
<frontend_type>select</frontend_type>
|
| 170 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 171 |
+
<sort_order>140</sort_order>
|
| 172 |
+
<show_in_default>1</show_in_default>
|
| 173 |
+
<show_in_website>1</show_in_website>
|
| 174 |
+
<show_in_store>1</show_in_store>
|
| 175 |
+
</avsactive>
|
| 176 |
+
<avssuccess translate="label">
|
| 177 |
+
<label>The AVS code returned must be in this list to be a successful transaction.</label>
|
| 178 |
+
<frontend_type>text</frontend_type>
|
| 179 |
+
<sort_order>150</sort_order>
|
| 180 |
+
<show_in_default>1</show_in_default>
|
| 181 |
+
<show_in_website>1</show_in_website>
|
| 182 |
+
<show_in_store>1</show_in_store>
|
| 183 |
+
</avssuccess> -->
|
| 184 |
+
|
| 185 |
+
<!-- <cvnactive translate="label">
|
| 186 |
+
<label>Use Cvn Verification</label>
|
| 187 |
+
<frontend_type>select</frontend_type>
|
| 188 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 189 |
+
<sort_order>160</sort_order>
|
| 190 |
+
<show_in_default>1</show_in_default>
|
| 191 |
+
<show_in_website>1</show_in_website>
|
| 192 |
+
<show_in_store>1</show_in_store>
|
| 193 |
+
</cvnactive>
|
| 194 |
+
<cvnsuccess translate="label">
|
| 195 |
+
<label>The CVN code returned must be in this list to be a successful transaction.</label>
|
| 196 |
+
<frontend_type>text</frontend_type>
|
| 197 |
+
<sort_order>170</sort_order>
|
| 198 |
+
<show_in_default>1</show_in_default>
|
| 199 |
+
<show_in_website>1</show_in_website>
|
| 200 |
+
<show_in_store>1</show_in_store>
|
| 201 |
+
</cvnsuccess> -->
|
| 202 |
+
|
| 203 |
+
<!-- <zero_preauth translate="label">
|
| 204 |
+
<label>Use Zero Preauth Amount</label>
|
| 205 |
+
<frontend_type>select</frontend_type>
|
| 206 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 207 |
+
<sort_order>180</sort_order>
|
| 208 |
+
<show_in_default>1</show_in_default>
|
| 209 |
+
<show_in_website>1</show_in_website>
|
| 210 |
+
<show_in_store>1</show_in_store>
|
| 211 |
+
</zero_preauth> -->
|
| 212 |
+
|
| 213 |
+
<!-- <repurchase_onfail translate="label comment">
|
| 214 |
+
<label>Force Repurchase Attempt?</label>
|
| 215 |
+
<comment>On failure to capture authorization, force repurchase attempt with token.</comment>
|
| 216 |
+
<frontend_type>select</frontend_type>
|
| 217 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 218 |
+
<sort_order>190</sort_order>
|
| 219 |
+
<show_in_default>1</show_in_default>
|
| 220 |
+
<show_in_website>1</show_in_website>
|
| 221 |
+
<show_in_store>1</show_in_store>
|
| 222 |
+
</repurchase_onfail> -->
|
| 223 |
+
</fields>
|
| 224 |
+
</chpayfirma>
|
| 225 |
+
</groups>
|
| 226 |
+
</payment>
|
| 227 |
+
</sections>
|
| 228 |
+
</config>
|
app/design/frontend/base/default/template/chpayfirma/logo.phtml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<li>
|
| 3 |
+
<img class="chpayfirma_logo" style="width: 175px;"
|
| 4 |
+
src="<?php echo $this->getSkinUrl('images/chpayfirma_logo.png') ?>" />
|
| 5 |
+
</li>
|
app/etc/modules/Collinsharper_Payfirma.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Collinsharper_Payfirma>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Payment />
|
| 9 |
+
</depends>
|
| 10 |
+
</Collinsharper_Payfirma>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Payfirma_Onsite_Payment_Gateway</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/MIT">MIT License</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Provides Credit Card processing through the Payfirma Online payment Gateway</summary>
|
| 10 |
+
<description>Provides Credit Card processing through the Payfirma Online payment Gateway. Supports USD and CAD currency values.</description>
|
| 11 |
+
<notes>Onsite Payment module. Install through Magento connect upload or via Magento connect extension key</notes>
|
| 12 |
+
<authors><author><name>Collins Harper</name><user>collinsharper</user><email>customersupport@collinsharper.com</email></author></authors>
|
| 13 |
+
<date>2014-05-06</date>
|
| 14 |
+
<time>19:38:23</time>
|
| 15 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="chpayfirma"><file name="logo.phtml" hash="0e5c3c7456fe455b50460d1efedcafbf"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="chpayfirma_logo.png" hash="b74c31d5a57f98cfd543a5157f642ee2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Collinsharper_Payfirma.xml" hash="f4fb6aecefa1e44f07d9a7819a82d812"/></dir></target><target name="magecommunity"><dir name="Collinsharper"><dir name="Payfirma"><dir name="Model"><file name="Api.php" hash="4402ecb961abe52566694bbbb44cc9b4"/><file name="Payment.php" hash="47628531ca537587c092ada45f8f80a5"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Currency.php" hash="a3b9ba19b2e5057371b1605885ea37db"/><file name="Cctype.php" hash="5cde7377b5ce6b6a2c24016a4a5733b1"/><file name="PaymentAction.php" hash="bfc103d1cb1378ea28000c4a05b1caf7"/></dir></dir></dir></dir><dir name="Block"><file name="Form.php" hash="860de41331ec7d20b1dc2f7c04820207"/></dir><dir name="etc"><file name="config.xml" hash="7a124c36ffde4a36d8ad21874fdeaf61"/><file name="system.xml" hash="d3935d6c4f699b960120a2f287e1e78e"/></dir><dir name="Helper"><file name="Data.php" hash="e8bd323ba8be1240c6300121874508a6"/></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.9</max></php></required></dependencies>
|
| 18 |
+
</package>
|
skin/frontend/base/default/images/chpayfirma_logo.png
ADDED
|
Binary file
|
