[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: http_url_post_raw



   Oops, I forgot to attach the program.

   thanks



   Vikas Mishra
   [1]vikasm@xxxxxxxxxx
   IT Applications
   SCJ Insurance Services
   925-474-3651 Direct
   925.474.3600 Company
   925.463.0822 Fax

   -----Original Message-----
   From: Vikas M
   Sent: Wednesday, November 12, 2008 3:04 PM
   To: 'ftpapi@xxxxxxxxxxxxxxxxxxxxxxx'
   Subject: RE: http_url_post_raw

   Scott,

    I am attaching the program I am using . Only thing I have changed
   to send it to you is Merchant id,Userid,Password as its for us. Rest
   is exactly same in the program.

   I get following error msg from their server in my RPG pgm after
   translating

   ---------

   <?xml version="1.0" encoding="UTF-8"?><txn><errorCode>6042<
   /errorCode><errorName>Invalid Request Format</errorName><err
   orMessage>XML request is not well-formed or request is incom
   plete.</errorMessage></txn>@

   -----



   If I put the same request on Web browser here isthe message , means
   exact cut and paste of url+xmldata



   [2]https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do?xml
   data=<txn><ssl_merchant_ID>XXXXXX</ssl_merchant_ID><ssl_user_id>YYYYYY
   </ssl_user_id><ssl_pin>ZZZZZZ</ssl_pin><ssl_transaction_type>ccsale</s
   sl_transaction_type><ssl_card_number>5421213556478745</ssl_card_number
   >%20%20%20<ssl_exp_date>0212</ssl_exp_date><ssl_amount>42.3</ssl_amoun
   t><ssl_salestax>0.00</ssl_salestax><ssl_cvv2cvc2_indicator>1</ssl_cvv2
   cvc2_indicator><ssl_cvv2cvc2>212</ssl_cvv2cvc2><ssl_customer_code>8745
   </ssl_customer_code><ssl_first_name>John</ssl_first_name><ssl_last_nam
   e>Muir</ssl_last_name><ssl_avs_address>1254%20Las%20Positas%20Dr</ssl_
   avs_address><ssl_address2></ssl_address2><ssl_city>concord</ssl_city><
   ssl_state>CA</ssl_state><ssl_avs_zip>94521</ssl_avs_zip><ssl_test_mode
   >true</ssl_test_mode><policynumber>5039740</policynumber></txn>





   ----------------

   <?xml version="1.0" encoding="UTF-8" ?>
   [3]- <txn>
     <errorCode>5000</errorCode>
     <errorName>Credit Card Number Invalid</errorName>
     <errorMessage>The Credit Card Number supplied in the authorization
   request appears to be invalid.</errorMessage>
     </txn>

   ---------
   (the developer guide is available here:
   https://www.myvirtualmerchant.com/VirtualMerchant/download/developerGu
   ide.pdf)
   thanks!


   Vikas Mishra
   [4]vikasm@xxxxxxxxxx
   IT Applications
   SCJ Insurance Services
   925-474-3651 Direct
   925.474.3600 Company
   925.463.0822 Fax

   -----Original Message-----
   From: Vikas M
   Sent: Wednesday, November 12, 2008 1:39 PM
   To: 'ftpapi@xxxxxxxxxxxxxxxxxxxxxxx'
   Subject: http_url_post_raw

   Hi Scott,

    I didn't get any help so I was wondering if you have any insight to
   this.



   Thanks,



   Vikas Mishra
   [5]vikasm@xxxxxxxxxx
   IT Applications
   SCJ Insurance Services

   -----Original Message-----
   From: Vikas M
   Sent: Wednesday, November 12, 2008 10:55 AM
   To: 'ftpapi@xxxxxxxxxxxxxxxxxxxxxxx'
   Subject: http_url_post_raw

   Hi Everybody,

    Please focus on giving me solution of the problem I described.

   All the information in this query is  just  testing data I made up.
   Its fake name with fake address with fake credit card number with fake
   expiration date. I hope this puts all the concerns to rest.



   I am getting an error saying that its invalid card number when I put
   this info on the browser. But when I try to do the same testing using
   Scott's API I get an error from the server that request is not well
   formed. If anybody can help in that , it would be great.

   (the developer guide is available here:
   https://www.myvirtualmerchant.com/VirtualMerchant/download/developerGu
   ide.pdf)
   thanks!



   Vikas Mishra
   [6]vikasm@xxxxxxxxxx
   IT Applications
   SCJ Insurance Services
   --

   Hi Everybody,
    I am using this API http_url_post_raw  to validate/charge crdit card
   but i get a return error saying that request is not well formed . This
   error is actually being returned from credit card verification server
   so it is communicating with it.
   But when I use the same request on web browser page , it works
   fine. Can anybody please point out where am I making the mistake? Here
   are the details:

     xmldata=
   'xmldata=<txn><ssl_merchant_ID>XXXXXX</ssl_merchant_ID><ssl_user_id'+
    '>YYYYYYY</ssl_user_id><ssl_pin>ZZZZZZ</ssl_pin><ssl_transaction_t'+
    'ype>ccsale</ssl_transaction_type><ssl_card_number>542121355647874'+
    '5</ssl_card_number><ssl_exp_date>0212</ssl_exp_date>'+
    '<ssl_amount>42.3</ssl_amount><ssl_salestax>0.00</ssl_salestax><ss'+
    'l_cvv2cvc2_indicator>1</ssl_cvv2cvc2_indicator><ssl_cvv2cvc2>212<'+
    '/ssl_cvv2cvc2><ssl_customer_code>8745</ssl_customer_code><ssl_fir'+
    'st_name>John</ssl_first_name><ssl_last_name>Muir</ssl_last_name><'+
    'ssl_avs_address>1254 Las Positas '+
    'Dr</ssl_avs_address><ssl_address2></ssl_address2><ssl_city>concor'+
    'd</ssl_city><ssl_state>CA</ssl_state><ssl_avs_zip>94521</ssl_avs_'+
    'zip></txn>' ;



    eval      rc = http_url_post_raw(
              'https://www.myvirtualmerchant.com/'    +
               'VirtualMerchant/processxml.do?'
                : %addr(xmldata): %len(%trimr(xmldata))
                : 1
                : %paddr('INCOMING')
                : 1)

   Looks like the credit card server doesnt receive the above request
   properly and returns me an error saying request not well formed. This
   error is listed as one of their return errors.
   But when I do paste of same request on browser page, I get proper
   result.

   Thanks,
   Vikas Mishra
   [7]vikasm@xxxxxxxxxx
   IT Applications
   SCJ Insurance Services

References

   1. outbind://139/vikasm@xxxxxxxxxx
   2. https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do?xmldata=<txn><ssl_merchant_ID>XXXXXX</ssl_merchant_ID><ssl_user_id>YYYYYY</ssl_user_id><ssl_pin>ZZZZZZ</ssl_pin><ssl_transaction_type>ccsale</ssl_transaction_type><ssl_card_number>5421213556478745</ssl_card_number>%20%20%20<ssl_exp_date>0212</ssl_exp_date><ssl_amount>42.3</ssl_amount><ssl_salestax>0.00</ssl_salestax><ssl_cvv2cvc2_indicator>1</ssl_cvv2cvc2_indicator><ssl_cvv2cvc2>212</ssl_cvv2cvc2><ssl_customer_code>8745</ssl_customer_code><ssl_first_name>John</ssl_first_name><ssl_last_name>Muir</ssl_last_name><ssl_avs_address>1254%20Las%20Positas%20Dr</ssl_avs_address><ssl_address2></ssl_address2><ssl_city>concord</ssl_city><ssl_state>CA</ssl_state><ssl_avs_zip>94521</ssl_avs_zip><ssl_test_mode>true</ssl_test_mode><policynumber>5039740</policynumber></txn
   3. https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do?xmldata=<txn><ssl_merchant_ID>519284</ssl_merchant_ID><ssl_user_id>webpage</ssl_user_id><ssl_pin>PPMFS7</ssl_pin><ssl_transaction_type>ccsale</ssl_transaction_type><ssl_card_number>
   4. outbind://134/vikasm@xxxxxxxxxx
   5. outbind://131/vikasm@xxxxxxxxxx
   6. outbind://124/vikasm@xxxxxxxxxx
   7. outbind://118/vikasm@xxxxxxxxxx
H*DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI')  
                                                         
 *MODULE                                                 
D/copy libhttp/qrpglesrc,httpapi_h                       
                                                         
                                                         
D WWW6425         PR                  ExtPgm('WWW6425')  
D   e_pol20a                    20A   const              
D   e_cardnum                   16A   const              
D   e_CCEXPDATE                  4A   const  
D   e_CARDCVV                    3A   const  
D   e_fname                     20A   const  
D   e_lname                     20A   const  
D   e_Bladdr1                   30A   const  
D   e_bladdr2                   30A   const  
D   e_blcity                    20A   const  
D   e_blstat                     2A   const  
D   e_blzip                      5A   const  
D   e_payamt                     8A   const  
D   e_apprvcd                   10A          
D   e_txnid                     20A          
D   e_ERRFLG                     1A          
D   e_ERRMSG                    50A          
D WWW6425         PI                       
D   e_pol20a                    20A   const
D   e_cardnum                   16A   const
D   e_CCEXPDATE                  4A   const
D   e_CARDCVV                    3A   const
D   e_fname                     20A   const
D   e_lname                     20A   const
D   e_Bladdr1                   30A   const
D   e_bladdr2                   30A   const
D   e_blcity                    20A   const
D   e_blstat                     2A   const
D   e_blzip                      5A   const        
D   e_payamt                     8A   const        
D   e_apprvcd                   10A                
D   e_txnid                     20A                
D   e_ERRFLG                     1A                
D   e_ERRMSG                    50A                
                                                   
D XMLDOC          DS                               
D  Header                 1     38             
D  CZIP                  39     43                        
D  CSTA                  44     45                        
D cmd             pr                  extpgm('QCMDEXC')   
D  command                     200A   const               
D  length                       15P 5 const               
                                                          
D CRLF            C                   CONST(x'0D25')      
D rc              s             10I 0                     
D msg             s             52A                       
D xmldata         s           1024A                     
                                                        
D INCOMING        PR            10I 0                   
D                               10I 0 value             
D                             8192A   options(*varsize) 
D                               10I 0 value             
D Retdata         S           3276A                     
D Retlen          S             10I 0 Inz(1)            
D nextpos         S             10I 0 inz(1)            
D lenstr          S             10I 0 inz(1)              
 *procedure prototypes                                    
D GETXML          PR                                      
D translate       PR                  ExtPgm('QDCXLATE')  
D   length                       5P 0 const               
D   data                     32766A   options(*varsize)   
D   table                       10A   const               
D pos             S              5U 0                     
D begpos          S              5U 0                     
*---------------------------------------------------------------- 
*  Set up parameters to Post to  server                 
*---------------------------------------------------------------- 
/Free                                                             
 xmldata=
'xmldata=<txn><ssl_merchant_ID>XXXXXX</ssl_merchant_ID><ssl_user_id'+
 '>YYYYYY</ssl_user_id><ssl_pin>ZZZZZZ</ssl_pin><ssl_transaction_t'+
 'ype>ccsale</ssl_transaction_type><ssl_card_number>542121355647874'+
 '5</ssl_card_number><ssl_exp_date>0212</ssl_exp_date>'+             
 '<ssl_amount>42.3</ssl_amount><ssl_salestax>0.00</ssl_salestax><ss'+
 'l_cvv2cvc2_indicator>1</ssl_cvv2cvc2_indicator><ssl_cvv2cvc2>212<'+
 '/ssl_cvv2cvc2><ssl_customer_code>8745</ssl_customer_code><ssl_fir'+
 'st_name>John</ssl_first_name><ssl_last_name>Muir</ssl_last_name><'+
 'ssl_avs_address>1254 Las Positas '+                                
 'Dr</ssl_avs_address><ssl_address2></ssl_address2><ssl_city>concor'+
 'd</ssl_city><ssl_state>CA</ssl_state><ssl_avs_zip>94521</ssl_avs_'+
 'zip></txn>' ;                                                      

  /End-Free                                                         
 C                   eval      rc = http_url_post_raw(              
 C                             'https://www.myvirtualmerchant.com/' 
 C                              'VirtualMerchant/processxml.do?'    
 C                               : %addr(xmldata): %len(%trimr(xmld 
 C                               : 1                                
 C                               : %paddr('INCOMING')               
 C                               : 1)                               

  ** Not needed for now          : 'application/x-www-form-urlencod 
  *                                                                 
  ***  bug in api    if        rc <> 1                              
  ***                eval      msg = http_error                     

C                   if        retlen > 1                          
 *----------------------------------------------------------------
 *  Convert ASCII data returned to EBCIDEC                        
 *----------------------------------------------------------------
C                   callp     Translate(retlen: retdata: 'QTCPEBC'
C                   callp     GETXML                              
C                   endif                                         
C                   eval      *inlr = *on                         
 *---------------------------------------------------------------- 
 * Incoming   - receives the raw data returned in the web          
 * This procedure is called from within the 'black box' of         
 * api http_url_post_raw. Note 5th parm                            
 *--------------------------------------------------------         
P incoming        B                                                
D incoming        PI            10I 0                              
D   descriptor                  10I 0 value                        
 D   data                      8192A   options(*varsize)            
 D   datalen                     10I 0 value                        
                                                                    
  *  Make sure we don't overflow the string:                        
 c                   eval      retlen = (nextpos + datalen)         
 c                   if        retlen > %size(retdata)              
 c                   eval      datalen=datalen-(%size(retdata)-retl 
 c                   endif                                          
  * If there is nothing to write, return THAT...                    
c                   if        datalen < 1                      
c                   return    0                                
c                   endif                                      
 * Here we add any data sent to the end of our 'retdata' s     
c                   eval      %subst(retdata: nextpos) =       
c                                %subst(data:1:datalen)        
c                   eval      nextpos = nextpos + datalen      
c                   return    datalen                          
P incoming        E                                            
 *-------------------------------------------------------------
 * GETXML parses returned XML   
 *                                                             
 *--------------------------------------------------------     
P GETXML          B                   EXPORT                   
D GETXML          PI                                           
 * Get the Result                                              
 /Free                                                         
                  endpos =1 ;                                     
               endpos =1 ;                                     
               pos = 1   ;                                     
               pos = %scan('<errorCode>': retdata:endpos);     
               Select ;                                        
                                                               
   // MEans there was an error ;                               
                                                               
              When      pos > 1     ;                          
                endpos = %scan('</errorCode>':retdata:pos+11); 
                lenstr = (endpos -(pos +11))              ;    
                                                               
              %subst(xmldata1: 1) =                              
              %subst(retdata:(pos+11):lenstr)           ;        
              dsply                   xmldata1          ;        
 // Means there was NO error ;                                   
            When pos=0 ;                                         
            pos = 1  ;                                           
            pos = %scan('<ssl_result_message>': retdata:endpos); 
            if        pos > 1 ;                                  
         endpos =%scan('</ssl_result_message>': retdata:pos+20); 
             lenstr = (endpos -(pos +20)) ;                  
             %subst(xmldata1: 1) =                           
                         %subst(retdata:(pos+20):lenstr);    
             dsply                   xmldata1;               
          ENDIF    ;                                         
                                                             
         Endsl;                                              
  /End-Free          
 P GETXML          E 


                                                                 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------