Version Notes
Added comments to code
Download this release
Release Info
| Developer | CreativeMinds |
| Extension | ZooZ_payment |
| Version | 3.0.0.4 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.0.3 to 3.0.0.4
- app/code/community/Zooz/Payments/Block/Customer/Creditcard.php +31 -5
- app/code/community/Zooz/Payments/Block/Form/Payments.php +30 -3
- app/code/community/Zooz/Payments/Model/Api.php +92 -4
- app/code/community/Zooz/Payments/Model/Info.php +4 -1
- app/code/community/Zooz/Payments/Model/Observer.php +25 -0
- app/code/community/Zooz/Payments/Model/Payments.php +54 -15
- app/code/community/Zooz/Payments/controllers/CustomerController.php +45 -5
- app/code/community/Zooz/Payments/etc/config.xml +1 -1
- package.xml +5 -5
app/code/community/Zooz/Payments/Block/Customer/Creditcard.php
CHANGED
|
@@ -35,7 +35,12 @@ class Zooz_Payments_Block_Customer_Creditcard extends Mage_Core_Block_Template {
|
|
| 35 |
protected function _getConfig() {
|
| 36 |
return Mage::getSingleton('payments/config');
|
| 37 |
}
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
public function getPaymentMethods()
|
| 40 |
{
|
| 41 |
$customerLoginId = false;
|
|
@@ -49,7 +54,12 @@ class Zooz_Payments_Block_Customer_Creditcard extends Mage_Core_Block_Template {
|
|
| 49 |
|
| 50 |
return false;
|
| 51 |
}
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
public function getCountryCollection()
|
| 54 |
{
|
| 55 |
if (!$this->_countryCollection) {
|
|
@@ -58,7 +68,12 @@ class Zooz_Payments_Block_Customer_Creditcard extends Mage_Core_Block_Template {
|
|
| 58 |
}
|
| 59 |
return $this->_countryCollection;
|
| 60 |
}
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
public function getCountryHtmlSelect()
|
| 63 |
{
|
| 64 |
$countryId = null;
|
|
@@ -82,7 +97,12 @@ class Zooz_Payments_Block_Customer_Creditcard extends Mage_Core_Block_Template {
|
|
| 82 |
|
| 83 |
return $select->getHtml();
|
| 84 |
}
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
public function getCountryOptions()
|
| 87 |
{
|
| 88 |
$options = false;
|
|
@@ -139,7 +159,13 @@ class Zooz_Payments_Block_Customer_Creditcard extends Mage_Core_Block_Template {
|
|
| 139 |
$this->setData('cc_years', $result);
|
| 140 |
return $result;
|
| 141 |
}
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
public function getCreditCardDetails()
|
| 144 |
{
|
| 145 |
$paymentData = false;
|
| 35 |
protected function _getConfig() {
|
| 36 |
return Mage::getSingleton('payments/config');
|
| 37 |
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Get saved credit cards in Zooz
|
| 41 |
+
*
|
| 42 |
+
* @return bool
|
| 43 |
+
*/
|
| 44 |
public function getPaymentMethods()
|
| 45 |
{
|
| 46 |
$customerLoginId = false;
|
| 54 |
|
| 55 |
return false;
|
| 56 |
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Retrieves collection of the countries saved in magento
|
| 60 |
+
*
|
| 61 |
+
* @return mixed
|
| 62 |
+
*/
|
| 63 |
public function getCountryCollection()
|
| 64 |
{
|
| 65 |
if (!$this->_countryCollection) {
|
| 68 |
}
|
| 69 |
return $this->_countryCollection;
|
| 70 |
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Retrieves html dropdown with countries
|
| 74 |
+
*
|
| 75 |
+
* @return mixed
|
| 76 |
+
*/
|
| 77 |
public function getCountryHtmlSelect()
|
| 78 |
{
|
| 79 |
$countryId = null;
|
| 97 |
|
| 98 |
return $select->getHtml();
|
| 99 |
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Retrieves country options
|
| 103 |
+
*
|
| 104 |
+
* @return bool|mixed
|
| 105 |
+
*/
|
| 106 |
public function getCountryOptions()
|
| 107 |
{
|
| 108 |
$options = false;
|
| 159 |
$this->setData('cc_years', $result);
|
| 160 |
return $result;
|
| 161 |
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Retrieves credit card details
|
| 165 |
+
*
|
| 166 |
+
* @return bool
|
| 167 |
+
* @throws Exception
|
| 168 |
+
*/
|
| 169 |
public function getCreditCardDetails()
|
| 170 |
{
|
| 171 |
$paymentData = false;
|
app/code/community/Zooz/Payments/Block/Form/Payments.php
CHANGED
|
@@ -57,6 +57,9 @@ class Zooz_Payments_Block_Form_Payments extends Mage_Payment_Block_Form {
|
|
| 57 |
return Mage::getModel('payments/config')->isSavingCardDataAllowed();
|
| 58 |
}
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
public function getSavedCards()
|
| 61 |
{
|
| 62 |
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
|
@@ -113,7 +116,14 @@ class Zooz_Payments_Block_Form_Payments extends Mage_Payment_Block_Form {
|
|
| 113 |
}
|
| 114 |
return Zooz_Payments_Model_Payments::ACTION_MODE_SANDBOX;
|
| 115 |
}
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
public function getPaymentToken($payment, $amount)
|
| 118 |
{
|
| 119 |
$paymentModel = $this->_getPayment();
|
|
@@ -122,6 +132,8 @@ class Zooz_Payments_Block_Form_Payments extends Mage_Payment_Block_Form {
|
|
| 122 |
}
|
| 123 |
|
| 124 |
/**
|
|
|
|
|
|
|
| 125 |
* @return bool
|
| 126 |
*/
|
| 127 |
public function isPciIframeEnabled()
|
|
@@ -129,16 +141,31 @@ class Zooz_Payments_Block_Form_Payments extends Mage_Payment_Block_Form {
|
|
| 129 |
return $this->_getConfig()->isPciIframeEnabled();
|
| 130 |
}
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
public function getIframeUrl()
|
| 133 |
{
|
| 134 |
return $this->_getConfig()->getPciIframeUrl();
|
| 135 |
}
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
public function getUniqueId()
|
| 138 |
{
|
| 139 |
return $this->_getConfig()->getProgramId();
|
| 140 |
}
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
public function isSandbox()
|
| 143 |
{
|
| 144 |
return $this->_getConfig()->isSandbox();
|
| 57 |
return Mage::getModel('payments/config')->isSavingCardDataAllowed();
|
| 58 |
}
|
| 59 |
|
| 60 |
+
/**
|
| 61 |
+
* @return array
|
| 62 |
+
*/
|
| 63 |
public function getSavedCards()
|
| 64 |
{
|
| 65 |
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
| 116 |
}
|
| 117 |
return Zooz_Payments_Model_Payments::ACTION_MODE_SANDBOX;
|
| 118 |
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Retrieves payment token from Zooz
|
| 122 |
+
*
|
| 123 |
+
* @param $payment array
|
| 124 |
+
* @param $amount float Grand Total
|
| 125 |
+
* @return null
|
| 126 |
+
*/
|
| 127 |
public function getPaymentToken($payment, $amount)
|
| 128 |
{
|
| 129 |
$paymentModel = $this->_getPayment();
|
| 132 |
}
|
| 133 |
|
| 134 |
/**
|
| 135 |
+
* Retrieves config if iframe is set for the payment
|
| 136 |
+
*
|
| 137 |
* @return bool
|
| 138 |
*/
|
| 139 |
public function isPciIframeEnabled()
|
| 141 |
return $this->_getConfig()->isPciIframeEnabled();
|
| 142 |
}
|
| 143 |
|
| 144 |
+
/**
|
| 145 |
+
* Retrieves iframe url
|
| 146 |
+
*
|
| 147 |
+
* @return string
|
| 148 |
+
*/
|
| 149 |
public function getIframeUrl()
|
| 150 |
{
|
| 151 |
return $this->_getConfig()->getPciIframeUrl();
|
| 152 |
}
|
| 153 |
+
|
| 154 |
+
/**
|
| 155 |
+
* Retrieves program unique ID
|
| 156 |
+
*
|
| 157 |
+
* @return string
|
| 158 |
+
*/
|
| 159 |
public function getUniqueId()
|
| 160 |
{
|
| 161 |
return $this->_getConfig()->getProgramId();
|
| 162 |
}
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* Retrieves config is sandbox is set
|
| 166 |
+
*
|
| 167 |
+
* @return bool
|
| 168 |
+
*/
|
| 169 |
public function isSandbox()
|
| 170 |
{
|
| 171 |
return $this->_getConfig()->isSandbox();
|
app/code/community/Zooz/Payments/Model/Api.php
CHANGED
|
@@ -1,22 +1,73 @@
|
|
| 1 |
<?php
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
class Zooz_Payments_Model_Api
|
| 4 |
{
|
|
|
|
|
|
|
|
|
|
| 5 |
const ACTION_MODE_SANDBOX = 'sandbox';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
const ACTION_MODE_PRODUCTION = 'production';
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
const URI_SANDBOX = 'https://sandbox.zooz.co/mobile/ZooZPaymentAPI';
|
|
|
|
|
|
|
|
|
|
| 9 |
const URI_PRODUCTION = 'https://app.zooz.com/mobile/ZooZPaymentAPI';
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
const RESPONSE_CODE_SUCCESS = 0;
|
|
|
|
|
|
|
|
|
|
| 12 |
const RESPONSE_CODE_FAILURE = -1;
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
const PAYMENT_METHOD_STATUS_VALID = 0;
|
|
|
|
|
|
|
|
|
|
| 15 |
const PAYMENT_METHOD_STATUS_EXPIRED = 1;
|
|
|
|
|
|
|
|
|
|
| 16 |
const PAYMENT_METHOD_STATUS_NOTVALID = 2;
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
const XML_PATH_CONFIG_GROUP = 'payment/payments/';
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
private function getConfigData($field, $storeId = null)
|
| 21 |
{
|
| 22 |
$path = self::XML_PATH_CONFIG_GROUP . $field;
|
|
@@ -24,6 +75,8 @@ class Zooz_Payments_Model_Api
|
|
| 24 |
}
|
| 25 |
|
| 26 |
/**
|
|
|
|
|
|
|
| 27 |
* @return Zooz_Payments_Model_Payments_Request
|
| 28 |
*/
|
| 29 |
protected function _getRequest()
|
|
@@ -32,6 +85,8 @@ class Zooz_Payments_Model_Api
|
|
| 32 |
}
|
| 33 |
|
| 34 |
/**
|
|
|
|
|
|
|
| 35 |
* @return Zooz_Payments_Helper_Data
|
| 36 |
*/
|
| 37 |
protected function _getHelper()
|
|
@@ -65,7 +120,7 @@ class Zooz_Payments_Model_Api
|
|
| 65 |
}
|
| 66 |
|
| 67 |
/**
|
| 68 |
-
*
|
| 69 |
*
|
| 70 |
* @return Varien_Http_Client
|
| 71 |
* @throws Zend_Http_Client_Exception
|
|
@@ -158,9 +213,14 @@ class Zooz_Payments_Model_Api
|
|
| 158 |
}
|
| 159 |
|
| 160 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
* @param Mage_Payment_Model_Info $payment
|
| 162 |
-
* @param $amount
|
| 163 |
-
* @param $customerLoginId
|
| 164 |
* @return Zooz_Payments_Model_Payments_Result
|
| 165 |
*/
|
| 166 |
public function openPayment(Mage_Payment_Model_Info $payment, $amount, $customerLoginId)
|
|
@@ -275,6 +335,8 @@ class Zooz_Payments_Model_Api
|
|
| 275 |
}
|
| 276 |
|
| 277 |
/**
|
|
|
|
|
|
|
| 278 |
* @return bool
|
| 279 |
*/
|
| 280 |
protected function _isSavingCardDataAllowed()
|
|
@@ -283,8 +345,10 @@ class Zooz_Payments_Model_Api
|
|
| 283 |
}
|
| 284 |
|
| 285 |
/**
|
|
|
|
|
|
|
| 286 |
* @param Varien_Object|array $cardData
|
| 287 |
-
* @param
|
| 288 |
* @param string $paymentToken
|
| 289 |
* @return Zooz_Payments_Model_Payments_Result
|
| 290 |
*/
|
|
@@ -350,6 +414,13 @@ class Zooz_Payments_Model_Api
|
|
| 350 |
return $response;
|
| 351 |
}
|
| 352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
public function getToken($customerLoginId = false) {
|
| 354 |
|
| 355 |
if(!$customerLoginId) {
|
|
@@ -360,6 +431,9 @@ class Zooz_Payments_Model_Api
|
|
| 360 |
}
|
| 361 |
|
| 362 |
/**
|
|
|
|
|
|
|
|
|
|
| 363 |
* @param string $customerLoginId
|
| 364 |
* @return string|null
|
| 365 |
*/
|
|
@@ -432,6 +506,13 @@ class Zooz_Payments_Model_Api
|
|
| 432 |
|
| 433 |
return $methods;
|
| 434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
public function getPaymentDetails($customerLoginId)
|
| 436 |
{
|
| 437 |
$request = $this->_getRequest();
|
|
@@ -471,6 +552,13 @@ class Zooz_Payments_Model_Api
|
|
| 471 |
return null;
|
| 472 |
}
|
| 473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
public function updateBilling($customer_id, $address) {
|
| 475 |
return $this->_getToken($customer_id, $address);
|
| 476 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
/**
|
| 4 |
+
* ZooZ Payments Integration
|
| 5 |
+
*
|
| 6 |
+
* @category Zooz
|
| 7 |
+
* @package Zooz_Payments
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Payment Api model
|
| 12 |
+
*
|
| 13 |
+
* @category Zooz
|
| 14 |
+
* @package Zooz_Payments
|
| 15 |
+
*/
|
| 16 |
class Zooz_Payments_Model_Api
|
| 17 |
{
|
| 18 |
+
/**
|
| 19 |
+
* @var string Static sandbox mode
|
| 20 |
+
*/
|
| 21 |
const ACTION_MODE_SANDBOX = 'sandbox';
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* @var string Static production mode
|
| 25 |
+
*/
|
| 26 |
const ACTION_MODE_PRODUCTION = 'production';
|
| 27 |
|
| 28 |
+
/**
|
| 29 |
+
* @var string sandbox api url
|
| 30 |
+
*/
|
| 31 |
const URI_SANDBOX = 'https://sandbox.zooz.co/mobile/ZooZPaymentAPI';
|
| 32 |
+
/**
|
| 33 |
+
* @var string production api url
|
| 34 |
+
*/
|
| 35 |
const URI_PRODUCTION = 'https://app.zooz.com/mobile/ZooZPaymentAPI';
|
| 36 |
|
| 37 |
+
/**
|
| 38 |
+
* @var int response code success
|
| 39 |
+
*/
|
| 40 |
const RESPONSE_CODE_SUCCESS = 0;
|
| 41 |
+
/**
|
| 42 |
+
* @var int response code failure
|
| 43 |
+
*/
|
| 44 |
const RESPONSE_CODE_FAILURE = -1;
|
| 45 |
|
| 46 |
+
/**
|
| 47 |
+
* @var int Payment method status valid
|
| 48 |
+
*/
|
| 49 |
const PAYMENT_METHOD_STATUS_VALID = 0;
|
| 50 |
+
/**
|
| 51 |
+
* @var int Payment method status expired
|
| 52 |
+
*/
|
| 53 |
const PAYMENT_METHOD_STATUS_EXPIRED = 1;
|
| 54 |
+
/**
|
| 55 |
+
* @var int Payment method status invalid
|
| 56 |
+
*/
|
| 57 |
const PAYMENT_METHOD_STATUS_NOTVALID = 2;
|
| 58 |
|
| 59 |
+
/**
|
| 60 |
+
* @var string config path
|
| 61 |
+
*/
|
| 62 |
const XML_PATH_CONFIG_GROUP = 'payment/payments/';
|
| 63 |
|
| 64 |
+
/**
|
| 65 |
+
* Returns config based on provided field
|
| 66 |
+
*
|
| 67 |
+
* @param $field
|
| 68 |
+
* @param null $storeId
|
| 69 |
+
* @return mixed
|
| 70 |
+
*/
|
| 71 |
private function getConfigData($field, $storeId = null)
|
| 72 |
{
|
| 73 |
$path = self::XML_PATH_CONFIG_GROUP . $field;
|
| 75 |
}
|
| 76 |
|
| 77 |
/**
|
| 78 |
+
* Returns Request Model
|
| 79 |
+
*
|
| 80 |
* @return Zooz_Payments_Model_Payments_Request
|
| 81 |
*/
|
| 82 |
protected function _getRequest()
|
| 85 |
}
|
| 86 |
|
| 87 |
/**
|
| 88 |
+
* Return helper
|
| 89 |
+
*
|
| 90 |
* @return Zooz_Payments_Helper_Data
|
| 91 |
*/
|
| 92 |
protected function _getHelper()
|
| 120 |
}
|
| 121 |
|
| 122 |
/**
|
| 123 |
+
* Return Api Client
|
| 124 |
*
|
| 125 |
* @return Varien_Http_Client
|
| 126 |
* @throws Zend_Http_Client_Exception
|
| 213 |
}
|
| 214 |
|
| 215 |
/**
|
| 216 |
+
* To start the payment process, use the openPayment API call. This opens a request to the Zooz server,
|
| 217 |
+
* using a secure channel.
|
| 218 |
+
* The openPayment call returns a payment token for uniquely identifying the transaction later on.
|
| 219 |
+
* The payment token is used to initiate payments, authorizations, refunds, voids, etc.; used for active operations.
|
| 220 |
+
*
|
| 221 |
* @param Mage_Payment_Model_Info $payment
|
| 222 |
+
* @param $amount integer Order grand total
|
| 223 |
+
* @param $customerLoginId integer customer login id saved in zooz api backend
|
| 224 |
* @return Zooz_Payments_Model_Payments_Result
|
| 225 |
*/
|
| 226 |
public function openPayment(Mage_Payment_Model_Info $payment, $amount, $customerLoginId)
|
| 335 |
}
|
| 336 |
|
| 337 |
/**
|
| 338 |
+
* Check's if Zooz should save cards in API side
|
| 339 |
+
*
|
| 340 |
* @return bool
|
| 341 |
*/
|
| 342 |
protected function _isSavingCardDataAllowed()
|
| 345 |
}
|
| 346 |
|
| 347 |
/**
|
| 348 |
+
* Adds credit card to payment
|
| 349 |
+
*
|
| 350 |
* @param Varien_Object|array $cardData
|
| 351 |
+
* @param integer $customerLoginId
|
| 352 |
* @param string $paymentToken
|
| 353 |
* @return Zooz_Payments_Model_Payments_Result
|
| 354 |
*/
|
| 414 |
return $response;
|
| 415 |
}
|
| 416 |
|
| 417 |
+
/**
|
| 418 |
+
* This call creates a secure session with Zooz server and allows you to add a credit card or remove it or
|
| 419 |
+
* do other operations, which are not payment related.
|
| 420 |
+
*
|
| 421 |
+
* @param bool $customerLoginId
|
| 422 |
+
* @return null|string
|
| 423 |
+
*/
|
| 424 |
public function getToken($customerLoginId = false) {
|
| 425 |
|
| 426 |
if(!$customerLoginId) {
|
| 431 |
}
|
| 432 |
|
| 433 |
/**
|
| 434 |
+
* Internal function to get token
|
| 435 |
+
* See getToken description
|
| 436 |
+
*
|
| 437 |
* @param string $customerLoginId
|
| 438 |
* @return string|null
|
| 439 |
*/
|
| 506 |
|
| 507 |
return $methods;
|
| 508 |
}
|
| 509 |
+
|
| 510 |
+
/**
|
| 511 |
+
* Retrieve complete payment details and payment statuses before and/or after commit or refund calls
|
| 512 |
+
*
|
| 513 |
+
* @param $customerLoginId
|
| 514 |
+
* @return Zooz_Payments_Model_Payments_Result
|
| 515 |
+
*/
|
| 516 |
public function getPaymentDetails($customerLoginId)
|
| 517 |
{
|
| 518 |
$request = $this->_getRequest();
|
| 552 |
return null;
|
| 553 |
}
|
| 554 |
|
| 555 |
+
/**
|
| 556 |
+
* Update's billing in Zooz
|
| 557 |
+
*
|
| 558 |
+
* @param $customer_id
|
| 559 |
+
* @param $address
|
| 560 |
+
* @return null|string
|
| 561 |
+
*/
|
| 562 |
public function updateBilling($customer_id, $address) {
|
| 563 |
return $this->_getToken($customer_id, $address);
|
| 564 |
}
|
app/code/community/Zooz/Payments/Model/Info.php
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
class Zooz_Payments_Model_Info
|
| 14 |
{
|
| 15 |
/**
|
| 16 |
-
* @var
|
| 17 |
*/
|
| 18 |
const PAYMENTSTATUS_APPROVED = 1001;
|
| 19 |
const PAYMENTSTATUS_AUTHORIZED_PENDING_COMPLETION = 1002;
|
|
@@ -32,6 +32,9 @@ class Zooz_Payments_Model_Info
|
|
| 32 |
const PAYMENTSTATUS_PAYMENT_APPROVED_PENDING_FOR_REFUND = 1017;
|
| 33 |
const PAYMENTSTATUS_REFUND_IS_WAITING_FOR_APPROVAL = 1018;
|
| 34 |
|
|
|
|
|
|
|
|
|
|
| 35 |
const PAYMENT_REASON_CODE_REFUND = 'refund';
|
| 36 |
|
| 37 |
}
|
| 13 |
class Zooz_Payments_Model_Info
|
| 14 |
{
|
| 15 |
/**
|
| 16 |
+
* @var integer
|
| 17 |
*/
|
| 18 |
const PAYMENTSTATUS_APPROVED = 1001;
|
| 19 |
const PAYMENTSTATUS_AUTHORIZED_PENDING_COMPLETION = 1002;
|
| 32 |
const PAYMENTSTATUS_PAYMENT_APPROVED_PENDING_FOR_REFUND = 1017;
|
| 33 |
const PAYMENTSTATUS_REFUND_IS_WAITING_FOR_APPROVAL = 1018;
|
| 34 |
|
| 35 |
+
/**
|
| 36 |
+
* @var string
|
| 37 |
+
*/
|
| 38 |
const PAYMENT_REASON_CODE_REFUND = 'refund';
|
| 39 |
|
| 40 |
}
|
app/code/community/Zooz/Payments/Model/Observer.php
CHANGED
|
@@ -1,9 +1,29 @@
|
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
class Zooz_Payments_Model_Observer
|
| 4 |
{
|
| 5 |
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
public function handleSalesOrderSaveBefore(Varien_Event_Observer $observer)
|
| 8 |
{
|
| 9 |
|
|
@@ -49,6 +69,11 @@ class Zooz_Payments_Model_Observer
|
|
| 49 |
|
| 50 |
}
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
protected function _getApi()
|
| 53 |
{
|
| 54 |
return Mage::getSingleton('payments/api');
|
| 1 |
<?php
|
| 2 |
+
/**
|
| 3 |
+
* ZooZ Payments Integration
|
| 4 |
+
*
|
| 5 |
+
* @category Zooz
|
| 6 |
+
* @package Zooz_Payments
|
| 7 |
+
*/
|
| 8 |
|
| 9 |
+
/**
|
| 10 |
+
* Observer class which will prepare order for sending to Zooz API
|
| 11 |
+
*
|
| 12 |
+
* Used for retrieving configuration data by payment models
|
| 13 |
+
*
|
| 14 |
+
* @category Zooz
|
| 15 |
+
* @package Zooz_Payments
|
| 16 |
+
*/
|
| 17 |
class Zooz_Payments_Model_Observer
|
| 18 |
{
|
| 19 |
|
| 20 |
|
| 21 |
+
/**
|
| 22 |
+
* Observer catchs the sales_order_save_before and prepare data required for zooz
|
| 23 |
+
*
|
| 24 |
+
* @param Varien_Event_Observer $observer
|
| 25 |
+
* @return void
|
| 26 |
+
*/
|
| 27 |
public function handleSalesOrderSaveBefore(Varien_Event_Observer $observer)
|
| 28 |
{
|
| 29 |
|
| 69 |
|
| 70 |
}
|
| 71 |
|
| 72 |
+
/**
|
| 73 |
+
* Retrevie the Api model
|
| 74 |
+
*
|
| 75 |
+
* @return Zooz_Payments_Model_Api
|
| 76 |
+
*/
|
| 77 |
protected function _getApi()
|
| 78 |
{
|
| 79 |
return Mage::getSingleton('payments/api');
|
app/code/community/Zooz/Payments/Model/Payments.php
CHANGED
|
@@ -77,7 +77,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 77 |
* Send authorize request to gateway
|
| 78 |
*
|
| 79 |
* @param Varien_Object $payment
|
| 80 |
-
* @param
|
| 81 |
* @return Zooz_Payments_Model_Payments
|
| 82 |
*/
|
| 83 |
public function authorize(Varien_Object $payment, $amount)
|
|
@@ -89,12 +89,6 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 89 |
|
| 90 |
$this->_initCardsStorage($payment);
|
| 91 |
|
| 92 |
-
// if ($this->isPartialAuthorization($payment)) {
|
| 93 |
-
// $this->_partialAuthorization($payment, $amount, self::REQUEST_TYPE_AUTH_ONLY);
|
| 94 |
-
// $payment->setSkipTransactionCreation(true);
|
| 95 |
-
// return $this;
|
| 96 |
-
// }
|
| 97 |
-
|
| 98 |
if($payment->getIsIframe()) {
|
| 99 |
$this->_paymentToken = $payment->getCcPaymentToken();
|
| 100 |
$this->_paymentMethodToken = $payment->getCcSavedCard();
|
|
@@ -126,7 +120,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 126 |
* Send capture request to gateway
|
| 127 |
*
|
| 128 |
* @param Varien_Object $payment
|
| 129 |
-
* @param
|
| 130 |
* @return Zooz_Payments_Model_Payments
|
| 131 |
*/
|
| 132 |
public function capture(Varien_Object $payment, $amount)
|
|
@@ -236,7 +230,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 236 |
* Refund the amount with transaction id
|
| 237 |
*
|
| 238 |
* @param Varien_Object $payment
|
| 239 |
-
* @param
|
| 240 |
* @return Mage_Paygate_Model_Authorizenet
|
| 241 |
* @throws Mage_Core_Exception
|
| 242 |
*/
|
|
@@ -289,14 +283,27 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 289 |
return $this;
|
| 290 |
}
|
| 291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
public function getPaymentToken($payment, $amount)
|
| 293 |
{
|
| 294 |
-
|
| 295 |
$result = $this->_openPayment($payment, $amount);
|
| 296 |
return $this->_paymentToken;
|
| 297 |
}
|
| 298 |
|
| 299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
protected function _openPayment($payment, $amount)
|
| 301 |
{
|
| 302 |
|
|
@@ -308,6 +315,8 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 308 |
}
|
| 309 |
|
| 310 |
/**
|
|
|
|
|
|
|
| 311 |
* @param Mage_Payment_Model_Info $payment
|
| 312 |
* @return $this
|
| 313 |
*/
|
|
@@ -339,7 +348,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 339 |
* Send request with new payment to gateway
|
| 340 |
*
|
| 341 |
* @param Mage_Payment_Model_Info $payment
|
| 342 |
-
* @param
|
| 343 |
* @param string $requestType
|
| 344 |
* @return Zooz_Payments_Model_Payments
|
| 345 |
* @throws Mage_Core_Exception
|
|
@@ -402,11 +411,13 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 402 |
Mage::throwException($defaultExceptionMessage);
|
| 403 |
}
|
| 404 |
return $this;
|
| 405 |
-
}
|
|
|
|
|
|
|
| 406 |
* Update transaction with order id
|
| 407 |
*
|
| 408 |
* @param Varien_Object $payment
|
| 409 |
-
* @param
|
| 410 |
* @param string $requestType
|
| 411 |
* @return Zooz_Payments_Model_Payments
|
| 412 |
* @throws Mage_Core_Exception
|
|
@@ -466,7 +477,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 466 |
* Send capture request to gateway for capture authorized transactions
|
| 467 |
*
|
| 468 |
* @param Mage_Payment_Model_Info $payment
|
| 469 |
-
* @param
|
| 470 |
* @return Zooz_Payments_Model_Payments
|
| 471 |
*/
|
| 472 |
protected function _preauthorizeCapture($payment, $requestedAmount)
|
|
@@ -521,7 +532,7 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 521 |
* Send capture request to gateway for capture authorized transactions of card
|
| 522 |
*
|
| 523 |
* @param Mage_Payment_Model_Info $payment
|
| 524 |
-
* @param
|
| 525 |
* @param Varien_Object $card
|
| 526 |
* @return Mage_Sales_Model_Order_Payment_Transaction
|
| 527 |
*/
|
|
@@ -714,6 +725,10 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 714 |
Mage::throwException(Mage::helper('payments')->convertMessagesToMessage($messages));
|
| 715 |
}
|
| 716 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
public function validate()
|
| 718 |
{
|
| 719 |
$helper = $this->_getHelper();
|
|
@@ -757,6 +772,9 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 757 |
return $this;
|
| 758 |
}
|
| 759 |
|
|
|
|
|
|
|
|
|
|
| 760 |
public function getVerificationRegEx()
|
| 761 |
{
|
| 762 |
return array_merge(parent::getVerificationRegEx(), array(
|
|
@@ -764,6 +782,10 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 764 |
));
|
| 765 |
}
|
| 766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 767 |
public function OtherCcType($type)
|
| 768 |
{
|
| 769 |
return in_array($type, array('OT', 'DC'));
|
|
@@ -780,6 +802,10 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 780 |
return $api->getPaymentMethod($paymentMethodToken, $customerLoginId);
|
| 781 |
}
|
| 782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 783 |
private function _getApiClient()
|
| 784 |
{
|
| 785 |
$client = new Varien_Http_Client();
|
|
@@ -799,6 +825,9 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 799 |
return $client;
|
| 800 |
}
|
| 801 |
|
|
|
|
|
|
|
|
|
|
| 802 |
private function _getRequestUri()
|
| 803 |
{
|
| 804 |
if ($this->getConfigData('payment_mode') == self::ACTION_MODE_PRODUCTION) {
|
|
@@ -891,6 +920,10 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 891 |
}
|
| 892 |
}
|
| 893 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
public function assignData($data)
|
| 895 |
{
|
| 896 |
if (!($data instanceof Varien_Object)) {
|
|
@@ -918,11 +951,17 @@ class Zooz_Payments_Model_Payments extends Mage_Payment_Model_Method_Cc {
|
|
| 918 |
return Mage::getModel('payments/config')->isSavingCardDataAllowed();
|
| 919 |
}
|
| 920 |
|
|
|
|
|
|
|
|
|
|
| 921 |
protected function _getHelper()
|
| 922 |
{
|
| 923 |
return Mage::helper('payments');
|
| 924 |
}
|
| 925 |
|
|
|
|
|
|
|
|
|
|
| 926 |
protected function _getRequest()
|
| 927 |
{
|
| 928 |
return Mage::getModel('payments/payments_request');
|
| 77 |
* Send authorize request to gateway
|
| 78 |
*
|
| 79 |
* @param Varien_Object $payment
|
| 80 |
+
* @param float $amount
|
| 81 |
* @return Zooz_Payments_Model_Payments
|
| 82 |
*/
|
| 83 |
public function authorize(Varien_Object $payment, $amount)
|
| 89 |
|
| 90 |
$this->_initCardsStorage($payment);
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
if($payment->getIsIframe()) {
|
| 93 |
$this->_paymentToken = $payment->getCcPaymentToken();
|
| 94 |
$this->_paymentMethodToken = $payment->getCcSavedCard();
|
| 120 |
* Send capture request to gateway
|
| 121 |
*
|
| 122 |
* @param Varien_Object $payment
|
| 123 |
+
* @param float $amount
|
| 124 |
* @return Zooz_Payments_Model_Payments
|
| 125 |
*/
|
| 126 |
public function capture(Varien_Object $payment, $amount)
|
| 230 |
* Refund the amount with transaction id
|
| 231 |
*
|
| 232 |
* @param Varien_Object $payment
|
| 233 |
+
* @param float $amount
|
| 234 |
* @return Mage_Paygate_Model_Authorizenet
|
| 235 |
* @throws Mage_Core_Exception
|
| 236 |
*/
|
| 283 |
return $this;
|
| 284 |
}
|
| 285 |
|
| 286 |
+
/**
|
| 287 |
+
* Retrieves payment token
|
| 288 |
+
*
|
| 289 |
+
* @param $payment
|
| 290 |
+
* @param $amount
|
| 291 |
+
* @return null
|
| 292 |
+
*/
|
| 293 |
public function getPaymentToken($payment, $amount)
|
| 294 |
{
|
|
|
|
| 295 |
$result = $this->_openPayment($payment, $amount);
|
| 296 |
return $this->_paymentToken;
|
| 297 |
}
|
| 298 |
|
| 299 |
|
| 300 |
+
/**
|
| 301 |
+
* Opens payments on api side
|
| 302 |
+
*
|
| 303 |
+
* @param $payment
|
| 304 |
+
* @param $amount
|
| 305 |
+
* @return $this
|
| 306 |
+
*/
|
| 307 |
protected function _openPayment($payment, $amount)
|
| 308 |
{
|
| 309 |
|
| 315 |
}
|
| 316 |
|
| 317 |
/**
|
| 318 |
+
* Adds credit card to payment
|
| 319 |
+
*
|
| 320 |
* @param Mage_Payment_Model_Info $payment
|
| 321 |
* @return $this
|
| 322 |
*/
|
| 348 |
* Send request with new payment to gateway
|
| 349 |
*
|
| 350 |
* @param Mage_Payment_Model_Info $payment
|
| 351 |
+
* @param float $amount
|
| 352 |
* @param string $requestType
|
| 353 |
* @return Zooz_Payments_Model_Payments
|
| 354 |
* @throws Mage_Core_Exception
|
| 411 |
Mage::throwException($defaultExceptionMessage);
|
| 412 |
}
|
| 413 |
return $this;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
/**
|
| 417 |
* Update transaction with order id
|
| 418 |
*
|
| 419 |
* @param Varien_Object $payment
|
| 420 |
+
* @param float $amount
|
| 421 |
* @param string $requestType
|
| 422 |
* @return Zooz_Payments_Model_Payments
|
| 423 |
* @throws Mage_Core_Exception
|
| 477 |
* Send capture request to gateway for capture authorized transactions
|
| 478 |
*
|
| 479 |
* @param Mage_Payment_Model_Info $payment
|
| 480 |
+
* @param float $amount
|
| 481 |
* @return Zooz_Payments_Model_Payments
|
| 482 |
*/
|
| 483 |
protected function _preauthorizeCapture($payment, $requestedAmount)
|
| 532 |
* Send capture request to gateway for capture authorized transactions of card
|
| 533 |
*
|
| 534 |
* @param Mage_Payment_Model_Info $payment
|
| 535 |
+
* @param float $amount
|
| 536 |
* @param Varien_Object $card
|
| 537 |
* @return Mage_Sales_Model_Order_Payment_Transaction
|
| 538 |
*/
|
| 725 |
Mage::throwException(Mage::helper('payments')->convertMessagesToMessage($messages));
|
| 726 |
}
|
| 727 |
|
| 728 |
+
/**
|
| 729 |
+
* @return $this|Mage_Payment_Model_Abstract
|
| 730 |
+
* @throws Mage_Core_Exception
|
| 731 |
+
*/
|
| 732 |
public function validate()
|
| 733 |
{
|
| 734 |
$helper = $this->_getHelper();
|
| 772 |
return $this;
|
| 773 |
}
|
| 774 |
|
| 775 |
+
/**
|
| 776 |
+
* @return array
|
| 777 |
+
*/
|
| 778 |
public function getVerificationRegEx()
|
| 779 |
{
|
| 780 |
return array_merge(parent::getVerificationRegEx(), array(
|
| 782 |
));
|
| 783 |
}
|
| 784 |
|
| 785 |
+
/**
|
| 786 |
+
* @param $type
|
| 787 |
+
* @return bool
|
| 788 |
+
*/
|
| 789 |
public function OtherCcType($type)
|
| 790 |
{
|
| 791 |
return in_array($type, array('OT', 'DC'));
|
| 802 |
return $api->getPaymentMethod($paymentMethodToken, $customerLoginId);
|
| 803 |
}
|
| 804 |
|
| 805 |
+
/**
|
| 806 |
+
* @return Varien_Http_Client
|
| 807 |
+
* @throws Zend_Http_Client_Exception
|
| 808 |
+
*/
|
| 809 |
private function _getApiClient()
|
| 810 |
{
|
| 811 |
$client = new Varien_Http_Client();
|
| 825 |
return $client;
|
| 826 |
}
|
| 827 |
|
| 828 |
+
/**
|
| 829 |
+
* @return string
|
| 830 |
+
*/
|
| 831 |
private function _getRequestUri()
|
| 832 |
{
|
| 833 |
if ($this->getConfigData('payment_mode') == self::ACTION_MODE_PRODUCTION) {
|
| 920 |
}
|
| 921 |
}
|
| 922 |
|
| 923 |
+
/**
|
| 924 |
+
* @param mixed $data
|
| 925 |
+
* @return $this
|
| 926 |
+
*/
|
| 927 |
public function assignData($data)
|
| 928 |
{
|
| 929 |
if (!($data instanceof Varien_Object)) {
|
| 951 |
return Mage::getModel('payments/config')->isSavingCardDataAllowed();
|
| 952 |
}
|
| 953 |
|
| 954 |
+
/**
|
| 955 |
+
* @return Mage_Core_Helper_Abstract
|
| 956 |
+
*/
|
| 957 |
protected function _getHelper()
|
| 958 |
{
|
| 959 |
return Mage::helper('payments');
|
| 960 |
}
|
| 961 |
|
| 962 |
+
/**
|
| 963 |
+
* @return false|Mage_Core_Model_Abstract
|
| 964 |
+
*/
|
| 965 |
protected function _getRequest()
|
| 966 |
{
|
| 967 |
return Mage::getModel('payments/payments_request');
|
app/code/community/Zooz/Payments/controllers/CustomerController.php
CHANGED
|
@@ -24,7 +24,12 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 24 |
$this->loadLayout();
|
| 25 |
$this->renderLayout();
|
| 26 |
}
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
public function creditcardsAction() {
|
| 29 |
if (!$this->_getSession()->isLoggedIn()) {
|
| 30 |
$this->_redirect('customer/account/login');
|
|
@@ -53,6 +58,10 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 53 |
$this->renderLayout();
|
| 54 |
}
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
public function deletecardAction()
|
| 57 |
{
|
| 58 |
$isValidToken = false;
|
|
@@ -76,7 +85,11 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 76 |
$this->_redirect('payments/customer/creditcards');
|
| 77 |
}
|
| 78 |
}
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
public function editcardAction()
|
| 81 |
{
|
| 82 |
$isValidToken = false;
|
|
@@ -103,6 +116,10 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 103 |
$this->renderLayout();
|
| 104 |
}
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
public function updateCustomerAddressAction() {
|
| 107 |
if(!Mage::app()->getRequest()->isAjax()){
|
| 108 |
$this->norouteAction();
|
|
@@ -133,6 +150,12 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 133 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('token' => $response)));
|
| 134 |
}
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
protected function _save($data)
|
| 137 |
{
|
| 138 |
if(!isset($data['payment'])) return new Varien_Object(array("response_code" => 0));
|
|
@@ -167,13 +190,25 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 167 |
|
| 168 |
return $response;
|
| 169 |
}
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
protected function _delete($cutomerLoginId, $paymentMethodToken)
|
| 172 |
{
|
| 173 |
$response = $this->_getApi()->removePaymentMethod($cutomerLoginId, $paymentMethodToken);
|
| 174 |
return $response;
|
| 175 |
}
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
protected function _getApi()
|
| 178 |
{
|
| 179 |
return Mage::getSingleton('payments/api');
|
|
@@ -188,7 +223,12 @@ class Zooz_Payments_CustomerController extends Mage_Core_Controller_Front_Action
|
|
| 188 |
{
|
| 189 |
return Mage::getSingleton('customer/session');
|
| 190 |
}
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
protected function _getCustomer()
|
| 193 |
{
|
| 194 |
return Mage::getSingleton('customer/session');
|
| 24 |
$this->loadLayout();
|
| 25 |
$this->renderLayout();
|
| 26 |
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Get list of all card in Zooz
|
| 30 |
+
* If post data is set runs Api call and add credit card in Zooz
|
| 31 |
+
*
|
| 32 |
+
*/
|
| 33 |
public function creditcardsAction() {
|
| 34 |
if (!$this->_getSession()->isLoggedIn()) {
|
| 35 |
$this->_redirect('customer/account/login');
|
| 58 |
$this->renderLayout();
|
| 59 |
}
|
| 60 |
|
| 61 |
+
/**
|
| 62 |
+
* Delete custome credit card in Zooz
|
| 63 |
+
*
|
| 64 |
+
*/
|
| 65 |
public function deletecardAction()
|
| 66 |
{
|
| 67 |
$isValidToken = false;
|
| 85 |
$this->_redirect('payments/customer/creditcards');
|
| 86 |
}
|
| 87 |
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Edit cc card ub Zooz
|
| 91 |
+
*
|
| 92 |
+
*/
|
| 93 |
public function editcardAction()
|
| 94 |
{
|
| 95 |
$isValidToken = false;
|
| 116 |
$this->renderLayout();
|
| 117 |
}
|
| 118 |
|
| 119 |
+
/**
|
| 120 |
+
* Updates customer billing address in Zooz
|
| 121 |
+
*
|
| 122 |
+
*/
|
| 123 |
public function updateCustomerAddressAction() {
|
| 124 |
if(!Mage::app()->getRequest()->isAjax()){
|
| 125 |
$this->norouteAction();
|
| 150 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('token' => $response)));
|
| 151 |
}
|
| 152 |
|
| 153 |
+
/**
|
| 154 |
+
* Prepare and save cc data in Zooz
|
| 155 |
+
*
|
| 156 |
+
* @param $data array Post data used for saving cc card
|
| 157 |
+
* @return Varien_Object
|
| 158 |
+
*/
|
| 159 |
protected function _save($data)
|
| 160 |
{
|
| 161 |
if(!isset($data['payment'])) return new Varien_Object(array("response_code" => 0));
|
| 190 |
|
| 191 |
return $response;
|
| 192 |
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* Calls API and removed cc on Zooz side form saved cc list
|
| 196 |
+
*
|
| 197 |
+
* @param $cutomerLoginId
|
| 198 |
+
* @param $paymentMethodToken
|
| 199 |
+
* @return mixed
|
| 200 |
+
*/
|
| 201 |
protected function _delete($cutomerLoginId, $paymentMethodToken)
|
| 202 |
{
|
| 203 |
$response = $this->_getApi()->removePaymentMethod($cutomerLoginId, $paymentMethodToken);
|
| 204 |
return $response;
|
| 205 |
}
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Retrieve Zooz API model
|
| 209 |
+
*
|
| 210 |
+
* @return Zooz_Payments_Model_Api
|
| 211 |
+
*/
|
| 212 |
protected function _getApi()
|
| 213 |
{
|
| 214 |
return Mage::getSingleton('payments/api');
|
| 223 |
{
|
| 224 |
return Mage::getSingleton('customer/session');
|
| 225 |
}
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Retrieve customers session
|
| 229 |
+
*
|
| 230 |
+
* @return Mage_Customer_Model_Session
|
| 231 |
+
*/
|
| 232 |
protected function _getCustomer()
|
| 233 |
{
|
| 234 |
return Mage::getSingleton('customer/session');
|
app/code/community/Zooz/Payments/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Zooz_Payments>
|
| 5 |
-
<version>3.0.0.
|
| 6 |
</Zooz_Payments>
|
| 7 |
</modules>
|
| 8 |
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Zooz_Payments>
|
| 5 |
+
<version>3.0.0.4</version>
|
| 6 |
</Zooz_Payments>
|
| 7 |
</modules>
|
| 8 |
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>ZooZ_payment</name>
|
| 4 |
-
<version>3.0.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>freeware</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Zooz payments package</summary>
|
| 10 |
<description>Zooz payments package</description>
|
| 11 |
-
<notes>
|
| 12 |
<authors><author><name>CreativeMinds</name><user>cminds</user><email>wojtek@cminds.com</email></author></authors>
|
| 13 |
-
<date>2016-06-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="zoozpayments"><file name="sprite-credit-card-types.png" hash="6c2e0ed5488cfeb218ceb27c5577e852"/><file name="zooz-cc.png" hash="3b66a873519785b378acfb0b0e0c8412"/><file name="zoozpayments.css" hash="ee7f9b1a65d764e9aeb29636e5b1f54e"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="zoozpayments"><file name="jquery.creditCardValidator.js" hash="17fc482f5c8c4730f28e7d0bbcabe72b"/></dir></dir></target><target name="magecommunity"><dir name="Zooz"><dir name="Payments"><dir name="Block"><dir name="Customer"><file name="Creditcard.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>ZooZ_payment</name>
|
| 4 |
+
<version>3.0.0.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>freeware</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Zooz payments package</summary>
|
| 10 |
<description>Zooz payments package</description>
|
| 11 |
+
<notes>Added comments to code</notes>
|
| 12 |
<authors><author><name>CreativeMinds</name><user>cminds</user><email>wojtek@cminds.com</email></author></authors>
|
| 13 |
+
<date>2016-06-13</date>
|
| 14 |
+
<time>12:07:38</time>
|
| 15 |
+
<contents><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="zoozpayments"><file name="sprite-credit-card-types.png" hash="6c2e0ed5488cfeb218ceb27c5577e852"/><file name="zooz-cc.png" hash="3b66a873519785b378acfb0b0e0c8412"/><file name="zoozpayments.css" hash="ee7f9b1a65d764e9aeb29636e5b1f54e"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="zoozpayments"><file name="jquery.creditCardValidator.js" hash="17fc482f5c8c4730f28e7d0bbcabe72b"/></dir></dir></target><target name="magecommunity"><dir name="Zooz"><dir name="Payments"><dir name="Block"><dir name="Customer"><file name="Creditcard.php" hash="ff96781d6db2ded9252bd86625a3d4ef"/></dir><dir name="Form"><file name="Payments.php" hash="1031c32f8584ec5b3dbf172dc7c7a7e4"/></dir><dir name="Info"><file name="Payments.php" hash="b59cf3509272c9d8fa57c806ddb864c1"/></dir></dir><file name="Exception.php" hash="e49547ad5ae8f5648c30c4fab6f606ee"/><dir name="Helper"><file name="Data.php" hash="6302290885cc3007da7e49d288e7998d"/></dir><dir name="Model"><file name="Api.php" hash="2e7769cc2df5d33df7dee0af5573e16c"/><file name="Config.php" hash="4e161d3ae3248235d7a4aa5144e60fe4"/><file name="Info.php" hash="a757ea234ea0b839405ba6ad7aa2aa62"/><file name="Ipn.php" hash="c70a448eca02e5b61e8d3464637b694e"/><dir name="Mysql4"><file name="Debug.php" hash="6e5bc2f93042ba4f016f15f81483daea"/></dir><file name="Observer.php" hash="c81321726ae29ff0a7e95b09269b0bb2"/><dir name="Payments"><file name="Cards.php" hash="927e304e987c4020ce46c8f0d0b53912"/><file name="Request.php" hash="7a0fb26596ceacc64f3aa01987f06feb"/><file name="Result.php" hash="c9608ca92bc7bbe60511fc11b5f8d79a"/><dir name="Source"><file name="Cctype.php" hash="87ad1d9fbfeabddb0b8b38bfb690ee7e"/><file name="PaymentAction.php" hash="6be437ff22f852f2eac556923a3afdf7"/><file name="PaymentMode.php" hash="f2872cc940adfe5351d24201ad094884"/></dir></dir><file name="Payments.php" hash="abf51d89f9663065615085aac51a16f8"/><dir name="Resource"><dir name="Payments"><file name="Collection.php" hash="c6a4f347e06dc35562ac08444112b6c8"/></dir><file name="Payments.php" hash="b887885de7e101d492689c793c87be65"/></dir></dir><file name="UnavailableException.php" hash="2bfdd035f35d3dffaf44e6bcb9a4f6d6"/><dir name="controllers"><dir name="Adminhtml"><dir name="Zooz"><file name="PaymentController.php" hash="3aac1119e3e861a1ba2aae00b3d59048"/></dir></dir><file name="CustomerController.php" hash="347ca31908d01716ce8b660f6b1205eb"/><file name="IpnController.php" hash="27fc0087901fe59220758e3848159ada"/><file name="PaymentController.php" hash="62c6927dc44f346e1482abce1218523e"/></dir><dir name="etc"><file name="config.xml" hash="f1ab1ba880810ff5981fa9348ab50caa"/><file name="system.xml" hash="7da86d74bdcbffec8a6db733064e6d87"/></dir><dir name="sql"><dir name="payments_setup"><file name="install-1.0.0.0.php" hash="2e240b26b7dc6d1434aa9f78d3107b5d"/><file name="upgrade-1.0.0.0-1.0.0.1.php" hash="d59299a49ba84795fdae33321b893b48"/><file name="upgrade-1.0.0.1-1.0.0.2.php" hash="9dd0a32f5674834d06845ab5167ff7b0"/><file name="upgrade-1.0.0.2-1.0.0.3.php" hash="78826e6ca8de98fa9f76a5f17df3ebe4"/><file name="upgrade-1.0.0.3-1.0.0.4.php" hash="b4ce3ed58d9d3678268a834d4857f875"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="zoozpayments"><dir name="form"><file name="payments.phtml" hash="08e8347be54fe60c7a6175c0d47b7c98"/></dir><dir name="info"><file name="payments.phtml" hash="5b26244b93e7c079e410159e8e5a7461"/><file name="pdf.phtml" hash="d63e867c1b2269b26d7a31af16da2372"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payments.xml" hash="6823ee1d13c4cf86ea410d17d68d49c8"/></dir><dir name="template"><dir name="zoozpayments"><dir name="checkout"><dir name="onepage"><file name="payment.phtml" hash="edb64e1fbec271a5e940972d34b3330a"/></dir><file name=".DS_Store" hash="0de33780b8186e211ff7222a9bf9fa6e"/></dir><dir name="customer"><dir name="creditcard"><file name="edit.phtml" hash="b040d06945d191a2b84b61f2362bd86d"/><file name="iframe.phtml" hash="163fb4b0adf9e53547e20f765a365897"/><file name="list.phtml" hash="45073aac94bf0bb7a91f92ce94e37ab3"/></dir></dir><dir name="form"><dir name="payments"><file name="data.phtml" hash="8e3c31eda55c15a53cf12d85cec22be6"/><file name="iframe.phtml" hash="bd7e334e2a77d7a1cb4284a2cc126e9e"/><file name="new.phtml" hash="e77582655e13b495befb05a51be6ca2c"/><file name="saved.phtml" hash="f28a9a69b1082da04e660bf47c5cc7ac"/></dir><file name="payments.phtml" hash="dfd4ff9d4edb8eec8dd9f93382a14513"/></dir><dir name="info"><file name="payments.phtml" hash="141a8094bbeb6c95818f7b9d7dfcbc7c"/></dir><file name="redirect.phtml" hash="546a08a2999203ce90646d78f3857fe3"/><file name=".DS_Store" hash="d902c5d9c62c1d9af9b4f3f2154167e5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zooz_Payments.xml" hash="451f889f850d621228b70a8e24845068"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
