我有一个具有处理程序功能的选项属性。我想从此属性调用自定义方法,但似乎没有调用该方法。
基本上我试图在 checkOutorder() 中创建一个新订单,该订单应该在成功付款时创建
组件.ts
options = {
//Redirect on success order
if (typeof response.razorpay_payment_id == "undefined" ||response.razorpay_payment_id < 1)
{
console.log("failure page");
} else
{
console.log("success page");
/*How to call the checkOutorder function from this property*/
this.checkOutorder //Doesnt call !
},
};
checkOutorder() {
...
...
console.log('Order Placed SuccessFully')
}
public initPay(): void {
this.options.amount = this.getTotal() * 100;
this.rzp1 = new this.winRef.nativeWindow.Razorpay(this.options);
/* If i put the contents of checkOutorder() here, it works , but "Order Placed SuccessFully" message appears even before the payment is made*/
this.rzp1.open();
}
组件.html
<button id="rzp-button1" class="razorpay-payment-button" (click)="initPay();">Pay</button>