UNPKG

palmpaywrappersdk

Version:

PalmPay Wrapper Sdk

94 lines (93 loc) 3.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateOrderRequestBuilder = exports.CreateOrderRequest = void 0; const PaymentRequest_1 = require("./PaymentRequest"); //import { BuildPayload } from './BuildPayload'; class CreateOrderRequest extends PaymentRequest_1.PaymentRequest { constructor(paymentRequest, amount, notifyUrl, orderId, title, description, userId, userMobileNo, currency, callBackUrl, goodsDetails, productType) { super(paymentRequest.requestTime, paymentRequest.version, paymentRequest.nonceStr); this.amount = amount; this.notifyUrl = notifyUrl; this.orderId = orderId; this.title = title; this.description = description; this.userId = userId; this.userMobileNo = userMobileNo; this.currency = currency; this.callBackUrl = callBackUrl; this.goodsDetails = goodsDetails; this.productType = productType; } toJSON() { return { requestTime: this.requestTime, version: this.version, nonceStr: this.nonceStr, amount: this.amount, notifyUrl: this.notifyUrl, orderId: this.orderId, title: this.title, description: this.description, userId: this.userId, userMobileNo: this.userMobileNo, currency: this.currency, callBackUrl: this.callBackUrl, goodsDetails: this.goodsDetails, productType: this.productType }; } } exports.CreateOrderRequest = CreateOrderRequest; class CreateOrderRequestBuilder extends PaymentRequest_1.BuildPayload { constructor(requestTime, version, nonceStr) { super(requestTime, version, nonceStr); } withAmount(amount) { this.amount = amount; return this; } withNotifyUrl(notifyUrl) { this.notifyUrl = notifyUrl; return this; } withOrderId(orderId) { this.orderId = orderId; return this; } withTitle(title) { this.title = title; return this; } withDescription(description) { this.description = description; return this; } withUserId(userId) { this.userId = userId; return this; } withUserMobileNo(userMobileNo) { this.userMobileNo = userMobileNo; return this; } withCurrency(currency) { this.currency = currency; return this; } withCallBackUrl(callBackUrl) { this.callBackUrl = callBackUrl; return this; } withGoodsDetails(goodsDetails) { this.goodsDetails = goodsDetails; return this; } withProductType(productType) { this.productType = productType; return this; } build() { return new CreateOrderRequest(super.build(), this.amount, this.notifyUrl, this.orderId, this.title, this.description, this.userId, this.userMobileNo, this.currency, this.callBackUrl, this.goodsDetails, this.productType); } } exports.CreateOrderRequestBuilder = CreateOrderRequestBuilder;