Getting broken response while posting barclays form through Karate

Viewed 61

I need to process a test order through Barclays. For that, I need to send some data which is an HTML form like below: I tried storing form in a variable like below: Given URL 'https://test.barclaycardsmartpay.com/hpp/pay.shtml'

def data = { billingAddress.city: "##",billingAddress.country: "#", billingAddress.HouseNumberOrName: "##",billingAddress.postalCode: "##",billingAddress.stateOrProvince: "##",billingAddress.street: "N/A",billingAddressType: "#",countryCode: "UK",currencyCode: "GBP",deliveryAddress.city: "##",deliveryAddress.country: "GB",deliveryAddress.houseNumberOrName: "##",deliveryAddress.postalCode: "##",deliveryAddress.stateOrProvince: "##",deliveryAddress.street: 'N/A',deliveryAddressType:"",merchantAccount: "##",merchantReference:"#(order)",voucherHashKey:0,merchantReturnData: "",paymentAmount: "#(totalCost)",resURL: "https://#.#.##.##.#/buy/process",SessionValidity:"#(val)",shipBeforeDate: "#(shipDate)",shopperLocale: "en_GB",skinCode:"##",merchantSig:"#(sig)"} // tried without quote

form fields data When method post Then status 200 I always get the broken response saying 'Unfortunately we are unable to process the request.' This is the form where the user needs to pass the card info and process the order through Barclays. I am passing some values through which are the responses from other API's like merchantSig, value, etc. If someone has any insight, please help.

1 Answers

I have no idea about "Barclays" but your JSON looks bad. I am not going to read all of it but just a suggestion below:

* def data = { billingAddress: { city: "##", country: "##" } }

See the difference with what you posted and try fixing it. My sincere suggestion is please pair up with someone in your same org (or a friend who has time) who can help you because from your previous questions I think you need to get a little more comfortable with JSON itself and some basic fundamentals.

Related