Jump to content

activa

Members
  • Posts

    737
  • Joined

  • Last visited

  • Days Won

    14

Posts posted by activa

  1. Hello

     

    i want to return response data in json to the IPN notification send from the gateway . something like

            // Send a response to mark this transaction as notified
              $response = array("status" => "OK", "message" => "Status recorded");
              header("Content-type: application/json");
              echo json_encode($response);

    is this not possible with the actual code ?  as i see the only return is the transaction data .

     

    the probleme here, if i don't return a notice to the gateway , it will not stop from sending the IPN every X minute .

     

     

  2. regardiong the thread subject again .

     

    the gateway has no notification function . only return_url .

     

    i have used callbacl url as the redirecturl for the gateway , but we have a probleme here .

     

    when the client redirect to the callback url , the transaction well recorded in the client dashboad , but we have a probleme in the client received page , as it return no response or message to the client .

    if we use the return_url as the callback url , the received page show the order is proccessing message, but no transaction are stored in the client side .

     

    we have search a multiple solution but no one has what we need .

     

    we have tested this code , whith redirecturl set to return_url .

        public function success(array $get, array $post) {
            return $this->validate($get, $post); 
        }

    the paiment validation is done via validate() function , and is well returning the data response, but is not storing any transaction in database .

     

    what we need is to store the transaction in database , and set the output transaction as response .

     

    we have set callbackurl , but the callback url is redireting to the recieved page and the recieved page call the success function , and no data are set via get or post .

     

    i hope if someone has well understand this situation and give me some idea or tips to do .

  3. what you have in modules logs .

     

    i have not tested the module . by the way replace it with and test

        public function renewService($package, $service, $parent_package=null, $parent_service=null) {
    
            $row = $this->getModuleRow($package->module_row);
            $api = $this->getApi($row->meta->reseller_id, $row->meta->key, $row->meta->sandbox == "true");
            
            // Renew domain
            if ($package->meta->type == "domain") {
                $fields = $this->serviceFieldsToObject($service->fields);
                
                // Load the API
                $api->loadCommand("logicboxes_domains");
                $domains = new LogicboxesDomains($api);
                
                $response = $domains->details(array('order-id' => $fields->{'order-id'}, 'options' => array("OrderDetails")));
                $this->processResponse($api, $response);
                $order = $response->response();
                
                $vars = array(
                    'years' => 1,
                    'order-id' => $fields->{'order-id'},
                    'exp-date' => $order->endtime,
                    'invoice-option' => "NoInvoice"
                );
                
                foreach ($package->pricing as $pricing) {
                    if ($pricing->id == $service->pricing_id) {
                        $vars['years'] = $pricing->term;
                        break;
                    }
                }
                
                // Only process renewal if adding years today will add time to the expiry date
                if (strtotime("+" . $vars['years'] . " years") > $order->endtime) {
                    $response = $domains->renew($vars);
                    $this->processResponse($api, $response);
                }
            }
            else {
                #
                # TODO: SSL Cert: Set cancelation date of service?
                #
            }
            
            return null;
        }
  4. ok, in my opinion, so no other way than store the token in the blesta database, and it's will serve you to identify the transaction when the gateway notification come to Blesta.

     

    And store token in the session could not be fine to receive notification of VOID or CHARGEBACK etc, that can come long time after and not from a web redirection

     

    the probleme is how to identify the transaction and the token , 

     

    let say this example .

     

    client A order service A and has paid .

    client A order service B and has paid .

     

    client B order service A and has paid .

     

    we have here 3 token , when we store this in database , how to identify the token that match the gateway response ?

     

    the only solution is to make a loop for all the token until we get a valid response .

  5.  

    You store the token in the database, but set an id in the callback URL so you know which database record to fetch..

     

     

    With my example methods mentioned above.

    function buildProcess(array $contact_info, $amount, array $invoice_amounts=null, array $options=null)
    {
      $sessionid = $this->createSessionID();
      $callbackurl = Configure::get("Blesta.gw_callback_url").Configure::get("Blesta.company_id")."/".strtolower(get_class($this))."/".$sessionid;
      
      //
      // ...add code to initiate transaction with gateway using their API here...
      //
      
      $data_you_want_to_store = array('client_id' => $contact_info['client_id'],  'invoice_amounts' => $invoice_amounts, 'token' => $token_received_from_gateway);
      $this->putSession($sessionid, $data_you_want_to_store);
     
      // redirect user to gateway
      header("Location: $url_received_from_gateway");
      exit(0);
    }
     
    function validate(array $get, array $post)
    {
       // fetch information from database using sessionid from URL
       $data = $this->getSession($get[2]);
     
       if (!$data)
          return;
     
       //
       // ...decrypt response from gateway with $data['token']...
       //
     
    }
    

     

    Thanks , max , your idea is brillant , unless this stupid gateway is sending all the response crypted , even if the custom data .

     

    look my code

            //redirection URL
            $redirect_url = Configure::get("Blesta.gw_callback_url") . Configure::get("Blesta.company_id") . "/payzone/".$this->ifSet($contact_info['client_id']);
            $merchant_id =  $this->ifSet($this->merchant_id);
    
            // Filling the request parameters
            $fields = array(
                // Client Info
                'apiVersion' => $this->apiVersion,
                'shopperID' => $this->ifSet($client->id),
                'shopperEmail' => $this->ifSet($client->email),
                'shopperFirstName' => $this->ifSet($client->first_name),
                'shopperLastName' => $this->ifSet($client->last_name),
                'shopperPhone' => $this->getContact($client),
                'shopperAddress' => $this->ifSet($client->address1) . ' ' . $this->ifSet($client->address2),
                'shopperState' => $this->ifSet($client->state),
                'shopperCity' => $this->ifSet($client->city),
                'shopperZipcode' => $this->ifSet($client->zip),
                'shopperCountryCode' => $this->ifSet($client->country),
                // Global Orders
                'orderID' => $order_id,
                'currency' =>  $this->currency,
                'amount' => ($amount * 100)  ,
                'shippingType' =>  $this->shipping_type ,
                'paymentType' =>  $this->payment_type ,
                'paymentMode' =>  $this->payment_mode ,                 
                'customerIP' =>  $_SERVER['REMOTE_ADDR'] ,    
                'orderDescription' =>  $this->ifSet($options['description']),                
                'ctrlRedirectURL' =>   $redirect_url,
                'ctrlCallbackURL' =>  $redirect_url,
                'merchantNotification' =>  true ,
                'merchantNotificationTo' =>  $this->ifSet($this->merchant_notification_to) ,    
                'merchantNotificationLang' =>  "fr" ,
                'ctrlCustomData' =>  $this->serializeInvoices($invoice_amounts)
            );
            
            
            $response = $this->execute_request("/transaction/prepare", json_encode($fields));
            
            if (!isset($this->Session))
                Loader::loadComponents($this, array("Session"));
    
            $this->Session->write("merchantToken", $response['merchantToken']);        
            
            // print_r($response);
            Loader::loadHelpers($this, array("Form", "Html"));
            $this->view = $this->makeView("process", "default", str_replace(ROOTWEBDIR, "", dirname(__FILE__) . DS));
            $this->view->set("post_to", $this->payzone_url . "/transaction/". $response['customerToken']."/dopay" );
    

    after the payment the gateway return a reponse all are creypted , and i should decrypt it with

        // Decrypting
        $json = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $merchantToken, $Data, MCRYPT_MODE_ECB);    
    
    
            if ($json) {
                // Remove PKCS#5 padding
                $json = $this->pkcs5_unpad($json);
                $response = json_decode($json, true);
            }
            else {
                $this->Input->setErrors($this->getCommonError("invalid"));
                // Log error response
                $this->log($this->ifSet($_SERVER['REQUEST_URI']), serialize($response), "output", false);
                return;
            }

    then i should work with $response .

     

    my probleme and obstacle that the gateway is not returing any thing in plain , that i will use it to identify the transaction in my database . and the big obstacle are in the notifification , because ican't use iether the sessions or the database to identify the transaction .

     

    the gateway is payxpert .

  6. Hi,

    How can I make attachments on support tickets and in client accounts, and wherever else they may be, load inside the browser rather than make you download it to your PC, then open it manually to view?

     

    Is this the same issue related to being forced to download PDFs? How do I make images load in browser like I already did for PDFs?

     

    Thanks

     

    note , attachment can be anything , and type like zip, rar , can't be loaded in the browser .

     

    also note loading in the browser can generate a exploit in somehow , like client upload a malicious file php and he can access it in browser .

     

    this case has nothing to compare with the PDF download .

     

    Finnaly , yes you can force the output to the browser , it need some core file hack another time .

  7. can you give the full way the token is generated please (I mean method the gateway documentation is giving)?

     

    So token generation do not use a merchant password or merchant gateway secret key?

     

     

    i send the client and order data to the marchent , it return me a token_id , marchent_url  and crypted data of order . then i should send the client to pay with a url that use this toekn as a complete link , like ;

     

    https://gateway.com/pay/marchent_url .

     

    after the payment , it return me a transaction data without the token_id  , this transaction shoulb decrypted by the token_id sended first time .

     

     

     

    is like the paypal checkout express ? you send a data to the gateway and then it return a hached code to add it to a url ?

     

    the same way , just paypal return the transaction data in plain .

     

     

    Does the gateway sends anything else upon return, besides the encrypted data?

    E.g., an unencrypted transaction id you can set?

     

    If not you will need to append a sessionid to the callback URL:

    $callbackurl = Configure::get("Blesta.gw_callback_url").Configure::get("Blesta.company_id")."/".strtolower(get_class($this))."/".$sessionid;
    

    And access the sessionid later with $get[2]

    Which works for gateway notifications, but not for the client redirect (because Blesta redirects the user to a different page without preserving the added /$sessionid) for which you have to use a normal session as workaround.
     

     

    Store the sessionid, token, invoice_amounts and client_id in the database.

    Either as separate fields (which would require a separate table for invoice_amounts like in Cody's database scheme), or by putting all data in an array and serializing that to a TEXT field with serialize(), like in my example code.

     

     

    we can't do it , because we should send the callback_url before we get the token . so i think the only way is storing the token in

     

    1 - sessions

    2 - cokies

    3 - database

  8.  

    We found a way to do this that works with the current Blesta capability (please do not remove this in any future releases, if anything, re-work it to make it better if you are unhappy with the way we are doing it).

    Example: https://billing.pacificidc.com/order/config/index/dedicated/?group_id=6&pricing_id=48&configoptions[16]=pacidc_cpu_i5-2400

     

    interesting .

     

     is blesta detect this without a core file modification ?

  9.  

    i have used as najahost say . and it work .

     

    but the return_url and the callback_url was confusing for me .

     

    i have thinked the callback_url is was used just for notification's gateways .

     

    also the success()  method is not storing any data as naja7host mentioned by the processReceived() , and i ask  why it return all the transaction data if not stoed or showed to the client .

     

    so i think it should be at least in the thank_you message display a something like

     

    Thank you for your orders .....

    Transaction ID  ; XXXXXX

    Amount Paid  ; 0000USD

    Invoice PAID N ; 1451 ,  1452 ; 1453 ;

     

    What do you think Tyson ?

×
×
  • Create New...