-
Notifications
You must be signed in to change notification settings - Fork 2
/
paymentreference.go
275 lines (251 loc) · 21.7 KB
/
paymentreference.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package moderntreasury
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apijson"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apiquery"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/param"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/requestconfig"
"github.com/Modern-Treasury/modern-treasury-go/v2/option"
"github.com/Modern-Treasury/modern-treasury-go/v2/packages/pagination"
)
// PaymentReferenceService contains methods and other services that help with
// interacting with the Modern Treasury API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewPaymentReferenceService] method instead.
type PaymentReferenceService struct {
Options []option.RequestOption
}
// NewPaymentReferenceService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewPaymentReferenceService(opts ...option.RequestOption) (r *PaymentReferenceService) {
r = &PaymentReferenceService{}
r.Options = opts
return
}
// get payment_reference
func (r *PaymentReferenceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentReference, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/payment_references/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// list payment_references
func (r *PaymentReferenceService) List(ctx context.Context, query PaymentReferenceListParams, opts ...option.RequestOption) (res *pagination.Page[PaymentReference], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/payment_references"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// list payment_references
func (r *PaymentReferenceService) ListAutoPaging(ctx context.Context, query PaymentReferenceListParams, opts ...option.RequestOption) *pagination.PageAutoPager[PaymentReference] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// get payment_reference
//
// Deprecated: use `Get` instead
func (r *PaymentReferenceService) Retireve(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentReference, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/payment_references/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
type PaymentReference struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
Object string `json:"object,required"`
// The actual reference number assigned by the bank.
ReferenceNumber string `json:"reference_number,required"`
// The type of reference number.
ReferenceNumberType PaymentReferenceReferenceNumberType `json:"reference_number_type,required"`
// The id of the referenceable to search for. Must be accompanied by the
// referenceable_type or will return an error.
ReferenceableID string `json:"referenceable_id,required"`
// One of the referenceable types. This must be accompanied by the id of the
// referenceable or will return an error.
ReferenceableType PaymentReferenceReferenceableType `json:"referenceable_type,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON paymentReferenceJSON `json:"-"`
}
// paymentReferenceJSON contains the JSON metadata for the struct
// [PaymentReference]
type paymentReferenceJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LiveMode apijson.Field
Object apijson.Field
ReferenceNumber apijson.Field
ReferenceNumberType apijson.Field
ReferenceableID apijson.Field
ReferenceableType apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *PaymentReference) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r paymentReferenceJSON) RawJSON() string {
return r.raw
}
// The type of reference number.
type PaymentReferenceReferenceNumberType string
const (
PaymentReferenceReferenceNumberTypeACHOriginalTraceNumber PaymentReferenceReferenceNumberType = "ach_original_trace_number"
PaymentReferenceReferenceNumberTypeACHTraceNumber PaymentReferenceReferenceNumberType = "ach_trace_number"
PaymentReferenceReferenceNumberTypeBankprovPaymentActivityDate PaymentReferenceReferenceNumberType = "bankprov_payment_activity_date"
PaymentReferenceReferenceNumberTypeBankprovPaymentID PaymentReferenceReferenceNumberType = "bankprov_payment_id"
PaymentReferenceReferenceNumberTypeBnkDevPrenotificationID PaymentReferenceReferenceNumberType = "bnk_dev_prenotification_id"
PaymentReferenceReferenceNumberTypeBnkDevTransferID PaymentReferenceReferenceNumberType = "bnk_dev_transfer_id"
PaymentReferenceReferenceNumberTypeBofaEndToEndID PaymentReferenceReferenceNumberType = "bofa_end_to_end_id"
PaymentReferenceReferenceNumberTypeBofaTransactionID PaymentReferenceReferenceNumberType = "bofa_transaction_id"
PaymentReferenceReferenceNumberTypeCheckNumber PaymentReferenceReferenceNumberType = "check_number"
PaymentReferenceReferenceNumberTypeCitibankReferenceNumber PaymentReferenceReferenceNumberType = "citibank_reference_number"
PaymentReferenceReferenceNumberTypeCitibankWorldlinkClearingSystemReferenceNumber PaymentReferenceReferenceNumberType = "citibank_worldlink_clearing_system_reference_number"
PaymentReferenceReferenceNumberTypeColumnFxQuoteID PaymentReferenceReferenceNumberType = "column_fx_quote_id"
PaymentReferenceReferenceNumberTypeColumnReversalPairTransferID PaymentReferenceReferenceNumberType = "column_reversal_pair_transfer_id"
PaymentReferenceReferenceNumberTypeColumnTransferID PaymentReferenceReferenceNumberType = "column_transfer_id"
PaymentReferenceReferenceNumberTypeCrossRiverPaymentID PaymentReferenceReferenceNumberType = "cross_river_payment_id"
PaymentReferenceReferenceNumberTypeCrossRiverServiceMessage PaymentReferenceReferenceNumberType = "cross_river_service_message"
PaymentReferenceReferenceNumberTypeCrossRiverTransactionID PaymentReferenceReferenceNumberType = "cross_river_transaction_id"
PaymentReferenceReferenceNumberTypeCurrencycloudConversionID PaymentReferenceReferenceNumberType = "currencycloud_conversion_id"
PaymentReferenceReferenceNumberTypeCurrencycloudPaymentID PaymentReferenceReferenceNumberType = "currencycloud_payment_id"
PaymentReferenceReferenceNumberTypeDcBankTransactionID PaymentReferenceReferenceNumberType = "dc_bank_transaction_id"
PaymentReferenceReferenceNumberTypeDwollaTransactionID PaymentReferenceReferenceNumberType = "dwolla_transaction_id"
PaymentReferenceReferenceNumberTypeEftTraceNumber PaymentReferenceReferenceNumberType = "eft_trace_number"
PaymentReferenceReferenceNumberTypeEvolveTransactionID PaymentReferenceReferenceNumberType = "evolve_transaction_id"
PaymentReferenceReferenceNumberTypeFedwireImad PaymentReferenceReferenceNumberType = "fedwire_imad"
PaymentReferenceReferenceNumberTypeFedwireOmad PaymentReferenceReferenceNumberType = "fedwire_omad"
PaymentReferenceReferenceNumberTypeFirstRepublicInternalID PaymentReferenceReferenceNumberType = "first_republic_internal_id"
PaymentReferenceReferenceNumberTypeGoldmanSachsCollectionRequestID PaymentReferenceReferenceNumberType = "goldman_sachs_collection_request_id"
PaymentReferenceReferenceNumberTypeGoldmanSachsEndToEndID PaymentReferenceReferenceNumberType = "goldman_sachs_end_to_end_id"
PaymentReferenceReferenceNumberTypeGoldmanSachsPaymentRequestID PaymentReferenceReferenceNumberType = "goldman_sachs_payment_request_id"
PaymentReferenceReferenceNumberTypeGoldmanSachsRequestID PaymentReferenceReferenceNumberType = "goldman_sachs_request_id"
PaymentReferenceReferenceNumberTypeGoldmanSachsUniquePaymentID PaymentReferenceReferenceNumberType = "goldman_sachs_unique_payment_id"
PaymentReferenceReferenceNumberTypeInteracMessageID PaymentReferenceReferenceNumberType = "interac_message_id"
PaymentReferenceReferenceNumberTypeJpmcCcn PaymentReferenceReferenceNumberType = "jpmc_ccn"
PaymentReferenceReferenceNumberTypeJpmcClearingSystemReference PaymentReferenceReferenceNumberType = "jpmc_clearing_system_reference"
PaymentReferenceReferenceNumberTypeJpmcCustomerReferenceID PaymentReferenceReferenceNumberType = "jpmc_customer_reference_id"
PaymentReferenceReferenceNumberTypeJpmcEndToEndID PaymentReferenceReferenceNumberType = "jpmc_end_to_end_id"
PaymentReferenceReferenceNumberTypeJpmcFirmRootID PaymentReferenceReferenceNumberType = "jpmc_firm_root_id"
PaymentReferenceReferenceNumberTypeJpmcFxTrnID PaymentReferenceReferenceNumberType = "jpmc_fx_trn_id"
PaymentReferenceReferenceNumberTypeJpmcP3ID PaymentReferenceReferenceNumberType = "jpmc_p3_id"
PaymentReferenceReferenceNumberTypeJpmcPaymentBatchID PaymentReferenceReferenceNumberType = "jpmc_payment_batch_id"
PaymentReferenceReferenceNumberTypeJpmcPaymentInformationID PaymentReferenceReferenceNumberType = "jpmc_payment_information_id"
PaymentReferenceReferenceNumberTypeJpmcPaymentReturnedDatetime PaymentReferenceReferenceNumberType = "jpmc_payment_returned_datetime"
PaymentReferenceReferenceNumberTypeLobCheckID PaymentReferenceReferenceNumberType = "lob_check_id"
PaymentReferenceReferenceNumberTypeOther PaymentReferenceReferenceNumberType = "other"
PaymentReferenceReferenceNumberTypePartialSwiftMir PaymentReferenceReferenceNumberType = "partial_swift_mir"
PaymentReferenceReferenceNumberTypePncClearingReference PaymentReferenceReferenceNumberType = "pnc_clearing_reference"
PaymentReferenceReferenceNumberTypePncInstructionID PaymentReferenceReferenceNumberType = "pnc_instruction_id"
PaymentReferenceReferenceNumberTypePncMultipaymentID PaymentReferenceReferenceNumberType = "pnc_multipayment_id"
PaymentReferenceReferenceNumberTypePncPaymentTraceID PaymentReferenceReferenceNumberType = "pnc_payment_trace_id"
PaymentReferenceReferenceNumberTypePncTransactionReferenceNumber PaymentReferenceReferenceNumberType = "pnc_transaction_reference_number"
PaymentReferenceReferenceNumberTypeRspecVendorPaymentID PaymentReferenceReferenceNumberType = "rspec_vendor_payment_id"
PaymentReferenceReferenceNumberTypeRtpInstructionID PaymentReferenceReferenceNumberType = "rtp_instruction_id"
PaymentReferenceReferenceNumberTypeSignetAPIReferenceID PaymentReferenceReferenceNumberType = "signet_api_reference_id"
PaymentReferenceReferenceNumberTypeSignetConfirmationID PaymentReferenceReferenceNumberType = "signet_confirmation_id"
PaymentReferenceReferenceNumberTypeSignetRequestID PaymentReferenceReferenceNumberType = "signet_request_id"
PaymentReferenceReferenceNumberTypeSilvergatePaymentID PaymentReferenceReferenceNumberType = "silvergate_payment_id"
PaymentReferenceReferenceNumberTypeSvbEndToEndID PaymentReferenceReferenceNumberType = "svb_end_to_end_id"
PaymentReferenceReferenceNumberTypeSvbPaymentID PaymentReferenceReferenceNumberType = "svb_payment_id"
PaymentReferenceReferenceNumberTypeSvbTransactionClearedForSanctionsReview PaymentReferenceReferenceNumberType = "svb_transaction_cleared_for_sanctions_review"
PaymentReferenceReferenceNumberTypeSvbTransactionHeldForSanctionsReview PaymentReferenceReferenceNumberType = "svb_transaction_held_for_sanctions_review"
PaymentReferenceReferenceNumberTypeSwiftMir PaymentReferenceReferenceNumberType = "swift_mir"
PaymentReferenceReferenceNumberTypeSwiftUetr PaymentReferenceReferenceNumberType = "swift_uetr"
PaymentReferenceReferenceNumberTypeUmbProductPartnerAccountNumber PaymentReferenceReferenceNumberType = "umb_product_partner_account_number"
PaymentReferenceReferenceNumberTypeUsbankPaymentApplicationReferenceID PaymentReferenceReferenceNumberType = "usbank_payment_application_reference_id"
PaymentReferenceReferenceNumberTypeUsbankPaymentID PaymentReferenceReferenceNumberType = "usbank_payment_id"
PaymentReferenceReferenceNumberTypeUsbankPendingRtpPaymentID PaymentReferenceReferenceNumberType = "usbank_pending_rtp_payment_id"
PaymentReferenceReferenceNumberTypeUsbankPostedRtpPaymentID PaymentReferenceReferenceNumberType = "usbank_posted_rtp_payment_id"
PaymentReferenceReferenceNumberTypeWellsFargoEndToEndID PaymentReferenceReferenceNumberType = "wells_fargo_end_to_end_id"
PaymentReferenceReferenceNumberTypeWellsFargoPaymentID PaymentReferenceReferenceNumberType = "wells_fargo_payment_id"
PaymentReferenceReferenceNumberTypeWellsFargoTraceNumber PaymentReferenceReferenceNumberType = "wells_fargo_trace_number"
PaymentReferenceReferenceNumberTypeWellsFargoUetr PaymentReferenceReferenceNumberType = "wells_fargo_uetr"
)
func (r PaymentReferenceReferenceNumberType) IsKnown() bool {
switch r {
case PaymentReferenceReferenceNumberTypeACHOriginalTraceNumber, PaymentReferenceReferenceNumberTypeACHTraceNumber, PaymentReferenceReferenceNumberTypeBankprovPaymentActivityDate, PaymentReferenceReferenceNumberTypeBankprovPaymentID, PaymentReferenceReferenceNumberTypeBnkDevPrenotificationID, PaymentReferenceReferenceNumberTypeBnkDevTransferID, PaymentReferenceReferenceNumberTypeBofaEndToEndID, PaymentReferenceReferenceNumberTypeBofaTransactionID, PaymentReferenceReferenceNumberTypeCheckNumber, PaymentReferenceReferenceNumberTypeCitibankReferenceNumber, PaymentReferenceReferenceNumberTypeCitibankWorldlinkClearingSystemReferenceNumber, PaymentReferenceReferenceNumberTypeColumnFxQuoteID, PaymentReferenceReferenceNumberTypeColumnReversalPairTransferID, PaymentReferenceReferenceNumberTypeColumnTransferID, PaymentReferenceReferenceNumberTypeCrossRiverPaymentID, PaymentReferenceReferenceNumberTypeCrossRiverServiceMessage, PaymentReferenceReferenceNumberTypeCrossRiverTransactionID, PaymentReferenceReferenceNumberTypeCurrencycloudConversionID, PaymentReferenceReferenceNumberTypeCurrencycloudPaymentID, PaymentReferenceReferenceNumberTypeDcBankTransactionID, PaymentReferenceReferenceNumberTypeDwollaTransactionID, PaymentReferenceReferenceNumberTypeEftTraceNumber, PaymentReferenceReferenceNumberTypeEvolveTransactionID, PaymentReferenceReferenceNumberTypeFedwireImad, PaymentReferenceReferenceNumberTypeFedwireOmad, PaymentReferenceReferenceNumberTypeFirstRepublicInternalID, PaymentReferenceReferenceNumberTypeGoldmanSachsCollectionRequestID, PaymentReferenceReferenceNumberTypeGoldmanSachsEndToEndID, PaymentReferenceReferenceNumberTypeGoldmanSachsPaymentRequestID, PaymentReferenceReferenceNumberTypeGoldmanSachsRequestID, PaymentReferenceReferenceNumberTypeGoldmanSachsUniquePaymentID, PaymentReferenceReferenceNumberTypeInteracMessageID, PaymentReferenceReferenceNumberTypeJpmcCcn, PaymentReferenceReferenceNumberTypeJpmcClearingSystemReference, PaymentReferenceReferenceNumberTypeJpmcCustomerReferenceID, PaymentReferenceReferenceNumberTypeJpmcEndToEndID, PaymentReferenceReferenceNumberTypeJpmcFirmRootID, PaymentReferenceReferenceNumberTypeJpmcFxTrnID, PaymentReferenceReferenceNumberTypeJpmcP3ID, PaymentReferenceReferenceNumberTypeJpmcPaymentBatchID, PaymentReferenceReferenceNumberTypeJpmcPaymentInformationID, PaymentReferenceReferenceNumberTypeJpmcPaymentReturnedDatetime, PaymentReferenceReferenceNumberTypeLobCheckID, PaymentReferenceReferenceNumberTypeOther, PaymentReferenceReferenceNumberTypePartialSwiftMir, PaymentReferenceReferenceNumberTypePncClearingReference, PaymentReferenceReferenceNumberTypePncInstructionID, PaymentReferenceReferenceNumberTypePncMultipaymentID, PaymentReferenceReferenceNumberTypePncPaymentTraceID, PaymentReferenceReferenceNumberTypePncTransactionReferenceNumber, PaymentReferenceReferenceNumberTypeRspecVendorPaymentID, PaymentReferenceReferenceNumberTypeRtpInstructionID, PaymentReferenceReferenceNumberTypeSignetAPIReferenceID, PaymentReferenceReferenceNumberTypeSignetConfirmationID, PaymentReferenceReferenceNumberTypeSignetRequestID, PaymentReferenceReferenceNumberTypeSilvergatePaymentID, PaymentReferenceReferenceNumberTypeSvbEndToEndID, PaymentReferenceReferenceNumberTypeSvbPaymentID, PaymentReferenceReferenceNumberTypeSvbTransactionClearedForSanctionsReview, PaymentReferenceReferenceNumberTypeSvbTransactionHeldForSanctionsReview, PaymentReferenceReferenceNumberTypeSwiftMir, PaymentReferenceReferenceNumberTypeSwiftUetr, PaymentReferenceReferenceNumberTypeUmbProductPartnerAccountNumber, PaymentReferenceReferenceNumberTypeUsbankPaymentApplicationReferenceID, PaymentReferenceReferenceNumberTypeUsbankPaymentID, PaymentReferenceReferenceNumberTypeUsbankPendingRtpPaymentID, PaymentReferenceReferenceNumberTypeUsbankPostedRtpPaymentID, PaymentReferenceReferenceNumberTypeWellsFargoEndToEndID, PaymentReferenceReferenceNumberTypeWellsFargoPaymentID, PaymentReferenceReferenceNumberTypeWellsFargoTraceNumber, PaymentReferenceReferenceNumberTypeWellsFargoUetr:
return true
}
return false
}
// One of the referenceable types. This must be accompanied by the id of the
// referenceable or will return an error.
type PaymentReferenceReferenceableType string
const (
PaymentReferenceReferenceableTypePaymentOrder PaymentReferenceReferenceableType = "payment_order"
PaymentReferenceReferenceableTypeReversal PaymentReferenceReferenceableType = "reversal"
PaymentReferenceReferenceableTypeReturn PaymentReferenceReferenceableType = "return"
)
func (r PaymentReferenceReferenceableType) IsKnown() bool {
switch r {
case PaymentReferenceReferenceableTypePaymentOrder, PaymentReferenceReferenceableTypeReversal, PaymentReferenceReferenceableTypeReturn:
return true
}
return false
}
type PaymentReferenceListParams struct {
AfterCursor param.Field[string] `query:"after_cursor"`
PerPage param.Field[int64] `query:"per_page"`
// The actual reference number assigned by the bank.
ReferenceNumber param.Field[string] `query:"reference_number"`
// The id of the referenceable to search for. Must be accompanied by the
// referenceable_type or will return an error.
ReferenceableID param.Field[string] `query:"referenceable_id"`
// One of the referenceable types. This must be accompanied by the id of the
// referenceable or will return an error.
ReferenceableType param.Field[PaymentReferenceListParamsReferenceableType] `query:"referenceable_type"`
}
// URLQuery serializes [PaymentReferenceListParams]'s query parameters as
// `url.Values`.
func (r PaymentReferenceListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatBrackets,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// One of the referenceable types. This must be accompanied by the id of the
// referenceable or will return an error.
type PaymentReferenceListParamsReferenceableType string
const (
PaymentReferenceListParamsReferenceableTypePaymentOrder PaymentReferenceListParamsReferenceableType = "payment_order"
PaymentReferenceListParamsReferenceableTypeReturn PaymentReferenceListParamsReferenceableType = "return"
PaymentReferenceListParamsReferenceableTypeReversal PaymentReferenceListParamsReferenceableType = "reversal"
)
func (r PaymentReferenceListParamsReferenceableType) IsKnown() bool {
switch r {
case PaymentReferenceListParamsReferenceableTypePaymentOrder, PaymentReferenceListParamsReferenceableTypeReturn, PaymentReferenceListParamsReferenceableTypeReversal:
return true
}
return false
}