Class: Vantiv::Api::RequestBody
- Inherits:
-
Object
- Object
- Vantiv::Api::RequestBody
- Defined in:
- lib/vantiv/api/request_body.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#application_id ⇒ Object
readonly
Returns the value of attribute application_id.
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#card ⇒ Object
Returns the value of attribute card.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#payment_account ⇒ Object
Returns the value of attribute payment_account.
-
#report_group ⇒ Object
readonly
Returns the value of attribute report_group.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
-
#version ⇒ Object
Returns the value of attribute version.
-
#xmlns ⇒ Object
Returns the value of attribute xmlns.
Class Method Summary collapse
- .for_auth_or_sale(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, cvv: nil, order_source: Vantiv.default_order_source, online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil, original_transaction_amount: nil) ⇒ Object
- .for_auth_reversal(transaction_id:, amount: nil) ⇒ Object
- .for_capture(transaction_id:, amount: nil) ⇒ Object
- .for_credit(transaction_id:, amount: nil) ⇒ Object
- .for_direct_post_tokenization(card_number:, expiry_month:, expiry_year:, cvv:) ⇒ Object
- .for_return(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source) ⇒ Object
- .for_tokenization(paypage_registration_id:) ⇒ Object
- .for_void(transaction_id:) ⇒ Object
Instance Method Summary collapse
-
#initialize(card: nil, transaction: nil, payment_account: nil) ⇒ RequestBody
constructor
A new instance of RequestBody.
- #to_json ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(card: nil, transaction: nil, payment_account: nil) ⇒ RequestBody
Returns a new instance of RequestBody.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vantiv/api/request_body.rb', line 21 def initialize(card: nil, transaction: nil, payment_account: nil) @card = card @transaction = transaction @payment_account = payment_account @merchant_id = Vantiv.merchant_id @application_id = SecureRandom.hex(12) @report_group = Vantiv.default_report_group @authentication = Authentication.new end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
17 18 19 |
# File 'lib/vantiv/api/request_body.rb', line 17 def address @address end |
#application_id ⇒ Object (readonly)
Returns the value of attribute application_id.
16 17 18 |
# File 'lib/vantiv/api/request_body.rb', line 16 def application_id @application_id end |
#authentication ⇒ Object
Returns the value of attribute authentication.
19 20 21 |
# File 'lib/vantiv/api/request_body.rb', line 19 def authentication @authentication end |
#card ⇒ Object
Returns the value of attribute card.
17 18 19 |
# File 'lib/vantiv/api/request_body.rb', line 17 def card @card end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
16 17 18 |
# File 'lib/vantiv/api/request_body.rb', line 16 def merchant_id @merchant_id end |
#payment_account ⇒ Object
Returns the value of attribute payment_account.
17 18 19 |
# File 'lib/vantiv/api/request_body.rb', line 17 def payment_account @payment_account end |
#report_group ⇒ Object (readonly)
Returns the value of attribute report_group.
16 17 18 |
# File 'lib/vantiv/api/request_body.rb', line 16 def report_group @report_group end |
#transaction ⇒ Object
Returns the value of attribute transaction.
17 18 19 |
# File 'lib/vantiv/api/request_body.rb', line 17 def transaction @transaction end |
#version ⇒ Object
Returns the value of attribute version.
19 20 21 |
# File 'lib/vantiv/api/request_body.rb', line 19 def version @version end |
#xmlns ⇒ Object
Returns the value of attribute xmlns.
19 20 21 |
# File 'lib/vantiv/api/request_body.rb', line 19 def xmlns @xmlns end |
Class Method Details
.for_auth_or_sale(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, cvv: nil, order_source: Vantiv.default_order_source, online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil, original_transaction_amount: nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/vantiv/api/request_body.rb', line 41 def self.for_auth_or_sale(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, cvv: nil, order_source: Vantiv.default_order_source, online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil, original_transaction_amount: nil) if online_payment_cryptogram cardholder_authentication = CardholderAuthentication.new( authentication_value: online_payment_cryptogram ) else cardholder_authentication = nil end transaction = Transaction.new( order_id: order_id, amount_in_cents: amount, customer_id: customer_id, order_source: order_source, partial_approved_flag: false, cardholder_authentication: cardholder_authentication, original_network_transaction_id: original_network_transaction_id, processing_type: processing_type, original_transaction_amount: original_transaction_amount ) card = Card.new( expiry_month: expiry_month, expiry_year: expiry_year, cvv: cvv ) payment_account = PaymentAccount.new(id: payment_account_id) new( transaction: transaction, card: card, payment_account: payment_account ) end |
.for_auth_reversal(transaction_id:, amount: nil) ⇒ Object
79 80 81 82 |
# File 'lib/vantiv/api/request_body.rb', line 79 def self.for_auth_reversal(transaction_id:, amount: nil) transaction = Transaction.new(id: transaction_id, amount_in_cents: amount) new(transaction: transaction) end |
.for_capture(transaction_id:, amount: nil) ⇒ Object
84 85 86 87 |
# File 'lib/vantiv/api/request_body.rb', line 84 def self.for_capture(transaction_id:, amount: nil) transaction = Transaction.new(id: transaction_id, amount_in_cents: amount) new(transaction: transaction) end |
.for_credit(transaction_id:, amount: nil) ⇒ Object
89 90 91 92 |
# File 'lib/vantiv/api/request_body.rb', line 89 def self.for_credit(transaction_id:, amount: nil) transaction = Transaction.new(id: transaction_id, amount_in_cents: amount) new(transaction: transaction) end |
.for_direct_post_tokenization(card_number:, expiry_month:, expiry_year:, cvv:) ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/vantiv/api/request_body.rb', line 120 def self.for_direct_post_tokenization(card_number:, expiry_month:, expiry_year:, cvv:) card = Card.new( account_number: card_number, expiry_month: expiry_month, expiry_year: expiry_year, cvv: cvv ) new(card: card) end |
.for_return(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/vantiv/api/request_body.rb', line 94 def self.for_return(amount:, customer_id:, order_id:, payment_account_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source) transaction = Transaction.new( order_id: order_id, amount_in_cents: amount, order_source: order_source, customer_id: customer_id ) card = Card.new( expiry_month: expiry_month, expiry_year: expiry_year ) payment_account = PaymentAccount.new(id: payment_account_id) new( transaction: transaction, card: card, payment_account: payment_account ) end |
.for_tokenization(paypage_registration_id:) ⇒ Object
115 116 117 118 |
# File 'lib/vantiv/api/request_body.rb', line 115 def self.for_tokenization(paypage_registration_id:) card = Card.new(paypage_registration_id: paypage_registration_id) new(card: card) end |
.for_void(transaction_id:) ⇒ Object
130 131 132 133 |
# File 'lib/vantiv/api/request_body.rb', line 130 def self.for_void(transaction_id:) transaction = Transaction.new(id: transaction_id) new(transaction: transaction) end |
Instance Method Details
#to_json ⇒ Object
33 34 35 |
# File 'lib/vantiv/api/request_body.rb', line 33 def to_json ::RequestBodyRepresenter.new(self).to_json end |
#to_xml ⇒ Object
37 38 39 |
# File 'lib/vantiv/api/request_body.rb', line 37 def to_xml ::RequestBodyRepresenterXml.new(self).to_xml end |