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) ⇒ 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) ⇒ 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 |
# 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) 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 ) 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
76 77 78 79 |
# File 'lib/vantiv/api/request_body.rb', line 76 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
81 82 83 84 |
# File 'lib/vantiv/api/request_body.rb', line 81 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
86 87 88 89 |
# File 'lib/vantiv/api/request_body.rb', line 86 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
117 118 119 120 121 122 123 124 125 |
# File 'lib/vantiv/api/request_body.rb', line 117 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
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/vantiv/api/request_body.rb', line 91 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
112 113 114 115 |
# File 'lib/vantiv/api/request_body.rb', line 112 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
127 128 129 130 |
# File 'lib/vantiv/api/request_body.rb', line 127 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 |