微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

设置inAppBrowserOption时,离子inAppBrowser browser.close不起作用

如何解决设置inAppBrowserOption时,离子inAppBrowser browser.close不起作用

大家好。拜托,我需要您的帮助,我目前正在通过添加在线支付来更新我的ionic应用程序,并且已经使用flutterwave付款网关成功实现了它。我的问题是,当inAppbrowser使用位置URL打开时,它可以正常工作,但是当我将inAppbrowserOptions设置为隐藏位置URL时,成功付款后无法执行下订单的逻辑。这是代码

completeOrder(){
this.rave.init(PRODUCTION_FLAG,"YOUR_PUBLIC_KEY")
          .then(_ => {
            let paymentObject = this.ravePayment.create({
              customer_email: this.user.email,amount: this.totalPrice,customer_firstname: `${this.user.first_name}`,customer_lastname: `${this.user.last_name}`,customer_phone: `${this.user.billing.phone}`,currency: "NGN",txref: "rave-15785819",redirect_url: "https://example.com/successful",Meta: [{
                Metaname: "flightID",Metavalue: "AP1234"
 
              }]
            })
            this.rave.preRender(paymentObject)
              .then(secure_link => {
               
                secure_link = secure_link + " "; 
                 
               // this open iab with location url and it works fine
                const browser = this.rave.render(secure_link,this.iab);
                browser.on("loadstop").subscribe((event: InAppbrowserEvent) => {
                 
                    if (event.url.indexOf('https://example.com/successful') != -1) {
                    
                      if ( event.url.includes("successful")) {         
                              this.loading.dismiss();
                              let orderObj = {};
                              orderObj['payment_method'] = this.paymentGatwayId;
                              orderObj['payment_method_title'] = this.paymentGatewayTitle;
                              orderObj['customer_id'] = currentCustomerId;
                              this.platform.ready().then(() => {
                                this.address = {
                                  first_name: this.user.first_name,last_name: this.user.last_name,address_1: this.user.billing.address_1,city: this.user.billing.city,address_2: this.user.billing.address_2,phone: this.user.billing.phone,}
                                orderObj['billing'] = this.address;
                            
                                orderObj['line_items'] = this.baseProducts;
                                
                                this.WC.placeOrder(orderObj).then(async (respData) => {
                                  this.storage.clear();
                                  this.storage.set('currentOrderData',respData);
                                  console.log(orderObj);
                                  
                                    
                                  this.route.navigate(['/menu/orders']);
                                }).catch((error) => {
                                  console.log(error);
                                });
                              });
                           }
                          else  
                          {
                         
                           this.loading.dismiss();
                          
                           this.route.navigate(['/checkout']);       
                         }    
                     browser.close()
                    }
                  })     
              }).catch(error => {
                // Error or invalid paymentObject passed in
                console.log("error",error);
              });
                       
          });
 
}

//这在回拨网址https://example.com/successful

中有存货
options : InAppbrowserOptions = {
    location: 'no',zoom: 'no',};
 
completeOrder(){
this.rave.init(PRODUCTION_FLAG,Metavalue: "AP1234"
 
              }]
            })
            this.rave.preRender(paymentObject)
              .then(secure_link => {
               
                secure_link = secure_link + " ";  
                  
                      // this open iab without location url and get stock at redirect_url 
                  const iabOpen =  this.iab.create(`${secure_link}`,'_blank',this.options);
 
                const browser = this.rave.render(secure_link,iabOpen);
                browser.on("loadstop").subscribe((event: InAppbrowserEvent) => {
                 
                    if (event.url.indexOf('https://example.com/successful') != -1) {
                    
                      if ( event.url.includes("successful")) {         
                              this.loading.dismiss();
                              let orderObj = {};
                              orderObj['payment_method'] = this.paymentGatwayId;
                              orderObj['payment_method_title'] = this.paymentGatewayTitle;
                              orderObj['customer_id'] = currentCustomerId;
                              this.platform.ready().then(() => {
                                this.address = {
                                  first_name: this.user.first_name,error);
              });
                       
          });
 
} 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。