Re: HELPRe: help

cynthia-ops
Helper

help

Hi, I'm working with one of your APIs and I need to run one of your codes. I'm working with visa direct and visa in-app provisioning. I'm trying to run the pushfunds_test.js file, which is this
'use strict';
var api = require('../src/funds_transfer_api').funds_transfer_api;
var assert = require('assert');

var authCredentials = require('C:/Users/cuchu/Downloads/visa/visa_direct/funds_transfer_api/credentials.json');

var funds_transfer_api = new api(authCredentials);

describe('Pushfunds API', function() {
var StatusCode = '';

it('pushfunds Api Execution', function(done) {
funds_transfer_api.pushfunds(getParameters())
.then(function (result) {
console.log('\nResponse: ' + JSON.stringify(result.response));
console.log('\nResponse Status: ' + result.response.statusCode);
StatusCode = result.response.statusCode.toString();
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(); // Indicates that the test case has finished
})
.catch(function (error) {
console.log('\nResponse: ' + JSON.stringify(error.response));
console.log('\nResponse Status: ' + error.response.statusCode);
StatusCode = error.response.statusCode.toString();
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(); // Indicates that the test case has finished
});
}).timeout(10000);

it('pushfunds StatusCode', function() {
assert.ok(StatusCode.startsWith('2'), 'Expected status code to start with 2');
});
});
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 = new Date().toISOString();

return parameters;
}
when running 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:20700) [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) API de Push Funds
Ejecución de la API de pushfunds:
Error: Se superó el tiempo de espera de 10000 ms. Para pruebas y enlaces asíncronos, asegúrese de llamar a "done()"; Si devuelve una Promesa, asegúrese de que se resuelva. (C:\Users\cuchu\Downloads\visa\visa_direct\funds_transfer_api\test\pushfunds_test.js)
en listOnTimeout (nodo:internal/timers:569:17)
en process.processTimers (nodo:internal/timers:512:7)

2)
Código de estado de pushfunds de la API de Push Funds:

AssertionError [ERR_ASSERTION]: código de estado esperado para comenzar con 2
+ esperado - real

-falso
+verdadero

en Context.<anonymous> (pushfunds_test.js:37:16)
en process.processImmediate(node:internal/timers:476:21)
me da este error

13 REPLIES 13
API_Products
Visa Developer Support Specialist

Re: help

Hi @cynthia-ops,

 

I ran a Visa Direct Push Funds Transaction and got a successful request/response payload. Please see my sample request/response payload below.

 

End Point https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pushfundstransactions
Method POST
Request
{
"amount": "124.05",
"localTransactionDateTime": "2023-08-25T19:17:28",
"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-25T19:18:04.000Z",
"settlementFlags": {
"settlementServiceFlag": "9",
"givUpdatedFlag": "false",
"settlementResponsibilityFlag": "true",
"givPreviouslyUpdatedFlag": "true"
},
"transactionIdentifier": 381228649430015,
"actionCode": "65",
"responseCode": "5"
}
Response Header
Status Code: 200 OK
Server : nginx
Date : Fri, 25 Aug 2023 19:18:04 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 273
Connection : keep-alive
X-SERVED-BY : -6b78b6f4
X-CORRELATION-ID : 1692991084_653_1453422694_-6b78b6f4_VDP_WS
X-APP-STATUS : 200
Content-Language : en-US
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 0
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains
Cache-Control : no-cache, no-store, must-revalidate
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,

Tee



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,

 

To test VIAP, please refer to my community forum post here for a successful request/response payload: https://community.developer.visa.com/t5/Implementation-API-Sample-Code/Trying-to-encrypt-the-FLE-and...  




Thanks,

Tee



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

HELPRe: help

HI, DIANA
I SEE THAT IF IT WORKS FOR YOU I WOULD LIKE TO KNOW WHERE YOU ARE RUNNING IT FROM, I AM USING VISUALSTUDIO, NODE MOHA TO VISUALIZE THE CODES THAT YOU OFFER AND I RUN IT FROM THE CMD WITH THE npx mocha pushfunds_js COMMAND AND I GET THIS RESULT
API Push Funds
(node:20700) [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]: Expected status code to start with 2
+ expected - actual

-false
+true

at Context.<anonymous> (pushfunds_test.js:37:16)
at process.processImmediate(node:internal/timers:476:21)
WHICH IS AN ERROR, FROM WHAT I UNDERSTAND AND HAVE INVESTIGATED, THIS ERROR IS BECAUSE THE BUFFER IS DEPRECATED SO I WOULD LIKE YOU TO TELL ME WHAT I CAN USE TO RECEIVE A RESPONSE LIKE THE ONE YOU OBTAINED, I DON'T KNOW IF YOU ARE USING POSTMAN , AND IF YOU USE POSTMAN HOW DO YOU ENTER THE DATA?, OR WHAT DO YOU USE TO MAKE THE REQUEST?

I ALREADY VERIFIED THE LINKS YOU SENT ME AND THEY DON'T WORK FOR ME.
THANK YOU!

API_Products
Visa Developer Support Specialist

Re: HELPRe: help

Hi @cynthia-ops,

 

You can use whichever tool you'd like to test. I'm using the Visa Developer Center Playground tool. Here's the Visa Developer Center Playground guide to help you get started with your sandbox testing: https://developer.visa.com/pages/visa-developer-center-playground. Please follow this guide, test again, and share your result with us.  




Thanks,

Tee



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: HELPRe: help

Hello, I am already using the same tool as you and I have certain errors when I want to make the request through the x-pay-token it sends me this error

{"responseStatus": {
"severity": "ERROR",
"code": "9208",
"message": "Token validation failed",
"status": 401,
"info": ""
}}

and here my response header
Status Code: 401
Server: nginx
Date : Thu, 31 Aug 2023 05:12:56 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 112
Connection : keep-alive
X-SERVED-BY : -8675d7f8-5
X-CORRELATION-ID : 1693458776_868_751331965_-8675d7f8-5_VDP_WS
X-ERROR-ORIGIN : 9200
X-APP-STATUS : 401
X-Frame-Options : SAME ORIGIN
X-XSS-Protection : 0
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains
Cache-Control : no-cache, no-store, must-revalidate
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;

 

and when I want to make the request with ssl it sends me this error

*Could not parse certificate: java.io.IOException: Empty input
*Cannot build keystoresigned overrun, bytes = 920

here it does not give me response header
my request is the following for both cases
{
"amount": "124.05",
"localTransactionDateTime": "2023-08-30T01:10: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"
}

API_Products
Visa Developer Support Specialist

Re: HELPRe: help

Hi @cynthia-ops,

 

Try running the sandbox test. Once you receive the response payload, use the localTransactionDateTime that you received from your response payload and enter it into your request payload. Then Run the sandbox test again. You should receive a successful request/response payload. Please share your result with us.




Thanks,

Tee



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: HELPRe: help

Hi @cynthia-ops,

 

Did you try to run the test again in sandbox? If so, please share your result with us. If the error is fixed, please let us know so I can take you off my contact list. 




Thanks,

Tee



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: HELPRe: help

Hello Diana, I already tried with the option you gave me and the error remains with the helloworl code, it works perfectly for me in postman and in the visa playground, both with Mutual SSL authentication and X-Pay-Token, it gives me a correct answer
{
"message": "helloworld",
"timestamp": "2023-08-31T05:39:04"
}
but when I try to do the tests with pushfundstransactions it no longer works with Mutual SSL or X-Pay-Token, I place the load and the response is
{"responseStatus": {
"severity": "ERROR",
"code": "9208",
"message": "Token validation failed",
"status": 401,
"info": ""
}}

cynthia-ops
Helper

Re: HELPRe: help

Hello Diana, I already tried with the option you gave me and the error remains with the helloworl code, it works perfectly for me in postman and in the visa playground, both with Mutual SSL authentication and X-Pay-Token, it gives me a correct answer. I also already chose to change the time and it still gives me the same error
{
"message": "helloworld",
"timestamp": "2023-08-31T05:39:04"
}
but when I try to do the tests with pushfundstransactions it no longer works with Mutual SSL or X-Pay-Token, I place the load and the response is
{"responseStatus": {
"severity": "ERROR",
"code": "9208",
"message": "Token validation failed",
"status": 401,
"info": ""
}}