nativescript-payments
Version:
A NativeScript plugin for in-app payments
63 lines • 3.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var failure_common_1 = require("./failure.common");
var Failure = (function (_super) {
__extends(Failure, _super);
function Failure(errorCode) {
var _this = _super.call(this, errorCode) || this;
switch (errorCode) {
case com.android.billingclient.api.BillingClient.BillingResponse.FEATURE_NOT_SUPPORTED:
_this._type = failure_common_1.FailureTypes.BILLING_AVAILABILITY;
_this._description = 'Requested feature is not supported by Play Store on the current device.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.SERVICE_DISCONNECTED:
_this._type = failure_common_1.FailureTypes.BILLING_AVAILABILITY;
_this._description = 'Play Store service is not connected now - potentially transient state.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.OK:
_this._type = null;
_this._description = 'Success. Not an error.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.USER_CANCELED:
_this._type = failure_common_1.FailureTypes.USER_CANCELLED;
_this._description = 'User pressed back or canceled a dialog.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.SERVICE_UNAVAILABLE:
_this._type = failure_common_1.FailureTypes.BILLING_AVAILABILITY;
_this._description = 'Network connection is down.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.BILLING_UNAVAILABLE:
_this._type = failure_common_1.FailureTypes.BILLING_AVAILABILITY;
_this._description = 'Billing API version is not supported for the type requested.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.ITEM_UNAVAILABLE:
_this._type = failure_common_1.FailureTypes.PRODUCT_UNAVAILABLE;
_this._description = 'Requested product is not available for purchase.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.DEVELOPER_ERROR:
_this._type = failure_common_1.FailureTypes.DEVELOPER_USAGE;
_this._description = 'Invalid arguments provided to the API.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.ERROR:
_this._type = failure_common_1.FailureTypes.UNSPECIFIED;
_this._description = 'Fatal error during the API action.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.ITEM_ALREADY_OWNED:
_this._type = failure_common_1.FailureTypes.PRODUCT_ALREADY_OWNED;
_this._description = 'Failure to purchase since item is already owned.';
break;
case com.android.billingclient.api.BillingClient.BillingResponse.ITEM_NOT_OWNED:
_this._type = failure_common_1.FailureTypes.PRODUCT_NOT_OWNED;
_this._description = 'Failure to consume since item is not owned. (Or restored and already consumed).';
break;
default:
_this._type = failure_common_1.FailureTypes.UNSPECIFIED;
_this._description = 'Not a known native error code.';
break;
}
return _this;
}
return Failure;
}(failure_common_1.BaseFailure));
exports.Failure = Failure;
//# sourceMappingURL=failure.android.js.map