Class: Tinker::Model::Dto::InitiatePaymentRequestDto
- Inherits:
-
Object
- Object
- Tinker::Model::Dto::InitiatePaymentRequestDto
- Defined in:
- lib/tinker/model/dto/initiate_payment_request_dto.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#customer_email ⇒ Object
readonly
Returns the value of attribute customer_email.
-
#customer_phone ⇒ Object
readonly
Returns the value of attribute customer_phone.
-
#gateway ⇒ Object
readonly
Returns the value of attribute gateway.
-
#merchant_reference ⇒ Object
readonly
Returns the value of attribute merchant_reference.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#return_url ⇒ Object
readonly
Returns the value of attribute return_url.
-
#transaction_desc ⇒ Object
readonly
Returns the value of attribute transaction_desc.
Instance Method Summary collapse
-
#initialize(amount:, currency:, gateway:, merchant_reference:, return_url:, customer_phone: nil, customer_email: nil, transaction_desc: nil, metadata: nil) ⇒ InitiatePaymentRequestDto
constructor
A new instance of InitiatePaymentRequestDto.
- #to_hash ⇒ Object
Constructor Details
#initialize(amount:, currency:, gateway:, merchant_reference:, return_url:, customer_phone: nil, customer_email: nil, transaction_desc: nil, metadata: nil) ⇒ InitiatePaymentRequestDto
Returns a new instance of InitiatePaymentRequestDto.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 10 def initialize(amount:, currency:, gateway:, merchant_reference:, return_url:, customer_phone: nil, customer_email: nil, transaction_desc: nil, metadata: nil) @amount = amount @currency = currency @gateway = gateway @merchant_reference = merchant_reference @return_url = return_url @customer_phone = customer_phone @customer_email = customer_email @transaction_desc = transaction_desc = end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def currency @currency end |
#customer_email ⇒ Object (readonly)
Returns the value of attribute customer_email.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def customer_email @customer_email end |
#customer_phone ⇒ Object (readonly)
Returns the value of attribute customer_phone.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def customer_phone @customer_phone end |
#gateway ⇒ Object (readonly)
Returns the value of attribute gateway.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def gateway @gateway end |
#merchant_reference ⇒ Object (readonly)
Returns the value of attribute merchant_reference.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def merchant_reference @merchant_reference end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def end |
#return_url ⇒ Object (readonly)
Returns the value of attribute return_url.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def return_url @return_url end |
#transaction_desc ⇒ Object (readonly)
Returns the value of attribute transaction_desc.
7 8 9 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 7 def transaction_desc @transaction_desc end |
Instance Method Details
#to_hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tinker/model/dto/initiate_payment_request_dto.rb', line 23 def to_hash gateway_value = @gateway.is_a?(String) ? @gateway : @gateway.to_s payload = { amount: @amount, currency: @currency, gateway: gateway_value, merchantReference: @merchant_reference, returnUrl: @return_url } payload[:customerPhone] = @customer_phone if @customer_phone payload[:customerEmail] = @customer_email if @customer_email payload[:transactionDesc] = @transaction_desc if @transaction_desc payload[:metadata] = if payload end |