freedomsponsors / www.freedomsponsors.org

Crowdfunding Free Software, one issue at a time.
https://freedomsponsors.org
GNU Affero General Public License v3.0
190 stars 76 forks source link

Conversion from USD to BRL #25

Closed tonylampada closed 12 years ago

tonylampada commented 12 years ago

When a brazilian user is making a payment, Paypal will only take the payment if the currency is BRL (that's why the profile edit page asks specifically "are you brazilian?")

The payment page converts from USD to BRL by using a fixed rate of 1USD = 2BRL. This is obviously wrong, FS should somehow get a current rate from somewhere trustable.

Also, that screen does a bad job at telling the user about the currency. So the user might freak out for a while when he sees his $30 offer appear as a $60 (sorry about that @mvallebr !)

tonylampada commented 12 years ago

Also, http://www.freedomsponsors.org/core/issue/20/incoming-transactions-do-not-take-into-account-currency-of-origin

tonylampada commented 12 years ago

Anyone knows where I can get currency exchange rates ? /cc @mvallebr

mvallebr commented 12 years ago

I think this is what you want, but not sure: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_APConvertCurrency

tonylampada commented 12 years ago

Will test it later, tks @mvallebr !

tonylampada commented 12 years ago

Tested it.

baseAmountList=[{'currency':{'code':'BRL', 'amount':1.00}}]
convertToCurrencyList=[{'currencyCode':'USD'}]
r = paypal.convert_currency(baseAmountList=baseAmountList, 
    convertToCurrencyList=convertToCurrencyList)
r
{'estimatedAmountTable': {'currencyConversionList': [{'baseAmount': {'amount': '1.0',
     'code': 'USD'},
    'currencyList': {'currency': [{'amount': '2.74', 'code': 'BRL'}]}}]},
 'responseEnvelope': {'ack': 'Success',
  'build': '3988550',
  'correlationId': '37fdfa0c5b56f',
  'timestamp': '2012-10-21T11:46:29.567-07:00'}}

(Meaning 1USD = 2.74BRL)

If we invert currencies paypal will say

1BRL = 0.34USD

And 1 / 2.74 = 0.364

"Real" sources say 1USD = 2.09BRL.

I guess I can't use Paypal then? :-1:

tonylampada commented 12 years ago

Asked on Stackoverflow --> http://stackoverflow.com/questions/13002511/paypal-convertcurrency-api-gives-a-wrong-usd-brl-rate-why

tonylampada commented 12 years ago

Also asked in the Brazilian forums --> https://www.paypal-brasil.com.br/forum/index.php?/topic/206-conversao-usd-brl-da-um-resultado-absurdo-274/

tonylampada commented 12 years ago

Goodbye paypal, Hello Google http://www.google.com/ig/calculator?hl=en&q=1USD%3D%3FBRL

tonylampada commented 12 years ago

And hello Yahoo! http://download.finance.yahoo.com/d/quotes.csv?s=USDBRL=X&f=sl1d1t1ba&e=.csv

tonylampada commented 12 years ago

More details about this http://stackoverflow.com/questions/1393385/currency-exchange-rates-for-paypal http://stackoverflow.com/questions/181990/programmatically-access-currency-exchange-rates http://stackoverflow.com/questions/1789699/php-example-for-paypal-adaptive-payments-convertcurrency-api

tonylampada commented 12 years ago

With this, I'm calling this closed http://blog.freedomsponsors.org/a-note-to-brazilians/