Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- {
- var APIKey = <?php echo json_encode($store_settings->apiKey); ?>;
- var Password = <?php echo json_encode($store_serttings->apiPassword); ?>;
- var StoreId = <?php echo json_encode($store_settings->storeID); ?>;
- var ReceiptNumber = <?php echo json_encode($inv->reference_no); ?>;
- var ReceiptValue = <?php echo json_encode($inv->total); ?>;
- var Receipt = {
- "APIKey": APIKey,
- "Password": Password,
- "StoreId": StoreId,
- "ReceiptNumber": ReceiptNumber,
- "ReceiptValue": ReceiptValue
- };
- PostReceipt(Receipt, false);
- });
- function PostReceipt(receipt, isRetry)
- {
- $.ajax({
- type: "post",
- url: "http://api.url/api/Receipt",
- data: { receipt },
- success: function(data)
- {
- setTimeout("location.href = 'index.php?module=pos';",2500);
- },
- error: function(xhr, status,data)
- {
- // Only retry the post once.
- // If it errors a second time, the customer will be informed elsewhere
- if (isRetry)
- {
- return;
- }
- else
- {
- PostReceipt(receipt, true);
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement