Module: Vantiv

Defined in:
lib/vantiv.rb,
lib/vantiv/paypage.rb,
lib/vantiv/version.rb,
lib/vantiv/api/card.rb,
lib/vantiv/test_card.rb,
lib/vantiv/api/address.rb,
lib/vantiv/api/request.rb,
lib/vantiv/environment.rb,
lib/vantiv/api/response.rb,
lib/vantiv/api/endpoints.rb,
lib/vantiv/mocked_sandbox.rb,
lib/vantiv/api/transaction.rb,
lib/vantiv/api/fraud_result.rb,
lib/vantiv/api/request_body.rb,
lib/vantiv/api/response_body.rb,
lib/vantiv/response_code_map.rb,
lib/vantiv/api/payment_account.rb,
lib/vantiv/api/capture_response.rb,
lib/vantiv/test_temporary_token.rb,
lib/vantiv/api/apple_pay_response.rb,
lib/vantiv/api/transaction_response.rb,
lib/vantiv/api/tokenization_response.rb,
lib/vantiv/mocked_sandbox/api_request.rb,
lib/vantiv/api/account_updater_response.rb,
lib/vantiv/certification/paypage_driver.rb,
lib/vantiv/certification/paypage_server.rb,
lib/vantiv/certification/response_cache.rb,
lib/vantiv/api/cardholder_authentication.rb,
lib/vantiv/api/live_transaction_response.rb,
lib/vantiv/api/tied_transaction_response.rb,
lib/vantiv/mocked_sandbox/fixture_generator.rb,
lib/vantiv/certification/validation_test_runner.rb,
lib/vantiv/certification/cert_request_body_compiler.rb

Defined Under Namespace

Modules: Api, Certification, Environment, MockedSandbox, Paypage Classes: ResponseCodeMap, TestCard, TestTemporaryToken

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.auth(amount:, payment_account_id:, customer_id:, order_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source, use_temporarily_stored_security_code: false, online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil, original_transaction_amount: nil) ⇒ Object



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.rb', line 44

def self.auth(amount:, payment_account_id:, customer_id:, order_id:, expiry_month:, expiry_year:,
  order_source: Vantiv.default_order_source, use_temporarily_stored_security_code: false,
  online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil,
  original_transaction_amount: nil)

  # RE use_temporarily_stored_security_code
  # From XML Docs:
  # When you submit the CVV2/CVC2/CID in a registerTokenRequest, the platform encrypts
  # and stores the value on a temporary basis for later use in a tokenized Auth/Sale
  # transaction submitted without the value. To use the store value when
  # submitting an Auth/Sale transaction, set the cardValidationNum value to 000.

  cvv = use_temporarily_stored_security_code ? '000' : nil

  body = Api::RequestBody.for_auth_or_sale(
    amount: amount,
    order_id: order_id,
    customer_id: customer_id,
    payment_account_id: ,
    expiry_month: expiry_month,
    expiry_year: expiry_year,
    cvv: cvv,
    order_source: order_source,
    online_payment_cryptogram: online_payment_cryptogram,
    original_network_transaction_id: original_network_transaction_id,
    original_transaction_amount: original_transaction_amount,
    processing_type: processing_type
  )
  Api::Request.new(
    endpoint: Api::Endpoints::AUTHORIZATION,
    body: body,
    response_object: Api::LiveTransactionResponse.new(:auth)
  ).run
end

.auth_capture(amount:, payment_account_id:, customer_id:, order_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source, online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil, original_transaction_amount: nil) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/vantiv.rb', line 105

def self.auth_capture(amount:, payment_account_id:, customer_id:, order_id:,
    expiry_month:, expiry_year:, order_source: Vantiv.default_order_source,
    online_payment_cryptogram: nil, original_network_transaction_id: nil, processing_type: nil,
    original_transaction_amount: nil)
  body = Api::RequestBody.for_auth_or_sale(
    amount: amount,
    order_id: order_id,
    customer_id: customer_id,
    payment_account_id: ,
    expiry_month: expiry_month,
    expiry_year: expiry_year,
    order_source: order_source,
    online_payment_cryptogram: online_payment_cryptogram,
    original_network_transaction_id: original_network_transaction_id,
    original_transaction_amount: original_transaction_amount,
    processing_type: processing_type
  )
  Api::Request.new(
    endpoint: Api::Endpoints::SALE,
    body: body,
    response_object: Api::LiveTransactionResponse.new(:sale)
  ).run
end

.auth_reversal(transaction_id:, amount: nil) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/vantiv.rb', line 79

def self.auth_reversal(transaction_id:, amount: nil)
  body = Api::RequestBody.for_auth_reversal(
    transaction_id: transaction_id,
    amount: amount
  )

  Api::Request.new(
    endpoint: Api::Endpoints::AUTH_REVERSAL,
    body: body,
    response_object: Api::TiedTransactionResponse.new(:auth_reversal)
  ).run
end

.capture(transaction_id:, amount: nil) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/vantiv.rb', line 92

def self.capture(transaction_id:, amount: nil)
  body = Api::RequestBody.for_capture(
    transaction_id: transaction_id,
    amount: amount
  )

  Api::Request.new(
    endpoint: Api::Endpoints::CAPTURE,
    body: body,
    response_object: Api::TiedTransactionResponse.new(:capture)
  ).run
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Vantiv)

    the object that the method was called on



174
175
176
# File 'lib/vantiv.rb', line 174

def self.configure
  yield self
end

.credit(transaction_id:, amount: nil) ⇒ Object

NOTE: ActiveMerchant’s #refund… only for use on a capture or sale it seems

-> 'returns' are refunds too, credits are tied to a sale/capture, returns can be willy nilly


131
132
133
134
135
136
137
138
139
140
141
# File 'lib/vantiv.rb', line 131

def self.credit(transaction_id:, amount: nil)
  body = Api::RequestBody.for_credit(
    amount: amount,
    transaction_id: transaction_id
  )
  Api::Request.new(
    endpoint: Api::Endpoints::CREDIT,
    body: body,
    response_object: Api::TiedTransactionResponse.new(:credit)
  ).run
end

.get_error_description(code:) ⇒ Object



170
171
172
# File 'lib/vantiv.rb', line 170

def self.get_error_description(code:)
  ResponseCodeMap.get_error_description(code: code)
end

.refund(amount:, payment_account_id:, customer_id:, order_id:, expiry_month:, expiry_year:, order_source: Vantiv.default_order_source) ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/vantiv.rb', line 143

def self.refund(amount:, payment_account_id:, customer_id:, order_id:,
    expiry_month:, expiry_year:, order_source: Vantiv.default_order_source)
  body = Api::RequestBody.for_return(
    amount: amount,
    customer_id: customer_id,
    order_id: order_id,
    payment_account_id: ,
    expiry_month: expiry_month,
    expiry_year: expiry_year,
    order_source: order_source
  )
  Api::Request.new(
    endpoint: Api::Endpoints::RETURN,
    body: body,
    response_object: Api::TiedTransactionResponse.new(:return)
  ).run
end

.rootObject



192
193
194
# File 'lib/vantiv.rb', line 192

def self.root
  File.dirname __dir__
end

.tokenize(temporary_token:) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vantiv.rb', line 14

def self.tokenize(temporary_token:)
  if temporary_token == "" or temporary_token == nil
    raise ArgumentError.new("Blank temporary token (PaypageRegistrationID): \n
                             Check that paypage error handling is implemented correctly.")
  end

  body = Api::RequestBody.for_tokenization(
    paypage_registration_id: temporary_token
  )
  Api::Request.new(
    endpoint: Api::Endpoints::TOKENIZATION,
    body: body,
    response_object: Api::TokenizationResponse.new
  ).run
end

.tokenize_by_direct_post(card_number:, expiry_month:, expiry_year:, cvv:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vantiv.rb', line 30

def self.tokenize_by_direct_post(card_number:, expiry_month:, expiry_year:, cvv:)
  body = Api::RequestBody.for_direct_post_tokenization(
    card_number: card_number,
    expiry_month: expiry_month,
    expiry_year: expiry_year,
    cvv: cvv
  )
  Api::Request.new(
    endpoint: Api::Endpoints::TOKENIZATION,
    body: body,
    response_object: Api::TokenizationResponse.new
  ).run
end

.void(transaction_id:) ⇒ Object

NOTE: can void credits



162
163
164
165
166
167
168
# File 'lib/vantiv.rb', line 162

def self.void(transaction_id:)
  Api::Request.new(
    endpoint: Api::Endpoints::VOID,
    body: Api::RequestBody.for_void(transaction_id: transaction_id),
    response_object: Api::TiedTransactionResponse.new(:void)
  ).run
end