nativescript-payments
Version:
A NativeScript plugin for in-app payments
53 lines • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var order_common_1 = require("./order.common");
var Order = (function (_super) {
__extends(Order, _super);
function Order(nativeValue, restored) {
if (restored === void 0) { restored = false; }
var _this = _super.call(this, nativeValue, restored) || this;
switch (nativeValue.transactionState) {
case 1:
_this.state = order_common_1.OrderState.VALID;
break;
case 4:
case 0:
case 3:
_this.state = order_common_1.OrderState.PROVISIONAL;
break;
case 2:
default:
_this.state = order_common_1.OrderState.INVALID;
break;
}
_this.itemId = nativeValue.payment ? nativeValue.payment.productIdentifier : 'undefined';
_this.orderId = nativeValue.transactionIdentifier;
_this.orderDate = nativeValue.transactionDate;
_this.receiptToken = nativeValue.transactionReceipt
? nativeValue.transactionReceipt.base64EncodedStringWithOptions(1)
: 'undefined';
_this.userData = nativeValue.payment ? nativeValue.payment.applicationUsername : 'undefined';
return _this;
}
Object.defineProperty(Order.prototype, "debug", {
get: function () {
if (this.nativeValue) {
var temp = {};
for (var i in this.nativeValue) {
if (this.nativeValue[i] != null) {
temp[i] = this.nativeValue[i];
}
}
return JSON.stringify(temp);
}
else {
return null;
}
},
enumerable: true,
configurable: true
});
return Order;
}(order_common_1.BaseOrder));
exports.Order = Order;
//# sourceMappingURL=order.ios.js.map