UNPKG

amazon-pay-async

Version:

API wrapper for Amazon Pay using promises and defining types

103 lines (102 loc) 3.77 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var ErrorTypes; (function (ErrorTypes) { ErrorTypes["badToken"] = "bad_token"; ErrorTypes["invalidCertificateDomain"] = "invalid_certificate_domain"; ErrorTypes["invalidSignatureVersion"] = "invalid_signature_version"; ErrorTypes["parseError"] = "parse_error"; ErrorTypes["signatureMismatch"] = "signature_mismatch"; })(ErrorTypes || (ErrorTypes = {})); var AmazonError = /** @class */ (function (_super) { __extends(AmazonError, _super); function AmazonError(type, message) { var _this = _super.call(this, message) || this; _this.type = type; return _this; } return AmazonError; }(Error)); var ApiError = /** @class */ (function (_super) { __extends(ApiError, _super); function ApiError(type, message, body) { var _this = _super.call(this, type, message) || this; _this.body = body; return _this; } return ApiError; }(AmazonError)); exports.ApiError = ApiError; var BadToken = /** @class */ (function (_super) { __extends(BadToken, _super); function BadToken(message, body) { var _this = _super.call(this, message) || this; _this.type = ErrorTypes.badToken; _this.message = message; _this.body = body; return _this; } return BadToken; }(Error)); exports.BadToken = BadToken; var ParseError = /** @class */ (function (_super) { __extends(ParseError, _super); function ParseError(message, body) { var _this = _super.call(this, message) || this; _this.type = ErrorTypes.parseError; _this.message = message; _this.body = body; return _this; } return ParseError; }(Error)); exports.ParseError = ParseError; var InvalidCertificateDomain = /** @class */ (function (_super) { __extends(InvalidCertificateDomain, _super); function InvalidCertificateDomain(message, body) { var _this = _super.call(this, message) || this; _this.type = ErrorTypes.invalidCertificateDomain; _this.message = message; _this.body = body; return _this; } return InvalidCertificateDomain; }(Error)); exports.InvalidCertificateDomain = InvalidCertificateDomain; var SignatureMismatch = /** @class */ (function (_super) { __extends(SignatureMismatch, _super); function SignatureMismatch(message, body) { var _this = _super.call(this, message) || this; _this.type = ErrorTypes.signatureMismatch; _this.message = message; _this.body = body; return _this; } return SignatureMismatch; }(Error)); exports.SignatureMismatch = SignatureMismatch; var InvalidSignatureVersion = /** @class */ (function (_super) { __extends(InvalidSignatureVersion, _super); function InvalidSignatureVersion(message, body) { var _this = _super.call(this, message) || this; _this.type = ErrorTypes.invalidSignatureVersion; _this.message = message; _this.body = body; return _this; } return InvalidSignatureVersion; }(Error)); exports.InvalidSignatureVersion = InvalidSignatureVersion;