Skip to content

Commit

Permalink
Add validation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrims0n committed Apr 30, 2016
1 parent bedafc7 commit c40d21c
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Razorpay_Payments_Model_Paymentmethod extends Mage_Payment_Model_Method_Ab
const CHANNEL_NAME = 'Razorpay/Magento%s_%s/%s';
const METHOD_CODE = 'razorpay';
const CURRENCY = 'INR';
const VERSION = '1.1.4';
const VERSION = '1.1.5';

protected $_code = self::METHOD_CODE;
protected $_canOrder = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public function orderAction()
$bA = $this->_getQuote()->getBillingAddress();

$responseArray['customer_name'] = $bA->getFirstname() . " " . $bA->getLastname();
$responseArray['customer_phone'] = $bA->getTelephone();
$responseArray['customer_phone'] = $bA->getTelephone() ?: '';
$responseArray['order_id'] = $orderId;
$responseArray['amount'] = $amount;
$responseArray['customer_email'] = $this->_getQuote()->getData('customer_email');
$responseArray['customer_email'] = $this->_getQuote()->getData('customer_email') ?: '';

$this->getResponse()
->setHttpResponseCode(200)
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Razorpay/Payments/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Razorpay_Payments>
<version>1.1.4</version>
<version>1.1.5</version>
</Razorpay_Payments>
</modules>
<global>
Expand Down
3 changes: 2 additions & 1 deletion app/design/frontend/base/default/layout/razorpay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</reference>
</firecheckout_index_index>
<!-- Compatibility with FireCheckout extension end-->

<!-- Compatibility with AppZab OneStepCheckout extension start-->
<onestepcheckout_index_index>
<reference name="head">
<block type="core/text" name="razorpay.checkout">
Expand All @@ -103,4 +103,5 @@
</block>
</reference>
</onestepcheckout_index_index>
<!-- Compatibility with AppZab OneStepCheckout extension end-->
</layout>
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@
};

var processRazorpayOrder = function() {
review.loadingbox();
var validator = new Validation(formId);

if (payment.currentMethod == '<?php echo $code ?>') {
if (validator.validate()) {
review.loadingbox();

if (razorpayUtils.isOrderSet()) {
review.onComplete();
placeRazorpayOrder();
if (payment.currentMethod == '<?php echo $code ?>') {

if (razorpayUtils.isOrderSet()) {
review.onComplete();
placeRazorpayOrder();
} else {
razorpayUtils.createOrder(placeRazorpayOrder, onError);
}
} else {
razorpayUtils.createOrder(placeRazorpayOrder, onError);
processNativeExtensionOrder();
}
} else {
processNativeExtensionOrder();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@
};

var processRazorpayOrder = function() {
if (payment.currentMethod == '<?php echo $code ?>') {
var validator = new Validation(formId);

if (razorpayUtils.isOrderSet()) {
placeRazorpayOrder();
if (validator.validate()) {
if (payment.currentMethod == '<?php echo $code ?>') {

if (razorpayUtils.isOrderSet()) {
placeRazorpayOrder();
} else {
razorpayUtils.createOrder(placeRazorpayOrder, showErrorMessage);
}
} else {
razorpayUtils.createOrder(placeRazorpayOrder, showErrorMessage);
processNativeExtensionOrder();
}
} else {
processNativeExtensionOrder();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@

// Process custom flow
var processRazorpayOrder = function() {
var addressForm = new VarienForm('opc-address-form-billing');

if (!addressForm.validator.validate()){
return;
}

if (!$j_opc('input[name="billing[use_for_shipping]"]').prop('checked')){
var addressForm = new VarienForm('opc-address-form-shipping');
if (!addressForm.validator.validate()){
return;
}
}

if (payment.currentMethod == '<?php echo $code; ?>') {
// Payment method is Razorpay Credit Card
IWD.OPC.Checkout.showLoader();
Expand Down
20 changes: 10 additions & 10 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>Razorpay_Payments</name>
<version>1.1.4</version>
<version>1.1.5</version>
<stability>beta</stability>
<license>MIT</license>
<channel>community</channel>
Expand All @@ -16,8 +16,8 @@
<email>[email protected]</email>
</author>
</authors>
<date>2016-04-29</date>
<time>04:16:53</time>
<date>2016-04-30</date>
<time>09:08:54</time>
<contents>
<target name="magecommunity">
<dir name="Razorpay">
Expand All @@ -30,13 +30,13 @@
<file hash="3eb01c681f348c86a4ec3c7dc7855439" name="Data.php"/>
</dir>
<dir name="Model">
<file hash="1571f59de8d2e17a93ae75171fac4d4b" name="Paymentmethod.php"/>
<file hash="3f91cadcb46727d639d35e7d3c745b0d" name="Paymentmethod.php"/>
</dir>
<dir name="controllers">
<file hash="e50ee030f720f26ef439a1dc6b8c66f8" name="CheckoutController.php"/>
<file hash="5d119068ed59ebe6bc27ff235762cb2c" name="CheckoutController.php"/>
</dir>
<dir name="etc">
<file hash="414512a1dc637d2d5de728b63344c2df" name="config.xml"/>
<file hash="238a09b888c75cd5c9d48fb45c192da9" name="config.xml"/>
<file hash="890c3193ccf85870cb0bd25f31ddf076" name="system.xml"/>
</dir>
</dir>
Expand All @@ -47,19 +47,19 @@
<dir name="base">
<dir name="default">
<dir name="layout">
<file hash="21fa3b940fd5aa033c79a4c4a26eb5e4" name="razorpay.xml"/>
<file hash="ac7bed7cced69cef2e1759b1d617c28c" name="razorpay.xml"/>
</dir>
<dir name="template">
<dir name="razorpay">
<dir name="extensions">
<dir name="appzab_osc">
<file hash="b8ac62ac314940ceda9a94bb7149043a" name="payments.phtml"/>
<file hash="9c06defd3a6a805f5bfdf9395dd87529" name="payments.phtml"/>
</dir>
<dir name="firecheckout">
<file hash="b792a741e5e8839202e93e6b9442b58b" name="payments.phtml"/>
<file hash="5df51cb66507cab9e0026125a6a8f6a2" name="payments.phtml"/>
</dir>
<dir name="iwd_opc">
<file hash="48fec536ebfee1dbe0c48c208f41b5c8" name="payments.phtml"/>
<file hash="a9ce71c2b5b5159d219f5fdddac0cdcb" name="payments.phtml"/>
</dir>
</dir>
<file hash="1493e996886160b37b930251f7ac78ce" name="order.phtml"/>
Expand Down

0 comments on commit c40d21c

Please sign in to comment.