How can I force PagSeguro to use BRL instead of my vendor currency?

Started by loppan, September 25, 2016, 15:18:32 PM

Previous topic - Next topic

loppan

Hello!

Strange question maybe, but I can't seem to solve this myself so I'm reaching out for help from any of the kind souls lurking around this forum :).

I'm based in Sweden but have a lot of Brazilian customers, so I want to offer them the Brazilian payment method "PagSeguro" (big thing in Brazil apparently).

There is a free plugin for VM3 made already that works great except for one thing - the total being sent to PagSeguro is in my shop currency and not Brazilian Real. So, if my product has a price of 100 "Swedish Krona" Pagseguro thinks that's worth 100 Brazilian Real which certainly not is the case :).

I assume I have to tell the plugin somehow to convert all amounts to BRL before sending any totals of to the Pagseguro site, and I'm also going to assume that it's quite easy to fix this as long as you've got a higher level of skills than me :).

The project is thankfully on github so if anyone is up for helping a fellow out here I would truly appreciate it :

https://github.com/luizwbr/PagSeguro-VirtueMart-3/blob/master/pagseguro_virtuemartbrasil.php

Million thanks in advance!

Best regards

Peter

GJC Web Design

this bit u should be looking into:

if (!class_exists('VirtueMartModelOrders'))
            require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
        $this->getPaymentCurrency($method);
        // END printing out HTML Form code (Payment Extra Info)
        $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
        $db = &JFactory::getDBO();
        $db->setQuery($q);
        $currency_code_3 = $db->loadResult();
        $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
        $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
        $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation