Version Notes
Initial release with procheckout payment method.
Download this release
Release Info
| Developer | PT Pay, S. A. |
| Extension | MEOWallet |
| Version | 0.0.1 |
| Comparing to | |
| See all releases | |
Version 0.0.1
- app/code/community/Meowallet/Payment/Helper/Data.php +12 -0
- app/code/community/Meowallet/Payment/Model/Meowallet/Abstract.php +193 -0
- app/code/community/Meowallet/Payment/Model/Meowallet/Procheckout.php +106 -0
- app/code/community/Meowallet/Payment/Model/Operation.php +19 -0
- app/code/community/Meowallet/Payment/Model/System/Config/Source/Environment/View.php +31 -0
- app/code/community/Meowallet/Payment/Model/System/Config/Source/Payment/Actions.php +27 -0
- app/code/community/Meowallet/Payment/controllers/ProcheckoutController.php +100 -0
- app/code/community/Meowallet/Payment/etc/config.xml +102 -0
- app/code/community/Meowallet/Payment/etc/system.xml +109 -0
- app/code/community/Meowallet/Payment/sql/mysql4-install-0.0.1.php +15 -0
- app/design/frontend/base/default/layout/meowallet.xml +11 -0
- app/design/frontend/base/default/template/meowallet/procheckout/failure.phtml +6 -0
- app/etc/modules/Meowallet_Payment.xml +12 -0
- package.xml +18 -0
app/code/community/Meowallet/Payment/Helper/Data.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Helper_Data extends Mage_Payment_Helper_Data {}
|
app/code/community/Meowallet/Payment/Model/Meowallet/Abstract.php
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Model_Meowallet_Abstract extends Mage_Payment_Model_Method_Abstract
|
| 13 |
+
{
|
| 14 |
+
protected $_code = 'meowallet_abstract';
|
| 15 |
+
|
| 16 |
+
const SANDBOX_ENVIRONMENT_ID = 0;
|
| 17 |
+
const SANDBOX_SERVICE_ENDPOINT = 'https://services.sandbox.meowallet.pt/api/v2';
|
| 18 |
+
const PRODUCTION_ENVIRONMENT_ID = 1;
|
| 19 |
+
const PRODUCTION_SERVICE_ENDPOINT = 'https://services.wallet.pt/api/v2';
|
| 20 |
+
|
| 21 |
+
private function _getPaymentConfig($path)
|
| 22 |
+
{
|
| 23 |
+
$code = $this->_code;
|
| 24 |
+
return Mage::getStoreConfig("payment/$code/$path");
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
private function _getEnvironmentCode()
|
| 28 |
+
{
|
| 29 |
+
$environment = $this->_getPaymentConfig('environment');
|
| 30 |
+
|
| 31 |
+
switch ($environment)
|
| 32 |
+
{
|
| 33 |
+
case static::SANDBOX_ENVIRONMENT_ID:
|
| 34 |
+
return 'sandbox';
|
| 35 |
+
case static::PRODUCTION_ENVIRONMENT_ID:
|
| 36 |
+
return 'production';
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
Mage::throwException("Invalid environment code '$environment'");
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
private function _registerRefund($payment, $amount)
|
| 43 |
+
{
|
| 44 |
+
$payment->registerRefundNotification($amount);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
private function _registerPayment($payment, $amount, $action = Meowallet_Payment_Model_Meowallet_Abstract::ACTION_AUTHORIZE)
|
| 48 |
+
{
|
| 49 |
+
switch ($action)
|
| 50 |
+
{
|
| 51 |
+
case Meowallet_Payment_Model_Meowallet_Abstract::ACTION_AUTHORIZE_CAPTURE:
|
| 52 |
+
$payment->registerCaptureNotification($amount);
|
| 53 |
+
break;
|
| 54 |
+
|
| 55 |
+
case Meowallet_Payment_Model_Meowallet_Abstract::ACTION_AUTHORIZE:
|
| 56 |
+
default:
|
| 57 |
+
$payment->registerAuthorizationNotification($amount);
|
| 58 |
+
break;
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
private function _isValidCallback($data)
|
| 63 |
+
{
|
| 64 |
+
$authToken = $this->getAPIToken();
|
| 65 |
+
$headers = array(
|
| 66 |
+
'Authorization: WalletPT ' . $authToken,
|
| 67 |
+
'Content-Type: application/json',
|
| 68 |
+
'Content-Length: ' . strlen($data));
|
| 69 |
+
|
| 70 |
+
$ch = curl_init();
|
| 71 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
| 72 |
+
curl_setopt($ch, CURLOPT_URL, $this->getServiceEndpoint('callback/verify'));
|
| 73 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
| 74 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
| 75 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
| 76 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
| 77 |
+
$response = curl_exec($ch);
|
| 78 |
+
|
| 79 |
+
if (0 == strcasecmp('true', $response))
|
| 80 |
+
{
|
| 81 |
+
return true;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
if (0 != strcasecmp('false', $response))
|
| 85 |
+
{
|
| 86 |
+
Mage::log("MEOWallet callback validation returned unexpected response '$response'", Zend_Log::ALERT);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
return false;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
protected function _decrypt($data)
|
| 93 |
+
{
|
| 94 |
+
return Mage::helper('core')->decrypt($data);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
protected function _getSalesOrderModel()
|
| 98 |
+
{
|
| 99 |
+
return Mage::getModel('sales/order');
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
protected function getServiceEndpoint($path = null)
|
| 103 |
+
{
|
| 104 |
+
$environment = $this->_getPaymentConfig('environment');
|
| 105 |
+
$url = null;
|
| 106 |
+
|
| 107 |
+
switch ($environment)
|
| 108 |
+
{
|
| 109 |
+
case static::SANDBOX_ENVIRONMENT_ID:
|
| 110 |
+
$url = static::SANDBOX_SERVICE_ENDPOINT;
|
| 111 |
+
break;
|
| 112 |
+
case static::PRODUCTION_ENVIRONMENT_ID:
|
| 113 |
+
$url = static::PRODUCTION_SERVICE_ENDPOINT;
|
| 114 |
+
break;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
if ( empty($url) )
|
| 118 |
+
{
|
| 119 |
+
Mage::throwException("Empty service endpoint for environment '$environment'");
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
return sprintf('%s/%s', $url, $path);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
protected function getAPIToken()
|
| 126 |
+
{
|
| 127 |
+
$environment = $this->_getEnvironmentCode();
|
| 128 |
+
$key = sprintf('payment/%s/%s_api_token',
|
| 129 |
+
$this->_code,
|
| 130 |
+
$environment);
|
| 131 |
+
|
| 132 |
+
return $this->_decrypt( Mage::getStoreConfig($key) );
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
protected function processPayment($invoice_id, $status, $amount)
|
| 136 |
+
{
|
| 137 |
+
Mage::log(sprintf("Processing payment for invoice_id '%s' with status '%s', amount '%s'", $invoice_id, $status, $amount));
|
| 138 |
+
|
| 139 |
+
$order = $this->_getSalesOrderModel()->loadByIncrementId($invoice_id);
|
| 140 |
+
|
| 141 |
+
if (null == $order)
|
| 142 |
+
{
|
| 143 |
+
throw new \InvalidArgumentException("Unknown order with invoice_id '$invoice_id'");
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
$payment = $order->getPayment();
|
| 147 |
+
|
| 148 |
+
if (null == $payment)
|
| 149 |
+
{
|
| 150 |
+
throw new \Exception('No payment associated with an order?!');
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
$comment = Mage::helper('meowallet')->__('%s<br/>Status: %s', "MEO Wallet", $status);
|
| 154 |
+
$order->addStatusHistoryComment($comment);
|
| 155 |
+
|
| 156 |
+
switch ($status)
|
| 157 |
+
{
|
| 158 |
+
case Meowallet_Payment_Model_Operation::COMPLETED:
|
| 159 |
+
$action = $this->_getPaymentConfig('payment_action');
|
| 160 |
+
$this->_registerPayment($payment, $amount, $action);
|
| 161 |
+
#$payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_ACCEPT, true);
|
| 162 |
+
break;
|
| 163 |
+
|
| 164 |
+
case Meowallet_Payment_Model_Operation::FAIL:
|
| 165 |
+
#$payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, true);
|
| 166 |
+
$order->cancel();
|
| 167 |
+
break;
|
| 168 |
+
|
| 169 |
+
case Meowallet_Payment_Model_Operation::CREATED:
|
| 170 |
+
case Meowallet_Payment_Model_Operation::PENDING:
|
| 171 |
+
#$payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true);
|
| 172 |
+
break;
|
| 173 |
+
|
| 174 |
+
default:
|
| 175 |
+
throw new \InvalidArgumentException("Payment operation status '$status' not handled by this module!");
|
| 176 |
+
}
|
| 177 |
+
$order->save();
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
public function processCallback($verbatim_callback)
|
| 181 |
+
{
|
| 182 |
+
if (false === $this->_isValidCallback($verbatim_callback))
|
| 183 |
+
{
|
| 184 |
+
throw new \InvalidArgumentException('Invalid callback');
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
$callback = json_decode($verbatim_callback);
|
| 188 |
+
|
| 189 |
+
Mage::log(sprintf("MEOWallet callback for invoice_id '%s' with status '%s'", $callback->ext_invoice_id, $callback->operation_status));
|
| 190 |
+
|
| 191 |
+
$this->processPayment($callback->ext_invoiceid, $callback->operation_status, $callback->amount);
|
| 192 |
+
}
|
| 193 |
+
}
|
app/code/community/Meowallet/Payment/Model/Meowallet/Procheckout.php
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Model_Meowallet_Procheckout extends Meowallet_Payment_Model_Meowallet_Abstract
|
| 13 |
+
|
| 14 |
+
{
|
| 15 |
+
protected $_code = 'meowallet_procheckout';
|
| 16 |
+
protected $_canUseCheckout = true;
|
| 17 |
+
protected $_isGateway = true;
|
| 18 |
+
protected $_canAuthorize = true;
|
| 19 |
+
protected $_canRefund = true;
|
| 20 |
+
protected $_canVoid = true;
|
| 21 |
+
protected $_canReviewPayment = true;
|
| 22 |
+
protected $_supportedCurrencyCodes = array('EUR');
|
| 23 |
+
|
| 24 |
+
protected function _getHelper()
|
| 25 |
+
{
|
| 26 |
+
return Mage::helper('meowallet');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Return Order place redirect url
|
| 31 |
+
*
|
| 32 |
+
* @return string
|
| 33 |
+
*/
|
| 34 |
+
public function getOrderPlaceRedirectUrl()
|
| 35 |
+
{
|
| 36 |
+
return Mage::getUrl('meowallet/procheckout/redirect', array('_secure' => true));
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function createCheckout($order, $url_confirm, $url_cancel)
|
| 40 |
+
{
|
| 41 |
+
$client = array('name' => $order->getCustomerName(),
|
| 42 |
+
'email' => $order->getCustomerEmail());
|
| 43 |
+
|
| 44 |
+
$Address = $order->getShippingAddress();
|
| 45 |
+
|
| 46 |
+
if (null != $Address)
|
| 47 |
+
{
|
| 48 |
+
$street = $Address->getStreet();
|
| 49 |
+
if (is_array($street))
|
| 50 |
+
{
|
| 51 |
+
$street = implode(' ', $street);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
$client['address'] = array('country' => $Address->getCountryId(),
|
| 55 |
+
'address' => $street,
|
| 56 |
+
'city' => $Address->getCity(),
|
| 57 |
+
'postalcode' => $Address->postcode); // getPostCode() returns null
|
| 58 |
+
|
| 59 |
+
$client['phone'] = $Address->getTelephone();
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
$payment = array('client' => $client,
|
| 63 |
+
'amount' => $order->getGrandTotal(),
|
| 64 |
+
'currency' => $order->getOrderCurrencyCode(),
|
| 65 |
+
'items' => array(),
|
| 66 |
+
'ext_invoiceid' => $order->getIncrementId());
|
| 67 |
+
|
| 68 |
+
$items = $order->getAllVisibleItems();
|
| 69 |
+
foreach($items as $item)
|
| 70 |
+
{
|
| 71 |
+
$payment['items'][] = array('ref' => $item->getProductId(),
|
| 72 |
+
'name' => $item->getName(),
|
| 73 |
+
'descr' => $item->getName(),
|
| 74 |
+
'qt' => $item->getQtyOrdered());
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
$request_data = json_encode(array('payment' => $payment,
|
| 78 |
+
'url_confirm' => $url_confirm,
|
| 79 |
+
'url_cancel' => $url_cancel));
|
| 80 |
+
$authToken = $this->getAPIToken();
|
| 81 |
+
$headers = array(
|
| 82 |
+
'Authorization: WalletPT ' . $authToken,
|
| 83 |
+
'Content-Type: application/json',
|
| 84 |
+
'Content-Length: ' . strlen($request_data)
|
| 85 |
+
);
|
| 86 |
+
|
| 87 |
+
$ch = curl_init();
|
| 88 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
| 89 |
+
curl_setopt($ch, CURLOPT_URL, $this->getServiceEndpoint('checkout'));
|
| 90 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
| 91 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $request_data);
|
| 92 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
| 93 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
| 94 |
+
$response = json_decode( curl_exec($ch) );
|
| 95 |
+
# $payment = $oder->getPayment();
|
| 96 |
+
# $payment->setTransactionId($response->id);
|
| 97 |
+
# $payment->save();
|
| 98 |
+
|
| 99 |
+
if (false == is_object($response) || false == property_exists($response, 'url_redirect'))
|
| 100 |
+
{
|
| 101 |
+
Mage::throwException($this->_getHelper()->__('Could not create MEO Wallet procheckout'));
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
return $response;
|
| 105 |
+
}
|
| 106 |
+
}
|
app/code/community/Meowallet/Payment/Model/Operation.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Model_Operation
|
| 13 |
+
{
|
| 14 |
+
const CREATED = "NEW";
|
| 15 |
+
const COMPLETED = "COMPLETED";
|
| 16 |
+
const PENDING = "PENDING";
|
| 17 |
+
const FAIL = "FAIL";
|
| 18 |
+
}
|
| 19 |
+
|
app/code/community/Meowallet/Payment/Model/System/Config/Source/Environment/View.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Model_System_Config_Source_Environment_View
|
| 13 |
+
{
|
| 14 |
+
public function toOptionArray()
|
| 15 |
+
{
|
| 16 |
+
return array(
|
| 17 |
+
array('value' => Meowallet_Payment_Model_Meowallet_Abstract::SANDBOX_ENVIRONMENT_ID,
|
| 18 |
+
'label'=> Mage::helper('meowallet')->__('Sandbox')),
|
| 19 |
+
array('value' => Meowallet_Payment_Model_Meowallet_Abstract::PRODUCTION_ENVIRONMENT_ID,
|
| 20 |
+
'label'=> Mage::helper('meowallet')->__('Production ')),
|
| 21 |
+
);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function toArray()
|
| 25 |
+
{
|
| 26 |
+
return array(
|
| 27 |
+
Meowallet_Payment_Model_Meowallet_Abstract::SANDBOX_ENVIRONMENT_ID => Mage::helper('meowallet')->__('Sandbox'),
|
| 28 |
+
Meowallet_Payment_Model_Meowallet_Abstract::PRODUCTION_ENVIRONMENT_ID => Mage::helper('meowallet')->__('Production'),
|
| 29 |
+
);
|
| 30 |
+
}
|
| 31 |
+
}
|
app/code/community/Meowallet/Payment/Model/System/Config/Source/Payment/Actions.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_Model_System_Config_Source_Payment_Actions
|
| 13 |
+
{
|
| 14 |
+
public function toOptionArray()
|
| 15 |
+
{
|
| 16 |
+
return array(
|
| 17 |
+
array(
|
| 18 |
+
'value' => Meowallet_Payment_Model_Meowallet_Abstract::ACTION_AUTHORIZE,
|
| 19 |
+
'label' => Mage::helper('meowallet')->__('Authorize Only')
|
| 20 |
+
),
|
| 21 |
+
array(
|
| 22 |
+
'value' => Meowallet_Payment_Model_Meowallet_Abstract::ACTION_AUTHORIZE_CAPTURE,
|
| 23 |
+
'label' => Mage::helper('meowallet')->__('Authorize and Capture')
|
| 24 |
+
),
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
}
|
app/code/community/Meowallet/Payment/controllers/ProcheckoutController.php
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Meowallet_Payment_ProcheckoutController extends Mage_Core_Controller_Front_Action
|
| 13 |
+
{
|
| 14 |
+
protected function _getRequestPayload()
|
| 15 |
+
{
|
| 16 |
+
return file_get_contents('php://input');
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Retrieve shopping cart model object
|
| 21 |
+
*
|
| 22 |
+
* @return Mage_Checkout_Model_Cart
|
| 23 |
+
*/
|
| 24 |
+
protected function _getCart()
|
| 25 |
+
{
|
| 26 |
+
return Mage::getSingleton('checkout/cart');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Get checkout session model instance
|
| 31 |
+
*
|
| 32 |
+
* @return Mage_Checkout_Model_Session
|
| 33 |
+
*/
|
| 34 |
+
protected function _getSession()
|
| 35 |
+
{
|
| 36 |
+
return Mage::getSingleton('checkout/session');
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
protected function _getSalesOrderModel()
|
| 40 |
+
{
|
| 41 |
+
return Mage::getModel('sales/order');
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
protected function _getProcheckoutModel()
|
| 45 |
+
{
|
| 46 |
+
return Mage::getModel('meowallet/meowallet_procheckout');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
public function redirectAction()
|
| 50 |
+
{
|
| 51 |
+
$orderId = $this->_getSession()->getLastRealOrderId();
|
| 52 |
+
$order = $this->_getSalesOrderModel()->loadByIncrementId($orderId);
|
| 53 |
+
$ProCheckout = $this->_getProcheckoutModel();
|
| 54 |
+
$checkout = $ProCheckout->createCheckout($order,
|
| 55 |
+
Mage::getUrl('checkout/onepage/success'),
|
| 56 |
+
Mage::getUrl('meowallet/procheckout/failure'));
|
| 57 |
+
|
| 58 |
+
$url = sprintf('%s%s%s=%s', $checkout->url_redirect,
|
| 59 |
+
false === strpos($checkout->url_redirect, '?') ? '?' : '&',
|
| 60 |
+
'locale',
|
| 61 |
+
Mage::app()->getLocale()->getLocaleCode());
|
| 62 |
+
|
| 63 |
+
$this->_redirectUrl($url);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
public function failureAction()
|
| 67 |
+
{
|
| 68 |
+
$lastOrderId = $this->_getSession()->getLastRealOrderId();
|
| 69 |
+
|
| 70 |
+
if ( ! $lastOrderId )
|
| 71 |
+
{
|
| 72 |
+
$this->_redirect('checkout/cart');
|
| 73 |
+
return;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
$this->loadLayout();
|
| 77 |
+
$this->renderLayout();
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
public function callbackAction()
|
| 81 |
+
{
|
| 82 |
+
$callback = $this->_getRequestPayload();
|
| 83 |
+
|
| 84 |
+
try
|
| 85 |
+
{
|
| 86 |
+
$this->_getProcheckoutModel()->processCallback($callback);
|
| 87 |
+
$this->getResponse()->setHeader('HTTP/1.0','200',true);
|
| 88 |
+
}
|
| 89 |
+
catch (\InvalidArgumentException $e)
|
| 90 |
+
{
|
| 91 |
+
Mage::log("MEOWallet received invalid callback. Request data: '$callback'");
|
| 92 |
+
$this->getResponse()->setHeader('HTTP/1.0','400',true);
|
| 93 |
+
}
|
| 94 |
+
catch (\Exception $e)
|
| 95 |
+
{
|
| 96 |
+
Mage::log('MEO Wallet error processing callback. Reason: '.$e->getMessage(), Zend_Log::ALERT);
|
| 97 |
+
$this->getResponse()->setHeader('HTTP/1.0','500',true);
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
}
|
app/code/community/Meowallet/Payment/etc/config.xml
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<Meowallet_Payment>
|
| 4 |
+
<version>0.0.1</version>
|
| 5 |
+
</Meowallet_Payment>
|
| 6 |
+
</modules>
|
| 7 |
+
<global>
|
| 8 |
+
<models>
|
| 9 |
+
<meowallet>
|
| 10 |
+
<class>Meowallet_Payment_Model</class>
|
| 11 |
+
</meowallet>
|
| 12 |
+
</models>
|
| 13 |
+
<helpers>
|
| 14 |
+
<meowallet>
|
| 15 |
+
<class>Meowallet_Payment_Helper</class>
|
| 16 |
+
</meowallet>
|
| 17 |
+
</helpers>
|
| 18 |
+
<blocks>
|
| 19 |
+
<meowallet>
|
| 20 |
+
<class>Meowallet_Payment_Block</class>
|
| 21 |
+
</meowallet>
|
| 22 |
+
</blocks>
|
| 23 |
+
<resources>
|
| 24 |
+
<meowallet_setup>
|
| 25 |
+
<setup>
|
| 26 |
+
<module>Meowallet_Payment</module>
|
| 27 |
+
</setup>
|
| 28 |
+
<connection>
|
| 29 |
+
<use>core_setup</use>
|
| 30 |
+
</connection>
|
| 31 |
+
</meowallet_setup>
|
| 32 |
+
<meowallet_write>
|
| 33 |
+
<connection>
|
| 34 |
+
<use>core_write</use>
|
| 35 |
+
</connection>
|
| 36 |
+
</meowallet_write>
|
| 37 |
+
<meowallet_read>
|
| 38 |
+
<connection>
|
| 39 |
+
<use>core_read</use>
|
| 40 |
+
</connection>
|
| 41 |
+
</meowallet_read>
|
| 42 |
+
</resources>
|
| 43 |
+
<payment>
|
| 44 |
+
<groups>
|
| 45 |
+
<meowallet>Meowallet</meowallet>
|
| 46 |
+
</groups>
|
| 47 |
+
</payment>
|
| 48 |
+
</global>
|
| 49 |
+
<adminhtml>
|
| 50 |
+
<translate>
|
| 51 |
+
<modules>
|
| 52 |
+
<Meowallet_Payment>
|
| 53 |
+
<files>
|
| 54 |
+
<default>Meowallet_Payment.csv</default>
|
| 55 |
+
</files>
|
| 56 |
+
</Meowallet_Payment>
|
| 57 |
+
</modules>
|
| 58 |
+
</translate>
|
| 59 |
+
</adminhtml>
|
| 60 |
+
<frontend>
|
| 61 |
+
<routers>
|
| 62 |
+
<meowallet>
|
| 63 |
+
<use>standard</use>
|
| 64 |
+
<args>
|
| 65 |
+
<module>Meowallet_Payment</module>
|
| 66 |
+
<frontName>meowallet</frontName>
|
| 67 |
+
</args>
|
| 68 |
+
</meowallet>
|
| 69 |
+
</routers>
|
| 70 |
+
<layout>
|
| 71 |
+
<updates>
|
| 72 |
+
<meowallet>
|
| 73 |
+
<file>meowallet.xml</file>
|
| 74 |
+
</meowallet>
|
| 75 |
+
</updates>
|
| 76 |
+
</layout>
|
| 77 |
+
<translate>
|
| 78 |
+
<modules>
|
| 79 |
+
<Meowallet_Payment>
|
| 80 |
+
<files>
|
| 81 |
+
<default>Meowallet_Payment.csv</default>
|
| 82 |
+
</files>
|
| 83 |
+
</Meowallet_Payment>
|
| 84 |
+
</modules>
|
| 85 |
+
</translate>
|
| 86 |
+
</frontend>
|
| 87 |
+
<default>
|
| 88 |
+
<payment>
|
| 89 |
+
<meowallet_procheckout>
|
| 90 |
+
<active>0</active>
|
| 91 |
+
<model>meowallet/meowallet_procheckout</model>
|
| 92 |
+
<title>MEO Wallet (Saldo/CC/MB)</title>
|
| 93 |
+
<payment_action>sale</payment_action>
|
| 94 |
+
<allowspecific>0</allowspecific>
|
| 95 |
+
<environment>1</environment>
|
| 96 |
+
<production_api_token></production_api_token>
|
| 97 |
+
<sandbox_api_token></sandbox_api_token>
|
| 98 |
+
<sort_order>1</sort_order>
|
| 99 |
+
</meowallet_procheckout>
|
| 100 |
+
</payment>
|
| 101 |
+
</default>
|
| 102 |
+
</config>
|
app/code/community/Meowallet/Payment/etc/system.xml
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<payment>
|
| 5 |
+
<groups>
|
| 6 |
+
<meowallet_procheckout translate="label" module="meowallet">
|
| 7 |
+
<label>MEO Wallet</label>
|
| 8 |
+
<frontend_type>text</frontend_type>
|
| 9 |
+
<sort_order>670</sort_order>
|
| 10 |
+
<show_in_default>1</show_in_default>
|
| 11 |
+
<show_in_website>1</show_in_website>
|
| 12 |
+
<show_in_store>1</show_in_store>
|
| 13 |
+
<fields>
|
| 14 |
+
<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">
|
| 24 |
+
<label>Title</label>
|
| 25 |
+
<frontend_type>text</frontend_type>
|
| 26 |
+
<sort_order>2</sort_order>
|
| 27 |
+
<show_in_default>1</show_in_default>
|
| 28 |
+
<show_in_website>1</show_in_website>
|
| 29 |
+
<show_in_store>1</show_in_store>
|
| 30 |
+
</title>
|
| 31 |
+
<order_status translate="label">
|
| 32 |
+
<label>New order status</label>
|
| 33 |
+
<frontend_type>select</frontend_type>
|
| 34 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
| 35 |
+
<sort_order>4</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 |
+
</order_status>
|
| 40 |
+
<payment_action translate="label">
|
| 41 |
+
<label>Payment Action</label>
|
| 42 |
+
<config_path>payment/payflow_advanced/payment_action</config_path>
|
| 43 |
+
<frontend_type>select</frontend_type>
|
| 44 |
+
<source_model>meowallet/system_config_source_payment_actions</source_model>
|
| 45 |
+
<sort_order>30</sort_order>
|
| 46 |
+
<show_in_default>1</show_in_default>
|
| 47 |
+
<show_in_website>1</show_in_website>
|
| 48 |
+
</payment_action>
|
| 49 |
+
<allowspecific translate="label">
|
| 50 |
+
<label>Payment Applicable From</label>
|
| 51 |
+
<frontend_type>select</frontend_type>
|
| 52 |
+
<sort_order>60</sort_order>
|
| 53 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 54 |
+
<show_in_default>1</show_in_default>
|
| 55 |
+
<show_in_website>1</show_in_website>
|
| 56 |
+
<show_in_store>0</show_in_store>
|
| 57 |
+
</allowspecific>
|
| 58 |
+
<specificcountry translate="label">
|
| 59 |
+
<label>Countries Payment Applicable From</label>
|
| 60 |
+
<frontend_type>multiselect</frontend_type>
|
| 61 |
+
<sort_order>70</sort_order>
|
| 62 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 63 |
+
<show_in_default>1</show_in_default>
|
| 64 |
+
<show_in_website>1</show_in_website>
|
| 65 |
+
<show_in_store>0</show_in_store>
|
| 66 |
+
<depends><allowspecific>1</allowspecific></depends>
|
| 67 |
+
</specificcountry>
|
| 68 |
+
<sort_order translate="label">
|
| 69 |
+
<label>Sort Order</label>
|
| 70 |
+
<frontend_type>text</frontend_type>
|
| 71 |
+
<sort_order>100</sort_order>
|
| 72 |
+
<show_in_default>1</show_in_default>
|
| 73 |
+
<show_in_website>1</show_in_website>
|
| 74 |
+
<show_in_store>0</show_in_store>
|
| 75 |
+
</sort_order>
|
| 76 |
+
<production_api_token translate="label comment">
|
| 77 |
+
<label>API Token - Production</label>
|
| 78 |
+
<comment><![CDATA[More info <a target="_blank" href="https://developers.wallet.pt/en/basics/auth.html">here</a>]]></comment>
|
| 79 |
+
<frontend_type>obscure</frontend_type>
|
| 80 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 81 |
+
<sort_order>90</sort_order>
|
| 82 |
+
<show_in_default>1</show_in_default>
|
| 83 |
+
<show_in_website>1</show_in_website>
|
| 84 |
+
<show_in_store>0</show_in_store>
|
| 85 |
+
</production_api_token>
|
| 86 |
+
<sandbox_api_token translate="label comment">
|
| 87 |
+
<label>API Token - Sandbox</label>
|
| 88 |
+
<comment><![CDATA[More info <a target="_blank" href="https://developers.wallet.pt/en/basics/auth.html">here</a>]]></comment>
|
| 89 |
+
<frontend_type>obscure</frontend_type>
|
| 90 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 91 |
+
<sort_order>90</sort_order>
|
| 92 |
+
<show_in_default>1</show_in_default>
|
| 93 |
+
<show_in_website>1</show_in_website>
|
| 94 |
+
<show_in_store>0</show_in_store>
|
| 95 |
+
</sandbox_api_token>
|
| 96 |
+
<environment translate="label">
|
| 97 |
+
<label>Environment in use</label>
|
| 98 |
+
<frontend_type>select</frontend_type>
|
| 99 |
+
<source_model>meowallet/system_config_source_environment_view</source_model>
|
| 100 |
+
<sort_order>30</sort_order>
|
| 101 |
+
<show_in_default>1</show_in_default>
|
| 102 |
+
</environment>
|
| 103 |
+
<model></model>
|
| 104 |
+
</fields>
|
| 105 |
+
</meowallet_procheckout>
|
| 106 |
+
</groups>
|
| 107 |
+
</payment>
|
| 108 |
+
</sections>
|
| 109 |
+
</config>
|
app/code/community/Meowallet/Payment/sql/mysql4-install-0.0.1.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 4 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 5 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 6 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 7 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 8 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 9 |
+
SOFTWARE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
// here are the table creation for this module e.g.:
|
| 13 |
+
$this->startSetup();
|
| 14 |
+
// $this->run("HERE YOUR SQL");
|
| 15 |
+
$this->endSetup();
|
app/design/frontend/base/default/layout/meowallet.xml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<meowallet_procheckout_failure>
|
| 4 |
+
<reference name="root">
|
| 5 |
+
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="content">
|
| 8 |
+
<block type="checkout/onepage_failure" name="checkout.failure" template="meowallet/procheckout/failure.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</meowallet_procheckout_failure>
|
| 11 |
+
</layout>
|
app/design/frontend/base/default/template/meowallet/procheckout/failure.phtml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="page-title">
|
| 2 |
+
<h1><?php echo $this->__('Your order has been cancelled') ?></h1>
|
| 3 |
+
</div>
|
| 4 |
+
<?php if ($this->getRealOrderId()) : ?><p><?php echo $this->__('Order #') . $this->getRealOrderId() ?></p><?php endif ?>
|
| 5 |
+
<?php if ($error = $this->getErrorMessage()) : ?><p><?php echo $error ?></p><?php endif ?>
|
| 6 |
+
<p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.', $this->getContinueShoppingUrl()) ?></p>
|
app/etc/modules/Meowallet_Payment.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Meowallet_Payment>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Payment/>
|
| 9 |
+
</depends>
|
| 10 |
+
</Meowallet_Payment>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>MEOWallet</name>
|
| 4 |
+
<version>0.0.1</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>MIT</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Official MEO Wallet extension.</summary>
|
| 10 |
+
<description>Official MEO Wallet extension to receive online payments, simple, fast and totally secure.</description>
|
| 11 |
+
<notes>Initial release with procheckout payment method.</notes>
|
| 12 |
+
<authors><author><name>PT Pay, S. A.</name><user>walletpt</user><email>walletpt@telecom.pt</email></author></authors>
|
| 13 |
+
<date>2015-04-06</date>
|
| 14 |
+
<time>18:33:29</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Meowallet"><dir name="Payment"><dir name="Helper"><file name="Data.php" hash="21881d69c35446e7c12b0f032675167d"/></dir><dir name="Model"><dir name="Meowallet"><file name="Abstract.php" hash="9d42dbcb74b3c82053de3b09536460e0"/><file name="Procheckout.php" hash="cc36c6d85da660bcdea98eb993c8f9ec"/></dir><file name="Operation.php" hash="546a9a09a77224747872bc1cbe7ce07f"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Environment"><file name="View.php" hash="a4af2d583723a2834421fbad08fe48cf"/></dir><dir name="Payment"><file name="Actions.php" hash="12eca297e01a63c5f9b5abcb19e8221d"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="ProcheckoutController.php" hash="5806bab4668a44b3e80f6f407da0eeb9"/></dir><dir name="etc"><file name="config.xml" hash="69e3df9377d27ed964fdc4c0e0993198"/><file name="system.xml" hash="cfb5c0ba4f5026b370e89a9913818729"/></dir><dir name="sql"><file name="mysql4-install-0.0.1.php" hash="24c6f7aeea694036ff277d42545eebc3"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Meowallet_Payment.xml" hash="4852d681cec539e144ab19a3b372937d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="meowallet.xml" hash="01dc73dd7e3532b5141c8a3ecc34dba9"/></dir><dir name="template"><dir name="meowallet"><dir name="procheckout"><file name="failure.phtml" hash="adaf4a6d642ad933e9cd17f026654e7c"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="pt_PT"><file name="Meowallet_Payment.xml" hash=""/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
