Version Notes
-addition for estimate shipping and tax
Download this release
Release Info
| Developer | Minkasu Inc |
| Extension | minkasu_smartphone_checkout |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.0 to 1.3.0
- app/code/community/Minkasu/Wallet/Helper/Api.php +1 -0
- app/code/community/Minkasu/Wallet/Helper/Api.php.bak +0 -161
- app/code/community/Minkasu/Wallet/Model/Api/Type/Transaction.php~ +0 -275
- app/code/community/Minkasu/Wallet/Model/Observer.php +143 -0
- app/code/community/Minkasu/Wallet/Model/Observer.php~ +0 -54
- app/code/community/Minkasu/Wallet/Model/Payment.php.bak +0 -115
- app/code/community/Minkasu/Wallet/controllers/PaymentController.php +99 -16
- app/code/community/Minkasu/Wallet/controllers/PaymentController.php.bk +0 -432
- app/code/community/Minkasu/Wallet/controllers/PaymentController.php.old +0 -408
- app/code/community/Minkasu/Wallet/controllers/PaymentController.php~ +0 -410
- app/code/community/Minkasu/Wallet/controllers/TransactionController.php~ +0 -122
- app/code/community/Minkasu/Wallet/etc/config.xml +33 -1
- app/code/community/Minkasu/Wallet/etc/system.xml +8 -0
- app/design/frontend/base/default/template/minkasu/wallet/estimate_box.phtml +7 -6
- app/design/frontend/base/default/template/minkasu/wallet/pay.phtml +20 -3
- app/design/frontend/ultimo/default/template/minkasu/wallet/estimate_box.phtml +2 -2
- package.xml +6 -8
app/code/community/Minkasu/Wallet/Helper/Api.php
CHANGED
|
@@ -12,6 +12,7 @@ class Minkasu_Wallet_Helper_Api extends Mage_Core_Helper_Data
|
|
| 12 |
const XML_PATH_API_ESTIMATE_ENABLED = 'payment/minkasu_wallet/estimate_enabled';
|
| 13 |
const XML_PATH_API_CC_TYPES = 'payment/minkasu_wallet/cctypes';
|
| 14 |
const XML_PATH_API_PAYMENTACTION = 'payment/minkasu_wallet/payment_action';
|
|
|
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Minkasu API log filename
|
| 12 |
const XML_PATH_API_ESTIMATE_ENABLED = 'payment/minkasu_wallet/estimate_enabled';
|
| 13 |
const XML_PATH_API_CC_TYPES = 'payment/minkasu_wallet/cctypes';
|
| 14 |
const XML_PATH_API_PAYMENTACTION = 'payment/minkasu_wallet/payment_action';
|
| 15 |
+
const XML_PATH_API_PROMO_CODES = 'payment/minkasu_wallet/promo_codes';
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Minkasu API log filename
|
app/code/community/Minkasu/Wallet/Helper/Api.php.bak
DELETED
|
@@ -1,161 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Minkasu_Wallet_Helper_Api extends Mage_Core_Helper_Data
|
| 3 |
-
{
|
| 4 |
-
/**
|
| 5 |
-
* Xml paths
|
| 6 |
-
*/
|
| 7 |
-
const XML_PATH_API_GATEWAY_URL = 'payment/minkasu_wallet/gateway_url';
|
| 8 |
-
const XML_PATH_API_ACCOUNT_ID = 'payment/minkasu_wallet/account_id';
|
| 9 |
-
const XML_PATH_API_TOKEN = 'payment/minkasu_wallet/token';
|
| 10 |
-
const XML_PATH_API_ACTIVE = 'payment/minkasu_wallet/active';
|
| 11 |
-
const XML_PATH_API_MODE = 'payment/minkasu_wallet/mode';
|
| 12 |
-
const XML_PATH_API_ESTIMATE_ENABLED = 'payment/minkasu_wallet/estimate_enabled';
|
| 13 |
-
const XML_PATH_API_CC_TYPES = 'payment/minkasu_wallet/cctypes';
|
| 14 |
-
const XML_PATH_API_PAYMENTACTION = 'payment/minkasu_wallet/paymentaction';
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Minkasu API log filename
|
| 18 |
-
*/
|
| 19 |
-
const LOG_FILENAME = 'minkasu_api.log';
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @return string
|
| 23 |
-
*/
|
| 24 |
-
public function getApiGatewayUrl()
|
| 25 |
-
{
|
| 26 |
-
return rtrim(Mage::getStoreConfig(self::XML_PATH_API_GATEWAY_URL), '/');
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* @return int
|
| 31 |
-
*/
|
| 32 |
-
public function getApiAccountId()
|
| 33 |
-
{
|
| 34 |
-
$configValue = Mage::getStoreConfig(self::XML_PATH_API_ACCOUNT_ID);
|
| 35 |
-
$configValue = json_decode($configValue, true);
|
| 36 |
-
|
| 37 |
-
return isset($configValue[$this->getApiMode()]) ? (int) $configValue[$this->getApiMode()] : '';
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
/**
|
| 41 |
-
* @return int
|
| 42 |
-
*/
|
| 43 |
-
public function getApiMode()
|
| 44 |
-
{
|
| 45 |
-
return (int) Mage::getStoreConfigFlag(self::XML_PATH_API_MODE);
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
/**
|
| 49 |
-
* @return string
|
| 50 |
-
*/
|
| 51 |
-
public function getApiAccountIds()
|
| 52 |
-
{
|
| 53 |
-
return Mage::getStoreConfig(self::XML_PATH_API_ACCOUNT_ID);
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
/**
|
| 57 |
-
* @return string
|
| 58 |
-
*/
|
| 59 |
-
public function getApiToken()
|
| 60 |
-
{
|
| 61 |
-
$configValue = Mage::getStoreConfig(self::XML_PATH_API_TOKEN);
|
| 62 |
-
$configValue = json_decode($configValue, true);
|
| 63 |
-
|
| 64 |
-
return isset($configValue[$this->getApiMode()]) ? $configValue[$this->getApiMode()] : '';
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
/**
|
| 68 |
-
* @return string
|
| 69 |
-
*/
|
| 70 |
-
public function getApiTokens()
|
| 71 |
-
{
|
| 72 |
-
return Mage::getStoreConfig(self::XML_PATH_API_TOKEN);
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
/**
|
| 76 |
-
* @param string $accountId
|
| 77 |
-
*
|
| 78 |
-
* @return $this
|
| 79 |
-
*/
|
| 80 |
-
public function saveApiAccountId($accountId)
|
| 81 |
-
{
|
| 82 |
-
$this->_saveConfig(self::XML_PATH_API_ACCOUNT_ID, json_encode(array($this->getApiMode() => $accountId)));
|
| 83 |
-
return $this;
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
/**
|
| 87 |
-
* @param string $key
|
| 88 |
-
* @param string $value
|
| 89 |
-
*
|
| 90 |
-
* @return $this
|
| 91 |
-
*/
|
| 92 |
-
protected function _saveConfig($key, $value)
|
| 93 |
-
{
|
| 94 |
-
/** @var $config Mage_Core_Model_Config */
|
| 95 |
-
$config = Mage::getModel('core/config');
|
| 96 |
-
/** @var $coreHelper Mage_Core_Helper_Data */
|
| 97 |
-
$coreHelper = Mage::helper('core');
|
| 98 |
-
$config->saveConfig($key, $coreHelper->encrypt($value));
|
| 99 |
-
return $this;
|
| 100 |
-
}
|
| 101 |
-
/**
|
| 102 |
-
* @param string $paymentAction
|
| 103 |
-
*
|
| 104 |
-
* @return $this
|
| 105 |
-
*/
|
| 106 |
-
public function savePaymentaction($paymentAction)
|
| 107 |
-
{
|
| 108 |
-
/** @var $config Mage_Core_Model_Config */
|
| 109 |
-
$config = Mage::getModel('core/config');
|
| 110 |
-
$config->saveConfig(self::XML_PATH_API_PAYMENTACTION, $paymentAction);
|
| 111 |
-
return $this;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
/**
|
| 115 |
-
* @param string $ccTypes
|
| 116 |
-
*
|
| 117 |
-
* @return $this
|
| 118 |
-
*/
|
| 119 |
-
public function saveCcTypes($ccTypes)
|
| 120 |
-
{
|
| 121 |
-
/** @var $config Mage_Core_Model_Config */
|
| 122 |
-
$config = Mage::getModel('core/config');
|
| 123 |
-
$config->saveConfig(self::XML_PATH_API_CC_TYPES, $ccTypes);
|
| 124 |
-
return $this;
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
/**
|
| 128 |
-
* @param string $token
|
| 129 |
-
*
|
| 130 |
-
* @return $this
|
| 131 |
-
*/
|
| 132 |
-
public function saveApiToken($token)
|
| 133 |
-
{
|
| 134 |
-
$this->_saveConfig(self::XML_PATH_API_TOKEN, json_encode(array($this->getApiMode() => $token)));
|
| 135 |
-
return $this;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
/**
|
| 139 |
-
* @return string
|
| 140 |
-
*/
|
| 141 |
-
public function getApiLogFilename()
|
| 142 |
-
{
|
| 143 |
-
return self::LOG_FILENAME;
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
/**
|
| 147 |
-
* @return bool
|
| 148 |
-
*/
|
| 149 |
-
public function isApiActive()
|
| 150 |
-
{
|
| 151 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_API_ACTIVE);
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
/**
|
| 155 |
-
* @return bool
|
| 156 |
-
*/
|
| 157 |
-
public function isApiEstimateEnabled()
|
| 158 |
-
{
|
| 159 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_API_ESTIMATE_ENABLED);
|
| 160 |
-
}
|
| 161 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/Model/Api/Type/Transaction.php~
DELETED
|
@@ -1,275 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_Model_Api_Type_Transaction extends Minkasu_Wallet_Model_Api_Type_Abstract
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* Field names
|
| 7 |
-
*/
|
| 8 |
-
const FIELD_NAME_PAYMENT_CODE = 'payment_code';
|
| 9 |
-
const FIELD_NAME_STATUS = 'status';
|
| 10 |
-
const FIELD_NAME_ACTION = 'act';
|
| 11 |
-
|
| 12 |
-
/**
|
| 13 |
-
* Operations with a transaction
|
| 14 |
-
*/
|
| 15 |
-
const OPERATION_CREATE = 'new_transaction';
|
| 16 |
-
const OPERATION_UPDATE = 'update_transaction_details';
|
| 17 |
-
const OPERATION_AUTHORIZE = 'authorize';
|
| 18 |
-
const OPERATION_CAPTURE = 'capture';
|
| 19 |
-
const OPERATION_CANCEL = 'cancel';
|
| 20 |
-
const OPERATION_REFUND = 'refund';
|
| 21 |
-
const OPERATION_VOID = 'void';
|
| 22 |
-
|
| 23 |
-
/**
|
| 24 |
-
* Type API name
|
| 25 |
-
*/
|
| 26 |
-
const API_NAME = 'transactions';
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* Transaction states
|
| 30 |
-
*/
|
| 31 |
-
const STATE_CREATED = 0;
|
| 32 |
-
const STATE_AUTHORIZED = 1;
|
| 33 |
-
const STATE_CAPTURED = 2;
|
| 34 |
-
const STATE_CANCELED = 3;
|
| 35 |
-
const STATE_CREDITED = 4;
|
| 36 |
-
const STATE_PREAUTHED = 5;
|
| 37 |
-
const STATE_PREAUTH_VOIDED = 6;
|
| 38 |
-
|
| 39 |
-
/**
|
| 40 |
-
* Get payment code of a transaction id
|
| 41 |
-
*
|
| 42 |
-
* @param int $transactionId
|
| 43 |
-
* @return array
|
| 44 |
-
*/
|
| 45 |
-
public function getPaymentCode($transactionId)
|
| 46 |
-
{
|
| 47 |
-
$params = array(
|
| 48 |
-
':id' => $transactionId,
|
| 49 |
-
':field' => self::FIELD_NAME_PAYMENT_CODE,
|
| 50 |
-
);
|
| 51 |
-
return $this->get($params);
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
/**
|
| 55 |
-
* Create a Minkasu transaction
|
| 56 |
-
*
|
| 57 |
-
* @param Mage_Sales_Model_Quote $quote
|
| 58 |
-
* @return array
|
| 59 |
-
*/
|
| 60 |
-
public function createTransaction(Mage_Sales_Model_Quote $quote)
|
| 61 |
-
{
|
| 62 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 63 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 64 |
-
/** @var $walletHelper Minkasu_Wallet_Helper_Data */
|
| 65 |
-
$walletHelper = Mage::helper('minkasu_wallet');
|
| 66 |
-
|
| 67 |
-
$params = array(
|
| 68 |
-
'operation' => self::OPERATION_CREATE,
|
| 69 |
-
'amount' => $walletHelper->convertDollarsToCents($quote->getGrandTotal()),
|
| 70 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 71 |
-
'merchant_bill_number' => $quote->getId(),
|
| 72 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 73 |
-
'beta_code' => 'mkbeta3314'
|
| 74 |
-
);
|
| 75 |
-
|
| 76 |
-
return $this->post($params);
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/**
|
| 80 |
-
* Update a Minkasu transaction
|
| 81 |
-
*
|
| 82 |
-
* @param $transactionId
|
| 83 |
-
* @param array $transactionData
|
| 84 |
-
* @return array
|
| 85 |
-
*/
|
| 86 |
-
public function updateTransaction($transactionId, array $transactionData)
|
| 87 |
-
{
|
| 88 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 89 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 90 |
-
|
| 91 |
-
$params = array(
|
| 92 |
-
'operation' => self::OPERATION_UPDATE,
|
| 93 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 94 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 95 |
-
'beta_code' => 'mkbeta3314',
|
| 96 |
-
':id' => $transactionId,
|
| 97 |
-
);
|
| 98 |
-
$params = array_merge($params, $transactionData);
|
| 99 |
-
|
| 100 |
-
return $this->post($params);
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
/**
|
| 104 |
-
* Authorize a Minkasu transaction
|
| 105 |
-
*
|
| 106 |
-
* @param string $transactionId
|
| 107 |
-
* @param string $paymentToken
|
| 108 |
-
*
|
| 109 |
-
* @return array
|
| 110 |
-
*/
|
| 111 |
-
public function authorizeTransaction($transactionId, $paymentToken)
|
| 112 |
-
{
|
| 113 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 114 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 115 |
-
|
| 116 |
-
$params = array(
|
| 117 |
-
'operation' => self::OPERATION_AUTHORIZE,
|
| 118 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 119 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 120 |
-
'payment_token' => $paymentToken,
|
| 121 |
-
':id' => $transactionId,
|
| 122 |
-
':action' => self::FIELD_NAME_ACTION,
|
| 123 |
-
);
|
| 124 |
-
|
| 125 |
-
return $this->post($params);
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
/**
|
| 129 |
-
* Capture a Minkasu transaction
|
| 130 |
-
*
|
| 131 |
-
* @param string $transactionId
|
| 132 |
-
*
|
| 133 |
-
* @return array
|
| 134 |
-
*/
|
| 135 |
-
public function captureTransaction($transactionId)
|
| 136 |
-
{
|
| 137 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 138 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 139 |
-
|
| 140 |
-
$params = array(
|
| 141 |
-
'operation' => self::OPERATION_CAPTURE,
|
| 142 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 143 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 144 |
-
':id' => $transactionId,
|
| 145 |
-
':action' => self::FIELD_NAME_ACTION,
|
| 146 |
-
);
|
| 147 |
-
|
| 148 |
-
return $this->post($params);
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
/**
|
| 152 |
-
* Cancel a Minkasu transaction
|
| 153 |
-
*
|
| 154 |
-
* @param string $transactionId
|
| 155 |
-
*
|
| 156 |
-
* @return array
|
| 157 |
-
*/
|
| 158 |
-
public function cancelTransaction($transactionId)
|
| 159 |
-
{
|
| 160 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 161 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 162 |
-
|
| 163 |
-
$params = array(
|
| 164 |
-
'operation' => self::OPERATION_CANCEL,
|
| 165 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 166 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 167 |
-
':id' => $transactionId,
|
| 168 |
-
':action' => self::FIELD_NAME_ACTION,
|
| 169 |
-
);
|
| 170 |
-
|
| 171 |
-
return $this->post($params);
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
/**
|
| 175 |
-
* Refund a Minkasu transaction
|
| 176 |
-
*
|
| 177 |
-
* @param string $transactionId
|
| 178 |
-
*
|
| 179 |
-
* @return array
|
| 180 |
-
*/
|
| 181 |
-
public function refundTransaction($transactionId, $amount)
|
| 182 |
-
{
|
| 183 |
-
/** @var $walletHelper Minkasu_Wallet_Helper_Data */
|
| 184 |
-
$walletHelper = Mage::helper('minkasu_wallet');
|
| 185 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 186 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 187 |
-
|
| 188 |
-
$params = array(
|
| 189 |
-
'operation' => self::OPERATION_REFUND,
|
| 190 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 191 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 192 |
-
'refund_amount' => $walletHelper->convertDollarsToCents($amount),
|
| 193 |
-
':id' => $transactionId,
|
| 194 |
-
':action' => self::FIELD_NAME_ACTION,
|
| 195 |
-
);
|
| 196 |
-
|
| 197 |
-
return $this->post($params);
|
| 198 |
-
}
|
| 199 |
-
|
| 200 |
-
/**
|
| 201 |
-
* Get a Minkasu transaction
|
| 202 |
-
*
|
| 203 |
-
* @param string $transactionId
|
| 204 |
-
*
|
| 205 |
-
* @return array
|
| 206 |
-
*/
|
| 207 |
-
public function getTransaction($transactionId)
|
| 208 |
-
{
|
| 209 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 210 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 211 |
-
|
| 212 |
-
$url = sprintf('%s/%s/%s', $apiHelper->getApiGatewayUrl(), $this->_getApiName(), $transactionId);
|
| 213 |
-
$data = array(
|
| 214 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 215 |
-
'minkasu_token' => $apiHelper->getApiToken()
|
| 216 |
-
);
|
| 217 |
-
$query = http_build_query($data);
|
| 218 |
-
$options = array(
|
| 219 |
-
'http' => array(
|
| 220 |
-
'header' => "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: " . strlen($query),
|
| 221 |
-
'method' => Varien_Http_Client::GET,
|
| 222 |
-
'content' => $query,
|
| 223 |
-
),
|
| 224 |
-
);
|
| 225 |
-
$context = stream_context_create($options);
|
| 226 |
-
$result = file_get_contents($url, false, $context);
|
| 227 |
-
return json_decode($result, true);
|
| 228 |
-
}
|
| 229 |
-
|
| 230 |
-
/**
|
| 231 |
-
* Void a Minkasu transaction
|
| 232 |
-
*
|
| 233 |
-
* @param string $transactionId
|
| 234 |
-
*
|
| 235 |
-
* @return array
|
| 236 |
-
*/
|
| 237 |
-
public function voidTransaction($transactionId)
|
| 238 |
-
{
|
| 239 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 240 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 241 |
-
|
| 242 |
-
$params = array(
|
| 243 |
-
'operation' => self::OPERATION_VOID,
|
| 244 |
-
'merchant_acct_id' => $apiHelper->getApiAccountId(),
|
| 245 |
-
'minkasu_token' => $apiHelper->getApiToken(),
|
| 246 |
-
':id' => $transactionId,
|
| 247 |
-
':action' => self::FIELD_NAME_ACTION,
|
| 248 |
-
);
|
| 249 |
-
|
| 250 |
-
return $this->post($params);
|
| 251 |
-
}
|
| 252 |
-
|
| 253 |
-
/**
|
| 254 |
-
* @param string $transactionId
|
| 255 |
-
*
|
| 256 |
-
* @return array
|
| 257 |
-
*/
|
| 258 |
-
public function getTransactionStatus($transactionId)
|
| 259 |
-
{
|
| 260 |
-
$params = array(
|
| 261 |
-
':id' => $transactionId,
|
| 262 |
-
':action' => self::FIELD_NAME_STATUS
|
| 263 |
-
);
|
| 264 |
-
|
| 265 |
-
return $this->get($params);
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
-
/**
|
| 269 |
-
* @return string
|
| 270 |
-
*/
|
| 271 |
-
protected function _getApiName()
|
| 272 |
-
{
|
| 273 |
-
return self::API_NAME;
|
| 274 |
-
}
|
| 275 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/Model/Observer.php
CHANGED
|
@@ -2,6 +2,84 @@
|
|
| 2 |
|
| 3 |
class Minkasu_Wallet_Model_Observer
|
| 4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
/**
|
| 6 |
* @param Varien_Event_Observer $observer
|
| 7 |
* @return $this
|
|
@@ -18,6 +96,68 @@ class Minkasu_Wallet_Model_Observer
|
|
| 18 |
return $this;
|
| 19 |
}
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
/**
|
| 22 |
* Show a warning to a customer if he goes miss checkout cart page
|
| 23 |
*
|
|
@@ -26,6 +166,9 @@ class Minkasu_Wallet_Model_Observer
|
|
| 26 |
*/
|
| 27 |
public function showNotice(Varien_Event_Observer $observer)
|
| 28 |
{
|
|
|
|
|
|
|
|
|
|
| 29 |
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 30 |
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 31 |
if (false === $apiHelper->isApiActive()) {
|
| 2 |
|
| 3 |
class Minkasu_Wallet_Model_Observer
|
| 4 |
{
|
| 5 |
+
|
| 6 |
+
const XML_PATH_API_PROMO_CODES = 'payment/minkasu_wallet/promo_codes';
|
| 7 |
+
|
| 8 |
+
protected function _getMinkasuPromoCodes()
|
| 9 |
+
{
|
| 10 |
+
$promo_codes_str = trim(Mage::getStoreConfig(self::XML_PATH_API_PROMO_CODES));
|
| 11 |
+
$promo_code_arr = explode(',', $promo_codes_str);
|
| 12 |
+
for ($i = 0; $i < count($promo_code_arr); $i++) {
|
| 13 |
+
$promo_code_arr[$i] = trim($promo_code_arr[$i]);
|
| 14 |
+
}
|
| 15 |
+
//Mage::log("Mk promo code str - " . $promo_codes_str . "; Promo codes - " . print_r($promo_code_arr, true));
|
| 16 |
+
return $promo_code_arr;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
protected function _hasMinkasuPromoCodes()
|
| 20 |
+
{
|
| 21 |
+
$promo_codes_str = trim(Mage::getStoreConfig(self::XML_PATH_API_PROMO_CODES));
|
| 22 |
+
if ($promo_codes_str == '') {
|
| 23 |
+
return FALSE;
|
| 24 |
+
}
|
| 25 |
+
return TRUE;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
protected function _getQuotePaymentMethod($quote)
|
| 29 |
+
{
|
| 30 |
+
$method_name = '';
|
| 31 |
+
try {
|
| 32 |
+
$method_name = $quote->getPayment()->getMethodInstance()->getCode();
|
| 33 |
+
}
|
| 34 |
+
catch (Exception $e) {
|
| 35 |
+
// Mage::log("Exception caught while reading payment method name.");
|
| 36 |
+
}
|
| 37 |
+
return $method_name;
|
| 38 |
+
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
protected function _resetQuotePaymentMethod()
|
| 43 |
+
{
|
| 44 |
+
|
| 45 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 46 |
+
$quote = $checkoutSession->getQuote();
|
| 47 |
+
|
| 48 |
+
$initial_payment_method = $this->_getQuotePaymentMethod($quote);
|
| 49 |
+
//Mage::log("Restting payment method - current: " . $initial_payment_method);
|
| 50 |
+
|
| 51 |
+
/*
|
| 52 |
+
if($quote->isVirtual()) {
|
| 53 |
+
if ($quote->getBillingAddress()) {
|
| 54 |
+
$quote->getBillingAddress()->setPaymentMethod('');
|
| 55 |
+
}
|
| 56 |
+
} else {
|
| 57 |
+
if ($quote->getShippingAddress()) {
|
| 58 |
+
$quote->getShippingAddress()->setPaymentMethod('');
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
// shipping totals may be affected by payment method
|
| 63 |
+
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 64 |
+
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 65 |
+
}
|
| 66 |
+
*/
|
| 67 |
+
|
| 68 |
+
$payment = $quote->getPayment();
|
| 69 |
+
if ($payment) {
|
| 70 |
+
$quote->removePayment();
|
| 71 |
+
}
|
| 72 |
+
$final_payment_method = $this->_getQuotePaymentMethod($quote);
|
| 73 |
+
//Mage::log("Restting payment method - new: " . $final_payment_method);
|
| 74 |
+
|
| 75 |
+
$quote->setTotalsCollectedFlag(false)->collectTotals();
|
| 76 |
+
$quote->save();
|
| 77 |
+
Mage::log("Payment method reset"); // " . $original_payment_method . " to " . $final_payment_method);
|
| 78 |
+
return;
|
| 79 |
+
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
/**
|
| 84 |
* @param Varien_Event_Observer $observer
|
| 85 |
* @return $this
|
| 96 |
return $this;
|
| 97 |
}
|
| 98 |
|
| 99 |
+
|
| 100 |
+
public function beforeSaveOrderQuoteToSession(Varien_Event_Observer $observer)
|
| 101 |
+
{
|
| 102 |
+
/** @var Mage_Checkout_Model_Cart $cart */
|
| 103 |
+
$cart = $observer->getEvent()->getCart();
|
| 104 |
+
|
| 105 |
+
$quote = $cart->getQuote();
|
| 106 |
+
//Mage::log('BeforeSaveOrderQuoteToSession called with coupon code ' . $quote->getCouponCode());
|
| 107 |
+
|
| 108 |
+
return $this;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/*
|
| 112 |
+
public function paymentMethodIsActive(Varien_Event_Observer $observer)
|
| 113 |
+
{
|
| 114 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 115 |
+
$method = $observer->getEvent()->getMethodInstance();
|
| 116 |
+
|
| 117 |
+
//Mage::log('PaymentMethodIsActive called with coupon code ' . $quote->getCouponCode() . ' and method ' . $method->getCode());
|
| 118 |
+
|
| 119 |
+
return $this;
|
| 120 |
+
}
|
| 121 |
+
*/
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
public function salesRuleValidatorProcess(Varien_Event_Observer $observer)
|
| 125 |
+
{
|
| 126 |
+
|
| 127 |
+
$quote = $observer->getQuote();
|
| 128 |
+
$current_payment_method = $this->_getQuotePaymentMethod($quote);
|
| 129 |
+
|
| 130 |
+
Mage::log('SalesRuleValidatorProcess called with coupon code ' . $quote->getCouponCode() . " and payment " . $current_payment_method);
|
| 131 |
+
|
| 132 |
+
$mk_promo_codes = $this->_getMinkasuPromoCodes();
|
| 133 |
+
$current_coupon_code = $quote->getCouponCode();
|
| 134 |
+
|
| 135 |
+
if (($current_coupon_code != '') && (in_array($current_coupon_code, $mk_promo_codes))) {
|
| 136 |
+
if (($current_payment_method != '') && ($current_payment_method != 'minkasu_wallet')) {
|
| 137 |
+
$quote->setCouponCode('');
|
| 138 |
+
//$quote->save();
|
| 139 |
+
$result = $observer['result'];
|
| 140 |
+
$result->setDiscountAmount(0);
|
| 141 |
+
Mage::log('Coupon code not allowed for this payment method. Removing coupon.');
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
return $this;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
public function predispatchCheckoutCartIndex(Varien_Event_Observer $observer)
|
| 150 |
+
{
|
| 151 |
+
|
| 152 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 153 |
+
//Mage::log('predispatchCheckoutCartIndex called with coupon code ' . $quote->getCouponCode());
|
| 154 |
+
if ($this->_hasMinkasuPromoCodes()) {
|
| 155 |
+
$this->_resetQuotePaymentMethod();
|
| 156 |
+
}
|
| 157 |
+
return $this;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
|
| 161 |
/**
|
| 162 |
* Show a warning to a customer if he goes miss checkout cart page
|
| 163 |
*
|
| 166 |
*/
|
| 167 |
public function showNotice(Varien_Event_Observer $observer)
|
| 168 |
{
|
| 169 |
+
|
| 170 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 171 |
+
|
| 172 |
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 173 |
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 174 |
if (false === $apiHelper->isApiActive()) {
|
app/code/community/Minkasu/Wallet/Model/Observer.php~
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_Model_Observer
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* @param Varien_Event_Observer $observer
|
| 7 |
-
* @return $this
|
| 8 |
-
*/
|
| 9 |
-
public function saveOrderQuoteToSession(Varien_Event_Observer $observer)
|
| 10 |
-
{
|
| 11 |
-
/** @var Mage_Checkout_Model_Cart $cart */
|
| 12 |
-
$cart = $observer->getEvent()->getCart();
|
| 13 |
-
$checkoutSession = $cart->getCheckoutSession();
|
| 14 |
-
$shippingAddress = $cart->getQuote()->getShippingAddress();
|
| 15 |
-
$shippingMethod = $cart->getQuote()->getShippingAddress()->getShippingMethod();
|
| 16 |
-
$checkoutSession->setData('minkasu_shipping_method', $shippingMethod);
|
| 17 |
-
$checkoutSession->setData('minkasu_shipping_estimated', $shippingMethod ? true : false);
|
| 18 |
-
if (($shippingAddress) && ($shippingAddress->exportCustomerAddress() != NULL)) {
|
| 19 |
-
$postcode = $shippingAddress->exportCustomerAddress()->getData()["postcode"];
|
| 20 |
-
$checkoutSession->setData('minkasu_estimate_postcode', $postcode);
|
| 21 |
-
} else {
|
| 22 |
-
|
| 23 |
-
}
|
| 24 |
-
//Mage::log($shippingAddress, true);
|
| 25 |
-
return $this;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* Show a warning to a customer if he goes miss checkout cart page
|
| 30 |
-
*
|
| 31 |
-
* @param Varien_Event_Observer $observer
|
| 32 |
-
* @return $this
|
| 33 |
-
*/
|
| 34 |
-
public function showNotice(Varien_Event_Observer $observer)
|
| 35 |
-
{
|
| 36 |
-
/** @var $apiHelper Minkasu_Wallet_Helper_Api */
|
| 37 |
-
$apiHelper = Mage::helper('minkasu_wallet/api');
|
| 38 |
-
if (false === $apiHelper->isApiActive()) {
|
| 39 |
-
return $this;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
/** @var Mage_Checkout_OnepageController $controller */
|
| 43 |
-
$controller = $observer->getData('controller_action');
|
| 44 |
-
/** @var $coreSession Mage_Core_Model_Session */
|
| 45 |
-
$coreSession = Mage::getSingleton('core/session');
|
| 46 |
-
$coreSession->addWarning(
|
| 47 |
-
$controller->__(
|
| 48 |
-
'You can <a href="%s">checkout quickly</a> using Minkasu App.',
|
| 49 |
-
Mage::getUrl('checkout/cart')
|
| 50 |
-
)
|
| 51 |
-
);
|
| 52 |
-
return $this;
|
| 53 |
-
}
|
| 54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/Model/Payment.php.bak
DELETED
|
@@ -1,115 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
| 4 |
-
{
|
| 5 |
-
protected $_code = 'minkasu_wallet';
|
| 6 |
-
|
| 7 |
-
protected $_canUseCheckout = false;
|
| 8 |
-
protected $_canUseInternal = false;
|
| 9 |
-
protected $_canUseForMultishipping = false;
|
| 10 |
-
|
| 11 |
-
protected $_canAuthorize = true;
|
| 12 |
-
protected $_canCapture = true;
|
| 13 |
-
protected $_canRefund = true;
|
| 14 |
-
protected $_canCancel = true;
|
| 15 |
-
protected $_canVoid = true;
|
| 16 |
-
|
| 17 |
-
public function isAvailable($quote = null)
|
| 18 |
-
{
|
| 19 |
-
return true;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
/**
|
| 23 |
-
* {@inheritdoc}
|
| 24 |
-
*/
|
| 25 |
-
public function isApplicableToQuote($quote, $checks)
|
| 26 |
-
{
|
| 27 |
-
return true;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
/**
|
| 31 |
-
* {@inheritdoc}
|
| 32 |
-
*/
|
| 33 |
-
public function authorize(Varien_Object $payment, $amount)
|
| 34 |
-
{
|
| 35 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 36 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 37 |
-
|
| 38 |
-
$quote = $checkoutSession->getQuote();
|
| 39 |
-
$orderId = $quote->getReservedOrderId();
|
| 40 |
-
Mage::log("Minkasu reserved order Id for quote is " . $orderId);
|
| 41 |
-
|
| 42 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 43 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 44 |
-
$client->getType('transaction')->authorizeTransaction(
|
| 45 |
-
$checkoutSession->getData('minkasu_txn_id'),
|
| 46 |
-
$checkoutSession->getData('minkasu_payment_token'),
|
| 47 |
-
$amount,
|
| 48 |
-
$orderId
|
| 49 |
-
);
|
| 50 |
-
|
| 51 |
-
$payment->setTransactionId($checkoutSession->getData('minkasu_txn_id'));
|
| 52 |
-
$payment->setIsTransactionClosed(0);
|
| 53 |
-
$payment->setTransactionAdditionalInfo('quote number', $checkoutSession->getData('minkasu_bill_number'));
|
| 54 |
-
|
| 55 |
-
/** @var $helper Minkasu_Wallet_Helper_Data */
|
| 56 |
-
$helper = Mage::helper('minkasu_wallet');
|
| 57 |
-
$helper->cleanCheckoutSessionParams();
|
| 58 |
-
|
| 59 |
-
return $this;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
/**
|
| 63 |
-
* {@inheritdoc}
|
| 64 |
-
*/
|
| 65 |
-
public function capture(Varien_Object $payment, $amount)
|
| 66 |
-
{
|
| 67 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 68 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 69 |
-
$client->getType('transaction')->captureTransaction($payment->getData('parent_transaction_id'), $amount);
|
| 70 |
-
$payment->setIsTransactionClosed(0);
|
| 71 |
-
|
| 72 |
-
return $this;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
/**
|
| 76 |
-
* {@inheritdoc}
|
| 77 |
-
*/
|
| 78 |
-
public function refund(Varien_Object $payment, $amount)
|
| 79 |
-
{
|
| 80 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 81 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 82 |
-
$transactionId = str_replace('-capture', '', $payment->getData('parent_transaction_id'));
|
| 83 |
-
$client->getType('transaction')->refundTransaction($transactionId, $amount);
|
| 84 |
-
$payment->setIsTransactionClosed(0);
|
| 85 |
-
|
| 86 |
-
return $this;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
/**
|
| 90 |
-
* {@inheritdoc}
|
| 91 |
-
* void the external gateway authorization and cancels the payment
|
| 92 |
-
*/
|
| 93 |
-
public function cancel(Varien_Object $payment)
|
| 94 |
-
{
|
| 95 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 96 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 97 |
-
$client->getType('transaction')->cancelTransaction($payment->getData('parent_transaction_id'));
|
| 98 |
-
|
| 99 |
-
return $this;
|
| 100 |
-
}
|
| 101 |
-
/**
|
| 102 |
-
* {@inheritdoc}
|
| 103 |
-
* void the external gateway authorization and cancels the payment
|
| 104 |
-
* Ideally 'void' should void only external gateway 'auth' and keep the transaction active
|
| 105 |
-
* A re-auth is possible on a voided txn. Currently Re-Auth is not implemented.
|
| 106 |
-
*/
|
| 107 |
-
public function void(Varien_Object $payment)
|
| 108 |
-
{
|
| 109 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 110 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 111 |
-
$client->getType('transaction')->cancelTransaction($payment->getData('parent_transaction_id'));
|
| 112 |
-
|
| 113 |
-
return $this;
|
| 114 |
-
}
|
| 115 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/controllers/PaymentController.php
CHANGED
|
@@ -25,6 +25,48 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 25 |
|
| 26 |
}
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
public function applyCouponCodeAction()
|
| 30 |
{
|
|
@@ -95,8 +137,9 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 95 |
// Step 2.1:Fill customer name (first name ?)
|
| 96 |
$quote->setCustomerFirstname($customerDetails['customer_name']);
|
| 97 |
// Step 3: Fill the address and save it as billing and shipping address
|
| 98 |
-
|
| 99 |
-
|
|
|
|
| 100 |
|
| 101 |
// Step 4: Shipping method should already be set by now.
|
| 102 |
$checkoutSession->setStepData('shipping_method', 'complete', true);
|
|
@@ -184,24 +227,34 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 184 |
*
|
| 185 |
* @return array
|
| 186 |
*/
|
| 187 |
-
|
| 188 |
-
|
| 189 |
$result = array();
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
if (!isset($response['customer_address'])
|
|
|
|
|
|
|
| 194 |
return $result;
|
| 195 |
}
|
| 196 |
|
| 197 |
$result['customer_name'] = $response['customer_name'];
|
| 198 |
-
|
| 199 |
$result['street_2'] = $response['customer_address']['address_line_2'];
|
| 200 |
$result['city'] = $response['customer_address']['city'];
|
| 201 |
-
|
| 202 |
$result['zip'] = $response['customer_address']['zip'];
|
| 203 |
$result['phone'] = $response['phone'];
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
$result['customer_details_valid'] = true;
|
| 206 |
|
| 207 |
return $result;
|
|
@@ -232,16 +285,46 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 232 |
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 233 |
$addressInfo['use_for_shipping'] = 1;
|
| 234 |
|
|
|
|
|
|
|
| 235 |
return $addressInfo;
|
| 236 |
}
|
| 237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
/**
|
| 239 |
* @param $quote
|
| 240 |
* @param array $data
|
| 241 |
*
|
| 242 |
* @return $this
|
| 243 |
*/
|
| 244 |
-
protected function _saveBillingAndShippingAddress($quote, $
|
| 245 |
{
|
| 246 |
$address = $quote->getBillingAddress();
|
| 247 |
/** @var $addressForm Mage_Customer_Model_Form */
|
|
@@ -250,7 +333,7 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 250 |
$addressForm->setEntityType('customer_address');
|
| 251 |
$addressForm->setEntity($address);
|
| 252 |
// emulate request object
|
| 253 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($
|
| 254 |
$addressErrors = $addressForm->validateData($addressData);
|
| 255 |
if (true !== $addressErrors) {
|
| 256 |
Mage::log("Minkasu - address validation failed");
|
|
@@ -258,12 +341,12 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 258 |
$addressForm->compactData($addressData);
|
| 259 |
//unset billing address attributes which were not shown in form
|
| 260 |
foreach ($addressForm->getAttributes() as $attribute) {
|
| 261 |
-
if (!isset($
|
| 262 |
$address->setData($attribute->getAttributeCode(), NULL);
|
| 263 |
}
|
| 264 |
}
|
| 265 |
$address->setCustomerAddressId(null);
|
| 266 |
-
$address->setEmail($
|
| 267 |
$address->implodeStreetAddress();
|
| 268 |
|
| 269 |
$billing = clone $address;
|
|
@@ -278,14 +361,14 @@ class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
|
| 278 |
// don't reset original shipping data, if it was not changed by customer
|
| 279 |
foreach ($shipping->getData() as $shippingKey => $shippingValue) {
|
| 280 |
if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
|
| 281 |
-
&& !isset($
|
| 282 |
) {
|
| 283 |
$billing->unsetData($shippingKey);
|
| 284 |
}
|
| 285 |
}
|
| 286 |
|
| 287 |
-
|
| 288 |
-
|
| 289 |
$shipping->setSaveInAddressBook(0);
|
| 290 |
$shipping->setShippingMethod($shippingMethod);
|
| 291 |
$shipping->setCollectShippingRates(true);
|
| 25 |
|
| 26 |
}
|
| 27 |
|
| 28 |
+
public function setPaymentMethodToMinkasuAction()
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 32 |
+
$quote = $checkoutSession->getQuote();
|
| 33 |
+
/*
|
| 34 |
+
if($quote->isVirtual()) {
|
| 35 |
+
$quote->getBillingAddress()->setPaymentMethod('minkasu_wallet');
|
| 36 |
+
} else {
|
| 37 |
+
$quote->getShippingAddress()->setPaymentMethod('minkasu_wallet');
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
// shipping totals may be affected by payment method
|
| 41 |
+
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 42 |
+
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
$versionArr = Mage::getVersionInfo();
|
| 46 |
+
$versionStr = $versionArr['major'] . "." . $versionArr['minor'];
|
| 47 |
+
Mage::log("Minkasu - Magento Version: " . $versionStr);
|
| 48 |
+
$versionFlt = floatval($versionStr);
|
| 49 |
+
|
| 50 |
+
if ($versionFlt >= 1.8) {
|
| 51 |
+
Mage::log("Minkasu - Setting Payment Model Method Checks");
|
| 52 |
+
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
|
| 53 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
|
| 54 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
|
| 55 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
|
| 56 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
|
| 57 |
+
}
|
| 58 |
+
*/
|
| 59 |
+
|
| 60 |
+
$payment = $quote->getPayment();
|
| 61 |
+
$payment->importData(array('method' => 'minkasu_wallet'));
|
| 62 |
+
$quote->save();
|
| 63 |
+
|
| 64 |
+
$result = ["status" => "success"];
|
| 65 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 66 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 67 |
+
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
|
| 71 |
public function applyCouponCodeAction()
|
| 72 |
{
|
| 137 |
// Step 2.1:Fill customer name (first name ?)
|
| 138 |
$quote->setCustomerFirstname($customerDetails['customer_name']);
|
| 139 |
// Step 3: Fill the address and save it as billing and shipping address
|
| 140 |
+
$billingAddressInfo = $this->_prepareBillingAddressInfo($customerDetails);
|
| 141 |
+
$shippingAddressInfo = $this->_prepareCustomerAddressInfo($customerDetails);
|
| 142 |
+
$this->_saveBillingAndShippingAddress($quote, $billingAddressInfo, $shippingAddressInfo);
|
| 143 |
|
| 144 |
// Step 4: Shipping method should already be set by now.
|
| 145 |
$checkoutSession->setStepData('shipping_method', 'complete', true);
|
| 227 |
*
|
| 228 |
* @return array
|
| 229 |
*/
|
| 230 |
+
protected function _extractCustomerDetails(array $response)
|
| 231 |
+
{
|
| 232 |
$result = array();
|
| 233 |
|
| 234 |
+
$result['customer_details_valid'] = false;
|
| 235 |
|
| 236 |
+
if (!isset($response['customer_address'])
|
| 237 |
+
|| (!isset($response['customer_name']))
|
| 238 |
+
|| (!isset($response['billing_address']))) {
|
| 239 |
return $result;
|
| 240 |
}
|
| 241 |
|
| 242 |
$result['customer_name'] = $response['customer_name'];
|
| 243 |
+
$result['street_1'] = $response['customer_address']['address_line_1'];
|
| 244 |
$result['street_2'] = $response['customer_address']['address_line_2'];
|
| 245 |
$result['city'] = $response['customer_address']['city'];
|
| 246 |
+
$result['state'] = $response['customer_address']['state'];
|
| 247 |
$result['zip'] = $response['customer_address']['zip'];
|
| 248 |
$result['phone'] = $response['phone'];
|
| 249 |
+
$result['email'] = $response['email'];
|
| 250 |
+
|
| 251 |
+
$result['billing_address'] = array();
|
| 252 |
+
$result['billing_address']['street_1'] = $response['billing_address']['address_line_1'];
|
| 253 |
+
$result['billing_address']['street_2'] = $response['billing_address']['address_line_2'];
|
| 254 |
+
$result['billing_address']['city'] = $response['billing_address']['city'];
|
| 255 |
+
$result['billing_address']['state'] = $response['billing_address']['state'];
|
| 256 |
+
$result['billing_address']['zip'] = $response['billing_address']['zip'];
|
| 257 |
+
|
| 258 |
$result['customer_details_valid'] = true;
|
| 259 |
|
| 260 |
return $result;
|
| 285 |
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 286 |
$addressInfo['use_for_shipping'] = 1;
|
| 287 |
|
| 288 |
+
// Mage::log('Shipping address info - ' . print_r($addressInfo, true));
|
| 289 |
+
|
| 290 |
return $addressInfo;
|
| 291 |
}
|
| 292 |
|
| 293 |
+
protected function _prepareBillingAddressInfo(array $customerDetails)
|
| 294 |
+
{
|
| 295 |
+
|
| 296 |
+
/** @var $regionModel Mage_Directory_Model_Region */
|
| 297 |
+
$regionModel = Mage::getModel('directory/region');
|
| 298 |
+
$regionModel->loadByCode($customerDetails['billing_address']['state'], 'US');
|
| 299 |
+
|
| 300 |
+
$customerNameParts = explode(' ', $customerDetails['customer_name']);
|
| 301 |
+
|
| 302 |
+
$addressInfo = array();
|
| 303 |
+
$addressInfo['firstname'] = $customerNameParts[0];
|
| 304 |
+
$addressInfo['lastname'] = end($customerNameParts);
|
| 305 |
+
$addressInfo['email'] = $customerDetails['email'];
|
| 306 |
+
$addressInfo['street'] = array(0 => $customerDetails['billing_address']['street_1'], 1 => $customerDetails['billing_address']['street_2']);
|
| 307 |
+
$addressInfo['city'] = $customerDetails['billing_address']['city'];
|
| 308 |
+
$addressInfo['region_id'] = $regionModel->getId();
|
| 309 |
+
$addressInfo['postcode'] = $customerDetails['billing_address']['zip'];
|
| 310 |
+
$addressInfo['country_id'] = 'US';
|
| 311 |
+
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 312 |
+
$addressInfo['use_for_shipping'] = 0;
|
| 313 |
+
|
| 314 |
+
// Mage::log('Billing address info - ' . print_r($addressInfo, true));
|
| 315 |
+
|
| 316 |
+
return $addressInfo;
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
/**
|
| 322 |
* @param $quote
|
| 323 |
* @param array $data
|
| 324 |
*
|
| 325 |
* @return $this
|
| 326 |
*/
|
| 327 |
+
protected function _saveBillingAndShippingAddress($quote, $billing_data, $shipping_data)
|
| 328 |
{
|
| 329 |
$address = $quote->getBillingAddress();
|
| 330 |
/** @var $addressForm Mage_Customer_Model_Form */
|
| 333 |
$addressForm->setEntityType('customer_address');
|
| 334 |
$addressForm->setEntity($address);
|
| 335 |
// emulate request object
|
| 336 |
+
$addressData = $addressForm->extractData($addressForm->prepareRequest($billing_data));
|
| 337 |
$addressErrors = $addressForm->validateData($addressData);
|
| 338 |
if (true !== $addressErrors) {
|
| 339 |
Mage::log("Minkasu - address validation failed");
|
| 341 |
$addressForm->compactData($addressData);
|
| 342 |
//unset billing address attributes which were not shown in form
|
| 343 |
foreach ($addressForm->getAttributes() as $attribute) {
|
| 344 |
+
if (!isset($billing_data[$attribute->getAttributeCode()])) {
|
| 345 |
$address->setData($attribute->getAttributeCode(), NULL);
|
| 346 |
}
|
| 347 |
}
|
| 348 |
$address->setCustomerAddressId(null);
|
| 349 |
+
$address->setEmail($billing_data['email']);
|
| 350 |
$address->implodeStreetAddress();
|
| 351 |
|
| 352 |
$billing = clone $address;
|
| 361 |
// don't reset original shipping data, if it was not changed by customer
|
| 362 |
foreach ($shipping->getData() as $shippingKey => $shippingValue) {
|
| 363 |
if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
|
| 364 |
+
&& !isset($billing_data[$shippingKey]) && !in_array($shippingKey, $requiredBillingAttributes)
|
| 365 |
) {
|
| 366 |
$billing->unsetData($shippingKey);
|
| 367 |
}
|
| 368 |
}
|
| 369 |
|
| 370 |
+
$shipping->addData($shipping_data);
|
| 371 |
+
$shipping->implodeStreetAddress();
|
| 372 |
$shipping->setSaveInAddressBook(0);
|
| 373 |
$shipping->setShippingMethod($shippingMethod);
|
| 374 |
$shipping->setCollectShippingRates(true);
|
app/code/community/Minkasu/Wallet/controllers/PaymentController.php.bk
DELETED
|
@@ -1,432 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
public function getShippingRatesAction()
|
| 7 |
-
{
|
| 8 |
-
|
| 9 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 10 |
-
$quote = $checkoutSession->getQuote();
|
| 11 |
-
$address = $quote->getShippingAddress();
|
| 12 |
-
|
| 13 |
-
$rates = $address->collectShippingRates()->getGroupedAllShippingRates();
|
| 14 |
-
|
| 15 |
-
$result = array();
|
| 16 |
-
|
| 17 |
-
foreach ($rates as $carrier) {
|
| 18 |
-
foreach ($carrier as $rate) {
|
| 19 |
-
array_push($result, $rate->getData());
|
| 20 |
-
}
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 24 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Make a payment
|
| 31 |
-
*/
|
| 32 |
-
public function paidAction()
|
| 33 |
-
{
|
| 34 |
-
/** @var $coreResource Mage_Core_Model_Resource */
|
| 35 |
-
$coreResource = Mage::getSingleton('core/resource');
|
| 36 |
-
$writeAdapter = $coreResource->getConnection('core_write');
|
| 37 |
-
|
| 38 |
-
// Step 1: Get the current quote object
|
| 39 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 40 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 41 |
-
$quote = $checkoutSession->getQuote();
|
| 42 |
-
|
| 43 |
-
try {
|
| 44 |
-
$writeAdapter->beginTransaction();
|
| 45 |
-
|
| 46 |
-
$minkasuTransactionId = $checkoutSession->getData('minkasu_txn_id');
|
| 47 |
-
$transactionInfoResponse = $this->_getMinkasuTransaction($minkasuTransactionId);
|
| 48 |
-
if (!isset($transactionInfoResponse['txn_state']) || $transactionInfoResponse['txn_state']
|
| 49 |
-
!= Minkasu_Wallet_Model_Api_Type_Transaction::STATE_PREAUTHED
|
| 50 |
-
) {
|
| 51 |
-
Mage::throwException('This transaction has wrong state.');
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
$customerDetails = $this->_extractCustomerDetails($transactionInfoResponse);
|
| 55 |
-
if (!($customerDetails['customer_details_valid'])) {
|
| 56 |
-
Mage::throwException('Required details not provided with payment.');
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
// Step 2: Set the checkout method as "guest
|
| 60 |
-
$quote->setCheckoutMethod('guest')->save();
|
| 61 |
-
// Step 2.1:Fill customer name (first name ?)
|
| 62 |
-
$quote->setCustomerFirstname($customerDetails['customer_name']);
|
| 63 |
-
// Step 3: Fill the address and save it as billing and shipping address
|
| 64 |
-
$addressInfo = $this->_prepareCustomerAddressInfo($customerDetails);
|
| 65 |
-
$this->_saveBillingAndShippingAddress($quote, $addressInfo);
|
| 66 |
-
|
| 67 |
-
// Step 4: Shipping method should already be set by now.
|
| 68 |
-
$checkoutSession->setStepData('shipping_method', 'complete', true);
|
| 69 |
-
|
| 70 |
-
// Step 5: Set payment method to minkasu wallet
|
| 71 |
-
$this->_savePayment($quote, array('method' => 'minkasu_wallet'));
|
| 72 |
-
|
| 73 |
-
// Calculate shipping rates now
|
| 74 |
-
$quote->getShippingAddress()->collectShippingRates()->save();
|
| 75 |
-
$quote->collectTotals()->save();
|
| 76 |
-
|
| 77 |
-
$writeAdapter->commit();
|
| 78 |
-
|
| 79 |
-
$order = $this->_saveOrder($quote);
|
| 80 |
-
|
| 81 |
-
if ($order->getId()) {
|
| 82 |
-
$this->_updateMinkasuTransactionWithOrderId($minkasuTransactionId, $order->getIncrementId());
|
| 83 |
-
} else {
|
| 84 |
-
Mage::throwException($this->__('Order has not been created.'));
|
| 85 |
-
}
|
| 86 |
-
} catch (Mage_Core_Exception $e) {
|
| 87 |
-
Mage::logException($e);
|
| 88 |
-
$writeAdapter->rollback();
|
| 89 |
-
|
| 90 |
-
try {
|
| 91 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 92 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 93 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 94 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 95 |
-
Mage::logException($internalException);
|
| 96 |
-
} catch (Exception $internalException) {
|
| 97 |
-
Mage::logException($internalException);
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
$this->_cleanCheckoutSessionParams();
|
| 101 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 102 |
-
$this->getResponse()->setBody($this->_prepareErrorBody($e->getMessage()));
|
| 103 |
-
$this->getResponse()->sendResponse();
|
| 104 |
-
die;
|
| 105 |
-
} catch (Exception $e) {
|
| 106 |
-
Mage::logException($e);
|
| 107 |
-
$writeAdapter->rollback();
|
| 108 |
-
|
| 109 |
-
try {
|
| 110 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 111 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 112 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 113 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 114 |
-
Mage::logException($internalException);
|
| 115 |
-
} catch (Exception $internalException) {
|
| 116 |
-
Mage::logException($internalException);
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
$this->_cleanCheckoutSessionParams();
|
| 120 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 121 |
-
$this->getResponse()->setBody(
|
| 122 |
-
$this->_prepareErrorBody('An error has occurred. Please contact store administrator.')
|
| 123 |
-
);
|
| 124 |
-
$this->getResponse()->sendResponse();
|
| 125 |
-
die;
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
$url = Mage::getUrl('checkout/onepage/success');
|
| 129 |
-
$this->getResponse()->setHttpResponseCode(201);
|
| 130 |
-
$this->getResponse()->setBody($this->_prepareBody(array('redirect_url' => $url)));
|
| 131 |
-
$this->getResponse()->sendResponse();
|
| 132 |
-
die;
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/**
|
| 136 |
-
* @param string $minkasuTransactionId
|
| 137 |
-
*
|
| 138 |
-
* @return array
|
| 139 |
-
*/
|
| 140 |
-
protected function _getMinkasuTransaction($minkasuTransactionId)
|
| 141 |
-
{
|
| 142 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 143 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 144 |
-
$result = $client->getType('transaction')->getTransaction($minkasuTransactionId);
|
| 145 |
-
return $result;
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
/**
|
| 149 |
-
* @param array $response
|
| 150 |
-
*
|
| 151 |
-
* @return array
|
| 152 |
-
*/
|
| 153 |
-
protected function _extractCustomerDetails(array $response)
|
| 154 |
-
{
|
| 155 |
-
$result = array();
|
| 156 |
-
|
| 157 |
-
$result['customer_details_valid'] = false;
|
| 158 |
-
|
| 159 |
-
if (!isset($response['customer_address']) || (!isset($response['customer_name']))) {
|
| 160 |
-
return $result;
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
$result['customer_name'] = $response['customer_name'];
|
| 164 |
-
$result['street_1'] = $response['customer_address']['address_line_1'];
|
| 165 |
-
$result['street_2'] = $response['customer_address']['address_line_2'];
|
| 166 |
-
$result['city'] = $response['customer_address']['city'];
|
| 167 |
-
$result['state'] = $response['customer_address']['state'];
|
| 168 |
-
$result['zip'] = $response['customer_address']['zip'];
|
| 169 |
-
$result['phone'] = $response['phone'];
|
| 170 |
-
$result['email'] = $response['email'];
|
| 171 |
-
$result['customer_details_valid'] = true;
|
| 172 |
-
|
| 173 |
-
return $result;
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
/**
|
| 177 |
-
* @param array $customerDetails
|
| 178 |
-
*
|
| 179 |
-
* @return array
|
| 180 |
-
*/
|
| 181 |
-
protected function _prepareCustomerAddressInfo(array $customerDetails)
|
| 182 |
-
{
|
| 183 |
-
/** @var $regionModel Mage_Directory_Model_Region */
|
| 184 |
-
$regionModel = Mage::getModel('directory/region');
|
| 185 |
-
$regionModel->loadByCode($customerDetails['state'], 'US');
|
| 186 |
-
|
| 187 |
-
$customerNameParts = explode(' ', $customerDetails['customer_name']);
|
| 188 |
-
|
| 189 |
-
$addressInfo = array();
|
| 190 |
-
$addressInfo['firstname'] = $customerNameParts[0];
|
| 191 |
-
$addressInfo['lastname'] = end($customerNameParts);
|
| 192 |
-
$addressInfo['email'] = $customerDetails['email'];
|
| 193 |
-
$addressInfo['street'] = array(0 => $customerDetails['street_1'], 1 => $customerDetails['street_2']);
|
| 194 |
-
$addressInfo['city'] = $customerDetails['city'];
|
| 195 |
-
$addressInfo['region_id'] = $regionModel->getId();
|
| 196 |
-
$addressInfo['postcode'] = $customerDetails['zip'];
|
| 197 |
-
$addressInfo['country_id'] = 'US';
|
| 198 |
-
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 199 |
-
$addressInfo['use_for_shipping'] = 1;
|
| 200 |
-
|
| 201 |
-
return $addressInfo;
|
| 202 |
-
}
|
| 203 |
-
|
| 204 |
-
/**
|
| 205 |
-
* @param $quote
|
| 206 |
-
* @param array $data
|
| 207 |
-
*
|
| 208 |
-
* @return $this
|
| 209 |
-
*/
|
| 210 |
-
protected function _saveBillingAndShippingAddress($quote, $data)
|
| 211 |
-
{
|
| 212 |
-
$address = $quote->getBillingAddress();
|
| 213 |
-
/** @var $addressForm Mage_Customer_Model_Form */
|
| 214 |
-
$addressForm = Mage::getModel('customer/form');
|
| 215 |
-
$addressForm->setFormCode('customer_address_edit');
|
| 216 |
-
$addressForm->setEntityType('customer_address');
|
| 217 |
-
$addressForm->setEntity($address);
|
| 218 |
-
// emulate request object
|
| 219 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($data));
|
| 220 |
-
$addressErrors = $addressForm->validateData($addressData);
|
| 221 |
-
if (true !== $addressErrors) {
|
| 222 |
-
Mage::log("Minkasu - address validation failed");
|
| 223 |
-
}
|
| 224 |
-
$addressForm->compactData($addressData);
|
| 225 |
-
//unset billing address attributes which were not shown in form
|
| 226 |
-
foreach ($addressForm->getAttributes() as $attribute) {
|
| 227 |
-
if (!isset($data[$attribute->getAttributeCode()])) {
|
| 228 |
-
$address->setData($attribute->getAttributeCode(), NULL);
|
| 229 |
-
}
|
| 230 |
-
}
|
| 231 |
-
$address->setCustomerAddressId(null);
|
| 232 |
-
$address->setEmail($data['email']);
|
| 233 |
-
$address->implodeStreetAddress();
|
| 234 |
-
|
| 235 |
-
$billing = clone $address;
|
| 236 |
-
$billing->unsAddressId()->unsAddressType();
|
| 237 |
-
|
| 238 |
-
$shipping = $quote->getShippingAddress();
|
| 239 |
-
$shippingMethod = $shipping->getShippingMethod();
|
| 240 |
-
|
| 241 |
-
// Billing address properties that must be always copied to shipping address
|
| 242 |
-
$requiredBillingAttributes = array('customer_address_id');
|
| 243 |
-
|
| 244 |
-
// don't reset original shipping data, if it was not changed by customer
|
| 245 |
-
foreach ($shipping->getData() as $shippingKey => $shippingValue) {
|
| 246 |
-
if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
|
| 247 |
-
&& !isset($data[$shippingKey]) && !in_array($shippingKey, $requiredBillingAttributes)
|
| 248 |
-
) {
|
| 249 |
-
$billing->unsetData($shippingKey);
|
| 250 |
-
}
|
| 251 |
-
}
|
| 252 |
-
|
| 253 |
-
$shipping->addData($billing->getData());
|
| 254 |
-
$shipping->setSameAsBilling(1);
|
| 255 |
-
$shipping->setSaveInAddressBook(0);
|
| 256 |
-
$shipping->setShippingMethod($shippingMethod);
|
| 257 |
-
$shipping->setCollectShippingRates(true);
|
| 258 |
-
|
| 259 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 260 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 261 |
-
$checkoutSession->setStepData('shipping', 'complete', true);
|
| 262 |
-
|
| 263 |
-
$quote->collectTotals();
|
| 264 |
-
$quote->save();
|
| 265 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 266 |
-
|
| 267 |
-
$checkoutSession->setStepData('billing', 'allow', true);
|
| 268 |
-
$checkoutSession->setStepData('billing', 'complete', true);
|
| 269 |
-
$checkoutSession->setStepData('shipping', 'allow', true);
|
| 270 |
-
|
| 271 |
-
return $this;
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
/**
|
| 275 |
-
* @param $quote
|
| 276 |
-
* @param array $data
|
| 277 |
-
*
|
| 278 |
-
* @return $this
|
| 279 |
-
*/
|
| 280 |
-
protected function _savePayment($quote, array $data)
|
| 281 |
-
{
|
| 282 |
-
try {
|
| 283 |
-
if($quote->isVirtual()) {
|
| 284 |
-
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 285 |
-
} else {
|
| 286 |
-
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 287 |
-
}
|
| 288 |
-
|
| 289 |
-
// shipping totals may be affected by payment method
|
| 290 |
-
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 291 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 292 |
-
}
|
| 293 |
-
|
| 294 |
-
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
|
| 295 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
|
| 296 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
|
| 297 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
|
| 298 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
|
| 299 |
-
|
| 300 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 301 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 302 |
-
$payment = $quote->getPayment();
|
| 303 |
-
$payment->importData($data);
|
| 304 |
-
$payment->setTransactionId($checkoutSession->getData('minkasu_txn_id'));
|
| 305 |
-
$payment->setTransactionAdditionalInfo('quote-no', $quote->getQuoteId());
|
| 306 |
-
|
| 307 |
-
$quote->save();
|
| 308 |
-
$checkoutSession->setStepData('payment', 'complete', true);
|
| 309 |
-
} catch (Exception $e) {
|
| 310 |
-
Mage::logException($e);
|
| 311 |
-
}
|
| 312 |
-
return $this;
|
| 313 |
-
}
|
| 314 |
-
|
| 315 |
-
/**
|
| 316 |
-
* @param $quote
|
| 317 |
-
*
|
| 318 |
-
* @return Mage_Sales_Model_Order
|
| 319 |
-
*/
|
| 320 |
-
protected function _saveOrder($quote)
|
| 321 |
-
{
|
| 322 |
-
$quote->setCustomerId(null);
|
| 323 |
-
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
|
| 324 |
-
$quote->setCustomerIsGuest(true);
|
| 325 |
-
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
| 326 |
-
|
| 327 |
-
/** @var $service Mage_Sales_Model_Service_Quote */
|
| 328 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
| 329 |
-
$service->submitAll();
|
| 330 |
-
|
| 331 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 332 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 333 |
-
$checkoutSession->setLastQuoteId($quote->getId());
|
| 334 |
-
$checkoutSession->setLastSuccessQuoteId($quote->getId());
|
| 335 |
-
$checkoutSession->clearHelperData();
|
| 336 |
-
|
| 337 |
-
$order = $service->getOrder();
|
| 338 |
-
|
| 339 |
-
if ($order->getId()) {
|
| 340 |
-
Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$quote));
|
| 341 |
-
|
| 342 |
-
/**
|
| 343 |
-
* we only want to send to customer about new order when there is no redirect to third party
|
| 344 |
-
*/
|
| 345 |
-
if ($order->getCanSendNewEmailFlag()) {
|
| 346 |
-
try {
|
| 347 |
-
$order->sendNewOrderEmail();
|
| 348 |
-
} catch (Exception $e) {
|
| 349 |
-
Mage::logException($e);
|
| 350 |
-
}
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
// add order information to the session
|
| 354 |
-
$checkoutSession->setLastOrderId($order->getId());
|
| 355 |
-
$checkoutSession->setRedirectUrl(null);
|
| 356 |
-
$checkoutSession->setLastRealOrderId($order->getIncrementId());
|
| 357 |
-
|
| 358 |
-
// as well a billing agreement can be created
|
| 359 |
-
$agreement = $order->getPayment()->getBillingAgreement();
|
| 360 |
-
if ($agreement) {
|
| 361 |
-
$checkoutSession->setLastBillingAgreementId($agreement->getId());
|
| 362 |
-
}
|
| 363 |
-
}
|
| 364 |
-
|
| 365 |
-
// add recurring profiles information to the session
|
| 366 |
-
$profiles = $service->getRecurringPaymentProfiles();
|
| 367 |
-
if ($profiles) {
|
| 368 |
-
$ids = array();
|
| 369 |
-
foreach ($profiles as $profile) {
|
| 370 |
-
$ids[] = $profile->getId();
|
| 371 |
-
}
|
| 372 |
-
$checkoutSession->setLastRecurringProfileIds($ids);
|
| 373 |
-
}
|
| 374 |
-
|
| 375 |
-
Mage::dispatchEvent(
|
| 376 |
-
'checkout_submit_all_after',
|
| 377 |
-
array('order' => $order, 'quote' => $quote, 'recurring_profiles' => $profiles)
|
| 378 |
-
);
|
| 379 |
-
|
| 380 |
-
$quote->save();
|
| 381 |
-
return $order;
|
| 382 |
-
}
|
| 383 |
-
|
| 384 |
-
/**
|
| 385 |
-
* @param string $minkasuTransactionId
|
| 386 |
-
* @param string $orderId
|
| 387 |
-
*
|
| 388 |
-
* @return array
|
| 389 |
-
*/
|
| 390 |
-
protected function _updateMinkasuTransactionWithOrderId($minkasuTransactionId, $orderId)
|
| 391 |
-
{
|
| 392 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 393 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 394 |
-
$result = $client->getType('transaction')->updateTransaction($minkasuTransactionId, array('merchant_bill_number' => $orderId), NULL);
|
| 395 |
-
|
| 396 |
-
return $result;
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
/**
|
| 400 |
-
* @return $this
|
| 401 |
-
*/
|
| 402 |
-
protected function _cleanCheckoutSessionParams()
|
| 403 |
-
{
|
| 404 |
-
/** @var $helper Minkasu_Wallet_Helper_Data */
|
| 405 |
-
$helper = Mage::helper('minkasu_wallet');
|
| 406 |
-
$helper->cleanCheckoutSessionParams();
|
| 407 |
-
return $this;
|
| 408 |
-
}
|
| 409 |
-
|
| 410 |
-
/**
|
| 411 |
-
* @param string $error
|
| 412 |
-
*
|
| 413 |
-
* @return string
|
| 414 |
-
*/
|
| 415 |
-
protected function _prepareErrorBody($error)
|
| 416 |
-
{
|
| 417 |
-
return $this->_prepareBody(array('error' => $this->__($error)));
|
| 418 |
-
}
|
| 419 |
-
|
| 420 |
-
/**
|
| 421 |
-
* @param array $data
|
| 422 |
-
*
|
| 423 |
-
* @return string
|
| 424 |
-
*/
|
| 425 |
-
protected function _prepareBody(array $data)
|
| 426 |
-
{
|
| 427 |
-
/** @var $helper Mage_Core_Helper_Data */
|
| 428 |
-
$helper = Mage::helper('core');
|
| 429 |
-
return $helper->jsonEncode($data);
|
| 430 |
-
}
|
| 431 |
-
}
|
| 432 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/controllers/PaymentController.php.old
DELETED
|
@@ -1,408 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* Make a payment
|
| 7 |
-
*/
|
| 8 |
-
public function paidAction()
|
| 9 |
-
{
|
| 10 |
-
/** @var $coreResource Mage_Core_Model_Resource */
|
| 11 |
-
$coreResource = Mage::getSingleton('core/resource');
|
| 12 |
-
$writeAdapter = $coreResource->getConnection('core_write');
|
| 13 |
-
|
| 14 |
-
// Step 1: Get the current quote object
|
| 15 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 16 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 17 |
-
$quote = $checkoutSession->getQuote();
|
| 18 |
-
|
| 19 |
-
try {
|
| 20 |
-
$writeAdapter->beginTransaction();
|
| 21 |
-
|
| 22 |
-
$minkasuTransactionId = $checkoutSession->getData('minkasu_txn_id');
|
| 23 |
-
$transactionInfoResponse = $this->_getMinkasuTransaction($minkasuTransactionId);
|
| 24 |
-
if (!isset($transactionInfoResponse['txn_state']) || $transactionInfoResponse['txn_state']
|
| 25 |
-
!= Minkasu_Wallet_Model_Api_Type_Transaction::STATE_PREAUTHED
|
| 26 |
-
) {
|
| 27 |
-
Mage::throwException('This transaction has wrong state.');
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
$customerDetails = $this->_extractCustomerDetails($transactionInfoResponse);
|
| 31 |
-
if (!($customerDetails['customer_details_valid'])) {
|
| 32 |
-
Mage::throwException('Required details not provided with payment.');
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
// Step 2: Set the checkout method as "guest
|
| 36 |
-
$quote->setCheckoutMethod('guest')->save();
|
| 37 |
-
// Step 2.1:Fill customer name (first name ?)
|
| 38 |
-
$quote->setCustomerFirstname($customerDetails['customer_name']);
|
| 39 |
-
// Step 3: Fill the address and save it as billing and shipping address
|
| 40 |
-
$addressInfo = $this->_prepareCustomerAddressInfo($customerDetails);
|
| 41 |
-
$this->_saveBillingAndShippingAddress($quote, $addressInfo);
|
| 42 |
-
|
| 43 |
-
// Step 4: Shipping method should already be set by now.
|
| 44 |
-
$checkoutSession->setStepData('shipping_method', 'complete', true);
|
| 45 |
-
|
| 46 |
-
// Step 5: Set payment method to minkasu wallet
|
| 47 |
-
$this->_savePayment($quote, array('method' => 'minkasu_wallet'));
|
| 48 |
-
|
| 49 |
-
// Calculate shipping rates now
|
| 50 |
-
$quote->getShippingAddress()->collectShippingRates()->save();
|
| 51 |
-
$quote->collectTotals()->save();
|
| 52 |
-
|
| 53 |
-
$writeAdapter->commit();
|
| 54 |
-
|
| 55 |
-
$order = $this->_saveOrder($quote);
|
| 56 |
-
|
| 57 |
-
if ($order->getId()) {
|
| 58 |
-
$this->_updateMinkasuTransactionWithOrderId($minkasuTransactionId, $order->getIncrementId());
|
| 59 |
-
} else {
|
| 60 |
-
Mage::throwException($this->__('Order has not been created.'));
|
| 61 |
-
}
|
| 62 |
-
} catch (Mage_Core_Exception $e) {
|
| 63 |
-
Mage::logException($e);
|
| 64 |
-
$writeAdapter->rollback();
|
| 65 |
-
|
| 66 |
-
try {
|
| 67 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 68 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 69 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 70 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 71 |
-
Mage::logException($internalException);
|
| 72 |
-
} catch (Exception $internalException) {
|
| 73 |
-
Mage::logException($internalException);
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
$this->_cleanCheckoutSessionParams();
|
| 77 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 78 |
-
$this->getResponse()->setBody($this->_prepareErrorBody($e->getMessage()));
|
| 79 |
-
$this->getResponse()->sendResponse();
|
| 80 |
-
die;
|
| 81 |
-
} catch (Exception $e) {
|
| 82 |
-
Mage::logException($e);
|
| 83 |
-
$writeAdapter->rollback();
|
| 84 |
-
|
| 85 |
-
try {
|
| 86 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 87 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 88 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 89 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 90 |
-
Mage::logException($internalException);
|
| 91 |
-
} catch (Exception $internalException) {
|
| 92 |
-
Mage::logException($internalException);
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
$this->_cleanCheckoutSessionParams();
|
| 96 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 97 |
-
$this->getResponse()->setBody(
|
| 98 |
-
$this->_prepareErrorBody('An error has occurred. Please contact store administrator.')
|
| 99 |
-
);
|
| 100 |
-
$this->getResponse()->sendResponse();
|
| 101 |
-
die;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
$url = Mage::getUrl('checkout/onepage/success');
|
| 105 |
-
$this->getResponse()->setHttpResponseCode(201);
|
| 106 |
-
$this->getResponse()->setBody($this->_prepareBody(array('redirect_url' => $url)));
|
| 107 |
-
$this->getResponse()->sendResponse();
|
| 108 |
-
die;
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
/**
|
| 112 |
-
* @param string $minkasuTransactionId
|
| 113 |
-
*
|
| 114 |
-
* @return array
|
| 115 |
-
*/
|
| 116 |
-
protected function _getMinkasuTransaction($minkasuTransactionId)
|
| 117 |
-
{
|
| 118 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 119 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 120 |
-
$result = $client->getType('transaction')->getTransaction($minkasuTransactionId);
|
| 121 |
-
return $result;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
/**
|
| 125 |
-
* @param array $response
|
| 126 |
-
*
|
| 127 |
-
* @return array
|
| 128 |
-
*/
|
| 129 |
-
protected function _extractCustomerDetails(array $response)
|
| 130 |
-
{
|
| 131 |
-
$result = array();
|
| 132 |
-
|
| 133 |
-
$result['customer_details_valid'] = false;
|
| 134 |
-
|
| 135 |
-
if (!isset($response['customer_address']) || (!isset($response['customer_name']))) {
|
| 136 |
-
return $result;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
$result['customer_name'] = $response['customer_name'];
|
| 140 |
-
$result['street_1'] = $response['customer_address']['address_line_1'];
|
| 141 |
-
$result['street_2'] = $response['customer_address']['address_line_2'];
|
| 142 |
-
$result['city'] = $response['customer_address']['city'];
|
| 143 |
-
$result['state'] = $response['customer_address']['state'];
|
| 144 |
-
$result['zip'] = $response['customer_address']['zip'];
|
| 145 |
-
$result['phone'] = $response['phone'];
|
| 146 |
-
$result['email'] = $response['email'];
|
| 147 |
-
$result['customer_details_valid'] = true;
|
| 148 |
-
|
| 149 |
-
return $result;
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
/**
|
| 153 |
-
* @param array $customerDetails
|
| 154 |
-
*
|
| 155 |
-
* @return array
|
| 156 |
-
*/
|
| 157 |
-
protected function _prepareCustomerAddressInfo(array $customerDetails)
|
| 158 |
-
{
|
| 159 |
-
/** @var $regionModel Mage_Directory_Model_Region */
|
| 160 |
-
$regionModel = Mage::getModel('directory/region');
|
| 161 |
-
$regionModel->loadByCode($customerDetails['state'], 'US');
|
| 162 |
-
|
| 163 |
-
$customerNameParts = explode(' ', $customerDetails['customer_name']);
|
| 164 |
-
|
| 165 |
-
$addressInfo = array();
|
| 166 |
-
$addressInfo['firstname'] = $customerNameParts[0];
|
| 167 |
-
$addressInfo['lastname'] = end($customerNameParts);
|
| 168 |
-
$addressInfo['email'] = $customerDetails['email'];
|
| 169 |
-
$addressInfo['street'] = array(0 => $customerDetails['street_1'], 1 => $customerDetails['street_2']);
|
| 170 |
-
$addressInfo['city'] = $customerDetails['city'];
|
| 171 |
-
$addressInfo['region_id'] = $regionModel->getId();
|
| 172 |
-
$addressInfo['postcode'] = $customerDetails['zip'];
|
| 173 |
-
$addressInfo['country_id'] = 'US';
|
| 174 |
-
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 175 |
-
$addressInfo['use_for_shipping'] = 1;
|
| 176 |
-
|
| 177 |
-
return $addressInfo;
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
/**
|
| 181 |
-
* @param $quote
|
| 182 |
-
* @param array $data
|
| 183 |
-
*
|
| 184 |
-
* @return $this
|
| 185 |
-
*/
|
| 186 |
-
protected function _saveBillingAndShippingAddress($quote, $data)
|
| 187 |
-
{
|
| 188 |
-
$address = $quote->getBillingAddress();
|
| 189 |
-
/** @var $addressForm Mage_Customer_Model_Form */
|
| 190 |
-
$addressForm = Mage::getModel('customer/form');
|
| 191 |
-
$addressForm->setFormCode('customer_address_edit');
|
| 192 |
-
$addressForm->setEntityType('customer_address');
|
| 193 |
-
$addressForm->setEntity($address);
|
| 194 |
-
// emulate request object
|
| 195 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($data));
|
| 196 |
-
$addressErrors = $addressForm->validateData($addressData);
|
| 197 |
-
if (true !== $addressErrors) {
|
| 198 |
-
Mage::log("Minkasu - address validation failed");
|
| 199 |
-
}
|
| 200 |
-
$addressForm->compactData($addressData);
|
| 201 |
-
//unset billing address attributes which were not shown in form
|
| 202 |
-
foreach ($addressForm->getAttributes() as $attribute) {
|
| 203 |
-
if (!isset($data[$attribute->getAttributeCode()])) {
|
| 204 |
-
$address->setData($attribute->getAttributeCode(), NULL);
|
| 205 |
-
}
|
| 206 |
-
}
|
| 207 |
-
$address->setCustomerAddressId(null);
|
| 208 |
-
$address->setEmail($data['email']);
|
| 209 |
-
$address->implodeStreetAddress();
|
| 210 |
-
|
| 211 |
-
$billing = clone $address;
|
| 212 |
-
$billing->unsAddressId()->unsAddressType();
|
| 213 |
-
|
| 214 |
-
$shipping = $quote->getShippingAddress();
|
| 215 |
-
$shippingMethod = $shipping->getShippingMethod();
|
| 216 |
-
|
| 217 |
-
// Billing address properties that must be always copied to shipping address
|
| 218 |
-
$requiredBillingAttributes = array('customer_address_id');
|
| 219 |
-
|
| 220 |
-
// don't reset original shipping data, if it was not changed by customer
|
| 221 |
-
foreach ($shipping->getData() as $shippingKey => $shippingValue) {
|
| 222 |
-
if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
|
| 223 |
-
&& !isset($data[$shippingKey]) && !in_array($shippingKey, $requiredBillingAttributes)
|
| 224 |
-
) {
|
| 225 |
-
$billing->unsetData($shippingKey);
|
| 226 |
-
}
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
$shipping->addData($billing->getData());
|
| 230 |
-
$shipping->setSameAsBilling(1);
|
| 231 |
-
$shipping->setSaveInAddressBook(0);
|
| 232 |
-
$shipping->setShippingMethod($shippingMethod);
|
| 233 |
-
$shipping->setCollectShippingRates(true);
|
| 234 |
-
|
| 235 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 236 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 237 |
-
$checkoutSession->setStepData('shipping', 'complete', true);
|
| 238 |
-
|
| 239 |
-
$quote->collectTotals();
|
| 240 |
-
$quote->save();
|
| 241 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 242 |
-
|
| 243 |
-
$checkoutSession->setStepData('billing', 'allow', true);
|
| 244 |
-
$checkoutSession->setStepData('billing', 'complete', true);
|
| 245 |
-
$checkoutSession->setStepData('shipping', 'allow', true);
|
| 246 |
-
|
| 247 |
-
return $this;
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
/**
|
| 251 |
-
* @param $quote
|
| 252 |
-
* @param array $data
|
| 253 |
-
*
|
| 254 |
-
* @return $this
|
| 255 |
-
*/
|
| 256 |
-
protected function _savePayment($quote, array $data)
|
| 257 |
-
{
|
| 258 |
-
try {
|
| 259 |
-
if($quote->isVirtual()) {
|
| 260 |
-
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 261 |
-
} else {
|
| 262 |
-
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 263 |
-
}
|
| 264 |
-
|
| 265 |
-
// shipping totals may be affected by payment method
|
| 266 |
-
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 267 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 268 |
-
}
|
| 269 |
-
|
| 270 |
-
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
|
| 271 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
|
| 272 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
|
| 273 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
|
| 274 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
|
| 275 |
-
|
| 276 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 277 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 278 |
-
$payment = $quote->getPayment();
|
| 279 |
-
$payment->importData($data);
|
| 280 |
-
$payment->setTransactionId($checkoutSession->getData('minkasu_txn_id'));
|
| 281 |
-
$payment->setTransactionAdditionalInfo('quote-no', $quote->getQuoteId());
|
| 282 |
-
|
| 283 |
-
$quote->save();
|
| 284 |
-
$checkoutSession->setStepData('payment', 'complete', true);
|
| 285 |
-
} catch (Exception $e) {
|
| 286 |
-
Mage::logException($e);
|
| 287 |
-
}
|
| 288 |
-
return $this;
|
| 289 |
-
}
|
| 290 |
-
|
| 291 |
-
/**
|
| 292 |
-
* @param $quote
|
| 293 |
-
*
|
| 294 |
-
* @return Mage_Sales_Model_Order
|
| 295 |
-
*/
|
| 296 |
-
protected function _saveOrder($quote)
|
| 297 |
-
{
|
| 298 |
-
$quote->setCustomerId(null);
|
| 299 |
-
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
|
| 300 |
-
$quote->setCustomerIsGuest(true);
|
| 301 |
-
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
| 302 |
-
|
| 303 |
-
/** @var $service Mage_Sales_Model_Service_Quote */
|
| 304 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
| 305 |
-
$service->submitAll();
|
| 306 |
-
|
| 307 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 308 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 309 |
-
$checkoutSession->setLastQuoteId($quote->getId());
|
| 310 |
-
$checkoutSession->setLastSuccessQuoteId($quote->getId());
|
| 311 |
-
$checkoutSession->clearHelperData();
|
| 312 |
-
|
| 313 |
-
$order = $service->getOrder();
|
| 314 |
-
|
| 315 |
-
if ($order->getId()) {
|
| 316 |
-
Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$quote));
|
| 317 |
-
|
| 318 |
-
/**
|
| 319 |
-
* we only want to send to customer about new order when there is no redirect to third party
|
| 320 |
-
*/
|
| 321 |
-
if ($order->getCanSendNewEmailFlag()) {
|
| 322 |
-
try {
|
| 323 |
-
$order->sendNewOrderEmail();
|
| 324 |
-
} catch (Exception $e) {
|
| 325 |
-
Mage::logException($e);
|
| 326 |
-
}
|
| 327 |
-
}
|
| 328 |
-
|
| 329 |
-
// add order information to the session
|
| 330 |
-
$checkoutSession->setLastOrderId($order->getId());
|
| 331 |
-
$checkoutSession->setRedirectUrl(null);
|
| 332 |
-
$checkoutSession->setLastRealOrderId($order->getIncrementId());
|
| 333 |
-
|
| 334 |
-
// as well a billing agreement can be created
|
| 335 |
-
$agreement = $order->getPayment()->getBillingAgreement();
|
| 336 |
-
if ($agreement) {
|
| 337 |
-
$checkoutSession->setLastBillingAgreementId($agreement->getId());
|
| 338 |
-
}
|
| 339 |
-
}
|
| 340 |
-
|
| 341 |
-
// add recurring profiles information to the session
|
| 342 |
-
$profiles = $service->getRecurringPaymentProfiles();
|
| 343 |
-
if ($profiles) {
|
| 344 |
-
$ids = array();
|
| 345 |
-
foreach ($profiles as $profile) {
|
| 346 |
-
$ids[] = $profile->getId();
|
| 347 |
-
}
|
| 348 |
-
$checkoutSession->setLastRecurringProfileIds($ids);
|
| 349 |
-
}
|
| 350 |
-
|
| 351 |
-
Mage::dispatchEvent(
|
| 352 |
-
'checkout_submit_all_after',
|
| 353 |
-
array('order' => $order, 'quote' => $quote, 'recurring_profiles' => $profiles)
|
| 354 |
-
);
|
| 355 |
-
|
| 356 |
-
$quote->save();
|
| 357 |
-
return $order;
|
| 358 |
-
}
|
| 359 |
-
|
| 360 |
-
/**
|
| 361 |
-
* @param string $minkasuTransactionId
|
| 362 |
-
* @param string $orderId
|
| 363 |
-
*
|
| 364 |
-
* @return array
|
| 365 |
-
*/
|
| 366 |
-
protected function _updateMinkasuTransactionWithOrderId($minkasuTransactionId, $orderId)
|
| 367 |
-
{
|
| 368 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 369 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 370 |
-
$result = $client->getType('transaction')->updateTransaction($minkasuTransactionId, array('merchant_bill_number' => $orderId), NULL);
|
| 371 |
-
|
| 372 |
-
return $result;
|
| 373 |
-
}
|
| 374 |
-
|
| 375 |
-
/**
|
| 376 |
-
* @return $this
|
| 377 |
-
*/
|
| 378 |
-
protected function _cleanCheckoutSessionParams()
|
| 379 |
-
{
|
| 380 |
-
/** @var $helper Minkasu_Wallet_Helper_Data */
|
| 381 |
-
$helper = Mage::helper('minkasu_wallet');
|
| 382 |
-
$helper->cleanCheckoutSessionParams();
|
| 383 |
-
return $this;
|
| 384 |
-
}
|
| 385 |
-
|
| 386 |
-
/**
|
| 387 |
-
* @param string $error
|
| 388 |
-
*
|
| 389 |
-
* @return string
|
| 390 |
-
*/
|
| 391 |
-
protected function _prepareErrorBody($error)
|
| 392 |
-
{
|
| 393 |
-
return $this->_prepareBody(array('error' => $this->__($error)));
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
/**
|
| 397 |
-
* @param array $data
|
| 398 |
-
*
|
| 399 |
-
* @return string
|
| 400 |
-
*/
|
| 401 |
-
protected function _prepareBody(array $data)
|
| 402 |
-
{
|
| 403 |
-
/** @var $helper Mage_Core_Helper_Data */
|
| 404 |
-
$helper = Mage::helper('core');
|
| 405 |
-
return $helper->jsonEncode($data);
|
| 406 |
-
}
|
| 407 |
-
}
|
| 408 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/controllers/PaymentController.php~
DELETED
|
@@ -1,410 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_PaymentController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* Make a payment
|
| 7 |
-
*/
|
| 8 |
-
public function paidAction()
|
| 9 |
-
{
|
| 10 |
-
/** @var $coreResource Mage_Core_Model_Resource */
|
| 11 |
-
$coreResource = Mage::getSingleton('core/resource');
|
| 12 |
-
$writeAdapter = $coreResource->getConnection('core_write');
|
| 13 |
-
|
| 14 |
-
// Step 1: Get the current quote object
|
| 15 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 16 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 17 |
-
$quote = $checkoutSession->getQuote();
|
| 18 |
-
|
| 19 |
-
try {
|
| 20 |
-
$writeAdapter->beginTransaction();
|
| 21 |
-
|
| 22 |
-
$minkasuTransactionId = $checkoutSession->getData('minkasu_txn_id');
|
| 23 |
-
$transactionInfoResponse = $this->_getMinkasuTransaction($minkasuTransactionId);
|
| 24 |
-
if (!isset($transactionInfoResponse['txn_state']) || $transactionInfoResponse['txn_state']
|
| 25 |
-
!= Minkasu_Wallet_Model_Api_Type_Transaction::STATE_PREAUTHED
|
| 26 |
-
) {
|
| 27 |
-
Mage::throwException('This transaction has wrong state.');
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
$customerDetails = $this->_extractCustomerDetails($transactionInfoResponse);
|
| 31 |
-
if (!($customerDetails['customer_details_valid'])) {
|
| 32 |
-
Mage::throwException('Required details not provided with payment.');
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
// Step 2: Set the checkout method as "guest
|
| 36 |
-
$quote->setCheckoutMethod('guest')->save();
|
| 37 |
-
// Step 2.1:Fill customer name (first name ?)
|
| 38 |
-
$quote->setCustomerFirstname($customerDetails['customer_name']);
|
| 39 |
-
// Step 3: Fill the address and save it as billing and shipping address
|
| 40 |
-
$addressInfo = $this->_prepareCustomerAddressInfo($customerDetails);
|
| 41 |
-
$this->_saveBillingAndShippingAddress($quote, $addressInfo);
|
| 42 |
-
|
| 43 |
-
// Step 4: Shipping method should already be set by now.
|
| 44 |
-
$checkoutSession->setStepData('shipping_method', 'complete', true);
|
| 45 |
-
|
| 46 |
-
// Step 5: Set payment method to minkasu wallet
|
| 47 |
-
$this->_savePayment($quote, array('method' => 'minkasu_wallet'));
|
| 48 |
-
|
| 49 |
-
// Calculate shipping rates now
|
| 50 |
-
$quote->getShippingAddress()->collectShippingRates()->save();
|
| 51 |
-
$quote->collectTotals()->save();
|
| 52 |
-
|
| 53 |
-
Mage::log("Minkasu - Estimated and collected totals");
|
| 54 |
-
|
| 55 |
-
$writeAdapter->commit();
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
$order = $this->_saveOrder($quote);
|
| 59 |
-
if ($order->getId()) {
|
| 60 |
-
$this->_updateMinkasuTransactionWithOrderId($minkasuTransactionId, $order->getIncrementId());
|
| 61 |
-
} else {
|
| 62 |
-
Mage::throwException($this->__('Order has not been created.'));
|
| 63 |
-
}
|
| 64 |
-
} catch (Mage_Core_Exception $e) {
|
| 65 |
-
Mage::logException($e);
|
| 66 |
-
$writeAdapter->rollback();
|
| 67 |
-
|
| 68 |
-
try {
|
| 69 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 70 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 71 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 72 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 73 |
-
Mage::logException($internalException);
|
| 74 |
-
} catch (Exception $internalException) {
|
| 75 |
-
Mage::logException($internalException);
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
$this->_cleanCheckoutSessionParams();
|
| 79 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 80 |
-
$this->getResponse()->setBody($this->_prepareErrorBody($e->getMessage()));
|
| 81 |
-
$this->getResponse()->sendResponse();
|
| 82 |
-
die;
|
| 83 |
-
} catch (Exception $e) {
|
| 84 |
-
Mage::logException($e);
|
| 85 |
-
$writeAdapter->rollback();
|
| 86 |
-
|
| 87 |
-
try {
|
| 88 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 89 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 90 |
-
$client->getType('transaction')->voidTransaction($minkasuTransactionId);
|
| 91 |
-
} catch (Mage_Core_Exception $internalException) {
|
| 92 |
-
Mage::logException($internalException);
|
| 93 |
-
} catch (Exception $internalException) {
|
| 94 |
-
Mage::logException($internalException);
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
$this->_cleanCheckoutSessionParams();
|
| 98 |
-
$this->getResponse()->setHttpResponseCode(500);
|
| 99 |
-
$this->getResponse()->setBody(
|
| 100 |
-
$this->_prepareErrorBody('An error has occurred. Please contact store administrator.')
|
| 101 |
-
);
|
| 102 |
-
$this->getResponse()->sendResponse();
|
| 103 |
-
die;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
$url = Mage::getUrl('checkout/onepage/success');
|
| 107 |
-
$this->getResponse()->setHttpResponseCode(201);
|
| 108 |
-
$this->getResponse()->setBody($this->_prepareBody(array('redirect_url' => $url)));
|
| 109 |
-
$this->getResponse()->sendResponse();
|
| 110 |
-
die;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
/**
|
| 114 |
-
* @param string $minkasuTransactionId
|
| 115 |
-
*
|
| 116 |
-
* @return array
|
| 117 |
-
*/
|
| 118 |
-
protected function _getMinkasuTransaction($minkasuTransactionId)
|
| 119 |
-
{
|
| 120 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 121 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 122 |
-
$result = $client->getType('transaction')->getTransaction($minkasuTransactionId);
|
| 123 |
-
return $result;
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
/**
|
| 127 |
-
* @param array $response
|
| 128 |
-
*
|
| 129 |
-
* @return array
|
| 130 |
-
*/
|
| 131 |
-
protected function _extractCustomerDetails(array $response)
|
| 132 |
-
{
|
| 133 |
-
$result = array();
|
| 134 |
-
|
| 135 |
-
$result['customer_details_valid'] = false;
|
| 136 |
-
|
| 137 |
-
if (!isset($response['customer_address']) || (!isset($response['customer_name']))) {
|
| 138 |
-
return $result;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
$result['customer_name'] = $response['customer_name'];
|
| 142 |
-
$result['street_1'] = $response['customer_address']['address_line_1'];
|
| 143 |
-
$result['street_2'] = $response['customer_address']['address_line_2'];
|
| 144 |
-
$result['city'] = $response['customer_address']['city'];
|
| 145 |
-
$result['state'] = $response['customer_address']['state'];
|
| 146 |
-
$result['zip'] = $response['customer_address']['zip'];
|
| 147 |
-
$result['phone'] = $response['phone'];
|
| 148 |
-
$result['email'] = $response['email'];
|
| 149 |
-
$result['customer_details_valid'] = true;
|
| 150 |
-
|
| 151 |
-
return $result;
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
/**
|
| 155 |
-
* @param array $customerDetails
|
| 156 |
-
*
|
| 157 |
-
* @return array
|
| 158 |
-
*/
|
| 159 |
-
protected function _prepareCustomerAddressInfo(array $customerDetails)
|
| 160 |
-
{
|
| 161 |
-
/** @var $regionModel Mage_Directory_Model_Region */
|
| 162 |
-
$regionModel = Mage::getModel('directory/region');
|
| 163 |
-
$regionModel->loadByCode($customerDetails['state'], 'US');
|
| 164 |
-
|
| 165 |
-
$customerNameParts = explode(' ', $customerDetails['customer_name']);
|
| 166 |
-
|
| 167 |
-
$addressInfo = array();
|
| 168 |
-
$addressInfo['firstname'] = $customerNameParts[0];
|
| 169 |
-
$addressInfo['lastname'] = end($customerNameParts);
|
| 170 |
-
$addressInfo['email'] = $customerDetails['email'];
|
| 171 |
-
$addressInfo['street'] = array(0 => $customerDetails['street_1'], 1 => $customerDetails['street_2']);
|
| 172 |
-
$addressInfo['city'] = $customerDetails['city'];
|
| 173 |
-
$addressInfo['region_id'] = $regionModel->getId();
|
| 174 |
-
$addressInfo['postcode'] = $customerDetails['zip'];
|
| 175 |
-
$addressInfo['country_id'] = 'US';
|
| 176 |
-
$addressInfo['telephone'] = $customerDetails['phone'];
|
| 177 |
-
$addressInfo['use_for_shipping'] = 1;
|
| 178 |
-
|
| 179 |
-
return $addressInfo;
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
/**
|
| 183 |
-
* @param $quote
|
| 184 |
-
* @param array $data
|
| 185 |
-
*
|
| 186 |
-
* @return $this
|
| 187 |
-
*/
|
| 188 |
-
protected function _saveBillingAndShippingAddress($quote, $data)
|
| 189 |
-
{
|
| 190 |
-
$address = $quote->getBillingAddress();
|
| 191 |
-
/** @var $addressForm Mage_Customer_Model_Form */
|
| 192 |
-
$addressForm = Mage::getModel('customer/form');
|
| 193 |
-
$addressForm->setFormCode('customer_address_edit');
|
| 194 |
-
$addressForm->setEntityType('customer_address');
|
| 195 |
-
$addressForm->setEntity($address);
|
| 196 |
-
// emulate request object
|
| 197 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($data));
|
| 198 |
-
$addressErrors = $addressForm->validateData($addressData);
|
| 199 |
-
if (true !== $addressErrors) {
|
| 200 |
-
Mage::log("Minkasu - address validation failed");
|
| 201 |
-
}
|
| 202 |
-
$addressForm->compactData($addressData);
|
| 203 |
-
//unset billing address attributes which were not shown in form
|
| 204 |
-
foreach ($addressForm->getAttributes() as $attribute) {
|
| 205 |
-
if (!isset($data[$attribute->getAttributeCode()])) {
|
| 206 |
-
$address->setData($attribute->getAttributeCode(), NULL);
|
| 207 |
-
}
|
| 208 |
-
}
|
| 209 |
-
$address->setCustomerAddressId(null);
|
| 210 |
-
$address->setEmail($data['email']);
|
| 211 |
-
$address->implodeStreetAddress();
|
| 212 |
-
|
| 213 |
-
$billing = clone $address;
|
| 214 |
-
$billing->unsAddressId()->unsAddressType();
|
| 215 |
-
|
| 216 |
-
$shipping = $quote->getShippingAddress();
|
| 217 |
-
$shippingMethod = $shipping->getShippingMethod();
|
| 218 |
-
|
| 219 |
-
// Billing address properties that must be always copied to shipping address
|
| 220 |
-
$requiredBillingAttributes = array('customer_address_id');
|
| 221 |
-
|
| 222 |
-
// don't reset original shipping data, if it was not changed by customer
|
| 223 |
-
foreach ($shipping->getData() as $shippingKey => $shippingValue) {
|
| 224 |
-
if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
|
| 225 |
-
&& !isset($data[$shippingKey]) && !in_array($shippingKey, $requiredBillingAttributes)
|
| 226 |
-
) {
|
| 227 |
-
$billing->unsetData($shippingKey);
|
| 228 |
-
}
|
| 229 |
-
}
|
| 230 |
-
|
| 231 |
-
$shipping->addData($billing->getData());
|
| 232 |
-
$shipping->setSameAsBilling(1);
|
| 233 |
-
$shipping->setSaveInAddressBook(0);
|
| 234 |
-
$shipping->setShippingMethod($shippingMethod);
|
| 235 |
-
$shipping->setCollectShippingRates(true);
|
| 236 |
-
|
| 237 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 238 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 239 |
-
$checkoutSession->setStepData('shipping', 'complete', true);
|
| 240 |
-
|
| 241 |
-
$quote->collectTotals();
|
| 242 |
-
$quote->save();
|
| 243 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 244 |
-
|
| 245 |
-
$checkoutSession->setStepData('billing', 'allow', true);
|
| 246 |
-
$checkoutSession->setStepData('billing', 'complete', true);
|
| 247 |
-
$checkoutSession->setStepData('shipping', 'allow', true);
|
| 248 |
-
|
| 249 |
-
return $this;
|
| 250 |
-
}
|
| 251 |
-
|
| 252 |
-
/**
|
| 253 |
-
* @param $quote
|
| 254 |
-
* @param array $data
|
| 255 |
-
*
|
| 256 |
-
* @return $this
|
| 257 |
-
*/
|
| 258 |
-
protected function _savePayment($quote, array $data)
|
| 259 |
-
{
|
| 260 |
-
try {
|
| 261 |
-
if($quote->isVirtual()) {
|
| 262 |
-
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 263 |
-
} else {
|
| 264 |
-
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 265 |
-
}
|
| 266 |
-
|
| 267 |
-
// shipping totals may be affected by payment method
|
| 268 |
-
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 269 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
|
| 273 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
|
| 274 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
|
| 275 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
|
| 276 |
-
| Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
|
| 277 |
-
|
| 278 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 279 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 280 |
-
$payment = $quote->getPayment();
|
| 281 |
-
$payment->importData($data);
|
| 282 |
-
$payment->setTransactionId($checkoutSession->getData('minkasu_txn_id'));
|
| 283 |
-
$payment->setTransactionAdditionalInfo('quote-no', $quote->getQuoteId());
|
| 284 |
-
|
| 285 |
-
$quote->save();
|
| 286 |
-
$checkoutSession->setStepData('payment', 'complete', true);
|
| 287 |
-
} catch (Exception $e) {
|
| 288 |
-
Mage::logException($e);
|
| 289 |
-
}
|
| 290 |
-
return $this;
|
| 291 |
-
}
|
| 292 |
-
|
| 293 |
-
/**
|
| 294 |
-
* @param $quote
|
| 295 |
-
*
|
| 296 |
-
* @return Mage_Sales_Model_Order
|
| 297 |
-
*/
|
| 298 |
-
protected function _saveOrder($quote)
|
| 299 |
-
{
|
| 300 |
-
$quote->setCustomerId(null);
|
| 301 |
-
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
|
| 302 |
-
$quote->setCustomerIsGuest(true);
|
| 303 |
-
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
| 304 |
-
|
| 305 |
-
/** @var $service Mage_Sales_Model_Service_Quote */
|
| 306 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
| 307 |
-
$service->submitAll();
|
| 308 |
-
|
| 309 |
-
/** @var $checkoutSession Mage_Checkout_Model_Session */
|
| 310 |
-
$checkoutSession = Mage::getSingleton('checkout/session');
|
| 311 |
-
$checkoutSession->setLastQuoteId($quote->getId());
|
| 312 |
-
$checkoutSession->setLastSuccessQuoteId($quote->getId());
|
| 313 |
-
$checkoutSession->clearHelperData();
|
| 314 |
-
|
| 315 |
-
$order = $service->getOrder();
|
| 316 |
-
|
| 317 |
-
if ($order->getId()) {
|
| 318 |
-
Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$quote));
|
| 319 |
-
|
| 320 |
-
/**
|
| 321 |
-
* we only want to send to customer about new order when there is no redirect to third party
|
| 322 |
-
*/
|
| 323 |
-
if ($order->getCanSendNewEmailFlag()) {
|
| 324 |
-
try {
|
| 325 |
-
$order->sendNewOrderEmail();
|
| 326 |
-
} catch (Exception $e) {
|
| 327 |
-
Mage::logException($e);
|
| 328 |
-
}
|
| 329 |
-
}
|
| 330 |
-
|
| 331 |
-
// add order information to the session
|
| 332 |
-
$checkoutSession->setLastOrderId($order->getId());
|
| 333 |
-
$checkoutSession->setRedirectUrl(null);
|
| 334 |
-
$checkoutSession->setLastRealOrderId($order->getIncrementId());
|
| 335 |
-
|
| 336 |
-
// as well a billing agreement can be created
|
| 337 |
-
$agreement = $order->getPayment()->getBillingAgreement();
|
| 338 |
-
if ($agreement) {
|
| 339 |
-
$checkoutSession->setLastBillingAgreementId($agreement->getId());
|
| 340 |
-
}
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
// add recurring profiles information to the session
|
| 344 |
-
$profiles = $service->getRecurringPaymentProfiles();
|
| 345 |
-
if ($profiles) {
|
| 346 |
-
$ids = array();
|
| 347 |
-
foreach ($profiles as $profile) {
|
| 348 |
-
$ids[] = $profile->getId();
|
| 349 |
-
}
|
| 350 |
-
$checkoutSession->setLastRecurringProfileIds($ids);
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
Mage::dispatchEvent(
|
| 354 |
-
'checkout_submit_all_after',
|
| 355 |
-
array('order' => $order, 'quote' => $quote, 'recurring_profiles' => $profiles)
|
| 356 |
-
);
|
| 357 |
-
|
| 358 |
-
$quote->save();
|
| 359 |
-
return $order;
|
| 360 |
-
}
|
| 361 |
-
|
| 362 |
-
/**
|
| 363 |
-
* @param string $minkasuTransactionId
|
| 364 |
-
* @param string $orderId
|
| 365 |
-
*
|
| 366 |
-
* @return array
|
| 367 |
-
*/
|
| 368 |
-
protected function _updateMinkasuTransactionWithOrderId($minkasuTransactionId, $orderId)
|
| 369 |
-
{
|
| 370 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 371 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 372 |
-
$result = $client->getType('transaction')->updateTransaction($minkasuTransactionId, array('merchant_bill_number' => $orderId), NULL);
|
| 373 |
-
|
| 374 |
-
return $result;
|
| 375 |
-
}
|
| 376 |
-
|
| 377 |
-
/**
|
| 378 |
-
* @return $this
|
| 379 |
-
*/
|
| 380 |
-
protected function _cleanCheckoutSessionParams()
|
| 381 |
-
{
|
| 382 |
-
/** @var $helper Minkasu_Wallet_Helper_Data */
|
| 383 |
-
$helper = Mage::helper('minkasu_wallet');
|
| 384 |
-
$helper->cleanCheckoutSessionParams();
|
| 385 |
-
return $this;
|
| 386 |
-
}
|
| 387 |
-
|
| 388 |
-
/**
|
| 389 |
-
* @param string $error
|
| 390 |
-
*
|
| 391 |
-
* @return string
|
| 392 |
-
*/
|
| 393 |
-
protected function _prepareErrorBody($error)
|
| 394 |
-
{
|
| 395 |
-
return $this->_prepareBody(array('error' => $this->__($error)));
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
/**
|
| 399 |
-
* @param array $data
|
| 400 |
-
*
|
| 401 |
-
* @return string
|
| 402 |
-
*/
|
| 403 |
-
protected function _prepareBody(array $data)
|
| 404 |
-
{
|
| 405 |
-
/** @var $helper Mage_Core_Helper_Data */
|
| 406 |
-
$helper = Mage::helper('core');
|
| 407 |
-
return $helper->jsonEncode($data);
|
| 408 |
-
}
|
| 409 |
-
}
|
| 410 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/controllers/TransactionController.php~
DELETED
|
@@ -1,122 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Minkasu_Wallet_TransactionController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* Create a Minkasu transaction
|
| 7 |
-
*/
|
| 8 |
-
public function createAction()
|
| 9 |
-
{
|
| 10 |
-
/** @var $cart Mage_Checkout_Model_Cart */
|
| 11 |
-
$cart = Mage::getModel('checkout/cart');
|
| 12 |
-
$quote = $cart->getQuote();
|
| 13 |
-
$checkoutSession = $cart->getCheckoutSession();
|
| 14 |
-
|
| 15 |
-
$expectedAddressInfo = NULL;
|
| 16 |
-
$shippingAddress = $quote->getShippingAddress();
|
| 17 |
-
if ($shippingAddress != NULL){
|
| 18 |
-
$expectedAddress = ($shippingAddress->exportCustomerAddress());
|
| 19 |
-
if ($expectedAddress != NULL) {
|
| 20 |
-
$data = $expectedAddress->getData();
|
| 21 |
-
$expectedAddressInfo = array (
|
| 22 |
-
'zip' => $data["postcode"],
|
| 23 |
-
'state' => $data["region"]
|
| 24 |
-
);
|
| 25 |
-
}
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
try {
|
| 29 |
-
/** @var $session Mage_Core_Model_Session */
|
| 30 |
-
$session = Mage::getSingleton('core/session');
|
| 31 |
-
if ($this->getRequest()->getParam('form_key') !== $session->getFormKey()) {
|
| 32 |
-
Mage::throwException($this->__('Wrong form key.'));
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 36 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 37 |
-
$transactionInfo = $client->getType('transaction')->createTransaction($quote, $expectedAddressInfo);
|
| 38 |
-
|
| 39 |
-
$checkoutSession->setData('minkasu_amount', $quote->getGrandTotal());
|
| 40 |
-
//TODO:AP:quoteId should be used as idempotency id down-the-road
|
| 41 |
-
//$checkoutSession->setData('minkasu_bill_number', $quote->getId());
|
| 42 |
-
$checkoutSession->setData('minkasu_txn_id', $transactionInfo['txn_id']);
|
| 43 |
-
$checkoutSession->setData('minkasu_payment_token',$transactionInfo['payment_token']);
|
| 44 |
-
$result = array(
|
| 45 |
-
'txn_id' => $transactionInfo['txn_id'],
|
| 46 |
-
'payment_code' => $transactionInfo['payment_code'],
|
| 47 |
-
'payment_code_ttl' => $transactionInfo['payment_code_ttl'],
|
| 48 |
-
);
|
| 49 |
-
} catch (Exception $e) {
|
| 50 |
-
Mage::logException($e);
|
| 51 |
-
$result = array('error' => $e->getMessage());
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 56 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
/**
|
| 60 |
-
* Update a Minkasu transaction
|
| 61 |
-
*/
|
| 62 |
-
public function updateAction()
|
| 63 |
-
{
|
| 64 |
-
/** @var $cart Mage_Checkout_Model_Cart */
|
| 65 |
-
$cart = Mage::getModel('checkout/cart');
|
| 66 |
-
$quote = $cart->getQuote();
|
| 67 |
-
$checkoutSession = $cart->getCheckoutSession();
|
| 68 |
-
|
| 69 |
-
/** @var $walletHelper Minkasu_Wallet_Helper_Data */
|
| 70 |
-
$walletHelper = Mage::helper('minkasu_wallet');
|
| 71 |
-
$minkasuTransactionData = array('amount' => $walletHelper->convertDollarsToCents($quote->getGrandTotal()));
|
| 72 |
-
$minkasuTransactionId = $checkoutSession->getData('minkasu_txn_id');
|
| 73 |
-
|
| 74 |
-
$expectedAddressInfo = NULL;
|
| 75 |
-
$shippingAddress = $quote->getShippingAddress();
|
| 76 |
-
if ($shippingAddress != NULL){
|
| 77 |
-
$expectedAddress = ($shippingAddress->exportCustomerAddress());
|
| 78 |
-
if ($expectedAddress != NULL) {
|
| 79 |
-
$data = $expectedAddress->getData();
|
| 80 |
-
$expectedAddressInfo = array (
|
| 81 |
-
'zip' => $data["postcode"],
|
| 82 |
-
'state' => $data["region"]
|
| 83 |
-
);
|
| 84 |
-
}
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
try {
|
| 88 |
-
/** @var $session Mage_Core_Model_Session */
|
| 89 |
-
$session = Mage::getSingleton('core/session');
|
| 90 |
-
if ($this->getRequest()->getParam('form_key') !== $session->getFormKey()) {
|
| 91 |
-
Mage::throwException($this->__('Wrong form key.'));
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
if (!$minkasuTransactionId) {
|
| 95 |
-
Mage::throwException($this->__("Transaction doesn't exist."));
|
| 96 |
-
}
|
| 97 |
-
/** @var $client Minkasu_Wallet_Model_Api_Client */
|
| 98 |
-
$client = Mage::getModel('minkasu_wallet/api_client');
|
| 99 |
-
$transactionInfo = $client->getType('transaction')
|
| 100 |
-
->updateTransaction($minkasuTransactionId, $minkasuTransactionData, $expectedAddressInfo);
|
| 101 |
-
|
| 102 |
-
$checkoutSession->setData('minkasu_amount', $quote->getGrandTotal());
|
| 103 |
-
$checkoutSession->setData('minkasu_bill_number', $quote->getId());
|
| 104 |
-
$checkoutSession->setData('minkasu_txn_id', $transactionInfo['txn_id']);
|
| 105 |
-
// Payment token will not be returned on an update transaction.
|
| 106 |
-
// Overwriting existing token with null causes later auth to fail.
|
| 107 |
-
//$checkoutSession->setData('minkasu_payment_token',$transactionInfo['payment_token']);
|
| 108 |
-
$result = array(
|
| 109 |
-
'txn_id' => $transactionInfo['txn_id'],
|
| 110 |
-
'payment_code' => $transactionInfo['payment_code'],
|
| 111 |
-
'payment_code_ttl' => $transactionInfo['payment_code_ttl'],
|
| 112 |
-
);
|
| 113 |
-
} catch (Exception $e) {
|
| 114 |
-
Mage::logException($e);
|
| 115 |
-
$result = array('error' => $e->getMessage());
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 120 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 121 |
-
}
|
| 122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Minkasu/Wallet/etc/config.xml
CHANGED
|
@@ -63,6 +63,26 @@
|
|
| 63 |
</minkasu_wallet_save_order_quote_to_session>
|
| 64 |
</observers>
|
| 65 |
</checkout_cart_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
<controller_action_predispatch_checkout_onepage_index>
|
| 67 |
<observers>
|
| 68 |
<minkasu_wallet_show_notice>
|
|
@@ -72,6 +92,17 @@
|
|
| 72 |
</minkasu_wallet_show_notice>
|
| 73 |
</observers>
|
| 74 |
</controller_action_predispatch_checkout_onepage_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
</events>
|
| 76 |
</global>
|
| 77 |
<frontend>
|
|
@@ -125,7 +156,8 @@
|
|
| 125 |
<payment_action>authorize</payment_action>
|
| 126 |
<token backend_model="adminhtml/system_config_backend_encrypted"/>
|
| 127 |
<estimate_enabled>1</estimate_enabled>
|
| 128 |
-
<address_po_box_enabled>
|
|
|
|
| 129 |
</minkasu_wallet>
|
| 130 |
</payment>
|
| 131 |
</default>
|
| 63 |
</minkasu_wallet_save_order_quote_to_session>
|
| 64 |
</observers>
|
| 65 |
</checkout_cart_save_after>
|
| 66 |
+
|
| 67 |
+
<checkout_cart_save_before>
|
| 68 |
+
<observers>
|
| 69 |
+
<minkasu_wallet_save_order_quote_to_session>
|
| 70 |
+
<type>singleton</type>
|
| 71 |
+
<class>minkasu_wallet/observer</class>
|
| 72 |
+
<method>beforeSaveOrderQuoteToSession</method>
|
| 73 |
+
</minkasu_wallet_save_order_quote_to_session>
|
| 74 |
+
</observers>
|
| 75 |
+
</checkout_cart_save_before>
|
| 76 |
+
<salesrule_validator_process>
|
| 77 |
+
<observers>
|
| 78 |
+
<minkasu_wallet_save_order_quote_to_session>
|
| 79 |
+
<type>singleton</type>
|
| 80 |
+
<class>minkasu_wallet/observer</class>
|
| 81 |
+
<method>salesRuleValidatorProcess</method>
|
| 82 |
+
</minkasu_wallet_save_order_quote_to_session>
|
| 83 |
+
</observers>
|
| 84 |
+
</salesrule_validator_process>
|
| 85 |
+
|
| 86 |
<controller_action_predispatch_checkout_onepage_index>
|
| 87 |
<observers>
|
| 88 |
<minkasu_wallet_show_notice>
|
| 92 |
</minkasu_wallet_show_notice>
|
| 93 |
</observers>
|
| 94 |
</controller_action_predispatch_checkout_onepage_index>
|
| 95 |
+
|
| 96 |
+
<controller_action_predispatch_checkout_cart_index>
|
| 97 |
+
<observers>
|
| 98 |
+
<minkasu_wallet_show_notice>
|
| 99 |
+
<type>singleton</type>
|
| 100 |
+
<class>minkasu_wallet/observer</class>
|
| 101 |
+
<method>predispatchCheckoutCartIndex</method>
|
| 102 |
+
</minkasu_wallet_show_notice>
|
| 103 |
+
</observers>
|
| 104 |
+
</controller_action_predispatch_checkout_cart_index>
|
| 105 |
+
|
| 106 |
</events>
|
| 107 |
</global>
|
| 108 |
<frontend>
|
| 156 |
<payment_action>authorize</payment_action>
|
| 157 |
<token backend_model="adminhtml/system_config_backend_encrypted"/>
|
| 158 |
<estimate_enabled>1</estimate_enabled>
|
| 159 |
+
<address_po_box_enabled>1</address_po_box_enabled>
|
| 160 |
+
<promo_codes></promo_codes>
|
| 161 |
</minkasu_wallet>
|
| 162 |
</payment>
|
| 163 |
</default>
|
app/code/community/Minkasu/Wallet/etc/system.xml
CHANGED
|
@@ -131,6 +131,14 @@
|
|
| 131 |
<show_in_website>1</show_in_website>
|
| 132 |
<show_in_store>0</show_in_store>
|
| 133 |
</cctypes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
</fields>
|
| 135 |
</minkasu_wallet>
|
| 136 |
</groups>
|
| 131 |
<show_in_website>1</show_in_website>
|
| 132 |
<show_in_store>0</show_in_store>
|
| 133 |
</cctypes>
|
| 134 |
+
<promo_codes>
|
| 135 |
+
<label>Minkasu Promotion Codes</label>
|
| 136 |
+
<frontend_type>text</frontend_type>
|
| 137 |
+
<sort_order>130</sort_order>
|
| 138 |
+
<show_in_default>1</show_in_default>
|
| 139 |
+
<show_in_website>1</show_in_website>
|
| 140 |
+
<show_in_store>0</show_in_store>
|
| 141 |
+
</promo_codes>
|
| 142 |
</fields>
|
| 143 |
</minkasu_wallet>
|
| 144 |
</groups>
|
app/design/frontend/base/default/template/minkasu/wallet/estimate_box.phtml
CHANGED
|
@@ -12,32 +12,33 @@ $show_minkasu_estimate_box = $_apiEstimateEnabled;
|
|
| 12 |
<?php if ($show_minkasu_estimate_box) : ?>
|
| 13 |
|
| 14 |
<div id="mk_shipping_est_div" style="display: block; overflow: auto">
|
| 15 |
-
<table style="border: 0px; margin:0px"><tr
|
|
|
|
| 16 |
<td style="border: 0px; padding: 0px; padding-bottom: 30px; padding-top: 20px;">
|
| 17 |
|
| 18 |
<table id="mk_shipping_est_table" style="background-color: #E7F6F0; border: 1px solid #19D383; border-collapse: separate; border-spacing: 0px; border-radius: 3px; margin: 0px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 15px; width: 330px">
|
| 19 |
|
| 20 |
<tr>
|
| 21 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:0px; text-align: right; vertical-align: middle">
|
| 22 |
-
<span style="color: #333333; font-family: Open Sans; font-size: 12px;">Shipping & Taxes</span>
|
| 23 |
</td>
|
| 24 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top:0px; vertical-align: middle">
|
| 25 |
<input type="text" id="ship_zip" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 85px" value="Zip code"/>
|
| 26 |
</td>
|
| 27 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:0px; vertical-align: middle">
|
| 28 |
-
<input type="button" id="mk_cart_est_btn" value="Estimate" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans; font-size: 12px; font-weight: 600; height: 24px; margin: 0px; padding: 4px; width: 80px">
|
| 29 |
</td>
|
| 30 |
</tr>
|
| 31 |
|
| 32 |
<tr id="discount_code_row" style="display:none">
|
| 33 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; text-align: right; vertical-align: middle">
|
| 34 |
-
<span id="discount_txt" style="color: #333333; font-family: Open Sans; font-size: 12px;">
|
| 35 |
</td>
|
| 36 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top:5px; vertical-align: middle">
|
| 37 |
<input type="text" id="discount_code" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 85px" value="Coupon"/>
|
| 38 |
</td>
|
| 39 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:5px; vertical-align: middle">
|
| 40 |
-
<input type="button" id="mk_cart_apply_btn" value="Apply" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans; font-size: 12px; font-weight: 600; height: 24px; margin: 0px; padding: 4px; width: 80px">
|
| 41 |
</td>
|
| 42 |
</tr>
|
| 43 |
|
|
@@ -49,7 +50,7 @@ $show_minkasu_estimate_box = $_apiEstimateEnabled;
|
|
| 49 |
|
| 50 |
<tr id="shipping_options_row" style="display:none">
|
| 51 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; text-align: right;">
|
| 52 |
-
<span style="color: #333333; font-family: Open Sans; font-size: 12px;">Shipping</span>
|
| 53 |
</td>
|
| 54 |
<td id="shipping_options_cell" colspan="2" style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:5px">
|
| 55 |
</td>
|
| 12 |
<?php if ($show_minkasu_estimate_box) : ?>
|
| 13 |
|
| 14 |
<div id="mk_shipping_est_div" style="display: block; overflow: auto">
|
| 15 |
+
<table style="border: 0px; margin:0px"><tr>
|
| 16 |
+
<!--td style="border: 0px; padding: 0px; width:100%"></td -->
|
| 17 |
<td style="border: 0px; padding: 0px; padding-bottom: 30px; padding-top: 20px;">
|
| 18 |
|
| 19 |
<table id="mk_shipping_est_table" style="background-color: #E7F6F0; border: 1px solid #19D383; border-collapse: separate; border-spacing: 0px; border-radius: 3px; margin: 0px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 15px; width: 330px">
|
| 20 |
|
| 21 |
<tr>
|
| 22 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:0px; text-align: right; vertical-align: middle">
|
| 23 |
+
<span style="color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px;">Shipping & Taxes</span>
|
| 24 |
</td>
|
| 25 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top:0px; vertical-align: middle">
|
| 26 |
<input type="text" id="ship_zip" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 85px" value="Zip code"/>
|
| 27 |
</td>
|
| 28 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:0px; vertical-align: middle">
|
| 29 |
+
<input type="button" id="mk_cart_est_btn" value="Estimate" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 600; height: 24px; margin: 0px; padding: 4px; width: 80px">
|
| 30 |
</td>
|
| 31 |
</tr>
|
| 32 |
|
| 33 |
<tr id="discount_code_row" style="display:none">
|
| 34 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; text-align: right; vertical-align: middle">
|
| 35 |
+
<span id="discount_txt" style="color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px;">Discount</span>
|
| 36 |
</td>
|
| 37 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top:5px; vertical-align: middle">
|
| 38 |
<input type="text" id="discount_code" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 85px" value="Coupon"/>
|
| 39 |
</td>
|
| 40 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:5px; vertical-align: middle">
|
| 41 |
+
<input type="button" id="mk_cart_apply_btn" value="Apply" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 600; height: 24px; margin: 0px; padding: 4px; width: 80px">
|
| 42 |
</td>
|
| 43 |
</tr>
|
| 44 |
|
| 50 |
|
| 51 |
<tr id="shipping_options_row" style="display:none">
|
| 52 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; text-align: right;">
|
| 53 |
+
<span style="color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px;">Shipping</span>
|
| 54 |
</td>
|
| 55 |
<td id="shipping_options_cell" colspan="2" style="border: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 0px; padding-top:5px">
|
| 56 |
</td>
|
app/design/frontend/base/default/template/minkasu/wallet/pay.phtml
CHANGED
|
@@ -195,7 +195,7 @@ var showShippingOptions = function() {
|
|
| 195 |
|
| 196 |
so_el.append("<select name=\"mk_shipping_option\" " +
|
| 197 |
"style=\"background-color: white; border-color: #999999; box-sizing: border-box; color: #333333; " +
|
| 198 |
-
"font-family: Open Sans; font-size: 13px; height: auto; margin: 0px; padding: 4px; width: 100%\">" + shipping_option_elems + "</select>");
|
| 199 |
so_el.find('[name="mk_shipping_option"]').change(function() {
|
| 200 |
var current_shipping_option = $(this).val();
|
| 201 |
updateCartPriceEstimateWithShippingOption(shipping_option_rates[current_shipping_option].code);
|
|
@@ -254,7 +254,23 @@ function zip_code_is_valid(zip) {
|
|
| 254 |
|
| 255 |
return true;
|
| 256 |
|
| 257 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
|
| 260 |
var updateCartPriceEstimateWithZip = function(zip) {
|
|
@@ -302,7 +318,9 @@ var updateCartPriceEstimateWithZip = function(zip) {
|
|
| 302 |
return;
|
| 303 |
}
|
| 304 |
});
|
|
|
|
| 305 |
});
|
|
|
|
| 306 |
};
|
| 307 |
|
| 308 |
var updateCartPriceEstimateWithDiscount = function(discount_code) {
|
|
@@ -554,7 +572,6 @@ $(document).ready(function() {
|
|
| 554 |
});
|
| 555 |
|
| 556 |
<?php if ($coupon_code) : ?>
|
| 557 |
-
$("#discount_txt").text("Remove discount");
|
| 558 |
$("#discount_code").prop("disabled", true);
|
| 559 |
$("#mk_cart_apply_btn").prop("value", "Remove");
|
| 560 |
$("#mk_shipping_est_table").find("#discount_code").val('<?php echo $coupon_code; ?>');
|
| 195 |
|
| 196 |
so_el.append("<select name=\"mk_shipping_option\" " +
|
| 197 |
"style=\"background-color: white; border-color: #999999; box-sizing: border-box; color: #333333; " +
|
| 198 |
+
"font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 13px; height: auto; margin: 0px; padding: 4px; width: 100%\">" + shipping_option_elems + "</select>");
|
| 199 |
so_el.find('[name="mk_shipping_option"]').change(function() {
|
| 200 |
var current_shipping_option = $(this).val();
|
| 201 |
updateCartPriceEstimateWithShippingOption(shipping_option_rates[current_shipping_option].code);
|
| 254 |
|
| 255 |
return true;
|
| 256 |
|
| 257 |
+
};
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
var setPaymentMethodToMinkasu = function(cb_fn) {
|
| 261 |
+
|
| 262 |
+
$.ajax({
|
| 263 |
+
url: '<?php echo $this->getUrl("minkasu_wallet/payment/setPaymentMethodToMinkasu") ?>',
|
| 264 |
+
type: 'post',
|
| 265 |
+
success: function(resp) {
|
| 266 |
+
cb_fn({status: "success"});
|
| 267 |
+
},
|
| 268 |
+
error: function(jqXHR, textStatus, errorThrown) {
|
| 269 |
+
cb_fn({status: "failed", error: errorThrown});
|
| 270 |
+
}
|
| 271 |
+
});
|
| 272 |
+
|
| 273 |
+
};
|
| 274 |
|
| 275 |
|
| 276 |
var updateCartPriceEstimateWithZip = function(zip) {
|
| 318 |
return;
|
| 319 |
}
|
| 320 |
});
|
| 321 |
+
|
| 322 |
});
|
| 323 |
+
|
| 324 |
};
|
| 325 |
|
| 326 |
var updateCartPriceEstimateWithDiscount = function(discount_code) {
|
| 572 |
});
|
| 573 |
|
| 574 |
<?php if ($coupon_code) : ?>
|
|
|
|
| 575 |
$("#discount_code").prop("disabled", true);
|
| 576 |
$("#mk_cart_apply_btn").prop("value", "Remove");
|
| 577 |
$("#mk_shipping_est_table").find("#discount_code").val('<?php echo $coupon_code; ?>');
|
app/design/frontend/ultimo/default/template/minkasu/wallet/estimate_box.phtml
CHANGED
|
@@ -21,7 +21,7 @@ $show_minkasu_estimate_box = $_apiEstimateEnabled;
|
|
| 21 |
<input type="text" id="ship_zip" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 65px;" value="Zip code">
|
| 22 |
</td>
|
| 23 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:0px; vertical-align: middle">
|
| 24 |
-
<input type="button" id="mk_cart_est_btn" value="Estimate Shipping" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans; font-size: 12px; font-weight: 600; height: 28px; margin: 0px; padding: 4px; width: 115px;">
|
| 25 |
</td>
|
| 26 |
</tr>
|
| 27 |
|
|
@@ -31,7 +31,7 @@ $show_minkasu_estimate_box = $_apiEstimateEnabled;
|
|
| 31 |
<input type="text" id="discount_code" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 65px;" value="Coupon">
|
| 32 |
</td>
|
| 33 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; vertical-align: middle">
|
| 34 |
-
<input type="button" id="mk_cart_apply_btn" value="Apply" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans; font-size: 12px; font-weight: 600; height: 28px; margin: 0px; padding: 4px; width: 115px;">
|
| 35 |
</td>
|
| 36 |
</tr>
|
| 37 |
|
| 21 |
<input type="text" id="ship_zip" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 65px;" value="Zip code">
|
| 22 |
</td>
|
| 23 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:0px; vertical-align: middle">
|
| 24 |
+
<input type="button" id="mk_cart_est_btn" value="Estimate Shipping" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 600; height: 28px; margin: 0px; padding: 4px; width: 115px;">
|
| 25 |
</td>
|
| 26 |
</tr>
|
| 27 |
|
| 31 |
<input type="text" id="discount_code" style="background-color: white; border-color: #999999; box-sizing: content-box; color: #999999; font-family: Open Sans; font-size: 13px; font-style: italic; height: 16px; margin: 0px; padding: 4px; width: 65px;" value="Coupon">
|
| 32 |
</td>
|
| 33 |
<td style="border: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 5px; padding-top:5px; vertical-align: middle">
|
| 34 |
+
<input type="button" id="mk_cart_apply_btn" value="Apply" style="background-color: #F2F2F2; border-color: #999999; border-radius: 2px; border-width: 1px; color: #333333; font-family: Open Sans, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 600; height: 28px; margin: 0px; padding: 4px; width: 115px;">
|
| 35 |
</td>
|
| 36 |
</tr>
|
| 37 |
|
package.xml
CHANGED
|
@@ -1,21 +1,19 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>minkasu_smartphone_checkout</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>MITL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Enjoy higher conversion and greater security by offering a smartphone checkout option for your customers </summary>
|
| 10 |
<description>Enjoy higher conversion and greater security by offering a smartphone checkout option for your customers </description>
|
| 11 |
-
<notes>-
|
| 12 |
-
|
| 13 |
-
- general UX enhancement
|
| 14 |
-
- https enabled</notes>
|
| 15 |
<authors><author><name>Minkasu Inc</name><user>it-admin</user><email>it-admin@minkasu.com</email></author></authors>
|
| 16 |
-
<date>2015-
|
| 17 |
-
<time>
|
| 18 |
-
<contents><target name="magecommunity"><dir name="Minkasu"><dir name="Wallet"><dir name="Block"><dir name="Adminhtml"><dir name="Merchant"><dir name="Create"><file name="Form.php" hash="77e288884729c197292d3799b2094d7b"/><file name="Success.php" hash="d1ed1419a27fed884c9d8d83eef9546c"/></dir><file name="Create.php" hash="108bac82be521ce9a98ffdcd716c7b4c"/><dir name="Edit"><file name="Form.php" hash="6d98746a2004442e70d6fa1e0c243723"/></dir><file name="Edit.php" hash="2c0b329a6f6df4af99da5c6407c280c8"/></dir><dir name="System"><dir name="Config"><dir name="Frontend"><file name="Cctype.php" hash="e236b1263378f894b7becf3852b1027e"/><file name="MinkasuGroup.php" hash="2fb103ce6e246972636dbfc4dd77bc42"/><file name="MinkasuMode.php" hash="f877b4be92ee3f869b6e42f0e1916a1b"/><file name="Paymentaction.php" hash="91420a5a4f610bf48821d51d688bc079"/></dir></dir></dir></dir><file name="Pay.php" hash="6545b86f80ab7a1aa43ddaaecce48112"/></dir><dir name="Helper"><dir name="Api"><file name="Merchant.php" hash="8192234ddd243022df5298171349321c"/></dir><file name="Api.php" hash="
|
| 19 |
<compatible/>
|
| 20 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
| 21 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>minkasu_smartphone_checkout</name>
|
| 4 |
+
<version>1.3.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>MITL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Enjoy higher conversion and greater security by offering a smartphone checkout option for your customers </summary>
|
| 10 |
<description>Enjoy higher conversion and greater security by offering a smartphone checkout option for your customers </description>
|
| 11 |
+
<notes>-addition for estimate shipping and tax
|
| 12 |
+
</notes>
|
|
|
|
|
|
|
| 13 |
<authors><author><name>Minkasu Inc</name><user>it-admin</user><email>it-admin@minkasu.com</email></author></authors>
|
| 14 |
+
<date>2015-09-09</date>
|
| 15 |
+
<time>23:44:40</time>
|
| 16 |
+
<contents><target name="magecommunity"><dir name="Minkasu"><dir name="Wallet"><dir name="Block"><dir name="Adminhtml"><dir name="Merchant"><dir name="Create"><file name="Form.php" hash="77e288884729c197292d3799b2094d7b"/><file name="Success.php" hash="d1ed1419a27fed884c9d8d83eef9546c"/></dir><file name="Create.php" hash="108bac82be521ce9a98ffdcd716c7b4c"/><dir name="Edit"><file name="Form.php" hash="6d98746a2004442e70d6fa1e0c243723"/></dir><file name="Edit.php" hash="2c0b329a6f6df4af99da5c6407c280c8"/></dir><dir name="System"><dir name="Config"><dir name="Frontend"><file name="Cctype.php" hash="e236b1263378f894b7becf3852b1027e"/><file name="MinkasuGroup.php" hash="2fb103ce6e246972636dbfc4dd77bc42"/><file name="MinkasuMode.php" hash="f877b4be92ee3f869b6e42f0e1916a1b"/><file name="Paymentaction.php" hash="91420a5a4f610bf48821d51d688bc079"/></dir></dir></dir></dir><file name="Pay.php" hash="6545b86f80ab7a1aa43ddaaecce48112"/></dir><dir name="Helper"><dir name="Api"><file name="Merchant.php" hash="8192234ddd243022df5298171349321c"/></dir><file name="Api.php" hash="a38dd4f9af37b6131d18b7d78b2eb802"/><file name="Data.php" hash="004ff5e827b9a2981019f421c7be01a9"/></dir><dir name="Model"><dir name="Api"><dir name="Adapter"><file name="Abstract.php" hash="2c35170bc831f3884c9351716ca55030"/><file name="Curl.php" hash="0f64beb2ed75a3cadcb9b264b7c10eb9"/></dir><file name="Client.php" hash="8575b8b0d52635b0ec5942d2ace4dba6"/><dir name="Format"><file name="Abstract.php" hash="011af2c9cd958efffbba03e411cc1627"/><file name="Json.php" hash="f32759fe608158aede8c39d4816b8236"/></dir><dir name="Type"><file name="Abstract.php" hash="df9ed9fa6e616f233c7e01d7943ee709"/><file name="Merchant.php" hash="96e782e3756f5753c46a36f1aa6970f8"/><file name="Transaction.php" hash="3365045471a509166827e7a86eb9e4ab"/></dir></dir><file name="Observer.php" hash="3911f50f92812a588c343206e4834d05"/><file name="Payment.php" hash="61aeb4f7d7e5872401de43c87711d3f3"/><dir name="Source"><dir name="Api"><file name="Mode.php" hash="0e479fee542ff543ad1e3a2206b74acf"/></dir><file name="Cctype.php" hash="833ab97e39326b25cf13c644866493fb"/><file name="Paymentaction.php" hash="04bb331b86110d118254d49bd96aa33d"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="AddressPoBoxEnabled.php" hash="9795465148b90b598fe811809ca591c0"/><file name="Cctype.php" hash="08fbfe643918fad60eb5fc1140616f85"/><file name="Double.php" hash="a9fc25c67caf2db75af89a85b188ad80"/><file name="MinkasuStatus.php" hash="3d1b41d010c4ec15311beebce2e88ae5"/><file name="Mode.php" hash="8f5e497d6dceff432ce5b6dc11400bb9"/><file name="Paymentaction.php" hash="fc061be2e85fd8303bcd1da95198a3e2"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Minkasu"><dir name="Wallet"><file name="MerchantController.php" hash="c892302a1883c417b56628ec43172a27"/></dir></dir></dir><file name="PaymentController.php" hash="7b02b386678b7e4be640b3842f043ac9"/><file name="TransactionController.php" hash="361617e656a59979d886fe54cf2328a5"/></dir><dir name="etc"><file name="config.xml" hash="eb43346e15eceddab9805a0b0bc8a075"/><file name="system.xml" hash="38091c8cba513d1464115e5483e71558"/></dir><dir name="sql"><dir name="minkasu_wallet_setup"><file name="install-0.0.0.1.php" hash="ccbed051e0d98bf2fa167ea7b13edb4f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Minkasu_Wallet.xml" hash="a8daca594f8108b5fd5f28b04842fa91"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="minkasu_wallet.xml" hash="95ca0132f2696fd91c0a67922030c8a2"/></dir><dir name="template"><dir name="minkasu"><dir name="wallet"><dir name="merchant"><dir name="create"><file name="success.phtml" hash="fec665badf6dc1032514ac0dd3b31996"/></dir><file name="popup.phtml" hash="5e4050fa03cee52c263d259383ae0308"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="minkasu_wallet.xml" hash="383412265ce51df29662f23f1e3accea"/></dir><dir name="template"><dir name="minkasu"><dir name="wallet"><file name="pay.phtml" hash="93c0a87a9fef5bb09a49370436325f9a"/><file name="estimate_box.phtml" hash="1bc7aab3113f038a805c13d553a22297"/></dir></dir></dir></dir></dir><dir name="gravdept"><dir name="acumen"><dir name="template"><dir name="minkasu"><dir name="wallet"><file name="estimate_box.phtml" hash="7c839278df79b217ad5f53a24ad8b32d"/></dir></dir></dir></dir></dir><dir name="ultimo"><dir name="default"><dir name="template"><dir name="minkasu"><dir name="wallet"><file name="estimate_box.phtml" hash="721b46be864fa8d29b5583dcc17478cc"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
| 19 |
</package>
|
