Re: help

cynthia-ops
Helper

help

Hello, I am trying an API, this is Create Multi Reverse Funds Transaction and I am trying to use the code that they offer but I am having problems because when I run it with node js it gives me an error because it asks me for this: mleKeyId, mlePublicKeyPath, mlePrivateKeyPath, cert this asks me in a file called funds_trasfer_api.js that connects to the multireversefundstransfer_test.js i mean this

missingValues.push('userId');
        }

        if (options.userId) {
            this.password = options.password;
        } else {
            missingValues.push('password');
        }

        if (options.key) {
            this.keyFile = options.key;
        } else {
            missingValues.push('key');
        }
        if (options.proxy) {
            this.proxy = options.proxy;
        }
        if (options.mleKeyId) {
            this.mleKeyId = options.mleKeyId;

        } else {
            missingValues.push('mleKeyId');
        }
        if (options.mlePublicKeyPath) {
            this.mlePublicKeyPath = options.mlePublicKeyPath;
        } else {
            missingValues.push('mlePublicKeyPath');
        }
        if (options.mlePrivateKeyPath) {
            this.mlePrivateKeyPath = options.mlePrivateKeyPath;
            privateKey = this.mlePrivateKeyPath;
        } else {
            missingValues.push('mlePrivateKeyPath');
        }


        if (options.cert) {
            this.certificateFile = options.cert;
        } else {
            missingValues.push('cert');
        }
I am new to this, what I understand is that I must replace the names that are in the parentheses and place my respective keys, I am only not sure which ones I should place and what is the mle thing I know is Merchant long encryption but where do I get the mlekeyid etc

 

9 REPLIES 9
API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

Please provide the information below for further investigation.

1. End Point
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body

Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

If the error is fixed please let me know and I'll take you off my contact list. 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

cynthia-ops
Helper

Re:help help

No, the error has not yet been solved and I'm running the files from the console directly with node js. I have another question, I noticed that they have an API called click to pay that I would like to work with, but when I click to start the project, it sends me to the page main where you add the APIs and I look for the click to pay one and it doesn't appear

API_Products
Visa Developer Support Specialist

Re: Re:help help

Hi @cynthia-ops,

 

To get started with Click to Pay, please refer to How Click to Pay Works and refer to the section that suits your use case as a Merchant or PSP here: https://developer.visa.com/capabilities/visa-secure-remote-commerce/docs  




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

You can get your mleKeyId, mlePublicKeyPath, and mlePrivateKeyPath from your project app dashboard. Refer to sample screenshots.

 

  1. Go to your project app
  2. Credentials
  3. then scroll down to Encryption/Decryption Mandatory Keys/Certificates for message level encryption.
  4. click on Generate Key-ID
  5. Your mleKeyID is the Key-ID (you can Copy Key)
  6. Click on Add CSR to download your MLE Private key
  7. Download the Server Encryption Certificate for the MLE Public Key

 

Screenshot Image - Project App Dashboard > Credentials

Sample Credentials.png

 

Screenshot Image - MLE

sample MLE.png




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

cynthia-ops
Helper

Re: help

Hello, I already solved the redentials. In your test data, this code comes

'use strict';
var api = require('../src/funds_transfer_api').funds_transfer_api;
var internalConfig = process.env.CONFIG_FILE;
var assert = require('assert');
var mocha = require('mocha');
var describe = mocha.describe;
var it = mocha.it;
if(internalConfig==null){
internalConfig = "credentials.json";
}
var StatusCode="";
var authCredentials = require('../' + internalConfig);

var funds_transfer_api = new api(authCredentials);

// path invoked is '/visadirect/fundstransfer/v1/pushfundstransactions';
it('pushfunds Api Execution', (done) => {
funds_transfer_api.pushfunds(getParameters())
.then(function (result) {
// Put your custom logic here
console.log('\nResponse: ' + JSON.stringify(result.response));
console.log('\nResponse Status: ' + JSON.stringify(result.response.statusCode));
StatusCode= JSON.stringify(result.response.statusCode);
console.log('\n--------------- Above product is Visa Direct ---------------');
console.log('\n--------------- API is Funds Transfer Api ---------------');
console.log('\n--------------- EndPoint is pushfunds ---------------');
console.log('\n\n');
done();
})
.catch(function (error) {
console.log('\nResponse: ' + JSON.stringify(error.response));
console.log('\nResponse Status: ' + JSON.stringify(error.response.statusCode));
StatusCode= JSON.stringify(error.response.statusCode);
console.log('\n--------------- Above product is Visa Direct ---------------');
console.log('\n--------------- API is Funds Transfer Api ---------------');
console.log('\n--------------- EndPoint is pushfunds ---------------');
console.log('\n\n');
done();
});
}).timeout(10000);

it('pushfunds StatusCode', function(){
// assert.equal(-1, [1,2,3].indexOf(4));
assert.equal(StatusCode.startsWith(2),true);
});
function getParameters() {
var parameters = {

"Accept": "application/json",
"Content-Type": "application/json"
};
parameters.payload = {
"businessApplicationId": "AA",
"transactionIdentifier": "381228649430015",
"cardAcceptor": {
"idCode": "CA-IDCode-77765",
address: {
"county": "San Mateo",
"country": "USA",
"state": "CA",
"zipCode": "94404"
},
"terminalId": "TID-9999",
"name": "Visa Inc. USA-Foster City"
},
"senderAddress": "901 Metro Center Blvd",
"sourceOfFundsCode": "05",
"recipientName": "rohan",
"senderName": "Mohammed Qasim",
"senderStateCode": "CA",
"merchantCategoryCode": "6012",
"acquirerCountryCode": "840",
"senderReference": "",
"recipientPrimaryAccountNumber": "4957030420210496",
"retrievalReferenceNumber": "412770451018",
"senderAccountNumber": "4653459515756154",
"transactionCurrencyCode": "USD",
"acquiringBin": "408999",
"pointOfServiceData": {
"posConditionCode": "00",
"panEntryMode": "90",
"motoECIIndicator": "0"
},
"senderCity": "Foster City",
"amount": "124.05",
"systemsTraceAuditNumber": "451018",
"senderCountryCode": "124"
};
parameters.payload.localTransactionDateTime = Date.now();

return parameters;
}
when running it in console it gives me this error
PS C:\Users\cuchu\Downloads\visa\visa_direct\funds_transfer_api\test> npx mocha pushfunds_test.js


API Push Funds
(node:22360) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
encryption error
1) pushfunds Api Execution
2) pushfunds StatusCode


0 passing (10s)
2 failed

1) Push Funds API
pushfunds API Execution:
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\Users\cuchu\Downloads\visa\visa_direct\funds_transfer_api\test\pushfunds_test.js)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)

2) Push Funds API
pushfunds StatusCode:

AssertionError [ERR_ASSERTION]: false == true
+ expected - actual

-false
+true

at Context.<anonymous> (pushfunds_test.js:37:16)
at process.processImmediate (node:internal/timers:476:21) will you have the solution?

API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

Try changing your "localTransactionDateTime": to the time shown in the Response Header and see if that works. See my successful sample request/response payload below and try your test again.

 

End Point https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pushfundstransactions
Method POST
Request
{
"amount": "124.05",
"localTransactionDateTime": "2023-08-29T20:23:33",
"senderAddress": "901 Metro Center Blvd",
"pointOfServiceData": {
"panEntryMode": "90",
"posConditionCode": "00",
"motoECIIndicator": "0"
},
"recipientPrimaryAccountNumber": "4957030420210496",
"colombiaNationalServiceData": {
"addValueTaxReturn": "10.00",
"taxAmountConsumption": "10.00",
"nationalNetReimbursementFeeBaseAmount": "20.00",
"addValueTaxAmount": "10.00",
"nationalNetMiscAmount": "10.00",
"countryCodeNationalService": "170",
"nationalChargebackReason": "11",
"emvTransactionIndicator": "1",
"nationalNetMiscAmountType": "A",
"nationalReimbursementFee": "20.00",
"costTransactionIndicator": "0"
},
"cardAcceptor": {
"address": {
"country": "USA",
"zipCode": "94404",
"county": "San Mateo",
"state": "CA"
},
"idCode": "CA-IDCode-77765",
"name": "Visa Inc. USA-Foster City",
"terminalId": "TID-9999"
},
"senderReference": "",
"transactionIdentifier": "381228649430015",
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"retrievalReferenceNumber": "412770451018",
"senderCity": "Foster City",
"senderStateCode": "CA",
"systemsTraceAuditNumber": "451018",
"senderName": "Mohammed Qasim",
"businessApplicationId": "AA",
"settlementServiceIndicator": "9",
"merchantCategoryCode": "6012",
"transactionCurrencyCode": "USD",
"recipientName": "rohan",
"senderCountryCode": "124",
"sourceOfFundsCode": "05",
"senderAccountNumber": "4653459515756154"
}
Response
{
"transmissionDateTime": "2023-08-29T20:26:25.000Z",
"settlementFlags": {
"settlementServiceFlag": "9",
"givUpdatedFlag": "false",
"settlementResponsibilityFlag": "true",
"givPreviouslyUpdatedFlag": "true"
},
"transactionIdentifier": 381228649430015,
"actionCode": "65",
"responseCode": "5"
}
Response Header
Status Code: 200
Server : nginx
Date : Tue, 29 Aug 2023 20:26:25 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 273
Connection : keep-alive
X-SERVED-BY : -8675d7f8-9m8
X-CORRELATION-ID : 1693340785_247_914830345_-8675d7f8-9m8_VDP_WS
X-APP-STATUS : 200
Content-Language : en-US
Cache-Control : no-cache, no-store, must-revalidate
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 0
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains
Pragma : no-cache
Expires : -1
Content-Security-Policy-Report-Only : default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;
X-Content-Security-Policy-Report-Only : default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;
X-WebKit-CSP-Report-Only : default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains;always

 

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

Please share your result with us. If the error is fixed, please let us know. 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

I haven't heard from you so I'll take you off my contact list. Please reach out to us at the community if you need further assistance. 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.