Coder Social home page Coder Social logo

currencycloud-php's People

Contributors

arjanwestdorp avatar chrisrosecc avatar codoffer avatar cpacalevcc avatar derikvercueil avatar eaddario avatar francescobbo avatar gergelykovacs avatar jeremy-cc avatar jonathancouchman avatar korki avatar liamm avatar lizzie88 avatar ollieza avatar rjnienaber avatar rtriska avatar trikoder-labs avatar zlikavac32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

currencycloud-php's Issues

setPaymentTypes cannot accept string or array

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?

setBeneficiaryAddress Does Not Allow Array

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?

Permission denied on API calls with valid API key

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!

Routing code value and type not aligned with the API

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]

Can't get the sub-account's Beneficiaries

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.

Bulk upload

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

Is this package still maintained or abandoned?

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).

Error using "terms_and_conditions_accepted" parameter of Account on creation

Sending these parameters:
Screenshot from 2022-02-08 23-09-22

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"
                }
            }
        ]
    }
}

The FIND enpoints are not considering the on_behalf_of flag

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.

Specifying currency when using BalancesEntryPoint::find method

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

Funding accounts on_behalf_of

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&currency=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?

Payer Address type is coded as Array

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

Beneficiary email issue

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

Wrong error structure for error_code "report_write_permission_missing"

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 = string
  • error_messages = array<field: array of errors>
    error:
  • code = string
  • message = string
  • params = array
    Example:
    {"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 = string
  • error_messages = array<field: error>
    Example:
    {"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'],

Technical support

i will get technical support from cloud currency.

it necessary for me.

Fundamental issue with APIs not accepting arrays

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.

symfony/yaml v5 supporting

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.

Joing

how to join Payment and Beneficiary Model.

Pagination

i will implement pagination.

i want to do pagination(next and previous) in laravel frame work.
pagination

Fields returned in reference/beneficiary_required_details are not consistent with beneficiaries/create

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.

symfony 3.3 issues

I use Laravel and have Symfony v3.3 dependecies installed by the framework.

composer CurrencyCloud/currencycloud-php is giving me an error:

  • Installation request for currency-cloud/client ^0.10.0 -> satisfiable by currency-cloud/client[v0.10.0].
  • Conclusion: remove symfony/event-dispatcher v3.3.12
  • Conclusion: don't install symfony/event-dispatcher v3.3.12
    Installation failed, reverting ./composer.json to its original content.

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"
    },

ClientHttpErrorListener unable to parse error messages

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) 

Missing attributes for Accounts

The Accounts SDK endpoint doesn't accept the following 3 parameters, but it's in the documentation:

  • api_trading
  • online_trading
  • phone_trading

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.