Skip to content

Commit

Permalink
Merge pull request #13 from magently/master
Browse files Browse the repository at this point in the history
Increase version to 0.7.3
  • Loading branch information
nicklloyd committed Nov 19, 2015
2 parents 68479b9 + 05f57b6 commit 017732d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 32 deletions.
22 changes: 17 additions & 5 deletions app/code/community/Sign2pay/Payment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ public function setStatusOnOrder($order, $status_code)
}

/**
* Prepare and return initial Sign2Pay request
* @todo device unical id
* Get current quote
*
* @return string
* @return Mage_Sales_Model_Quote $quote
*/
public function getSign2PayInitialRequest()
public function getQuote()
{
$session = Mage::getSingleton('checkout/session');
$quote = null;
Expand All @@ -177,6 +176,19 @@ public function getSign2PayInitialRequest()
$quote = Mage::getModel('sales/quote')->load($session->getSign2payQuoteId() ? $session->getSign2payQuoteId() : $session->getQuoteId());
}

return $quote;
}

/**
* Prepare and return initial Sign2Pay request
* @todo device unical id
*
* @return string
*/
public function getSign2PayInitialRequest()
{
$quote = $this->getQuote();

$billaddress = $quote->getBillingAddress();

$options = array();
Expand All @@ -185,7 +197,7 @@ public function getSign2PayInitialRequest()
$options['amount'] = $quote->getGrandTotal() * 100;
$options['response_type'] = 'code';
$options['device_uid'] = 'test';
$options['locale'] = Mage::app()->getLocale()->getLocaleCode();
$options['locale'] = preg_replace('/_.*$/', '', Mage::app()->getLocale()->getLocaleCode());
$options['state'] = $this->userStateHash();
$options['scope'] = 'payment';
$options['ref_id'] = $this->sign2PayCheckoutHash($quote->getReservedOrderId());
Expand Down
18 changes: 8 additions & 10 deletions app/code/community/Sign2pay/Payment/Model/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getRequestData($key = null)
/**
* Exchange hashed credentials for token (second step of Authrature)
*
*
*
* @return string (encoded json)
*/
public function processTokenExchangeRequest(array $data){
Expand All @@ -54,7 +54,7 @@ public function processTokenExchangeRequest(array $data){
/*==========================================start request preparation==========================*/
$client = new Varien_Http_Client('https://app.sign2pay.com/oauth/token');
$client->setMethod(Varien_Http_Client::POST);

$client->setAuth($client_id,$client_secret);
$client->setParameterPost($request_body);

Expand All @@ -70,28 +70,26 @@ public function processTokenExchangeRequest(array $data){
/**
* Exchange token for payment id (third step of Authrature)
*
*
*
* @return string (encoded json)
*/
public function processPaymentRequest(array $data){
//start variables preparation
$client_id = Mage::helper('sign2pay')->getSign2payClientId();
$client_secret = Mage::helper('sign2pay')->getSign2payClientSecret();

$quote = Mage::getSingleton('checkout/session')->getQuote();
$amount = $quote['grand_total']*100;

$quote = Mage::helper('sign2pay')->getQuote();

$ref_id = Mage::getSingleton('checkout/session')->getSign2PayCheckoutHash();

$request_body = array(
'client_id' => $client_id,
'amount' => $amount,
'amount' => $quote->getGrandTotal() * 100,
'ref_id' => $ref_id,
'token' => $data['access_token']['token']
);
//end variables preparation


/*==========================================start request preparation==========================*/
$client = new Varien_Http_Client('https://app.sign2pay.com/api/v2/payment/authorize/capture');
$client->setMethod(Varien_Http_Client::POST);
Expand Down Expand Up @@ -123,7 +121,7 @@ public function processPaymentCaptureResponse(array $request)
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$purchase_id = $this->getRequestData('purchase_id');
Mage::getSingleton('checkout/session')->setPurchaseId($purchase_id);

// Load appropriate order
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
if (!$this->_order->getId()) {
Expand Down Expand Up @@ -198,7 +196,7 @@ public function _verifyResponse($purchase_id)
}
else{
return false;
}
}
} catch (Zend_Http_Client_Exception $e) {
Mage::logException($e);
return false;
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Sign2pay/Payment/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Sign2pay_Payment>
<version>0.7.0</version>
<version>0.7.3</version>
</Sign2pay_Payment>
</modules>

Expand Down
10 changes: 0 additions & 10 deletions app/code/community/Sign2pay/Payment/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@
<show_in_store>1</show_in_store>
</heading_settings>

<merchant_id translate="label" backend_model="adminhtml/system_config_backend_encrypted">
<label>Merchant ID</label>
<comment>Located on your Sign2Pay Application settings page</comment>
<frontend_type>text</frontend_type>
<sort_order>6</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</merchant_id>

<client_id translate="label" backend_model="adminhtml/system_config_backend_encrypted">
<label>Client ID</label>
<comment>Located on your Sign2Pay Application settings page</comment>
Expand Down
11 changes: 5 additions & 6 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>Sign2Pay_Mobile_Payments</name>
<version>0.7.0</version>
<version>0.7.3</version>
<stability>beta</stability>
<license>Sign2Pay Commercial License</license>
<channel>community</channel>
Expand All @@ -13,12 +13,11 @@ Analysing hundreds of data points in a single signature, Sign2Pay provides the s
&#xD;
Compatible with: 1.7, 1.8, 1.9</description>
<notes>Changes:&#xD;
- Added Authrature authentication&#xD;
- Added notification to adminhtml if sign2pay is enabled and there are other currencies than EUR</notes>
- Fix payment amount in payment request</notes>
<authors><author><name>Sign2Pay</name><user>Sign2Pay</user><email>[email protected]</email></author></authors>
<date>2015-11-17</date>
<time>12:09:37</time>
<contents><target name="magecommunity"><dir name="Sign2pay"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="80a5205a24d830664b7f0a75c649c3ca"/></dir><dir name="Form"><file name="Sign2pay.php" hash="cd2d8bb7275ca626a36855ad33ee1f2a"/></dir><dir name="Info"><file name="Sign2pay.php" hash="f24dfc1137275bb5963ac3ce115c9702"/></dir><file name="Redirect.php" hash="b5eb3712efd70cfb7c136b98538a8b26"/><file name="RiskAssessment.php" hash="2404631636842acb48d0faa17bdaa0c0"/></dir><dir name="Helper"><file name="Checkout.php" hash="8dc4a28893064a1be1652eeb3e8092bb"/><file name="Data.php" hash="a952edfbef652126bc62ed42ea183eba"/></dir><dir name="Model"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="OnepageTypes.php" hash="ef9973c103caa53d5dee6ff8bf13a547"/></dir></dir></dir></dir><file name="Observer.php" hash="7acd19fdd773394f48e8b3e72b104c59"/><file name="Processor.php" hash="98cde7be09ab0c593c4f8a7619d4e3c6"/><file name="Sign2pay.php" hash="d32ef2a9d5b9af7213fec934256effcd"/></dir><dir name="controllers"><file name="PaymentController.php" hash="7af74604b5d25f886d123ca5b14391f9"/></dir><dir name="etc"><file name="config.xml" hash="bced054424844f9c2f961762f21a90da"/><file name="system.xml" hash="fb892ed63a1d4495744bfa96235fca7f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sign2pay.xml" hash="953d1389f9c540f790ffefc1541f2695"/></dir><dir name="template"><dir name="sign2pay"><dir name="form"><file name="sign2pay.phtml" hash="fa3c955409366048bef157d507df7988"/></dir><file name="redirect.phtml" hash="f9fa638723240bd8e3f84ae3835a499c"/><file name="riskassessment.phtml" hash="9d15a0924c0ebe7516a4f2cf23b0be17"/><file name="success.phtml" hash="8670cd6c98497a862f1e134082c9f45c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sign2pay_Payment.xml" hash="62959f5fdbe4e43aee1ac6c3bffc0978"/></dir></target><target name="mageweb"><dir name="js"><dir name="sign2pay"><file name="jquery.min.js" hash="e0e0559014b222245deb26b6ae8bd940"/><file name="payment.js" hash="2a732234223ec379f6f12fd308c20219"/></dir></dir></target></contents>
<date>2015-11-19</date>
<time>10:44:04</time>
<contents><target name="magecommunity"><dir name="Sign2pay"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="80a5205a24d830664b7f0a75c649c3ca"/></dir><dir name="Form"><file name="Sign2pay.php" hash="cd2d8bb7275ca626a36855ad33ee1f2a"/></dir><dir name="Info"><file name="Sign2pay.php" hash="f24dfc1137275bb5963ac3ce115c9702"/></dir><file name="Redirect.php" hash="b5eb3712efd70cfb7c136b98538a8b26"/><file name="RiskAssessment.php" hash="2404631636842acb48d0faa17bdaa0c0"/></dir><dir name="Helper"><file name="Checkout.php" hash="8dc4a28893064a1be1652eeb3e8092bb"/><file name="Data.php" hash="96f356b7a94c2eaa974721c35aaa2656"/></dir><dir name="Model"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="OnepageTypes.php" hash="ef9973c103caa53d5dee6ff8bf13a547"/></dir></dir></dir></dir><file name="Observer.php" hash="7acd19fdd773394f48e8b3e72b104c59"/><file name="Processor.php" hash="f028d03baaff7e143492d220e84bf0d7"/><file name="Sign2pay.php" hash="d32ef2a9d5b9af7213fec934256effcd"/></dir><dir name="controllers"><file name="PaymentController.php" hash="7af74604b5d25f886d123ca5b14391f9"/></dir><dir name="etc"><file name="config.xml" hash="37fb4d97f7d1532f9bea74c86775af90"/><file name="system.xml" hash="d42e26a55c606001325c3f23b17a9e70"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sign2pay.xml" hash="953d1389f9c540f790ffefc1541f2695"/></dir><dir name="template"><dir name="sign2pay"><dir name="form"><file name="sign2pay.phtml" hash="fa3c955409366048bef157d507df7988"/></dir><file name="redirect.phtml" hash="f9fa638723240bd8e3f84ae3835a499c"/><file name="riskassessment.phtml" hash="9d15a0924c0ebe7516a4f2cf23b0be17"/><file name="success.phtml" hash="8670cd6c98497a862f1e134082c9f45c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sign2pay_Payment.xml" hash="62959f5fdbe4e43aee1ac6c3bffc0978"/></dir></target><target name="mageweb"><dir name="js"><dir name="sign2pay"><file name="jquery.min.js" hash="e0e0559014b222245deb26b6ae8bd940"/><file name="payment.js" hash="2a732234223ec379f6f12fd308c20219"/></dir></dir></target></contents>
<compatible/>
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
</package>

0 comments on commit 017732d

Please sign in to comment.