Class: Transbank::Onepay::TransactionCreateRequest
- Inherits:
-
Object
- Object
- Transbank::Onepay::TransactionCreateRequest
- Includes:
- Request
- Defined in:
- lib/transbank/sdk/onepay/requests/transaction_create_request.rb
Overview
Create a payload to create [Transaction] on Transbank
Constant Summary collapse
- SIGNATURE_PARAMS =
[:external_unique_number, :total, :items_quantity, :issued_at, :callback_url].freeze
Instance Attribute Summary collapse
-
#app_scheme ⇒ Object
Returns the value of attribute app_scheme.
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#commerce_logo_url ⇒ Object
Returns the value of attribute commerce_logo_url.
-
#external_unique_number ⇒ Object
Returns the value of attribute external_unique_number.
-
#generate_ott_qr_code ⇒ Object
readonly
Returns the value of attribute generate_ott_qr_code.
-
#issued_at ⇒ Object
Returns the value of attribute issued_at.
-
#items ⇒ Object
Returns the value of attribute items.
-
#items_quantity ⇒ Object
Returns the value of attribute items_quantity.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#total ⇒ Object
Returns the value of attribute total.
-
#width_height ⇒ Object
Returns the value of attribute width_height.
Attributes included from Request
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ TransactionCreateRequest
constructor
are on the [Channel] class.
- #sign(secret) ⇒ Object
Methods included from Request
Methods included from Utils::JSONUtils
included, #jsonify, #transform_hash_keys, #underscore
Methods included from Utils::SignatureUtils
#hmac_sha256, #signature_for, #to_data, #valid_signature?
Constructor Details
#initialize(opts = {}) ⇒ TransactionCreateRequest
are on the [Channel] class
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 30 def initialize(opts = {}) self.external_unique_number = opts.fetch(:external_unique_number) self.total = opts.fetch(:total) self.items_quantity = opts.fetch(:items_quantity) self.items = opts.fetch(:items) self.issued_at = opts.fetch(:issued_at) self.callback_url = opts.fetch(:callback_url) channel = opts.fetch(:channel, Channel::WEB) self.channel = channel self.app_scheme = opts.fetch(:app_scheme, '') self.signature = nil self.commerce_logo_url = opts.fetch(:commerce_logo_url) self.width_height = opts.fetch(:width_height) # This is never anything but true, but it is required by the server @generate_ott_qr_code = true end |
Instance Attribute Details
#app_scheme ⇒ Object
Returns the value of attribute app_scheme.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def app_scheme @app_scheme end |
#callback_url ⇒ Object
Returns the value of attribute callback_url.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def callback_url @callback_url end |
#channel ⇒ Object
Returns the value of attribute channel.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def channel @channel end |
#commerce_logo_url ⇒ Object
Returns the value of attribute commerce_logo_url.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def commerce_logo_url @commerce_logo_url end |
#external_unique_number ⇒ Object
Returns the value of attribute external_unique_number.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def external_unique_number @external_unique_number end |
#generate_ott_qr_code ⇒ Object (readonly)
Returns the value of attribute generate_ott_qr_code.
10 11 12 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 10 def generate_ott_qr_code @generate_ott_qr_code end |
#issued_at ⇒ Object
Returns the value of attribute issued_at.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def issued_at @issued_at end |
#items ⇒ Object
Returns the value of attribute items.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def items @items end |
#items_quantity ⇒ Object
Returns the value of attribute items_quantity.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def items_quantity @items_quantity end |
#signature ⇒ Object
Returns the value of attribute signature.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def signature @signature end |
#total ⇒ Object
Returns the value of attribute total.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def total @total end |
#width_height ⇒ Object
Returns the value of attribute width_height.
7 8 9 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 7 def width_height @width_height end |
Instance Method Details
#sign(secret) ⇒ Object
79 80 81 82 |
# File 'lib/transbank/sdk/onepay/requests/transaction_create_request.rb', line 79 def sign(secret) @signature = signature_for(to_data, secret) self end |