Click here to Skip to main content
15,894,825 members

Comments by Member 12939914 (Top 5 by date)

Member 12939914 14-Mar-19 13:07pm View    
Thank you for the update Richard.
I'm trying to consume an API with the below Headers, Body and Pre-script from POSTMAN.

HEADERS

Content-Type application/json
MERCHANT_ID {{merchantId}}
API_KEY {{apiKey}}
REQUEST_ID {{requestId}}
REQUEST_TS {{timeStamp}}
API_DETAILS_HASH {{apiHash}}

BODY

{
"toBank":"{{toBank}}",
"creditAccount":"{{creditAccount}}",
"narration":"{{narration}}",
"amount":"{{amount}}",
"transRef":"{{transRef}}",
"fromBank":"{{fromBank}}",
"debitAccount":"{{debitAccount}}",
"beneficiaryEmail":"{{beneficiaryEmail}}"
}

PRE-REQUEST SCRIPT

var merchantId ="KUDI1234";
var apiKey ="S1VESTEyMzR8S1VESQ==";
var apiToken ="dWFBTVVGTGZRUEZaemRvVC8wYVNuRkVTc2REVi9GWGdCMHRvWHNXTnovaz0=";
var fromBank= "044";
var debitAccount = "1234565678";
var toBank = "058";
var creditAccount = "0582915208017";
var narration = "Regular Payment";
var amount = "5000";
var beneficiaryEmail = "qa@test.com";
var AES_128_ENCRYPT = function(rawData)
{
var key = "cymsrniuxqtgfzva";
var iv = "czidrfwqugpaxvkj";
key = CryptoJS.enc.Utf8.parse(key);
iv = CryptoJS.enc.Utf8.parse(iv);
var encryptData = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(rawData), key,
{
keySize: 128 / 8,
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return encryptData;

}
creditAccount = AES_128_ENCRYPT(creditAccount);
var d = new Date();
var requestId = d.getTime();
var randomnumber=Math.floor(Math.random()*1101233)
var transRef = randomnumber;
var apiHash = CryptoJS.SHA512(apiKey + requestId + apiToken);
toBank = AES_128_ENCRYPT(toBank);
narration = AES_128_ENCRYPT(narration);
amount = AES_128_ENCRYPT(amount);
transRef = AES_128_ENCRYPT(transRef);
fromBank= AES_128_ENCRYPT(fromBank);
debitAccount = AES_128_ENCRYPT(debitAccount);
beneficiaryEmail = AES_128_ENCRYPT(beneficiaryEmail);
var dd = d.getDate();
var mm = d.getMonth()+1; //January is 0!
var yyyy = d.getFullYear();
if(dd<10){
dd='0'+dd;
}
if(mm<10){
mm='0'+mm;
}
var hours = d.getUTCHours();
var minutes = d.getUTCMinutes();
var seconds = d.getUTCSeconds();
var timeStamp = yyyy+'-'+mm+'-'+dd+'T'+hours+':'+minutes+':'+seconds+'+000000';
postman.setGlobalVariable('merchantId', merchantId);
postman.setGlobalVariable('apiKey', apiKey);
postman.setGlobalVariable('requestId', requestId);
postman.setGlobalVariable('apiHash', apiHash);
postman.setGlobalVariable('timeStamp', timeStamp);
postman.setGlobalVariable('toBank', toBank);
postman.setGlobalVariable('creditAccount', creditAccount);
postman.setGlobalVariable('narration', narration);
postman.setGlobalVariable('amount', amount);
postman.setGlobalVariable('transRef', transRef);
postman.setGlobalVariable('fromBank', fromBank);
postman.setGlobalVariable('debitAccount', debitAccount);
postman.setGlobalVariable('beneficiaryEmail', beneficiaryEmail);

//pm.variables.get("variable_key");
Member 12939914 13-Mar-19 15:17pm View    
@ Gerry Schmitz, You shouldn't be looking for the content to discourage the people who are ready to help. What value did your comment add to this problem. I wonder who mark that selfish comment as answer.

@ Richard, I will suggest we don't judge the person we don't. Either you use hand or spoon to eat, the priority is to put something inside the stomach.
I can change that if you want.
Member 12939914 13-Mar-19 15:07pm View    
No, I intentionally left the value like that because my problem is not in the body of request. The problem reside on the header. I know what the request will fail with if I maintain same value on the body like. Its a scenario I already tested on POSTMAN.
If you have any assistance or addition, please assist to clarify.
Member 12939914 13-Mar-19 15:01pm View    
Dear Richard, Thank you for your time and review.
Have try my best but all the effort prove aborting.
I keep getting same error message "Input string was not in a correct format".
Can you assist in any way.
Thank you.
Member 12939914 13-Mar-19 5:57am View    
int uses up 4 bytes of memory (and it CANNOT contain a decimal), double uses 8 bytes of memory. Just different tools for different purposes. int is a binary representation of a whole number, double is a double-precision floating point number