This repository was archived by the owner on Mar 15, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,20 @@ def check(*args, **kw):
8888 .returns (('some-pay-key' , '' )))
8989 self .client .post_ajax (self .purchase_url , data = {'tier' : 0 })
9090
91+ @fudge .patch ('paypal.get_paykey' )
92+ def test_paykey_default_currency (self , get_paykey ):
93+ PreApprovalUser .objects .create (user = self .user , currency = 'BRL' ,
94+ paypal_key = 'foo' )
95+
96+ def check (* args , ** kw ):
97+ return (args [0 ]['currency' ] == 'BRL' and
98+ args [0 ]['amount' ] == Decimal ('0.99' ))
99+ (get_paykey .expects_call ()
100+ .with_args (arg .passes_test (check ))
101+ .returns (('some-pay-key' , '' )))
102+ self .client .post_ajax (self .purchase_url , data = {'tier' : 0 })
103+
104+
91105 @fudge .patch ('paypal.get_paykey' )
92106 def test_paykey_error (self , get_paykey ):
93107 get_paykey .expects_call ().raises (PaypalError ())
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ def purchase(request, addon):
6060 preapproval = None
6161 if waffle .flag_is_active (request , 'allow-pre-auth' ) and request .amo_user :
6262 preapproval = request .amo_user .get_preapproval ()
63+ # User the users default currency.
64+ if currency == 'USD' and preapproval .currency :
65+ currency = preapproval .currency
6366
6467 try :
6568 paykey , status = paypal .get_paykey (dict (
You can’t perform that action at this time.
0 commit comments