Module: Vantiv

Defined in:
lib/vantiv.rb,
lib/vantiv/paypage.rb,
lib/vantiv/version.rb,
lib/vantiv/test_card.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/request_body.rb,
lib/vantiv/api/capture_response.rb,
lib/vantiv/api/tokenization_response.rb,
lib/vantiv/api/request_body_generator.rb,
lib/vantiv/mocked_sandbox/api_request.rb,
lib/vantiv/certification/paypage_driver.rb,
lib/vantiv/certification/paypage_server.rb,
lib/vantiv/certification/response_cache.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

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.auth(amount:, payment_account_id:, customer_id:, order_id:) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vantiv.rb', line 40

def self.auth(amount:, payment_account_id:, customer_id:, order_id:)
  body = Api::RequestBody.for_auth_or_sale(
    amount: amount,
    order_id: order_id,
    customer_id: customer_id,
    payment_account_id: 
  )
  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:) ⇒ Object



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

def self.auth_capture(amount:, payment_account_id:, customer_id:, order_id:)
  body = Api::RequestBody.for_auth_or_sale(
    amount: amount,
    order_id: order_id,
    customer_id: customer_id,
    payment_account_id: 
  )
  Api::Request.new(
    endpoint: Api::Endpoints::SALE,
    body: body,
    response_object: Api::LiveTransactionResponse.new(:sale)
  ).run
end

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



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vantiv.rb', line 54

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



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/vantiv.rb', line 67

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



131
132
133
# File 'lib/vantiv.rb', line 131

def self.configure
  yield self
end

.credit(transaction_id:, amount:) ⇒ 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


96
97
98
99
100
101
102
103
104
105
106
# File 'lib/vantiv.rb', line 96

def self.credit(transaction_id:, amount:)
  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:) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/vantiv.rb', line 108

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

.rootObject



149
150
151
# File 'lib/vantiv.rb', line 149

def self.root
  File.dirname __dir__
end

.tokenize(temporary_token:) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vantiv.rb', line 10

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



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/vantiv.rb', line 26

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



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

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