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/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: TestCard, TestTemporaryToken

Constant Summary collapse

VERSION =
"1.0.0"

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) ⇒ Object



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
# File 'lib/vantiv.rb', line 43

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)

  # 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
  )
  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) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/vantiv.rb', line 100

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)
  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
  )
  Api::Request.new(
    endpoint: Api::Endpoints::SALE,
    body: body,
    response_object: Api::LiveTransactionResponse.new(:sale)
  ).run
end

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



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/vantiv.rb', line 74

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



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vantiv.rb', line 87

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



161
162
163
# File 'lib/vantiv.rb', line 161

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


122
123
124
125
126
127
128
129
130
131
132
# File 'lib/vantiv.rb', line 122

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

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



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/vantiv.rb', line 134

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



179
180
181
# File 'lib/vantiv.rb', line 179

def self.root
  File.dirname __dir__
end

.tokenize(temporary_token:) ⇒ Object



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

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



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

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



153
154
155
156
157
158
159
# File 'lib/vantiv.rb', line 153

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