1 Reply Latest reply on Feb 2, 2010 11:47 PM by frszilinski

    CairngormCommand -> EventHandler -> ExternalInterface -> HTMLPopup -> window.opener == null !!!

    frszilinski

      Hey,

      I stumbled over a strange behavior... First I thought it's the PopUpBlocker

       

      I successfully implemented the payPalFlex solution. Only difference is, that I need to create a OrderHeader Entity before calling the PayPal-PopUp Window.

       

      So if I cancel the PayPal process and want to make the callback via. JavaScript to Flex (it's the onCancel part...)  the window.opener is null?! So I am already searching about 5 hours to find out what happened there. I think it's because I am not running in the main thread anymore.

       

      (I already tried to implement this with a changeWatcher and the Cairngorm successHandler Pattern...)

       

      Do you have a clue what's the Problem?

      Thanks!!!!

       

       

      some code out of my cart:

      ...
      
      // this gets called from button "Pay with PayPal"
      private function doPayWithPayPal(event:Event):void {
      
              // first create the OrderHeader
           var orderHeader:EOrderHeader = new EOrderHeader();
           orderHeader.id = 0;                    
           orderHeader.orderNumber = 0;               
           orderHeader.customerID = 0;                
           orderHeader.giftCodeID = 0;
           orderHeader.shipmentTypeID = 0;
           orderHeader.fulfillmentFlag = 'F';
           orderHeader.dateOrderDate = new Date();          
           orderHeader.orderTotal = sumOrder;
      
              // dispatch event to create orderHeader on Server
           var orderHeaderEvent:OrderHeaderEvent = new OrderHeaderEvent(OrderHeaderEvent.SAVE_ORDER_HEADER);
           orderHeaderEvent.orderHeader = orderHeader;
              orderHeaderEvent.successHandler = orderHeaderSaved;
           orderHeaderEvent.dispatch();
      }               
      protected function orderHeaderSaved():void {
           if( AdminModel.getInstance().returnedOrderHeader == null ) {
                Alert.show("Error!!!");
           }
           var orderID:Number = AdminModel.getInstance().returnedOrderHeader.id;
           var requestURL:String = "remote/payPalFlex/startPaymentFlex.php";
           ExternalInterface.call('window.open','about:blank',
                'myWindow','height=500,width=900,toolbar=no,scrollbars=yes' );
           var url:URLRequest = new URLRequest("remote/payPalFlex/startPaymentFlex.php");
           url.data = new URLVariables();
           var obj:URLVariables = new URLVariables();
           url.data.useAs = orderID; 
           url.method = "GET";
           navigateToURL(url,"DomainStickersWindow");
      }
      
      ...
      

       

      in cancle.php:

      <html>
      <head>
      <title>PayPal PHP API Response</title>
      <script type="text/javascript">
           function doCancel() {
                window.opener.window.document.getElementById('index').doCancel();
                window.close();
           }
      </script>
      </head>
      <body>
        You canceled, close to go back to the shop blablabl...
      <a href="javascript:doCancel()">ZurŸck zum Shop</a>
      </body>
      </html>