Class: Redex::Request::TransactionRequest
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- Redex::Request::TransactionRequest
- Defined in:
- lib/redex/request/transaction_request.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#auto_capture ⇒ Object
Returns the value of attribute auto_capture.
-
#card_cvv ⇒ Object
Returns the value of attribute card_cvv.
-
#card_expiration_month ⇒ Object
Returns the value of attribute card_expiration_month.
-
#card_expiration_year ⇒ Object
Returns the value of attribute card_expiration_year.
-
#card_holder_name ⇒ Object
Returns the value of attribute card_holder_name.
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#installments ⇒ Object
Returns the value of attribute installments.
-
#invoice_note ⇒ Object
Returns the value of attribute invoice_note.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#recorrence ⇒ Object
readonly
Returns the value of attribute recorrence.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ TransactionRequest
constructor
A new instance of TransactionRequest.
- #sanitized_fields ⇒ Object
Methods inherited from BaseRequest
#authorization_params, client, #result, #sanitize
Constructor Details
#initialize(params = {}) ⇒ TransactionRequest
Returns a new instance of TransactionRequest.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/redex/request/transaction_request.rb', line 10 def initialize(params = {}) @order_id = params[:order_id] @amount = params[:amount] @installments = params.fetch(:installments, 1) @invoice_note = params[:invoice_note] @card_number = params[:card_number] @card_cvv = params[:card_cvv] @card_holder_name = params[:card_holder_name] @card_expiration_month = params[:card_expiration_month] @card_expiration_year = params[:card_expiration_year] @auto_capture = params.fetch(:auto_capture, true) @recorrence = params.fetch(:recorrence, false) @origin = 1 end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def amount @amount end |
#auto_capture ⇒ Object
Returns the value of attribute auto_capture.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def auto_capture @auto_capture end |
#card_cvv ⇒ Object
Returns the value of attribute card_cvv.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def card_cvv @card_cvv end |
#card_expiration_month ⇒ Object
Returns the value of attribute card_expiration_month.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def card_expiration_month @card_expiration_month end |
#card_expiration_year ⇒ Object
Returns the value of attribute card_expiration_year.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def card_expiration_year @card_expiration_year end |
#card_holder_name ⇒ Object
Returns the value of attribute card_holder_name.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def card_holder_name @card_holder_name end |
#card_number ⇒ Object
Returns the value of attribute card_number.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def card_number @card_number end |
#installments ⇒ Object
Returns the value of attribute installments.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def installments @installments end |
#invoice_note ⇒ Object
Returns the value of attribute invoice_note.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def invoice_note @invoice_note end |
#order_id ⇒ Object
Returns the value of attribute order_id.
4 5 6 |
# File 'lib/redex/request/transaction_request.rb', line 4 def order_id @order_id end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
8 9 10 |
# File 'lib/redex/request/transaction_request.rb', line 8 def origin @origin end |
#recorrence ⇒ Object (readonly)
Returns the value of attribute recorrence.
8 9 10 |
# File 'lib/redex/request/transaction_request.rb', line 8 def recorrence @recorrence end |
Instance Method Details
#sanitized_fields ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/redex/request/transaction_request.rb', line 25 def sanitized_fields { NumPedido: sanitize(:order_id), Total: sanitize(:amount), Parcelas: sanitize(:installments), IdentificacaoFatura: sanitize(:invoice_note), Nrcartao: sanitize(:card_number), Cvc2: sanitize(:card_cvv), Portador: sanitize(:card_holder_name), Mes: sanitize(:card_expiration_month), Ano: sanitize(:card_expiration_year), Recorrente: sanitize(:recorrence), Origem: sanitize(:origin), Transacao: transaction_type }.merge().sort.to_h.select { |k, v| !v.to_s.empty? } end |