Class: Lithic::Resources::Transactions

Inherits:
Object
  • Object
show all
Defined in:
lib/lithic/resources/transactions.rb,
lib/lithic/resources/transactions/events.rb,
lib/lithic/resources/transactions/enhanced_commercial_data.rb,
lib/lithic/resources/transactions/events/enhanced_commercial_data.rb

Defined Under Namespace

Classes: EnhancedCommercialData, Events

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Transactions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Transactions.

Parameters:



329
330
331
332
333
# File 'lib/lithic/resources/transactions.rb', line 329

def initialize(client:)
  @client = client
  @enhanced_commercial_data = Lithic::Resources::Transactions::EnhancedCommercialData.new(client: client)
  @events = Lithic::Resources::Transactions::Events.new(client: client)
end

Instance Attribute Details

#enhanced_commercial_dataLithic::Resources::Transactions::EnhancedCommercialData (readonly)



7
8
9
# File 'lib/lithic/resources/transactions.rb', line 7

def enhanced_commercial_data
  @enhanced_commercial_data
end

#eventsLithic::Resources::Transactions::Events (readonly)



10
11
12
# File 'lib/lithic/resources/transactions.rb', line 10

def events
  @events
end

Instance Method Details

#expire_authorization(transaction_token, request_options: {}) ⇒ nil

Expire authorization

Parameters:

  • transaction_token (String)

    The token of the transaction to expire.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



87
88
89
90
91
92
93
94
# File 'lib/lithic/resources/transactions.rb', line 87

def expire_authorization(transaction_token, params = {})
  @client.request(
    method: :post,
    path: ["v1/transactions/%1$s/expire_authorization", transaction_token],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(account_token: nil, begin_: nil, card_token: nil, end_: nil, ending_before: nil, page_size: nil, result: nil, starting_after: nil, status: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::Transaction>

Some parameter documentations has been truncated, see Models::TransactionListParams for more details.

List card transactions. All amounts are in the smallest unit of their respective currency (e.g., cents for USD) and inclusive of any acquirer fees.

Parameters:

  • account_token (String)

    Filters for transactions associated with a specific account.

  • begin_ (Time)

    Date string in RFC 3339 format. Only entries created after the specified time wi

  • card_token (String)

    Filters for transactions associated with a specific card.

  • end_ (Time)

    Date string in RFC 3339 format. Only entries created before the specified time w

  • ending_before (String)

    A cursor representing an item’s token before which a page of results should end.

  • page_size (Integer)

    Page size (for pagination).

  • result (Symbol, Lithic::Models::TransactionListParams::Result)

    Filters for transactions using transaction result field. Can filter by ‘APPROVED

  • starting_after (String)

    A cursor representing an item’s token after which a page of results should begin

  • status (Symbol, Lithic::Models::TransactionListParams::Status)

    Filters for transactions using transaction status field.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/lithic/resources/transactions.rb', line 64

def list(params = {})
  parsed, options = Lithic::TransactionListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v1/transactions",
    query: parsed.transform_keys(begin_: "begin", end_: "end"),
    page: Lithic::Internal::CursorPage,
    model: Lithic::Transaction,
    options: options
  )
end

#retrieve(transaction_token, request_options: {}) ⇒ Lithic::Models::Transaction

Get a specific card transaction. All amounts are in the smallest unit of their respective currency (e.g., cents for USD).

Parameters:

  • transaction_token (String)

    Globally unique identifier for the transaction.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



24
25
26
27
28
29
30
31
# File 'lib/lithic/resources/transactions.rb', line 24

def retrieve(transaction_token, params = {})
  @client.request(
    method: :get,
    path: ["v1/transactions/%1$s", transaction_token],
    model: Lithic::Transaction,
    options: params[:request_options]
  )
end

#simulate_authorization(amount:, descriptor:, pan:, mcc: nil, merchant_acceptor_id: nil, merchant_amount: nil, merchant_currency: nil, partial_approval_capable: nil, pin: nil, status: nil, request_options: {}) ⇒ Lithic::Models::TransactionSimulateAuthorizationResponse

Some parameter documentations has been truncated, see Models::TransactionSimulateAuthorizationParams for more details.

Simulates an authorization request from the card network as if it came from a merchant acquirer. If you are configured for ASA, simulating authorizations requires your ASA client to be set up properly, i.e. be able to respond to the ASA request with a valid JSON. For users that are not configured for ASA, a daily transaction limit of $5000 USD is applied by default. You can update this limit via the [update account](docs.lithic.com/reference/patchaccountbytoken) endpoint.

Parameters:

  • amount (Integer)

    Amount (in cents) to authorize. For credit authorizations and financial credit a

  • descriptor (String)

    Merchant descriptor.

  • pan (String)

    Sixteen digit card number.

  • mcc (String)

    Merchant category code for the transaction to be simulated. A four-digit number

  • merchant_acceptor_id (String)

    Unique identifier to identify the payment card acceptor.

  • merchant_amount (Integer)

    Amount of the transaction to be simulated in currency specified in merchant_curr

  • merchant_currency (String)

    3-character alphabetic ISO 4217 currency code. Note: Simulator only accepts USD,

  • partial_approval_capable (Boolean)

    Set to true if the terminal is capable of partial approval otherwise false.

  • pin (String)

    Simulate entering a PIN. If omitted, PIN check will not be performed.

  • status (Symbol, Lithic::Models::TransactionSimulateAuthorizationParams::Status)

    Type of event to simulate.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



135
136
137
138
139
140
141
142
143
144
# File 'lib/lithic/resources/transactions.rb', line 135

def simulate_authorization(params)
  parsed, options = Lithic::TransactionSimulateAuthorizationParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/authorize",
    body: parsed,
    model: Lithic::Models::TransactionSimulateAuthorizationResponse,
    options: options
  )
end

#simulate_authorization_advice(token:, amount:, request_options: {}) ⇒ Lithic::Models::TransactionSimulateAuthorizationAdviceResponse

Some parameter documentations has been truncated, see Models::TransactionSimulateAuthorizationAdviceParams for more details.

Simulates an authorization advice from the card network as if it came from a merchant acquirer. An authorization advice changes the pending amount of the transaction.

Parameters:

  • token (String)

    The transaction token returned from the /v1/simulate/authorize. response.

  • amount (Integer)

    Amount (in cents) to authorize. This amount will override the transaction’s amou

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



164
165
166
167
168
169
170
171
172
173
# File 'lib/lithic/resources/transactions.rb', line 164

def simulate_authorization_advice(params)
  parsed, options = Lithic::TransactionSimulateAuthorizationAdviceParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/authorization_advice",
    body: parsed,
    model: Lithic::Models::TransactionSimulateAuthorizationAdviceResponse,
    options: options
  )
end

#simulate_clearing(token:, amount: nil, request_options: {}) ⇒ Lithic::Models::TransactionSimulateClearingResponse

Some parameter documentations has been truncated, see Models::TransactionSimulateClearingParams for more details.

Clears an existing authorization, either debit or credit. After this event, the transaction transitions from ‘PENDING` to `SETTLED` status.

If ‘amount` is not set, the full amount of the transaction will be cleared. Transactions that have already cleared, either partially or fully, cannot be cleared again using this endpoint.

Parameters:

  • token (String)

    The transaction token returned from the /v1/simulate/authorize response.

  • amount (Integer)

    Amount (in cents) to clear. Typically this will match the amount in the original

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



196
197
198
199
200
201
202
203
204
205
# File 'lib/lithic/resources/transactions.rb', line 196

def simulate_clearing(params)
  parsed, options = Lithic::TransactionSimulateClearingParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/clearing",
    body: parsed,
    model: Lithic::Models::TransactionSimulateClearingResponse,
    options: options
  )
end

#simulate_credit_authorization_advice(amount:, descriptor:, pan:, mcc: nil, merchant_acceptor_id: nil, request_options: {}) ⇒ Lithic::Models::TransactionSimulateCreditAuthorizationAdviceResponse

Some parameter documentations has been truncated, see Models::TransactionSimulateCreditAuthorizationAdviceParams for more details.

Simulates a credit authorization advice from the card network. This message indicates that the network approved a credit authorization on your behalf.

Parameters:

  • amount (Integer)

    Amount (in cents). Any value entered will be converted into a negative amount in

  • descriptor (String)

    Merchant descriptor.

  • pan (String)

    Sixteen digit card number.

  • mcc (String)

    Merchant category code for the transaction to be simulated. A four-digit number

  • merchant_acceptor_id (String)

    Unique identifier to identify the payment card acceptor.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



231
232
233
234
235
236
237
238
239
240
# File 'lib/lithic/resources/transactions.rb', line 231

def simulate_credit_authorization_advice(params)
  parsed, options = Lithic::TransactionSimulateCreditAuthorizationAdviceParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/credit_authorization_advice",
    body: parsed,
    model: Lithic::Models::TransactionSimulateCreditAuthorizationAdviceResponse,
    options: options
  )
end

#simulate_return(amount:, descriptor:, pan:, request_options: {}) ⇒ Lithic::Models::TransactionSimulateReturnResponse

Returns, or refunds, an amount back to a card. Returns simulated via this endpoint clear immediately, without prior authorization, and result in a ‘SETTLED` transaction status.

Parameters:

  • amount (Integer)

    Amount (in cents) to authorize.

  • descriptor (String)

    Merchant descriptor.

  • pan (String)

    Sixteen digit card number.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



259
260
261
262
263
264
265
266
267
268
# File 'lib/lithic/resources/transactions.rb', line 259

def simulate_return(params)
  parsed, options = Lithic::TransactionSimulateReturnParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/return",
    body: parsed,
    model: Lithic::Models::TransactionSimulateReturnResponse,
    options: options
  )
end

#simulate_return_reversal(token:, request_options: {}) ⇒ Lithic::Models::TransactionSimulateReturnReversalResponse

Reverses a return, i.e. a credit transaction with a ‘SETTLED` status. Returns can be financial credit authorizations, or credit authorizations that have cleared.

Parameters:

  • token (String)

    The transaction token returned from the /v1/simulate/authorize response.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



283
284
285
286
287
288
289
290
291
292
# File 'lib/lithic/resources/transactions.rb', line 283

def simulate_return_reversal(params)
  parsed, options = Lithic::TransactionSimulateReturnReversalParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/return_reversal",
    body: parsed,
    model: Lithic::Models::TransactionSimulateReturnReversalResponse,
    options: options
  )
end

#simulate_void(token:, amount: nil, type: nil, request_options: {}) ⇒ Lithic::Models::TransactionSimulateVoidResponse

Some parameter documentations has been truncated, see Models::TransactionSimulateVoidParams for more details.

Voids a pending authorization. If ‘amount` is not set, the full amount will be voided. Can be used on partially voided transactions but not partially cleared transactions. _Simulating an authorization expiry on credit authorizations or credit authorization advice is not currently supported but will be added soon._

Parameters:

  • token (String)

    The transaction token returned from the /v1/simulate/authorize response.

  • amount (Integer)

    Amount (in cents) to void. Typically this will match the amount in the original

  • type (Symbol, Lithic::Models::TransactionSimulateVoidParams::Type)

    Type of event to simulate. Defaults to ‘AUTHORIZATION_REVERSAL`.

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



315
316
317
318
319
320
321
322
323
324
# File 'lib/lithic/resources/transactions.rb', line 315

def simulate_void(params)
  parsed, options = Lithic::TransactionSimulateVoidParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/simulate/void",
    body: parsed,
    model: Lithic::Models::TransactionSimulateVoidResponse,
    options: options
  )
end