Update saved card error handling
This commit is contained in:
parent
11d2f2e974
commit
a8603a01ea
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "postalpoint_square_plugin",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "postalpoint_square_plugin",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"main": "plugin.js",
|
||||
"author": "PostalPortal LLC",
|
||||
"license": "BSD-3-Clause",
|
||||
|
||||
@ -481,7 +481,7 @@ exports.init = function () {
|
||||
|
||||
if (typeof paymentResponse.errors != "undefined") {
|
||||
global.apis.pos.addOnscreenPaymentLog("Error processing saved payment: " + paymentResponse.errors[0].code);
|
||||
global.apis.alert(paymentResponse.errors[0].code, "Saved payment error");
|
||||
throw new Error("Saved payment error: " + paymentResponse.errors[0].code);
|
||||
return false;
|
||||
} else {
|
||||
if (paymentResponse.payment.status == "COMPLETED") {
|
||||
@ -489,11 +489,11 @@ exports.init = function () {
|
||||
return true;
|
||||
} else if (paymentResponse.payment.status == "CANCELED") {
|
||||
global.apis.pos.addOnscreenPaymentLog("The saved card payment was canceled.");
|
||||
global.apis.alert("The saved card payment was canceled before it finished.", "Payment canceled");
|
||||
throw new Error("Payment canceled: The saved card payment was canceled before it finished.");
|
||||
return false;
|
||||
} else if (paymentResponse.payment.status == "FAILED") {
|
||||
global.apis.pos.addOnscreenPaymentLog("The saved card payment failed.");
|
||||
global.apis.alert("The saved card payment failed.", "Payment failed");
|
||||
throw new Error("The saved card payment failed.")
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user