Skip to content

Commit

Permalink
Creating order after saving quote shipping address (#224)
Browse files Browse the repository at this point in the history
* Creating order after saving quote shipping address

* update ajax call to check order by 500ms
  • Loading branch information
ramth05 authored Feb 12, 2021
1 parent 81b3195 commit 5b8d906
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Controller/Payment/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function execute()
}

//set the chache for race with webhook
$this->cache->save("started", "quote_Front_processing_$receipt_id", ["razorpay"], 120);
$this->cache->save("started", "quote_Front_processing_$receipt_id", ["razorpay"], 300);

$response = $this->resultFactory->create(ResultFactory::TYPE_JSON);
$response->setData($responseContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,24 @@ define(

//update shipping and billing before order into quotes
if(!quote.isVirtual()) {
shippingSaveProcessor.saveShippingInformation();
shippingSaveProcessor.saveShippingInformation().success(
function (response) {
self.createRzpOrder();
}
).fail(
function (response) {
fullScreenLoader.stopLoader();
self.isPaymentProcessing.reject(response.message);
}
);
} else {
self.createRzpOrder();
}

},
createRzpOrder: function(){
var self = this;

$.ajax({
type: 'POST',
url: url.build('razorpay/payment/order?' + Math.random().toString(36).substring(10)),
Expand Down Expand Up @@ -167,7 +182,6 @@ define(
}
});
},

createInputFieldsFromOptions: function (options, form) {
var self = this;

Expand Down Expand Up @@ -265,7 +279,7 @@ define(
if(response.order_id){
$(location).attr('href', 'onepage/success?' + Math.random().toString(36).substring(10));
}else{
setTimeout(function(){ self.checkRzpOrder(data); }, 1000);
setTimeout(function(){ self.checkRzpOrder(data); }, 1500);
}
} else {
self.placeOrder(data);
Expand Down

0 comments on commit 5b8d906

Please sign in to comment.