Currencies without decimals should be sent multiplied by 100

Created on 28 January 2016, about 9 years ago
Updated 23 January 2025, 3 months ago

When payment is made with currency without decimals (like the Colombian Peso), the amount sent to SERMEPA is not multiplied by 100, so when we got to the payment gateway the amount payable is divided by 100 to add decimals.

i.e.: We buy a product for 10,000 Colombian pesos, but the payment gateway told us to pay 100.00 pesos.

I think the problem is in "commerce_sermepa_order_form", where we should recalculate final amount. Am I right?

  $gateway->setTransactionType('0')
  // Assign an order number.
          ->setOrder(substr(date('ymdHis') . $order->order_id, -12, 12))
  // Set transaction amount.
          ->setAmount($order->commerce_order_total[LANGUAGE_NONE][0]['amount']) /// <<------ ???
  // Set currency.
          ->setCurrency($settings['currency'])
  // Set feedback url.
          ->setMerchantURL($settings['merchant_url'])
  // Set merchant OK url.
          ->setUrlOK($settings['return'])
  // Set merchant KO url.
          ->setUrlKO($settings['cancel_return'])
  // Set customer language.
          ->setConsumerLanguage($settings['Ds_Merchant_ConsumerLanguage'])
  // Store commerce order id in merchant data.
         ->setMerchantData($order->order_id);
🌱 Plan
Status

Closed: outdated

Version

1.4

Component

Code

Created by

🇪🇸Spain Juanjol Navarra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024