Skip to content

Magento 2 Module for allow paypal module with a custom country

License

Notifications You must be signed in to change notification settings

allamgr/magento2-allamgr-paypal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

magento2-allamgr-paypal

Magento 2 Module for allow paypal module with a custom country, and change the currency of payment, fow now only work with the Paypal Express method and dont conver the currencies.

Installation

Copy the folder Allamgr in the app/code folder of magento2

Open terminal and run magento setup:upgrade from magento root folder or run magento php -f bin\magento setup:upgrade if you don't have magento cli installed

#How it works You can set your own logic for which countries it will be available the method in app/code/Allamgr/Checkout/Model/Paypal/Express.php

public function canUseForCurrency($currencyCode)
{
    return ($currencyCode === "DOP")? true : $this->_pro->getConfig()->isCurrencyCodeSupported($currencyCode);
}

Set an available currency for paypal for proceed with the order method _callDoAuthorize in app/code/Allamgr/Checkout/Model/Paypal/Express.php

$api = $this->_setApiProcessableErrors()
            ->setAmount($amount)
            ->setCurrencyCode(
                //Custom logic  
                //($payment->getOrder()->getBaseCurrencyCode() === "DOP")? "USD" : $payment->getOrder()->getBaseCurrencyCode()
                //or Espefific logic
                "USD"
            )
            ->setTransactionId($parentTransactionId)
            ->callDoAuthorization();

#TODO: Convert the currency Improve the readme.me

About

Magento 2 Module for allow paypal module with a custom country

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages