Hi,
I am trying to do a POST to a web site of some data (not a file), instead of a GET (it is to handle credit card transactions using PROTX). I had used getPageData which of course did not work and then saw this post. I tried using Jan’s sample code (with a couple of tweaks), but can’t seem to get the resulting pageData back after doing the POST (which returns a value of 200, which I think means OK, & checking on the web site, it seems the the POST worked!!!
)
Please could someone tell me what is wrong with this code (I’m not sure I need all the 'escape’s in the code which were there when I was trying to pass all the data in a URL with GET…)
//setUpDataForPreAuthProtx
//set up fields for protx
var L_Poster, L_HttpResult, L_HttpCode, L_AddParam2 ;
L_Poster = plugins.http.getPoster('https://ukvpstest.protx.com/VPSDirectAuth/PaymentGateway.asp');
L_AddParam2 = L_Poster.addParameter('VPSProtocol','2.22');
L_AddParam2 = L_Poster.addParameter('TxType','PREAUTH');
L_AddParam2 = L_Poster.addParameter('Vendor','beerchoice')
L_AddParam2 = L_Poster.addParameter('VendorTxCode',escape( orders_id ));
L_AddParam2 = L_Poster.addParameter('Amount','1.00');
L_AddParam2 = L_Poster.addParameter('Currency','GBP') ;
L_AddParam2 = L_Poster.addParameter('Description',escape( orders_to_orders_products.products_model )) ;
L_AddParam2 = L_Poster.addParameter('CardHolder',escape( cc_owner )) ;
L_AddParam2 = L_Poster.addParameter('CardNumber',escape( plugins.fmp.substitute( cc_number, ' ', '') )) ;
L_AddParam2 = L_Poster.addParameter('StartDate',plugins.fmp.left( cc_start , 2) + plugins.fmp.right( cc_start , 2)) ;
L_AddParam2 = L_Poster.addParameter('ExpiryDate',plugins.fmp.left( cc_expires , 2) + plugins.fmp.right( cc_expires , 2)) ;
L_AddParam2 = L_Poster.addParameter('IssueNumber',cc_issue_no) ;
L_AddParam2 = L_Poster.addParameter('CV2',cc_cv2) ;
L_AddParam2 = L_Poster.addParameter('CardType',cc_type) ;
L_AddParam2 = L_Poster.addParameter('BillingAddress',escape( billing_street_address + ', ' + billing_suburb + ', ' + billing_city + ', ' + billing_state )) ;
L_AddParam2 = L_Poster.addParameter('BillingPostCode',escape( billing_postcode )) ;
L_AddParam2 = L_Poster.addParameter('DeliveryAddress',escape( delivery_street_address + ', ' + delivery_suburb + ', ' + delivery_city + ', ' + delivery_state )) ;
L_AddParam2 = L_Poster.addParameter('DeliveryPostCode',escape( delivery_postcode )) ;
L_AddParam2 = L_Poster.addParameter('CustomerName',escape( customers_name )) ;
L_AddParam2 = L_Poster.addParameter('ContactNumber',escape( customers_telephone )) ;
L_AddParam2 = L_Poster.addParameter('ContactFax','') ;
L_AddParam2 = L_Poster.addParameter('CustomerEMail',escape( customers_email_address )) ;
L_AddParam2 = L_Poster.addParameter('ApplyAVSCV2','3') ;
L_HttpCode = L_Poster.doPost() ;
globals.g_cc_recvd_text = plugins.http.getPageData(L_Poster);
Thanks,
Rafi.