@@ -26,33 +26,75 @@ defmodule Algora.PSP do
2626
2727 @ type error :: Stripe.Error . t ( )
2828
29- @ type invoice :: Stripe.Invoice . t ( )
29+ @ type metadata :: % {
30+ optional ( String . t ( ) ) => String . t ( )
31+ }
32+
33+ @ type invoice :: Algora.PSP.Invoice . t ( )
3034 defmodule Invoice do
3135 @ moduledoc false
36+ @ type t :: Stripe.Invoice . t ( )
37+
38+ @ spec create ( params , options ) :: { :ok , t } | { :error , Algora.PSP . error ( ) }
39+ when params:
40+ % {
41+ optional ( :auto_advance ) => boolean ,
42+ :customer => Stripe . id ( ) | Stripe.Customer . t ( )
43+ }
44+ | % { } ,
45+ options: % {
46+ :idempotency_key => String . t ( )
47+ }
48+ def create ( params , opts ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params , Keyword . new ( opts ) )
49+
50+ @ spec pay ( Stripe . id ( ) | t , params , options ) :: { :ok , t } | { :error , Algora.PSP . error ( ) }
51+ when params:
52+ % {
53+ optional ( :off_session ) => boolean ,
54+ optional ( :payment_method ) => String . t ( )
55+ }
56+ | % { } ,
57+ options: % {
58+ :idempotency_key => String . t ( )
59+ }
60+ def pay ( invoice_id , params , opts ) , do: Algora.PSP . client ( __MODULE__ ) . pay ( invoice_id , params , Keyword . new ( opts ) )
3261
33- def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
34- def pay ( invoice_id , params ) , do: Algora.PSP . client ( __MODULE__ ) . pay ( invoice_id , params )
3562 def retrieve ( id ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id )
36- def retrieve ( id , opts ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id , opts )
63+ def retrieve ( id , opts ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id , Keyword . new ( opts ) )
3764 end
3865
39- @ type invoiceitem :: Stripe .Invoiceitem. t ( )
66+ @ type invoiceitem :: Algora.PSP .Invoiceitem. t ( )
4067 defmodule Invoiceitem do
4168 @ moduledoc false
42-
43- def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
69+ @ type t :: Stripe.Invoiceitem . t ( )
70+
71+ @ spec create ( params , options ) :: { :ok , t } | { :error , Algora.PSP . error ( ) }
72+ when params:
73+ % {
74+ optional ( :amount ) => integer ,
75+ :currency => String . t ( ) ,
76+ :customer => Stripe . id ( ) | Stripe.Customer . t ( ) ,
77+ optional ( :description ) => String . t ( ) ,
78+ optional ( :invoice ) => Stripe . id ( ) | Stripe.Invoice . t ( )
79+ }
80+ | % { } ,
81+ options: % {
82+ :idempotency_key => String . t ( )
83+ }
84+ def create ( params , opts ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params , Keyword . new ( opts ) )
4485 end
4586
46- @ type transfer :: Stripe .Transfer. t ( )
87+ @ type transfer :: Algora.PSP .Transfer. t ( )
4788 defmodule Transfer do
4889 @ moduledoc false
90+ @ type t :: Stripe.Transfer . t ( )
4991
50- @ spec create ( params , options ) :: { :ok , Algora.PSP . transfer ( ) } | { :error , Algora.PSP . error ( ) }
92+ @ spec create ( params , options ) :: { :ok , t } | { :error , Algora.PSP . error ( ) }
5193 when params: % {
5294 :amount => pos_integer ,
5395 :currency => String . t ( ) ,
5496 :destination => String . t ( ) ,
55- optional ( :metadata ) => Stripe.Types . metadata ( ) ,
97+ optional ( :metadata ) => Algora.PSP . metadata ( ) ,
5698 optional ( :source_transaction ) => String . t ( ) ,
5799 optional ( :transfer_group ) => String . t ( ) ,
58100 optional ( :description ) => String . t ( ) ,
@@ -64,73 +106,82 @@ defmodule Algora.PSP do
64106 def create ( params , opts ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params , Keyword . new ( opts ) )
65107 end
66108
67- @ type session :: Stripe .Session. t ( )
109+ @ type session :: Algora.PSP .Session. t ( )
68110 defmodule Session do
69111 @ moduledoc false
70112
113+ @ type t :: Stripe.Session . t ( )
71114 @ type line_item_data :: Stripe.Session . line_item_data ( )
72115 @ type payment_intent_data :: Stripe.Session . payment_intent_data ( )
73116
74117 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
75118 end
76119
77- @ type payment_method :: Stripe .PaymentMethod. t ( )
120+ @ type payment_method :: Algora.PSP .PaymentMethod. t ( )
78121 defmodule PaymentMethod do
79122 @ moduledoc false
80123
124+ @ type t :: Stripe.PaymentMethod . t ( )
81125 def attach ( params ) , do: Algora.PSP . client ( __MODULE__ ) . attach ( params )
82126 def retrieve ( id ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id )
83127 end
84128
85- @ type payment_intent :: Stripe .PaymentIntent. t ( )
129+ @ type payment_intent :: Algora.PSP .PaymentIntent. t ( )
86130 defmodule PaymentIntent do
87131 @ moduledoc false
88132
133+ @ type t :: Stripe.PaymentIntent . t ( )
89134 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
90135 end
91136
92- @ type setup_intent :: Stripe .SetupIntent. t ( )
137+ @ type setup_intent :: Algora.PSP .SetupIntent. t ( )
93138 defmodule SetupIntent do
94139 @ moduledoc false
95140
141+ @ type t :: Stripe.SetupIntent . t ( )
96142 def retrieve ( id , params ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id , params )
97143 end
98144
99- @ type customer :: Stripe .Customer. t ( )
145+ @ type customer :: Algora.PSP .Customer. t ( )
100146 defmodule Customer do
101147 @ moduledoc false
102148
149+ @ type t :: Stripe.Customer . t ( )
103150 def retrieve ( id ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id )
104151 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
105152 end
106153
107- @ type account :: Stripe .Account. t ( )
154+ @ type account :: Algora.PSP .Account. t ( )
108155 defmodule Account do
109156 @ moduledoc false
110157
158+ @ type t :: Stripe.Account . t ( )
111159 def retrieve ( id ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id )
112160 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
113161 def delete ( id ) , do: Algora.PSP . client ( __MODULE__ ) . delete ( id )
114162 end
115163
116- @ type account_link :: Stripe .AccountLink. t ( )
164+ @ type account_link :: Algora.PSP .AccountLink. t ( )
117165 defmodule AccountLink do
118166 @ moduledoc false
119167
168+ @ type t :: Stripe.AccountLink . t ( )
120169 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
121170 end
122171
123- @ type login_link :: Stripe .LoginLink. t ( )
172+ @ type login_link :: Algora.PSP .LoginLink. t ( )
124173 defmodule LoginLink do
125174 @ moduledoc false
126175
176+ @ type t :: Stripe.LoginLink . t ( )
127177 def create ( params ) , do: Algora.PSP . client ( __MODULE__ ) . create ( params )
128178 end
129179
130- @ type balance_transaction :: Stripe .BalanceTransaction. t ( )
180+ @ type balance_transaction :: Algora.PSP .BalanceTransaction. t ( )
131181 defmodule BalanceTransaction do
132182 @ moduledoc false
133183
184+ @ type t :: Stripe.BalanceTransaction . t ( )
134185 def retrieve ( id ) , do: Algora.PSP . client ( __MODULE__ ) . retrieve ( id )
135186 end
136187end
0 commit comments