问题描述
我正在尝试在付款成功后调用 API。所以我在 razorPaySuccessHandler 函数中调用 Function ,但它抛出如下错误:
constructor(
private userService: UserService
) { }
paymentProcess() {
let creditDialogRef = this.dialog.open(CreditFormComponent);
creditDialogRef.afterClosed().subscribe(result => {
this.userService.createOrder(this.id).subscribe(res => {
// this.RAZORPAY_OPTIONS.amount = result.data.amount;
this.RAZORPAY_OPTIONS.amount = '100';
this.RAZORPAY_OPTIONS.order_id = '';
// binding this object to both success and dismiss handler
this.RAZORPAY_OPTIONS["handler"] = this.razorPaySuccessHandler.bind(this);
let razorpay = new Razorpay(this.RAZORPAY_OPTIONS);
razorpay.open();
});
});
}
public razorPaySuccessHandler(response) {
console.log("razorpay",response)
if (response.razorpay_payment_id) {
console.log(response,"Order Placed");
this.razorpayResponse = `Razorpay Response`;
this.userService.verifyOrder(this.orderId).subscribe(res=>{
console.log(res)
})
}
else {
console.log("Payment Failed")
}
}
我收到错误:
Uncaught TypeError: Cannot read property 'verifyOrder' of undefined
at Ui.push../src/app/views/marketing/home-page/home-page.component.ts.HomePageComponent.razorPaySuccessHandler (home-page.component.ts:214)
at checkout.js:1
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)