jera_payment 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +2 -0
- data/app/controllers/jera_payment/callbacks_controller.rb +22 -0
- data/app/controllers/jera_payment/jera_payment_controller.rb +5 -0
- data/config/locale/jera_payment.pt-BR.yml +243 -0
- data/config/routes.rb +5 -0
- data/lib/generators/active_record/jera_payment_generator.rb +59 -0
- data/lib/generators/active_record/templates/create_jera_payment_charges.rb +36 -0
- data/lib/generators/active_record/templates/create_jera_payment_credit_cards.rb +20 -0
- data/lib/generators/active_record/templates/create_jera_payment_customers.rb +22 -0
- data/lib/generators/active_record/templates/create_jera_payment_households.rb +18 -0
- data/lib/generators/active_record/templates/create_jera_payment_invoices.rb +42 -0
- data/lib/generators/active_record/templates/create_jera_payment_plans.rb +18 -0
- data/lib/generators/active_record/templates/create_jera_payment_sub_accounts.rb +39 -0
- data/lib/generators/active_record/templates/create_jera_payment_subscriptions.rb +26 -0
- data/lib/generators/active_record/templates/create_jera_payment_transfers.rb +15 -0
- data/lib/generators/active_record/templates/create_jera_payment_withdrawals.rb +15 -0
- data/lib/generators/jera_payment/install_generator.rb +68 -0
- data/lib/generators/jera_payment/jera_payment_generator.rb +46 -0
- data/lib/generators/jera_payment/templates/jera_payment.rb +9 -0
- data/lib/jera_payment.rb +39 -0
- data/lib/jera_payment/api/iugu/base.rb +55 -0
- data/lib/jera_payment/api/iugu/charge.rb +12 -0
- data/lib/jera_payment/api/iugu/customer.rb +37 -0
- data/lib/jera_payment/api/iugu/household.rb +13 -0
- data/lib/jera_payment/api/iugu/invoice.rb +55 -0
- data/lib/jera_payment/api/iugu/payment_method.rb +39 -0
- data/lib/jera_payment/api/iugu/payment_token.rb +12 -0
- data/lib/jera_payment/api/iugu/plan.rb +42 -0
- data/lib/jera_payment/api/iugu/sub_account.rb +40 -0
- data/lib/jera_payment/api/iugu/subscription.rb +72 -0
- data/lib/jera_payment/api/iugu/transfer.rb +24 -0
- data/lib/jera_payment/api/iugu/withdrawal.rb +26 -0
- data/lib/jera_payment/application.rb +79 -0
- data/lib/jera_payment/engine.rb +5 -0
- data/lib/jera_payment/models/charge.rb +30 -0
- data/lib/jera_payment/models/concerns/household_methods.rb +33 -0
- data/lib/jera_payment/models/concerns/invoice_methods.rb +42 -0
- data/lib/jera_payment/models/concerns/resource_callbacks.rb +40 -0
- data/lib/jera_payment/models/concerns/sub_account_methods.rb +18 -0
- data/lib/jera_payment/models/concerns/subscription_methods.rb +34 -0
- data/lib/jera_payment/models/concerns/transfer_methods.rb +18 -0
- data/lib/jera_payment/models/concerns/withdrawal_methods.rb +18 -0
- data/lib/jera_payment/models/credit_card.rb +16 -0
- data/lib/jera_payment/models/customer.rb +14 -0
- data/lib/jera_payment/models/household.rb +51 -0
- data/lib/jera_payment/models/invoice.rb +49 -0
- data/lib/jera_payment/models/plan.rb +16 -0
- data/lib/jera_payment/models/sub_account.rb +53 -0
- data/lib/jera_payment/models/subscription.rb +29 -0
- data/lib/jera_payment/models/transfer.rb +20 -0
- data/lib/jera_payment/models/withdrawal.rb +24 -0
- data/lib/jera_payment/parsers/iugu/charge_parser.rb +39 -0
- data/lib/jera_payment/parsers/iugu/credit_card_parser.rb +31 -0
- data/lib/jera_payment/parsers/iugu/household_parser.rb +16 -0
- data/lib/jera_payment/parsers/iugu/invoice_parser.rb +31 -0
- data/lib/jera_payment/parsers/iugu/sub_account_parser.rb +26 -0
- data/lib/jera_payment/parsers/iugu/transfer_parser.rb +15 -0
- data/lib/jera_payment/services/iugu/base.rb +23 -0
- data/lib/jera_payment/services/iugu/charges/create.rb +30 -0
- data/lib/jera_payment/services/iugu/credit_cards/create.rb +40 -0
- data/lib/jera_payment/services/iugu/credit_cards/destroy.rb +23 -0
- data/lib/jera_payment/services/iugu/credit_cards/update.rb +19 -0
- data/lib/jera_payment/services/iugu/customers/create.rb +27 -0
- data/lib/jera_payment/services/iugu/customers/destroy.rb +22 -0
- data/lib/jera_payment/services/iugu/customers/update.rb +30 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/base.rb +24 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/created.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/due.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/dunning_action.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/installment_released.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/payment_failed.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/refund.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/released.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/invoice/status_changed.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/referrals/bank_verification.rb +39 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/referrals/base.rb +16 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/referrals/verification.rb +24 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/activated.rb +12 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/base.rb +18 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/changed.rb +12 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/created.rb +12 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/expired.rb +12 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/renewed.rb +12 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/subscription/suspended.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/withdraw_request/base.rb +16 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/withdraw_request/created.rb +8 -0
- data/lib/jera_payment/services/iugu/handle_callbacks/withdraw_request/status_changed.rb +20 -0
- data/lib/jera_payment/services/iugu/households/create.rb +19 -0
- data/lib/jera_payment/services/iugu/invoices/create.rb +31 -0
- data/lib/jera_payment/services/iugu/invoices/duplicate.rb +54 -0
- data/lib/jera_payment/services/iugu/invoices/send_email.rb +18 -0
- data/lib/jera_payment/services/iugu/invoices/update_status.rb +31 -0
- data/lib/jera_payment/services/iugu/plans/create.rb +26 -0
- data/lib/jera_payment/services/iugu/plans/destroy.rb +17 -0
- data/lib/jera_payment/services/iugu/plans/update.rb +18 -0
- data/lib/jera_payment/services/iugu/sub_accounts/create.rb +26 -0
- data/lib/jera_payment/services/iugu/sub_accounts/update.rb +19 -0
- data/lib/jera_payment/services/iugu/sub_accounts/verify.rb +38 -0
- data/lib/jera_payment/services/iugu/subscriptions/change_plan.rb +41 -0
- data/lib/jera_payment/services/iugu/subscriptions/create.rb +29 -0
- data/lib/jera_payment/services/iugu/subscriptions/destroy.rb +26 -0
- data/lib/jera_payment/services/iugu/subscriptions/update.rb +18 -0
- data/lib/jera_payment/services/iugu/subscriptions/update_credits.rb +37 -0
- data/lib/jera_payment/services/iugu/subscriptions/update_situation.rb +36 -0
- data/lib/jera_payment/services/iugu/transfers/create.rb +28 -0
- data/lib/jera_payment/services/iugu/withdrawals/create.rb +27 -0
- data/lib/jera_payment/version.rb +3 -0
- metadata +208 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f3dd3e6509ddb946b8e1869d695938dfaead8142
|
4
|
+
data.tar.gz: ecae0de56db8a911965f835ba88d6a385c825be6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6f9fb188b81e2868b3c470eb3a7de8fe6baf4b202512883cb5df0ec7a9c88accb7ffd2ce5e69801ab9fbc6e66f596dc8e60067ac533c30fdc5e58c291b43211
|
7
|
+
data.tar.gz: 39f84aa3f34a3cf6bcc9080c81c6668c66acdb3720c497f052de9fec3ba6f4290d9c4ecd93f472581c1bda48de12d22406873295d34238aeab229e16e2df7fe4
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Jera Software
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module JeraPayment
|
2
|
+
class CallbacksController < JeraPaymentController
|
3
|
+
def callback
|
4
|
+
status = eval("#{api_name}::HandleCallbacks::#{format_event(params[:event])}.new(#{params}).call")
|
5
|
+
|
6
|
+
render json: { status: status }, status: status
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
def api_name
|
11
|
+
JeraPayment.api.to_s.capitalize
|
12
|
+
end
|
13
|
+
|
14
|
+
def format_event(event)
|
15
|
+
resource = event.split('.').first.capitalize
|
16
|
+
|
17
|
+
event = event.split('.').last.split('_').map{|w| w.capitalize}.join
|
18
|
+
|
19
|
+
resource + "::" + event
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
pt-BR:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
jera_payment/transfer:
|
5
|
+
one: Transferência entre Subconta
|
6
|
+
other: Transferências entre Subcontas
|
7
|
+
jera_payment/household:
|
8
|
+
one: Conta bancária
|
9
|
+
other: Contas bancárias
|
10
|
+
jera_payment/withdrawal:
|
11
|
+
one: Saque
|
12
|
+
other: Saques
|
13
|
+
jera_payment/sub_account:
|
14
|
+
one: Subconta
|
15
|
+
other: Subcontas
|
16
|
+
jera_payment/customer:
|
17
|
+
one: Cliente
|
18
|
+
other: Clientes
|
19
|
+
jera_payment/invoice:
|
20
|
+
one: Fatura
|
21
|
+
other: Faturas
|
22
|
+
jera_payment/credit_card:
|
23
|
+
one: Cartão de crédito
|
24
|
+
other: Cartões de crédito
|
25
|
+
jera_payment/charge:
|
26
|
+
one: Cobrança
|
27
|
+
other: Cobranças
|
28
|
+
attributes:
|
29
|
+
jera_payment/transfer:
|
30
|
+
id: ID
|
31
|
+
api_id: API ID
|
32
|
+
api: API ID
|
33
|
+
sub_account: Subconta
|
34
|
+
sub_account_id: ID Subconta
|
35
|
+
receiver: Destinatário
|
36
|
+
receiver_id: ID Destinatário
|
37
|
+
amount_cents: Valor em centavos
|
38
|
+
amount_localized: Valor em reais
|
39
|
+
custom_variables: Variáveis customizadas
|
40
|
+
jera_payment/household:
|
41
|
+
id: ID
|
42
|
+
sub_account: Subconta
|
43
|
+
sub_account_id: ID Subconta
|
44
|
+
agency: Agência
|
45
|
+
account: Conta
|
46
|
+
account_type: Tipo de conta
|
47
|
+
bank: Banco
|
48
|
+
document: Documento
|
49
|
+
status: Situação
|
50
|
+
feedback: Feedback
|
51
|
+
verification: Criada na verificação?
|
52
|
+
jera_payment/withdrawal:
|
53
|
+
id: ID
|
54
|
+
api_id: API ID
|
55
|
+
api: API ID
|
56
|
+
amount: Valor
|
57
|
+
custom_variables: Variáveis customizadas
|
58
|
+
status: Situação
|
59
|
+
feedback: Feedback
|
60
|
+
sub_account: Subconta
|
61
|
+
sub_account_id: ID Subconta
|
62
|
+
jera_payment/sub_account:
|
63
|
+
id: ID
|
64
|
+
account_id: API ID
|
65
|
+
account: API ID
|
66
|
+
current_household: Conta bancária atual
|
67
|
+
current_household_id: ID Conta bancária atual
|
68
|
+
sub_accountable: Titular
|
69
|
+
name: Nome
|
70
|
+
comissions: Comissões
|
71
|
+
auto_withdrawal: Saque automático
|
72
|
+
fines: Multas
|
73
|
+
per_day_interest: Juros por dia de atraso
|
74
|
+
late_payment_fine: Valor da multa por atraso
|
75
|
+
auto_advance: Antecipação automática
|
76
|
+
auto_advance_type: Tipo de antecipação
|
77
|
+
auto_advance_option: Opção de antecipação
|
78
|
+
bank_slip: Boleto
|
79
|
+
credit_card: Cartão de crédito
|
80
|
+
payment_email_notification: Notificação de pagamento realizado
|
81
|
+
payment_email_notification_receiver: Email para notificação de pagamento realizado
|
82
|
+
early_payment_discount: Desconto por pagamento antecipado
|
83
|
+
early_payment_discounts: Configuração do desconto de pagamento antecipado
|
84
|
+
subscriptions_billing_days: Dias para criação de faturas para próximo ciclo
|
85
|
+
subscriptions_trial_period: Duração do período de teste (dias)
|
86
|
+
default_return_url: URL para redirecionamento pós pagamento
|
87
|
+
owner_emails_to_notify: Emails que recem notificações da conta
|
88
|
+
resp_name: Nome do responsável
|
89
|
+
resp_cpf: CPF do responsável
|
90
|
+
can_receive?: Pode receber?
|
91
|
+
is_verified?: Verificado?
|
92
|
+
last_verification_request_feedback: Último feedback
|
93
|
+
jera_payment/customer:
|
94
|
+
id: ID
|
95
|
+
api_id: API ID
|
96
|
+
api: API ID
|
97
|
+
email: E-mail
|
98
|
+
name: Nome
|
99
|
+
customerable: Titular
|
100
|
+
current_credit_card: Cartão de crédito padrão
|
101
|
+
phone: Telefone
|
102
|
+
cpf_cnpj: CPF/CNPJ
|
103
|
+
jera_payment/credit_card:
|
104
|
+
id: ID
|
105
|
+
customer: Cliente
|
106
|
+
api_id: API ID
|
107
|
+
api: API ID
|
108
|
+
brand: Bandeira
|
109
|
+
number: Número
|
110
|
+
first_name: Primeiro nome
|
111
|
+
last_name: Sobrenome
|
112
|
+
cvv: CVV
|
113
|
+
month: Mês de expiração
|
114
|
+
year: Ano de expiração
|
115
|
+
description: Descrição
|
116
|
+
test: Cartão de teste
|
117
|
+
jera_payment/charge:
|
118
|
+
id: ID
|
119
|
+
invoice: Fatura
|
120
|
+
method: Método
|
121
|
+
token: Token
|
122
|
+
customer_payment_method_api_id: API ID do cartão de crédito do cliente
|
123
|
+
customer_payment_method_api: API ID do cartão de crédito do cliente
|
124
|
+
restrict_payment_method: Método de pagamento restrito
|
125
|
+
customer_api_id: API ID do cliente
|
126
|
+
customer_api: API ID do cliente
|
127
|
+
email: E-mail
|
128
|
+
months: Parcelas
|
129
|
+
discount_cents: Desconto em centavos
|
130
|
+
bank_slip_extra_days: Prazo para pagamento do boleto
|
131
|
+
keep_dunning: Manter cobrança
|
132
|
+
items: Items
|
133
|
+
cpf_cnpj: CPF/CNPJ
|
134
|
+
name: Nome
|
135
|
+
phone_prefix: Prefixo do telefone
|
136
|
+
phone: Número do telefone
|
137
|
+
email: E-mail
|
138
|
+
zip_code: CEP
|
139
|
+
street: Rua
|
140
|
+
number: Número
|
141
|
+
neighborhood: Bairro
|
142
|
+
city: Cidade
|
143
|
+
state: Estado
|
144
|
+
country: País
|
145
|
+
complement: Complemento
|
146
|
+
url: URL
|
147
|
+
pdf: PDF
|
148
|
+
identification: Identificação
|
149
|
+
jera_payment/invoice:
|
150
|
+
id: ID
|
151
|
+
api_id: API ID
|
152
|
+
api: API ID
|
153
|
+
customer: Cliente
|
154
|
+
status: Situação
|
155
|
+
email: E-mail
|
156
|
+
cc_emails: E-mails para cópia
|
157
|
+
due_date: Data de vencimento
|
158
|
+
ensure_workday_due_date: Vencimento apenas em dia de semana
|
159
|
+
items: Items
|
160
|
+
total_cents: Valor total em centavos
|
161
|
+
discount_cents: Desconto em centavos
|
162
|
+
payable_with: Pagável com
|
163
|
+
return_url: URL para redirecionamento pós pagamento
|
164
|
+
expired_url: URL para redirecionamento de fatura expirada
|
165
|
+
notification_url: Webhook de fatura
|
166
|
+
fines: Multa por atraso
|
167
|
+
late_payment_fine: Valor da multa por atraso
|
168
|
+
per_day_interest: Juros por dia de atraso
|
169
|
+
ignore_due_email: Ignorar email de vencimento
|
170
|
+
ignore_canceled_email: Ignorar email de cancelamento
|
171
|
+
current_fines_option: Multas iguais à fatura original
|
172
|
+
keep_early_payment_discount: Desconto de antecipação igual à fatura original
|
173
|
+
subscription_api_id: API ID da Assinatura
|
174
|
+
subscription_api: API ID da Assinatura
|
175
|
+
credits: Créditos
|
176
|
+
early_payment_discount: Desconto por pagamento antecipado
|
177
|
+
early_payment_discounts: Configuração do desconto de pagamento antecipado
|
178
|
+
secure_url: URL da fatura
|
179
|
+
duplicated: Fatura duplicada
|
180
|
+
payer: Pagante
|
181
|
+
jera_payment/plan:
|
182
|
+
name: Nome
|
183
|
+
identifier: Identificador
|
184
|
+
interval: Intervalo
|
185
|
+
interval_type: Tipo de intervalor
|
186
|
+
value_cents: Preço em centavos
|
187
|
+
payable_with: Pagável com
|
188
|
+
features: Features
|
189
|
+
jera_payment/subscription:
|
190
|
+
id: ID
|
191
|
+
api_id: ID na API
|
192
|
+
api: ID na API
|
193
|
+
customer_id: ID do cliente
|
194
|
+
customer: Cliente
|
195
|
+
plan_identifier: Identificador do plano
|
196
|
+
expires_at: Expira em
|
197
|
+
only_on_charge_success: Criar assinatura se cobrança bem sucedida
|
198
|
+
ignore_due_email: Ignorar email de vencimento
|
199
|
+
payable_with: Pagável com
|
200
|
+
credits_based: Baseada em créditos
|
201
|
+
price_cents: Preço em centavos de recarga
|
202
|
+
credits_cycle: Qtde de créditos adicionados por ciclo
|
203
|
+
credits_min: Quantidade de créditos para ativar ciclo
|
204
|
+
subitems: Items adicionais
|
205
|
+
custom_variables: Variáveis personalizadas
|
206
|
+
enumerize:
|
207
|
+
jera_payment/withdrawal:
|
208
|
+
status:
|
209
|
+
pending: Pendente
|
210
|
+
processing: Processando
|
211
|
+
accepted: Aceito
|
212
|
+
rejected: Recusado
|
213
|
+
jera_payment/household:
|
214
|
+
account_type:
|
215
|
+
checking: Corrente
|
216
|
+
savings: Poupança
|
217
|
+
bank:
|
218
|
+
itau: Itaú
|
219
|
+
bradesco: Bradesco
|
220
|
+
caixa_economica: Caixa Econômica
|
221
|
+
banco_do_brasil: Banco do Brasil
|
222
|
+
santander: Santander
|
223
|
+
banrisul: Banrisul
|
224
|
+
sicredi: Sicredi
|
225
|
+
sicoob: Sicoob
|
226
|
+
inter: Inter
|
227
|
+
brb: BRB
|
228
|
+
status:
|
229
|
+
pending: Pendente
|
230
|
+
accepted: Aceito
|
231
|
+
rejected: Recusado
|
232
|
+
jera_payment/invoice:
|
233
|
+
status:
|
234
|
+
pending: Pendente
|
235
|
+
paid: Paga
|
236
|
+
canceled: Cancelada
|
237
|
+
partially_paid: Paga parcialmente
|
238
|
+
refunded: Reembolsada
|
239
|
+
expired: Expirada
|
240
|
+
authorized: Autorizada
|
241
|
+
in_protest: Em protesto
|
242
|
+
chargeback: Estornada
|
243
|
+
in_analysis: Em análise
|
data/config/routes.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class JeraPaymentGenerator < ActiveRecord::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def create_customers_table
|
9
|
+
migration_template "create_jera_payment_customers.rb", "db/migrate/create_jera_payment_customers.rb", migration_version: migration_version
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_credit_cards_table
|
13
|
+
migration_template "create_jera_payment_credit_cards.rb", "db/migrate/create_jera_payment_credit_cards.rb", migration_version: migration_version
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_invoices_table
|
17
|
+
migration_template "create_jera_payment_invoices.rb", "db/migrate/create_jera_payment_invoices.rb", migration_version: migration_version
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_charges_table
|
21
|
+
migration_template "create_jera_payment_charges.rb", "db/migrate/create_jera_payment_charges.rb", migration_version: migration_version
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_plans_table
|
25
|
+
migration_template "create_jera_payment_plans.rb", "db/migrate/create_jera_payment_plans.rb", migration_version: migration_version
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_subscriptions_table
|
29
|
+
migration_template "create_jera_payment_subscriptions.rb", "db/migrate/create_jera_payment_subscriptions.rb", migration_version: migration_version
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_sub_accounts_table
|
33
|
+
migration_template "create_jera_payment_sub_accounts.rb", "db/migrate/create_jera_payment_sub_accounts.rb", migration_version: migration_version
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_withdrawals_table
|
37
|
+
migration_template "create_jera_payment_withdrawals.rb", "db/migrate/create_jera_payment_withdrawals.rb", migration_version: migration_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_households_table
|
41
|
+
migration_template "create_jera_payment_households.rb", "db/migrate/create_jera_payment_households.rb", migration_version: migration_version
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_transfers_table
|
45
|
+
migration_template "create_jera_payment_transfers.rb", "db/migrate/create_jera_payment_transfers.rb", migration_version: migration_version
|
46
|
+
end
|
47
|
+
|
48
|
+
def rails5_and_up?
|
49
|
+
Rails::VERSION::MAJOR >= 5
|
50
|
+
end
|
51
|
+
|
52
|
+
def migration_version
|
53
|
+
if rails5_and_up?
|
54
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateJeraPaymentCharges < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :jera_payment_charges do |t|
|
4
|
+
t.belongs_to :invoice
|
5
|
+
t.belongs_to :sub_account
|
6
|
+
t.string :method
|
7
|
+
t.string :token
|
8
|
+
t.string :customer_payment_method_api_id
|
9
|
+
t.boolean :restrict_payment_method
|
10
|
+
t.string :customer_api_id
|
11
|
+
t.string :email
|
12
|
+
t.integer :months
|
13
|
+
t.integer :discount_cents
|
14
|
+
t.integer :bank_slip_extra_days
|
15
|
+
t.boolean :keep_dunning
|
16
|
+
t.text :items
|
17
|
+
t.string :cpf_cnpj
|
18
|
+
t.string :name
|
19
|
+
t.string :phone_prefix
|
20
|
+
t.string :phone
|
21
|
+
t.string :zip_code
|
22
|
+
t.string :street
|
23
|
+
t.string :number
|
24
|
+
t.string :neighborhood
|
25
|
+
t.string :city
|
26
|
+
t.string :state
|
27
|
+
t.string :country
|
28
|
+
t.string :complement
|
29
|
+
t.string :url
|
30
|
+
t.string :pdf
|
31
|
+
t.string :identification
|
32
|
+
|
33
|
+
t.timestamps null: false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateJeraPaymentCreditCards < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :jera_payment_credit_cards do |t|
|
4
|
+
|
5
|
+
t.references :customer
|
6
|
+
t.string :api_id
|
7
|
+
t.string :brand
|
8
|
+
t.string :number
|
9
|
+
t.string :first_name
|
10
|
+
t.string :last_name
|
11
|
+
t.string :cvv
|
12
|
+
t.string :month
|
13
|
+
t.string :year
|
14
|
+
t.string :description
|
15
|
+
t.boolean :test
|
16
|
+
|
17
|
+
t.timestamps null: false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateJeraPaymentCustomers < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :jera_payment_customers do |t|
|
4
|
+
|
5
|
+
t.string :api_id
|
6
|
+
t.string :email
|
7
|
+
t.string :name
|
8
|
+
t.integer :phone
|
9
|
+
t.string :cpf_cnpj
|
10
|
+
t.string :city
|
11
|
+
t.string :state
|
12
|
+
t.string :street
|
13
|
+
t.string :number
|
14
|
+
t.string :zip_code
|
15
|
+
t.references :customerable, polymorphic: true, index: {name: 'index_jera_payment_customers_on_customerable' }
|
16
|
+
t.references :current_credit_card
|
17
|
+
t.references :sub_account
|
18
|
+
|
19
|
+
t.timestamps null: false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|