File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,15 @@ defmodule Algora.Admin do
29
29
with { :ok , tx } <- Repo . fetch_by ( Transaction , id: id ) ,
30
30
{ :ok ,
31
31
% Stripe.Charge {
32
- balance_transaction: % Stripe.BalanceTransaction { currency: "usd" , amount: gross_amount , fee: provider_fee }
33
- } } <- PSP.Charge . retrieve ( tx . provider_id , expand: [ "balance_transaction" ] ) do
32
+ balance_transaction: % Stripe.BalanceTransaction { currency: currency , amount: gross_amount , fee: provider_fee }
33
+ } } <- Algora.PSP.Charge . retrieve ( tx . provider_id , expand: [ "balance_transaction" ] ) do
34
+ gross_amount = Money . from_integer ( gross_amount , currency )
35
+ provider_fee = Money . from_integer ( provider_fee , currency )
36
+
34
37
tx
35
38
|> change ( % {
36
39
gross_amount: gross_amount ,
37
- total_fee: gross_amount - tx . net_amount ,
40
+ total_fee: Money . sub! ( gross_amount , tx . net_amount ) ,
38
41
provider_fee: provider_fee
39
42
} )
40
43
|> Repo . update ( )
You can’t perform that action at this time.
0 commit comments