import { PaymentRequest,BuildPayload } from './PaymentRequest'; //import { BuildPayload } from './BuildPayload'; export class CreateOrderRequest extends PaymentRequest { amount?: number; notifyUrl?: string; orderId?: string; title?: string; description?: string; userId?: string; userMobileNo?: string; currency?: string; callBackUrl?: string; goodsDetails?: string; productType?: string; constructor( paymentRequest: PaymentRequest, amount?: number, notifyUrl?: string, orderId?: string, title?: string, description?: string, userId?: string, userMobileNo?: string, currency?: string, callBackUrl?: string, goodsDetails?: string, productType?: string ) { 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; } public toJSON(): object { 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 }; } } export class CreateOrderRequestBuilder extends BuildPayload { private amount?: number; private notifyUrl?: string; private orderId?: string; private title?: string; private description?: string; private userId?: string; private userMobileNo?: string; private currency?: string; private callBackUrl?: string; private goodsDetails?: string; private productType?: string; constructor(requestTime: number, version: string, nonceStr: string) { super(requestTime, version, nonceStr); } public withAmount(amount: number): CreateOrderRequestBuilder { this.amount = amount; return this; } public withNotifyUrl(notifyUrl: string): CreateOrderRequestBuilder { this.notifyUrl = notifyUrl; return this; } public withOrderId(orderId: string): CreateOrderRequestBuilder { this.orderId = orderId; return this; } public withTitle(title: string): CreateOrderRequestBuilder { this.title = title; return this; } public withDescription(description: string): CreateOrderRequestBuilder { this.description = description; return this; } public withUserId(userId: string): CreateOrderRequestBuilder { this.userId = userId; return this; } public withUserMobileNo(userMobileNo: string): CreateOrderRequestBuilder { this.userMobileNo = userMobileNo; return this; } public withCurrency(currency: string): CreateOrderRequestBuilder { this.currency = currency; return this; } public withCallBackUrl(callBackUrl: string): CreateOrderRequestBuilder { this.callBackUrl = callBackUrl; return this; } public withGoodsDetails(goodsDetails: string): CreateOrderRequestBuilder { this.goodsDetails = goodsDetails; return this; } public withProductType(productType: string): CreateOrderRequestBuilder { this.productType = productType; return this; } public build(): CreateOrderRequest { 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 ); } }