nativescript-payments
Version:
A NativeScript plugin for in-app payments
38 lines • 1.42 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;
var jsonObject = JSON.parse(nativeValue.getOriginalJson());
switch (jsonObject.purchaseState) {
case 0:
_this.state = order_common_1.OrderState.VALID;
break;
case 1:
case 2:
default:
_this.state = order_common_1.OrderState.INVALID;
break;
}
_this.itemId = nativeValue.getSku();
_this.receiptToken = nativeValue.getPurchaseToken();
_this.dataSignature = nativeValue.getSignature();
_this.orderId = nativeValue.getOrderId();
_this.userData = jsonObject.developerPayload;
_this.orderDate = new Date(nativeValue.getPurchaseTime());
return _this;
}
Object.defineProperty(Order.prototype, "debug", {
get: function () {
return this.nativeValue.getOriginalJson();
},
enumerable: true,
configurable: true
});
return Order;
}(order_common_1.BaseOrder));
exports.Order = Order;
//# sourceMappingURL=order.android.js.map