|
3 | 3 | module Lithic |
4 | 4 | module Models |
5 | 5 | module TransactionMonitoring |
| 6 | + # A single transaction associated with a case. The `category` field identifies |
| 7 | + # whether this is a card transaction or a payment transaction. |
| 8 | + # |
6 | 9 | # @see Lithic::Resources::TransactionMonitoring::Cases#list_transactions |
7 | | - class CaseTransaction < Lithic::Internal::Type::BaseModel |
8 | | - # @!attribute token |
9 | | - # Globally unique identifier for the transaction |
10 | | - # |
11 | | - # @return [String] |
12 | | - required :token, String |
13 | | - |
14 | | - # @!attribute account_token |
15 | | - # Token of the account the transaction belongs to |
16 | | - # |
17 | | - # @return [String] |
18 | | - required :account_token, String |
19 | | - |
20 | | - # @!attribute added_at |
21 | | - # Date and time at which the transaction was added to the case |
22 | | - # |
23 | | - # @return [Time] |
24 | | - required :added_at, Time |
25 | | - |
26 | | - # @!attribute card_token |
27 | | - # Token of the card the transaction was made on |
28 | | - # |
29 | | - # @return [String] |
30 | | - required :card_token, String |
31 | | - |
32 | | - # @!attribute transaction_created_at |
33 | | - # Date and time at which the transaction was created |
34 | | - # |
35 | | - # @return [Time] |
36 | | - required :transaction_created_at, Time |
37 | | - |
38 | | - # @!method initialize(token:, account_token:, added_at:, card_token:, transaction_created_at:) |
39 | | - # A single transaction associated with a case |
40 | | - # |
41 | | - # @param token [String] Globally unique identifier for the transaction |
42 | | - # |
43 | | - # @param account_token [String] Token of the account the transaction belongs to |
44 | | - # |
45 | | - # @param added_at [Time] Date and time at which the transaction was added to the case |
46 | | - # |
47 | | - # @param card_token [String] Token of the card the transaction was made on |
48 | | - # |
49 | | - # @param transaction_created_at [Time] Date and time at which the transaction was created |
| 10 | + module CaseTransaction |
| 11 | + extend Lithic::Internal::Type::Union |
| 12 | + |
| 13 | + discriminator :category |
| 14 | + |
| 15 | + # A card transaction associated with a case |
| 16 | + variant -> { Lithic::TransactionMonitoring::CaseTransaction::CardCaseTransaction } |
| 17 | + |
| 18 | + # A payment (ACH) transaction associated with a case |
| 19 | + variant -> { Lithic::TransactionMonitoring::CaseTransaction::PaymentCaseTransaction } |
| 20 | + |
| 21 | + class CardCaseTransaction < Lithic::Internal::Type::BaseModel |
| 22 | + # @!attribute token |
| 23 | + # Globally unique identifier for the card transaction |
| 24 | + # |
| 25 | + # @return [String] |
| 26 | + required :token, String |
| 27 | + |
| 28 | + # @!attribute account_token |
| 29 | + # Token of the account the transaction belongs to |
| 30 | + # |
| 31 | + # @return [String] |
| 32 | + required :account_token, String |
| 33 | + |
| 34 | + # @!attribute added_at |
| 35 | + # Date and time at which the transaction was added to the case |
| 36 | + # |
| 37 | + # @return [Time] |
| 38 | + required :added_at, Time |
| 39 | + |
| 40 | + # @!attribute card_token |
| 41 | + # Token of the card the transaction was made on |
| 42 | + # |
| 43 | + # @return [String] |
| 44 | + required :card_token, String |
| 45 | + |
| 46 | + # @!attribute category |
| 47 | + # |
| 48 | + # @return [Symbol, :CARD] |
| 49 | + required :category, const: :CARD |
| 50 | + |
| 51 | + # @!attribute transaction_created_at |
| 52 | + # Date and time at which the transaction was created |
| 53 | + # |
| 54 | + # @return [Time] |
| 55 | + required :transaction_created_at, Time |
| 56 | + |
| 57 | + # @!method initialize(token:, account_token:, added_at:, card_token:, transaction_created_at:, category: :CARD) |
| 58 | + # A card transaction associated with a case |
| 59 | + # |
| 60 | + # @param token [String] Globally unique identifier for the card transaction |
| 61 | + # |
| 62 | + # @param account_token [String] Token of the account the transaction belongs to |
| 63 | + # |
| 64 | + # @param added_at [Time] Date and time at which the transaction was added to the case |
| 65 | + # |
| 66 | + # @param card_token [String] Token of the card the transaction was made on |
| 67 | + # |
| 68 | + # @param transaction_created_at [Time] Date and time at which the transaction was created |
| 69 | + # |
| 70 | + # @param category [Symbol, :CARD] |
| 71 | + end |
| 72 | + |
| 73 | + class PaymentCaseTransaction < Lithic::Internal::Type::BaseModel |
| 74 | + # @!attribute token |
| 75 | + # Globally unique identifier for the payment transaction |
| 76 | + # |
| 77 | + # @return [String] |
| 78 | + required :token, String |
| 79 | + |
| 80 | + # @!attribute added_at |
| 81 | + # Date and time at which the transaction was added to the case |
| 82 | + # |
| 83 | + # @return [Time] |
| 84 | + required :added_at, Time |
| 85 | + |
| 86 | + # @!attribute category |
| 87 | + # |
| 88 | + # @return [Symbol, :PAYMENT] |
| 89 | + required :category, const: :PAYMENT |
| 90 | + |
| 91 | + # @!attribute financial_account_token |
| 92 | + # Token of the financial account the payment belongs to |
| 93 | + # |
| 94 | + # @return [String] |
| 95 | + required :financial_account_token, String |
| 96 | + |
| 97 | + # @!attribute transaction_created_at |
| 98 | + # Date and time at which the transaction was created |
| 99 | + # |
| 100 | + # @return [Time] |
| 101 | + required :transaction_created_at, Time |
| 102 | + |
| 103 | + # @!attribute account_token |
| 104 | + # Token of the account the payment belongs to, if applicable |
| 105 | + # |
| 106 | + # @return [String, nil] |
| 107 | + optional :account_token, String |
| 108 | + |
| 109 | + # @!method initialize(token:, added_at:, financial_account_token:, transaction_created_at:, account_token: nil, category: :PAYMENT) |
| 110 | + # A payment (ACH) transaction associated with a case |
| 111 | + # |
| 112 | + # @param token [String] Globally unique identifier for the payment transaction |
| 113 | + # |
| 114 | + # @param added_at [Time] Date and time at which the transaction was added to the case |
| 115 | + # |
| 116 | + # @param financial_account_token [String] Token of the financial account the payment belongs to |
| 117 | + # |
| 118 | + # @param transaction_created_at [Time] Date and time at which the transaction was created |
| 119 | + # |
| 120 | + # @param account_token [String] Token of the account the payment belongs to, if applicable |
| 121 | + # |
| 122 | + # @param category [Symbol, :PAYMENT] |
| 123 | + end |
| 124 | + |
| 125 | + # @!method self.variants |
| 126 | + # @return [Array(Lithic::Models::TransactionMonitoring::CaseTransaction::CardCaseTransaction, Lithic::Models::TransactionMonitoring::CaseTransaction::PaymentCaseTransaction)] |
50 | 127 | end |
51 | 128 | end |
52 | 129 | end |
|
0 commit comments