Class: SimplyWompi::Transactions::Domain::Dtos::CreateTransactionDto

Inherits:
Object
  • Object
show all
Defined in:
lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb

Overview

Create Transaction Data Transfer Object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(acceptance_token:, amount_in_cents:, currency:, customer_email:, payment_method:, reference:) ⇒ CreateTransactionDto

Returns a new instance of CreateTransactionDto.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 14

def initialize(
  acceptance_token:,
  amount_in_cents:,
  currency:,
  customer_email:,
  payment_method:,
  reference:
)
  unless acceptance_token.is_a?(String)
    raise ArgumentError("ArgumentError acceptance_token: #{acceptance_token.class}, is not instance of #{String}")
  end

  unless amount_in_cents.is_a?(Integer)
    raise ArgumentError("ArgumentError amount_in_cents: #{amount_in_cents.class}, is not instance of #{Integer}")
  end

  unless currency.is_a?(String)
    raise ArgumentError("ArgumentError currency: #{currency.class}, is not instance of #{String}")
  end

  unless customer_email.is_a?(String)
    raise ArgumentError("ArgumentError customer_email: #{customer_email.class}, is not instance of #{String}")
  end

  unless payment_method.is_a?(CreateTransactionPaymentMethodDto)
    raise ArgumentError("ArgumentError payment_method: #{payment_method.class}, is not instance of #{CreateTransactionPaymentMethodDto}")
  end

  unless reference.is_a?(String)
    raise ArgumentError("ArgumentError reference: #{reference.class}, is not instance of #{String}")
  end

  @acceptance_token = acceptance_token
  @amount_in_cents = amount_in_cents
  @currency = currency
  @customer_email = customer_email
  @payment_method = payment_method
  @reference = reference
end

Instance Attribute Details

#acceptance_tokenObject (readonly)

Returns the value of attribute acceptance_token.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def acceptance_token
  @acceptance_token
end

#amount_in_centsObject (readonly)

Returns the value of attribute amount_in_cents.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def amount_in_cents
  @amount_in_cents
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def currency
  @currency
end

#customer_emailObject (readonly)

Returns the value of attribute customer_email.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def customer_email
  @customer_email
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def payment_method
  @payment_method
end

#referenceObject (readonly)

Returns the value of attribute reference.



7
8
9
# File 'lib/simply_wompi/transactions/domain/dtos/create_transaction_dto.rb', line 7

def reference
  @reference
end