@nativescript/payments
Version:
In-App Purchase and Subscriptions for NativeScript
55 lines • 3.01 kB
JavaScript
import { BaseFailure, FailureTypes } from './common';
export { FailureTypes } from './common';
export class Failure extends BaseFailure {
constructor(errorCode) {
super(errorCode);
switch (errorCode // TODO Handle Domain?
) {
case 0 /* SKErrorCode.Unknown */:
this._type = FailureTypes.UNSPECIFIED;
this._description = 'Indicates that an unknown or unexpected error occurred.';
break;
case 1 /* SKErrorCode.ClientInvalid */:
this._type = FailureTypes.PRODUCT_ALREADY_OWNED;
this._description = 'Indicates that the client is not allowed to perform the attempted action.';
break;
case 2 /* SKErrorCode.PaymentCancelled */:
this._type = FailureTypes.USER_CANCELLED;
this._description = 'Indicates that the user cancelled a payment request.';
break;
case 3 /* SKErrorCode.PaymentInvalid */:
this._type = FailureTypes.DEVELOPER_USAGE;
this._description = 'Indicates that one of the payment parameters was not recognized by the Apple App Store.';
break;
case 4 /* SKErrorCode.PaymentNotAllowed */:
this._type = FailureTypes.BILLING_AVAILABILITY;
this._description = 'Indicates that the user is not allowed to authorize payments.';
break;
case 5 /* SKErrorCode.StoreProductNotAvailable */:
this._type = FailureTypes.PRODUCT_UNAVAILABLE;
this._description = 'Indicates that the requested product is not available in the store.';
break;
case 6 /* SKErrorCode.CloudServicePermissionDenied */:
this._type = FailureTypes.BILLING_AVAILABILITY;
this._description = 'Indicates that the user has not allowed access to Cloud service information.';
break;
case 7 /* SKErrorCode.CloudServiceNetworkConnectionFailed */:
this._type = FailureTypes.NETWORK_AVAILABILITY;
this._description = 'Indicates that the device could not connect to the network.';
break;
case 8 /* SKErrorCode.CloudServiceRevoked */:
this._type = FailureTypes.BILLING_AVAILABILITY;
this._description = 'Indicates that the user has revoked permission to use this cloud service.';
break;
case 999 /*Custom for attempting to finish an incomplete transaction*/:
this._type = FailureTypes.PRODUCT_NOT_OWNED;
this._description = 'Indicates attempt to finalize invalid, provisional, or restored order.';
break;
default:
this._type = FailureTypes.UNSPECIFIED;
this._description = 'Not a known native error code.';
break;
}
}
}
//# sourceMappingURL=index.ios.js.map