Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braintree CE 2.1.0 doesn't accept payments in KRW - error msg 'Amount is an invalid format.' #5961

Closed
flecxie opened this issue Aug 3, 2016 · 8 comments
Assignees
Labels
Component: Payment improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@flecxie
Copy link

flecxie commented Aug 3, 2016

I can't process KRW payments with Braintree on CE 2.1.0, getting the following error message in debug.log: Amount is an invalid format.

Steps to reproduce

  1. Create Braintree Sandbox account + additional Korean Wong Merchant Account ID
  2. Apply patch from Braintree sandbox errors when using alternative Merchant Account ID on Magento CE 2.1.0 #5910 to get alternative Merchant Account ID's working
  3. Configure Magento CE 2.1.0 store for alternative merchant ID, enable Braintree debugging & place test order for a large amount (I tried with ₩826,961.35 which is equivalent to ~700 USD)

Expected result

  1. Success

Actual result

  1. Fails with error below in debug.log:
  'response' => 
  array (
    'success' => false,
    '' . "\0" . '*' . "\0" . '_attributes' =>
    array ( 
      'errors' =>
      Braintree\Error\ErrorCollection::__set_state(array(
         '_errors' =>
        Braintree\Error\ValidationErrorCollection::__set_state(array(
           '_errors' => 
          array (
          ),
           '_nested' => 
          array (
            'transaction' =>
            Braintree\Error\ValidationErrorCollection::__set_state(array(
               '_errors' => 
              array (
                0 => 
                Braintree\Error\Validation::__set_state(array(
                   '_attribute' => 'amount',
                   '_code' => '81503',
                   '_message' => 'Amount is an invalid format.',
                )), 
              ),

@joni-jones
Copy link
Contributor

Hi, @flecxie.
Please, attach request log.

@flecxie
Copy link
Author

flecxie commented Aug 4, 2016

Request array below:

[2016-08-03 10:02:57] main.DEBUG: array (
  'request' =>
  array (
    'customer' =>
    array (
      'firstName' => 'XXXXXXXXXXXXX',
      'lastName' => 'XXXXXXXXXXXXX',
      'company' => NULL,
      'phone' => '132465',
      'email' => 'XXXXXXXXXXXXX@XXXXXXXXXXXXX.com',
    ),
    'amount' => '826961.35',
    'paymentMethodNonce' => 'XXXXXXXXXXXXX',
    'orderId' => '7000000901',
    'merchantAccountId' => 'XXXXXXXXXXXXX',
    'channel' => 'Magento2_Cart_Community_BT',
    'billing' =>
    array (
      'firstName' => 'XXXXXXXXXXXXX',
      'lastName' => 'XXXXXXXXXXXXX',
      'company' => NULL,
      'streetAddress' => 'XXXXXXXXXXXXX',
      'extendedAddress' => '',
      'locality' => 'Seoul',
      'region' => NULL,
      'postalCode' => '123-465',
      'countryCodeAlpha2' => 'KR',
    ),
    'shipping' =>
    array (
      'firstName' => 'XXXXXXXXXXXXX',
      'lastName' => 'XXXXXXXXXXXXX',
      'company' => NULL,
      'streetAddress' => 'XXXXXXXXXXXXX',
      'extendedAddress' => '',
      'locality' => 'Seoul',
      'region' => NULL,
      'postalCode' => '123-465',
      'countryCodeAlpha2' => 'KR',
    ),
    'options' =>
    array (
      'storeInVaultOnSuccess' => true,
      'three_d_secure' =>
      array (
        'required' => true,
      ),
    ),
  ),
  'client' => 'Magento\\Braintree\\Gateway\\Http\\Client\\TransactionSale',
  'response' =>
  array (
    'success' => false,
    '' . "\0" . '*' . "\0" . '_attributes' =>
    array (
      'errors' =>
      Braintree\Error\ErrorCollection::__set_state(array(
         '_errors' =>
        Braintree\Error\ValidationErrorCollection::__set_state(array(
           '_errors' =>
          array (
          ),
           '_nested' =>
          array (
            'transaction' =>
            Braintree\Error\ValidationErrorCollection::__set_state(array(
               '_errors' =>
              array (
                0 =>
                Braintree\Error\Validation::__set_state(array(
                   '_attribute' => 'amount',
                   '_code' => '81503',
                   '_message' => 'Amount is an invalid format.',
                )),
              ),
...

@joni-jones
Copy link
Contributor

If you open a list of currencies supported by Braintree, you will see that KRW is zero-decimal currency, but in your request amount is a fractional part.

@flecxie
Copy link
Author

flecxie commented Aug 4, 2016

Thanks for that info @joni-jones! Is there a way to tell Magento that this is a zero-decimal currency / avoid that it uses decimals?

@joni-jones
Copy link
Contributor

Magento doesn't process any currency details because each payment processor can contain own specific for different currencies.
We need to decide what we should do in that case, we can't just change authorization amount for Braintree related to some currency because order amounts won't be match.

I've created internal ticket MAGETWO-56451 to investigate this issue.

@joni-jones joni-jones added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report and removed Progress: needs update labels Aug 5, 2016
@flecxie
Copy link
Author

flecxie commented Aug 12, 2016

@joni-jones: Can you think of a workaround for now?
Is it possible to change the decimal precision of a currency store-wide?

@asemenenko
Copy link

@flecxie @joni-jones
This is a framework level feature. Magento needs to support a non-decimal currencies outside a payments area, this includes Catalog module, Sales module, reporting etc. Payment gateway is a consumer of the output provided by the sales module/checkout/quote. We can not just multiple calculated numbers by 100 in particular payment module, we do also need to be consistent about displaying it across the system. Ticket is converted to a user story. As a temporary solution you can write a custom format function.

@piotrekkaminski
Copy link
Contributor

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

magento-engcom-team pushed a commit that referenced this issue Aug 5, 2020
…er#144

"Login as Customer" functionality should be enabled by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Payment improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

5 participants