Class: JeraPayment::Parsers::Iugu::ChargeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/jera_payment/parsers/iugu/charge_parser.rb

Class Method Summary collapse

Class Method Details

.charge_body(resource) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jera_payment/parsers/iugu/charge_parser.rb', line 5

def self.charge_body(resource)
  {
    invoice_id: resource&.invoice&.api_id,
    customer_payment_method_id: resource.customer_payment_method_api_id,
    restrict_payment_method: resource.restrict_payment_method,
    customer_id: resource.customer_api_id,
    email: resource.email,
    months: resource.months,
    discount_cents: resource.discount_cents,
    bank_slip_extra_days: resource.bank_slip_extra_days,
    keep_dunning: resource.keep_dunning,
    items: resource.items,
    payer: {
      cpf_cnpj: resource.cpf_cnpj,
      name: resource.name,
      phone_prefix: resource.phone_prefix,
      phone: resource.phone,
      email: resource.email,
      address: {
        zip_code: resource.zip_code,
        street: resource.street,
        number: resource.number,
        neighborhood: resource.neighborhood,
        city: resource.city,
        state: resource.state,
        country: resource.country,
        complement: resource.complement
      },
    },
  }
end