currencycloud / currencycloud-php Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The API is returning conflicting messages when setting a payment type using setPaymentTypes()
If I do:
...
->setPaymentTypes('regular')
...
The API returns:
ErrorException: Argument 1 passed to CurrencyCloud\Model\Beneficiary::setPaymentTypes() must be of the type array, string given
Then, when I attempt to use a array like:
...
->setPaymentTypes(['regular'])
...
The API returns:
CurrencyCloud\Exception\BadRequestException: Invalid extra parameters:'{:payment_types=>{:"0"=>"regular"}}'
Which is it? And what is the correct syntax?
When getting beneficiary information using the API, the BeneficiaryAddress
is returned as an array. However, when trying to setBeneficiaryAddress
using an array, I get an error.
For example, I am doing:
$beneficiary = Beneficiary::create( 'Joe Bloggs', 'US', 'USD', 'Joe Bloggs' )
->setBeneficiaryFirstName('Joe')
->setBeneficiaryLastName('Blogs')
->setBeneficiaryCountry('US')
->setBeneficiaryEntityType('individual')
->setBeneficiaryAddress(['1010 Crenshaw Blvd', 'Los Angeles'])
->setBeneficiaryCity('Torrance')
->setBeneficiaryStateOrProvince('California')
->setBeneficiaryCountry('US')
->setBeneficiaryPostcode('90501')
->setAccountNumber('12345678')
->setRoutingCodeType1('aba')
->setRoutingCodeValue1('122235821');
This results in
CurrencyCloud\Exception\BadRequestException: Invalid extra parameters:'{:beneficiary_address=>{:"0"=>"1010 Crenshaw Blvd", :"1"=>"Los Angeles"}}'
How can multi-line address be correct passed to the setBeneficiaryAddress
function?
How will do universal Authentication part
Having some problems with permissions (using the "demonstration" environment), the code is similar to the cookbook example:
$session = new CurrencyCloud\Session(CURRENCYCLOUD_ENVIRONMENT, CURRENCYCLOUD_USER_ID, CURRENCYCLOUD_API_KEY);
// $session->loginId, $session->apiKey are set
// $session->apiKey set to 'https://devapi.thecurrencycloud.com/v2/'
$currencyCloud = CurrencyCloud\CurrencyCloud::createDefault($session);
$currencyCloud->authenticate()->login(); // $session->authToken set
$currencyCloud->balances()->find();
// CurrencyCloud\Exception\ForbiddenException with message 'Permission denied'
// string(133) "{"error_code":"permission_denied","error_messages":{"base":[{"code":"permission_denied","message":"Permission denied","params":{}}]}}"
Calls to $currencyCloud->rates()->detailed()
do succeed so I'm not sure what the problem is. Any suggestions would be appreciated!
There is a problem with the implementation in the PHP SDK.
During beneficiary find
method, if additional routing parameters are provided, the SDK generates the following field names:
routing_code_type_1
routing_code_value_1
routing_code_type_2
routing_code_value_2
Using the method, it generates this API error response:
Invalid extra parameters:'{:routing_code_value_1=>"071922777", :routing_code_type_1=>"aba"}
The API expects an array of items: routing_code_type[0], routing_code_type[1]
Beneficiary::setBeneficiaryAddress() requires an array value, however, this is rejected by the API:
$beneficiary->setBeneficiaryAddress(array('23 Acacia Road'));
// => API Error: Beneficiary address is missing
I tried 3 ways to get the sub-accounts' Beneficiaries but it keep response the house-account's beneficiaries.
1st way:
$currencyCloud->getSession()->setOnBehalfOf($contactId);
$beneficiaries = $currencyCloud->beneficiaries()->find();
2ed way:
$beneficiaries = $currencyCloud->beneficiaries()->find(null, null, $contactId);
3rd way:
$beneficiaries = $currencyCloud->onBehalfOf($contactId, function($currencyCloud){
$data = $currencyCloud->beneficiaries()->find();
dd($data);
});
I hard code the contact id into the sdk source code(BeneficiariesEntryPoint->convertBeneficiaryToRequest), it works fine.
i have seen bulk upload option in your could currency project (www.cloudcurrency.com) but your package dont provide this features. how will implement this feature
Parameter terms_and_conditions_accepted
is not supported by SDK (in Account creation). Could you please add it?
We were thinking to start using Currencycloud, but it seems there is no support for the php client.
I posted issues, submitted a PR for Symfony 3x compatibility (now we need 4x), sent emails to Currencycloud support, but got nothing back.
I have a contact at CC sales, but the woman has no idea what I'm talking about and is not technical.
In fact she suggested at one point that it's possible to link up Stripe with CC. After scratching our heads for weeks and driving everyone at Stripe nuts, we found out she was misinformed and gave us false information.
What is going on? I thought Currencycloud is one of the major players? Are they on their way out?
I see absolutely no activity here. The email for the guy who maintains the package doesn't exist and he doesn't seem to work for CC anymore for a while (I googled him).
and getting error:
{
"error_code": "account_create_failed",
"error_messages": {
"terms_and_conditions_accepted": [
{
"code": "terms_and_conditions_accepted_type_is_wrong",
"message": "terms_and_conditions_accepted should be of boolean type",
"params": {
"type": "boolean"
}
}
]
}
}
For php 8.1
I was about to implement the currency cloud API and after some debugging I realised, if I call the
$this->client->beneficiaries()->find($beneficiary, null, $payout->getOnBehalfOf());
function, the find method doesn't consider the on_behalf_of value (3rd argument). It always searches in the main account, not in the sub account.
After I changed the following line, it worked, but I'm not sure if it would create some error in other places:
AbstractEntityEntryPoint::doFind
function
from this
$response = $this->request(
'GET',
$entryPoint,
call_user_func($converterToRequest, $searchModel, $onBehalfOf) + $this->convertPaginationToRequest(
$pagination
)
);
to this
$response = $this->request(
'GET',
$entryPoint,
call_user_func($converterToRequest, $searchModel, $onBehalfOf) + $this->convertPaginationToRequest(
$pagination
) + [
'on_behalf_of' => $onBehalfOf
]
);
Creating a beneficiary on behalf of functions.
Could you please check this issue, for the time being, I will add a custom request to our code.
Good day,
Currently, there is no way to specify the currency when using the BalancesEntryPoint::find
method:
public function find(
$amountFrom = null,
$amountTo = null,
$asAtDate = null,
Pagination $pagination = null,
$onBehalfOf = null
) {
The use case is to check if a user already has a specific currency set up on their account before attempting to create the currency.
For example
$balances = $currencyCloud->balances()->find([currency => $currencyCode]);
if($balances->count() > 0){
// user already has currency set up on their account
....
} else {
// Create a balance for the user
$balance = $currencyCloud->balances()->retrieve($currencyCode);
}
Thanks
Is there any API to find the conversion above and conversion below limits?
Greetings!
Can you please clarify one thing: currency cloud support tells that endpoint /funding_accounts/find
can accept on_behalf_of
parameter, but there is no info in documentation of API nor in this SDK.
They even added an example: baseUrl/funding_accounts/find?payment_type=priority¤cy=GBP&account_id=*-d52f-4cc9-b2e4-*&on_behalf_of=*-5020-45ac-bd6d-*
(i replaced real data with stars)
So if API really accepts on_behalf_of
parameter - can you please add a support for this feature in SDK?
Argument 5 passed to CurrencyCloud\Model\Payer::__construct() must be of the type array or null, string given, called in /home/vagrant/code/laravel/Lintium/vendor/currency-cloud/client/src/EntryPoint/PayersEntryPoint.php on line 47
Hi there,
I have just noticed this issue recently. It seems there is an issue with saving beneficiary's email address during creating a new beneficiary. Everything is ok while we create a new temporary beneficiary object and set an email to this person object by using setEmail(). But after we save this beneficiary to currency cloud by using beneficiaries()->create() method and check this newly saved record the email address shows up as an empty string (and null while retrieving beneficiary).
I faced this issue in our app which leverages your api. On the other hand, I have also tested it by using your cook-book.php official test code, and got the same result. (Beneficiary's email address is not saved at all.)
thanks
Tried to make request to generate payment report (https://developer.currencycloud.com/docs/item/generate-payment-report/) and received 500 error, because of invalid error structure.
Typical error structure is:
{"error_code":"auth_failed","error_messages":{"username":[{"code":"invalid_supplied_credentials","message":"Authentication failed with the supplied credentials","params":[]}]}}
But for error "report_write_permission_missing" structure is wrong:
{"error_code":"report_write_permission_missing","error_messages":{"base":{"code":"report_write_permission_missing","message":"User does not have permission 'report_write' to perform this operation","params":[]}}}
Which results in ClientHttpErrorListener:62 error - Cannot access offset of type string on string
'code' => $messageContext['code'],
i will get technical support from cloud currency.
it necessary for me.
There is a issue with the API not being able to accept arrays correctly. I have come to this conclusion after attempting to address and fix issues #6 and #7.
Neither of the following modification to the PHP SDK worked:
$common['payment_types'] = ['regular'];
$common['payment_types'] = json_encode( ['regular'] );
$common['payment_types'][] = 'regular';
They resulted in one of two errors:
{
"error_code": "beneficiary_update_failed",
"error_messages": {
"payment_types": [
{
"code": "payment_types_type_is_wrong",
"message": "payment_types should be of array type",
"params": {
"type": "array"
}
}
]
}
}
or
{
"field":"base",
"code":"invalid_extra_parameters",
"message":"Invalid extra parameters:'{:payment_types=>{:\"1\"=>\"regular\"}}'",
"params":{
"parameters":{
"payment_types":{
"0": "regular"
}
}
}
}
This leads me to believe there is a issue with the API itself not being able to accept array data correctly. Happy to be proven wrong If someone has found a workaround or solution.
You are using symfony/yaml: ^2.7|^3.0|^4.0, but modern Symfony applications have symfony/yaml v5 version. Your dependency makes impossible to use this SDK in the modern Symfony apps.
how to join Payment and Beneficiary Model.
Hello
Regarding the doc : https://developer.currencycloud.com/documentation/api-docs/payments/get-payments-id-submission/
I can't find a way in the PHP client how to use this route, is an implementation planned in a near future for this ?
Thank you
There are some inconsistencies with the data that is returned by the /v2/reference/beneficiary_required_details
API call, and what is sent in the /v2/beneficiaries/create
API.
For example, calling beneficiary_required_details
returns the field acct_number
(see below), but the field is actually called account_number
in the beneficiaries/create
API.
{
"details": [
{
"payment_type": "priority",
"acct_number": "^\\d{1,17}$",
"aba": "^[0-9A-Z]{9}$"
},
...
]
}
Why the difference in field names?
Another inconsistency in the same API call is when using GBP
as currency and GB
as country. It's returns sort_code
as a field, but the beneficiaries/create
uses routing_code_type_1
and routing_code_value_1
for this value.
I use Laravel and have Symfony v3.3 dependecies installed by the framework.
composer CurrencyCloud/currencycloud-php
is giving me an error:
Is there any particular reason for this? What is your advice? I don't think Laravel lets me roll back to ^2.8
Thanks!
Steve
This is from the laravel/framework composer.json:
"require": {
"php": ">=7.0",
"ext-mbstring": "*",
"ext-openssl": "*",
"doctrine/inflector": "~1.1",
"erusev/parsedown": "~1.6",
"league/flysystem": "~1.0",
"monolog/monolog": "~1.12",
"mtdowling/cron-expression": "~1.0",
"nesbot/carbon": "~1.20",
"psr/container": "~1.0",
"psr/simple-cache": "^1.0",
"ramsey/uuid": "~3.0",
"swiftmailer/swiftmailer": "~6.0",
"symfony/console": "~3.3",
"symfony/debug": "~3.3",
"symfony/finder": "~3.3",
"symfony/http-foundation": "~3.3",
"symfony/http-kernel": "~3.3",
"symfony/process": "~3.3",
"symfony/routing": "~3.3",
"symfony/var-dumper": "~3.3",
"tijsverkoyen/css-to-inline-styles": "~2.2",
"vlucas/phpdotenv": "~2.2"
},
Hello
I'm unable to find a way to do this with the SDK.
Is that possible to implement that?
Thank you
We noticed a case, that response can contain string in error_messages field instead of an array.
php.WARNING: Warning: foreach() argument must be of type array|object, string given {"exception":"[object] (ErrorException(code: 0): Warning: foreach() argument must be of type array|object, string given at /var/www/.../vendor/currency-cloud/client/src/EventDispatcher/Listener/ClientHttpErrorListener.php:72)
symfony/event-dispatcher version used in your package is incompatible with the latest Laravel version.
Server don't support full datetime format, only date format it support
Is it possible to order results by a specific column?
For example, the API documentation for finding conversions, https://www.currencycloud.com/developers/docs/item/find-conversions/ lets you specify the properties to order by:
But I don't see how to achieve this with the SDK.
Thanks,
Lance
i want to login through User Id and Password.
like your url : https://direct-demo.currencycloud.com/login
$session = new Session(
Session::ENVIRONMENT_DEMONSTRATION,
'',
''
);
in this case you did user id and api key
but i want to do like direct demo through this url : https://direct-demo.currencycloud.com/login
The Accounts
SDK endpoint doesn't accept the following 3 parameters, but it's in the documentation:
I'm trying to locate funding account details using the following API end point: https://developer.currencycloud.com/docs/item/find-funding-accounts/
I can see the code for the end point:
https://github.com/CurrencyCloud/currencycloud-php/blob/master/src/EntryPoint/FundingEntryPoint.php
But I can't see how to use it with the SDK.
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.