currencycloud / currencycloud-js Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
hi there,
Could you update to include api for '/v2/reference/payer_required_details'.
Cheers
Dear Dev team,
Please can you add ..virtual_accounts/subaccounts/ method to your new release.
Thanks.
Hello! I have an error when trying to create payment:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at new APIerror (/usr/src/app/node_modules/currency-cloud/lib/error.js:37:45)
at new InternalApplicationError (/usr/src/app/node_modules/currency-cloud/lib/error.js:87:1)
at new module.exports (/usr/src/app/node_modules/currency-cloud/lib/error.js:110:14)
at /usr/src/app/node_modules/currency-cloud/lib/client.js:125:17
at tryCatcher (/usr/src/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/src/app/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/usr/src/app/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/usr/src/app/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/usr/src/app/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/usr/src/app/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/usr/src/app/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/usr/src/app/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/src/app/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:462:21)
Service response:
StatusCodeError: 500 - ""
at new StatusCodeError (/usr/src/app/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/usr/src/app/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/usr/src/app/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:376:20)
at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1154:10)
at Request.emit (events.js:376:20)
at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:482:28)
at IncomingMessage.emit (events.js:388:22)
at endReadableNT (internal/streams/readable.js:1336:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Request data:
{
headers: {
'X-Auth-Token': '7006......1d37',
'User-Agent': 'CurrencyCloudSDK/2.0 NodeJS/4.1.0'
},
uri: 'https://devapi.currencycloud.com/v2/payments/create',
method: 'POST',
qsStringifyOptions: { arrayFormat: 'brackets' },
form: {
on_behalf_of: '7a3265be-dee5-4e43-be7f-49769eaf71b9',
beneficiary_id: '675eddd7-f853-4d1f-a5f1-90886f39e43c',
currency: 'EUR',
amount: '1.00',
reason: 'reason payment',
payment_type: 'priority',
reference: '11643750-c6db-11eb-8251-69c9c3f6281a'
},
qs: null,
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false
}
Hi,
While reviewing our logs we have noticed that the currencycloud-js SDK has been triggering a security warning when installed:
$ npm install [email protected] --save
changed 1 package, and audited 492 packages in 1s
54 packages are looking for funding
run `npm fund` for details
5 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Would it be possible to migrate away form the deprecated dependency so the application does not trigger security warnings?
Cheers,
Jamie
Hi,
Is there any plans for the js library to be converted to typescript for type support?
Thanks in advance
Dear Dev team,
Please can you include the following api in the next release:
GET https://api.currencycloud.com/v2/transactions/sender/{SENDER_ID}
Getting a TypeError: errorMessages[field] is not iterable
when I call payments.delete
and receive an error message.
Looks to be an issue with how error.js handles 400 errors.
Access to fetch at 'https://devapi.currencycloud.com/v2/authenticate/api' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Calling authentication.login gives us the error above. I can't immediately see in the code how to set the request's mode to be no-cors
.
This is an irregular bug which could be being caused at the TCC API end - often we can access it without CORS errors at all, but this downtime is obviously a blocker.
in the currency-cloud package for nodejs, in the lib => "client.js" file. There is an issue on calling "requestToken" function since 22.11.2017 about 3pm CET. The issue is as marked in the following:
Note* : only in DEMO environment.
Seems like there is an issue with "qs", i tried with "form" and it worked
var requestToken = function() {
var promise = rp.post({
uri: config.baseUrl + config.authUrl,
qs: {
login_id: config.loginId,
api_key: config.apiKey
}
})
.then(function(res) {
token = JSON.parse(res).auth_token;
return token;
});
return promise;
};
Imagine a test file with the following:
const args = { id: 'account-id' }
await currencyCloud.onBehalfOf('contact-id', () => {
return currencyCloud.accounts.get(args);
});
expect(args.onBehalfOf).toEqual('contact-id');
Ran into this during development, so forked currency-cloud
to avoid it.
We've stuck on integrating the currency cloud api into our backend api.
We are using AWS API gateway + lambda + currency-cloud(v4.0.4) + nodejs12.x as our backend restful API.
Attached the two files related to currency cloud API as your reference, and the logs from the lambda function is:
START RequestId: d9e31686-70ba-4786-a05c-f6b59dad5840 Version: $LATEST 2021-03-08T12:00:44.333Z d9e31686-70ba-4786-a05c-f6b59dad5840 INFO validateCCBeneficiary ... 2021-03-08T12:00:44.333Z d9e31686-70ba-4786-a05c-f6b59dad5840 INFO CCFunc start login ... END RequestId: d9e31686-70ba-4786-a05c-f6b59dad5840 REPORT RequestId: d9e31686-70ba-4786-a05c-f6b59dad5840 Duration: 30030.43 ms Billed Duration: 30000 ms Memory Size: 1024 MB Max Memory Used: 111 MB 2021-03-08T12:01:14.363Z d9e31686-70ba-4786-a05c-f6b59dad5840 Task timed out after 30.03 seconds
From the logs, we can see that the login never success at all. And we did try a few ways:
currencyCloud.authentication.login({ environment: process.env.CC_ENV, loginId: process.env.CC_ID, apiKey: process.env.CC_KEY }).then(() => { console.log('cc login success'); currencyCloud.authentication.logout(); })
START RequestId: 3d1103fa-58ff-4026-a3fe-c57a001dee98 Version: $LATEST 2021-03-15T07:57:13.020Z 3d1103fa-58ff-4026-a3fe-c57a001dee98 INFO validateCCBeneficiary ... 2021-03-15T07:57:13.112Z 3d1103fa-58ff-4026-a3fe-c57a001dee98 INFO TypeError: Cannot read property 'then' of undefined at Runtime.beneficiary_validateBeneficiary [as handler] (/var/task/src/handlers/webpack:/src/handlers/beneficiary.js:61:5) at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) 2021-03-15T07:57:13.113Z 3d1103fa-58ff-4026-a3fe-c57a001dee98 INFO TypeError: Cannot read property 'then' of undefined at Runtime.beneficiary_validateBeneficiary [as handler] (/var/task/src/handlers/webpack:/src/handlers/beneficiary.js:61:5) at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) END RequestId: 3d1103fa-58ff-4026-a3fe-c57a001dee98 REPORT RequestId: 3d1103fa-58ff-4026-a3fe-c57a001dee98 Duration: 135.06 ms Billed Duration: 136 ms Memory Size: 1024 MB Max Memory Used: 106 MB Init Duration: 723.40 ms
Steps to reproduce:
Happens occasionally when pulling from the rates
endpoint using the node package. Instead of receiving rates we experience the error
[SyntaxError: Unexpected token <]
Desired behaviour:
If the error does happen, it would be good to see the payload that caused it. I suspect it's html being returned by the server?
It seems these are not APIErrors
because we are using toYAML()
.
Are you able to provide any insight into these errors and how we can output more information about them?
In developers docs currencycloud have a request for validating payment before creating it: https://www.currencycloud.com/developers/docs/item/validate-payment/
But in your library is missing this method
Here is an example script with an incorrect currency code:
var currencyCloud = require('currency-cloud');
currencyCloud.authentication.login({
environment: 'demo',
loginId: '<login>',
apiKey: '<password>'
})
.then(function() {
return currencyCloud.reference.getBeneficiaryRequiredDetails({
currency: 'EU', // invalid currency code
bankAccountCountry: 'DE'
});
})
.then(console.log)
.catch(console.log);
The api will throw an error and we'll get a response like the following:
{ [APIerror: beneficiary_required_details_failed]
name: 'APIerror',
message: 'beneficiary_required_details_failed',
cause:
{ statusCode: 400,
error:
{ errorCode: 'beneficiary_required_details_failed',
errorMessages: [Object] } } }
There are a few details missing here and that would be listed in other apis. Here is some example output from the Ruby SDK:
CurrencyCloud::BadRequestError: CurrencyCloud::BadRequestError
---
platform: ruby-2.2.0
request:
parameters:
currency: EU
bank_account_country: DE
verb: get
url: https://devapi.thecurrencycloud.com/v2/reference/beneficiary_required_details
response:
status_code: 400
date: Wed, 04 Nov 2015 07:27:15 GMT
request_id: 2911773143226628915
errors:
- field: currency
code: currency_is_in_invalid_format
message: currency is not a valid ISO 4217 currency code
params:
type: currency
Also note that when converting the error to string for display, it converts it to YAML. This is standardized across all other SDKs and I would expect it to be the same for this one as well.
One of the main dependencies have been deprecated
https://github.com/request/request
There are a few options that can replace request
request/request#3142
Is there a plan to replace it?
Thanks
Dear dev team,
Can you add the API endpoints for date_change_quote and cancel_quote for conversions.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.