UNPKG

voko-sdk

Version:
68 lines (67 loc) 2.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VokoPaymentResponse = void 0; const types_1 = require("../types"); class VokoPaymentResponse { success; transactionId; providerTransactionId; status; amount; currency; phoneNumber; email; reference; message; timestamp; paymentMethod; operator; providerData; fullName; constructor(data) { this.success = data.success; this.transactionId = data.transactionId; this.providerTransactionId = data.providerTransactionId; this.status = data.status; this.amount = data.amount; this.currency = data.currency; this.phoneNumber = data.phoneNumber; this.email = data.email; this.fullName = data.fullName; this.reference = data.reference; this.message = data.message; this.timestamp = data.timestamp; this.paymentMethod = data.paymentMethod; this.operator = data.operator; this.providerData = data.providerData; } isSuccessful() { return this.success && this.status === types_1.PaymentStatus.SUCCESS; } isPending() { return this.status === types_1.PaymentStatus.PENDING; } isFailed() { return this.status === types_1.PaymentStatus.FAILED; } toJSON() { return { success: this.success, transactionId: this.transactionId, providerTransactionId: this.providerTransactionId, status: this.status, amount: this.amount, currency: this.currency, phoneNumber: this.phoneNumber, email: this.email, reference: this.reference, message: this.message, timestamp: this.timestamp, paymentMethod: this.paymentMethod, operator: this.operator, providerData: this.providerData, fullName: this.fullName, }; } } exports.VokoPaymentResponse = VokoPaymentResponse;