Skip to content

Commit 66f4fe0

Browse files
feat(api): Add amounts object to ASA request
1 parent 53243ce commit 66f4fe0

File tree

2 files changed

+218
-39
lines changed

2 files changed

+218
-39
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 177
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-8382e530e5b258ec35781d1e167a9a0159bdade6a8fc28e309bdb3eadc0dcdef.yml
3-
openapi_spec_hash: 6489eed734e9c836b16d0c5b4bbce4e4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c24eebe942f400bff8922a6fbef1ce551ad14f61eb4da21b50d823a62ca42586.yml
3+
openapi_spec_hash: b79ed927e625dedff69cea29131a34d9
44
config_hash: 693dddc4721eef512d75ab6c60897794

webhook.go

Lines changed: 216 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,17 +1035,31 @@ type CardAuthorizationApprovalRequestWebhookEvent struct {
10351035
// zero if no fee is assessed. Rebates may be transmitted as a negative value to
10361036
// indicate credited fees.
10371037
AcquirerFee int64 `json:"acquirer_fee,required"`
1038-
// Authorization amount of the transaction (in cents), including any acquirer fees.
1039-
// The contents of this field are identical to `authorization_amount`.
1038+
// Deprecated, use `amounts`. Authorization amount of the transaction (in cents),
1039+
// including any acquirer fees. The contents of this field are identical to
1040+
// `authorization_amount`.
1041+
//
1042+
// Deprecated: deprecated
10401043
Amount int64 `json:"amount,required"`
1041-
// The base transaction amount (in cents) plus the acquirer fee field. This is the
1042-
// amount the issuer should authorize against unless the issuer is paying the
1043-
// acquirer fee on behalf of the cardholder.
1044+
// Structured amounts for this authorization. The `cardholder` and `merchant`
1045+
// amounts reflect the original network authorization values. For programs with
1046+
// hold adjustments enabled (e.g., automated fuel dispensers or tipping MCCs), the
1047+
// `hold` amount may exceed the `cardholder` and `merchant` amounts to account for
1048+
// anticipated final transaction amounts such as tips or fuel fill-ups
1049+
Amounts CardAuthorizationApprovalRequestWebhookEventAmounts `json:"amounts,required"`
1050+
// Deprecated, use `amounts`. The base transaction amount (in cents) plus the
1051+
// acquirer fee field. This is the amount the issuer should authorize against
1052+
// unless the issuer is paying the acquirer fee on behalf of the cardholder.
1053+
//
1054+
// Deprecated: deprecated
10441055
AuthorizationAmount int64 `json:"authorization_amount,required"`
10451056
Avs CardAuthorizationApprovalRequestWebhookEventAvs `json:"avs,required"`
10461057
// Card object in ASA
10471058
Card CardAuthorizationApprovalRequestWebhookEventCard `json:"card,required"`
1048-
// 3-character alphabetic ISO 4217 code for cardholder's billing currency.
1059+
// Deprecated, use `amounts`. 3-character alphabetic ISO 4217 code for cardholder's
1060+
// billing currency.
1061+
//
1062+
// Deprecated: deprecated
10491063
CardholderCurrency string `json:"cardholder_currency,required"`
10501064
// The portion of the transaction requested as cash back by the cardholder, and
10511065
// does not include any acquirer fees. The amount field includes the purchase
@@ -1058,16 +1072,22 @@ type CardAuthorizationApprovalRequestWebhookEvent struct {
10581072
Created time.Time `json:"created,required" format:"date-time"`
10591073
EventType CardAuthorizationApprovalRequestWebhookEventEventType `json:"event_type,required"`
10601074
Merchant shared.Merchant `json:"merchant,required"`
1061-
// The amount that the merchant will receive, denominated in `merchant_currency`
1062-
// and in the smallest currency unit. Note the amount includes `acquirer_fee`,
1063-
// similar to `authorization_amount`. It will be different from
1064-
// `authorization_amount` if the merchant is taking payment in a different
1065-
// currency.
1075+
// Deprecated, use `amounts`. The amount that the merchant will receive,
1076+
// denominated in `merchant_currency` and in the smallest currency unit. Note the
1077+
// amount includes `acquirer_fee`, similar to `authorization_amount`. It will be
1078+
// different from `authorization_amount` if the merchant is taking payment in a
1079+
// different currency.
1080+
//
1081+
// Deprecated: deprecated
10661082
MerchantAmount int64 `json:"merchant_amount,required"`
10671083
// 3-character alphabetic ISO 4217 code for the local currency of the transaction.
1084+
//
1085+
// Deprecated: deprecated
10681086
MerchantCurrency string `json:"merchant_currency,required"`
1069-
// Amount (in cents) of the transaction that has been settled, including any
1070-
// acquirer fees
1087+
// Deprecated, use `amounts`. Amount (in cents) of the transaction that has been
1088+
// settled, including any acquirer fees.
1089+
//
1090+
// Deprecated: deprecated
10711091
SettledAmount int64 `json:"settled_amount,required"`
10721092
// The type of authorization request that this request is for. Note that
10731093
// `CREDIT_AUTHORIZATION` and `FINANCIAL_CREDIT_AUTHORIZATION` is only available to
@@ -1079,11 +1099,13 @@ type CardAuthorizationApprovalRequestWebhookEvent struct {
10791099
CardholderAuthentication CardholderAuthentication `json:"cardholder_authentication"`
10801100
// Deprecated, use `cash_amount`.
10811101
Cashback int64 `json:"cashback"`
1082-
// If the transaction was requested in a currency other than the settlement
1083-
// currency, this field will be populated to indicate the rate used to translate
1084-
// the merchant_amount to the amount (i.e., `merchant_amount` x `conversion_rate` =
1085-
// `amount`). Note that the `merchant_amount` is in the local currency and the
1086-
// amount is in the settlement currency.
1102+
// Deprecated, use `amounts`. If the transaction was requested in a currency other
1103+
// than the settlement currency, this field will be populated to indicate the rate
1104+
// used to translate the merchant_amount to the amount (i.e., `merchant_amount` x
1105+
// `conversion_rate` = `amount`). Note that the `merchant_amount` is in the local
1106+
// currency and the amount is in the settlement currency.
1107+
//
1108+
// Deprecated: deprecated
10871109
ConversionRate float64 `json:"conversion_rate"`
10881110
// The event token associated with the authorization. This field is only set for
10891111
// programs enrolled into the beta.
@@ -1122,6 +1144,7 @@ type cardAuthorizationApprovalRequestWebhookEventJSON struct {
11221144
Token apijson.Field
11231145
AcquirerFee apijson.Field
11241146
Amount apijson.Field
1147+
Amounts apijson.Field
11251148
AuthorizationAmount apijson.Field
11261149
Avs apijson.Field
11271150
Card apijson.Field
@@ -1162,6 +1185,145 @@ func (r cardAuthorizationApprovalRequestWebhookEventJSON) RawJSON() string {
11621185

11631186
func (r CardAuthorizationApprovalRequestWebhookEvent) implementsParsedWebhookEvent() {}
11641187

1188+
// Structured amounts for this authorization. The `cardholder` and `merchant`
1189+
// amounts reflect the original network authorization values. For programs with
1190+
// hold adjustments enabled (e.g., automated fuel dispensers or tipping MCCs), the
1191+
// `hold` amount may exceed the `cardholder` and `merchant` amounts to account for
1192+
// anticipated final transaction amounts such as tips or fuel fill-ups
1193+
type CardAuthorizationApprovalRequestWebhookEventAmounts struct {
1194+
Cardholder CardAuthorizationApprovalRequestWebhookEventAmountsCardholder `json:"cardholder,required"`
1195+
Hold CardAuthorizationApprovalRequestWebhookEventAmountsHold `json:"hold,required,nullable"`
1196+
Merchant CardAuthorizationApprovalRequestWebhookEventAmountsMerchant `json:"merchant,required"`
1197+
Settlement CardAuthorizationApprovalRequestWebhookEventAmountsSettlement `json:"settlement,required,nullable"`
1198+
JSON cardAuthorizationApprovalRequestWebhookEventAmountsJSON `json:"-"`
1199+
}
1200+
1201+
// cardAuthorizationApprovalRequestWebhookEventAmountsJSON contains the JSON
1202+
// metadata for the struct [CardAuthorizationApprovalRequestWebhookEventAmounts]
1203+
type cardAuthorizationApprovalRequestWebhookEventAmountsJSON struct {
1204+
Cardholder apijson.Field
1205+
Hold apijson.Field
1206+
Merchant apijson.Field
1207+
Settlement apijson.Field
1208+
raw string
1209+
ExtraFields map[string]apijson.Field
1210+
}
1211+
1212+
func (r *CardAuthorizationApprovalRequestWebhookEventAmounts) UnmarshalJSON(data []byte) (err error) {
1213+
return apijson.UnmarshalRoot(data, r)
1214+
}
1215+
1216+
func (r cardAuthorizationApprovalRequestWebhookEventAmountsJSON) RawJSON() string {
1217+
return r.raw
1218+
}
1219+
1220+
type CardAuthorizationApprovalRequestWebhookEventAmountsCardholder struct {
1221+
// Amount in the smallest unit of the applicable currency (e.g., cents)
1222+
Amount int64 `json:"amount,required"`
1223+
// Exchange rate used for currency conversion
1224+
ConversionRate string `json:"conversion_rate,required"`
1225+
// 3-character alphabetic ISO 4217 currency
1226+
Currency shared.Currency `json:"currency,required"`
1227+
JSON cardAuthorizationApprovalRequestWebhookEventAmountsCardholderJSON `json:"-"`
1228+
}
1229+
1230+
// cardAuthorizationApprovalRequestWebhookEventAmountsCardholderJSON contains the
1231+
// JSON metadata for the struct
1232+
// [CardAuthorizationApprovalRequestWebhookEventAmountsCardholder]
1233+
type cardAuthorizationApprovalRequestWebhookEventAmountsCardholderJSON struct {
1234+
Amount apijson.Field
1235+
ConversionRate apijson.Field
1236+
Currency apijson.Field
1237+
raw string
1238+
ExtraFields map[string]apijson.Field
1239+
}
1240+
1241+
func (r *CardAuthorizationApprovalRequestWebhookEventAmountsCardholder) UnmarshalJSON(data []byte) (err error) {
1242+
return apijson.UnmarshalRoot(data, r)
1243+
}
1244+
1245+
func (r cardAuthorizationApprovalRequestWebhookEventAmountsCardholderJSON) RawJSON() string {
1246+
return r.raw
1247+
}
1248+
1249+
type CardAuthorizationApprovalRequestWebhookEventAmountsHold struct {
1250+
// Amount in the smallest unit of the applicable currency (e.g., cents)
1251+
Amount int64 `json:"amount,required"`
1252+
// 3-character alphabetic ISO 4217 currency
1253+
Currency shared.Currency `json:"currency,required"`
1254+
JSON cardAuthorizationApprovalRequestWebhookEventAmountsHoldJSON `json:"-"`
1255+
}
1256+
1257+
// cardAuthorizationApprovalRequestWebhookEventAmountsHoldJSON contains the JSON
1258+
// metadata for the struct
1259+
// [CardAuthorizationApprovalRequestWebhookEventAmountsHold]
1260+
type cardAuthorizationApprovalRequestWebhookEventAmountsHoldJSON struct {
1261+
Amount apijson.Field
1262+
Currency apijson.Field
1263+
raw string
1264+
ExtraFields map[string]apijson.Field
1265+
}
1266+
1267+
func (r *CardAuthorizationApprovalRequestWebhookEventAmountsHold) UnmarshalJSON(data []byte) (err error) {
1268+
return apijson.UnmarshalRoot(data, r)
1269+
}
1270+
1271+
func (r cardAuthorizationApprovalRequestWebhookEventAmountsHoldJSON) RawJSON() string {
1272+
return r.raw
1273+
}
1274+
1275+
type CardAuthorizationApprovalRequestWebhookEventAmountsMerchant struct {
1276+
// Amount in the smallest unit of the applicable currency (e.g., cents)
1277+
Amount int64 `json:"amount,required"`
1278+
// 3-character alphabetic ISO 4217 currency
1279+
Currency shared.Currency `json:"currency,required"`
1280+
JSON cardAuthorizationApprovalRequestWebhookEventAmountsMerchantJSON `json:"-"`
1281+
}
1282+
1283+
// cardAuthorizationApprovalRequestWebhookEventAmountsMerchantJSON contains the
1284+
// JSON metadata for the struct
1285+
// [CardAuthorizationApprovalRequestWebhookEventAmountsMerchant]
1286+
type cardAuthorizationApprovalRequestWebhookEventAmountsMerchantJSON struct {
1287+
Amount apijson.Field
1288+
Currency apijson.Field
1289+
raw string
1290+
ExtraFields map[string]apijson.Field
1291+
}
1292+
1293+
func (r *CardAuthorizationApprovalRequestWebhookEventAmountsMerchant) UnmarshalJSON(data []byte) (err error) {
1294+
return apijson.UnmarshalRoot(data, r)
1295+
}
1296+
1297+
func (r cardAuthorizationApprovalRequestWebhookEventAmountsMerchantJSON) RawJSON() string {
1298+
return r.raw
1299+
}
1300+
1301+
type CardAuthorizationApprovalRequestWebhookEventAmountsSettlement struct {
1302+
// Amount in the smallest unit of the applicable currency (e.g., cents)
1303+
Amount int64 `json:"amount,required"`
1304+
// 3-character alphabetic ISO 4217 currency
1305+
Currency shared.Currency `json:"currency,required"`
1306+
JSON cardAuthorizationApprovalRequestWebhookEventAmountsSettlementJSON `json:"-"`
1307+
}
1308+
1309+
// cardAuthorizationApprovalRequestWebhookEventAmountsSettlementJSON contains the
1310+
// JSON metadata for the struct
1311+
// [CardAuthorizationApprovalRequestWebhookEventAmountsSettlement]
1312+
type cardAuthorizationApprovalRequestWebhookEventAmountsSettlementJSON struct {
1313+
Amount apijson.Field
1314+
Currency apijson.Field
1315+
raw string
1316+
ExtraFields map[string]apijson.Field
1317+
}
1318+
1319+
func (r *CardAuthorizationApprovalRequestWebhookEventAmountsSettlement) UnmarshalJSON(data []byte) (err error) {
1320+
return apijson.UnmarshalRoot(data, r)
1321+
}
1322+
1323+
func (r cardAuthorizationApprovalRequestWebhookEventAmountsSettlementJSON) RawJSON() string {
1324+
return r.raw
1325+
}
1326+
11651327
type CardAuthorizationApprovalRequestWebhookEventAvs struct {
11661328
// Cardholder address
11671329
Address string `json:"address,required"`
@@ -4925,12 +5087,16 @@ type ParsedWebhookEvent struct {
49255087
AdditionalData interface{} `json:"additional_data"`
49265088
// Address
49275089
Address ExternalBankAccountAddress `json:"address,nullable"`
4928-
// Authorization amount of the transaction (in cents), including any acquirer fees.
4929-
// The contents of this field are identical to `authorization_amount`.
5090+
// Deprecated, use `amounts`. Authorization amount of the transaction (in cents),
5091+
// including any acquirer fees. The contents of this field are identical to
5092+
// `authorization_amount`.
5093+
//
5094+
// Deprecated: deprecated
49305095
Amount int64 `json:"amount"`
49315096
// This field can have the runtime type of [StatementAmountDue].
49325097
AmountDue interface{} `json:"amount_due"`
4933-
// This field can have the runtime type of [TransactionAmounts],
5098+
// This field can have the runtime type of
5099+
// [CardAuthorizationApprovalRequestWebhookEventAmounts], [TransactionAmounts],
49345100
// [NetworkTotalAmounts].
49355101
Amounts interface{} `json:"amounts"`
49365102
// This field can have the runtime type of [ThreeDSAuthenticationApp].
@@ -4947,9 +5113,11 @@ type ParsedWebhookEvent struct {
49475113
AuthenticationRequestType ParsedWebhookEventAuthenticationRequestType `json:"authentication_request_type,nullable"`
49485114
// Indicates the outcome of the 3DS authentication process.
49495115
AuthenticationResult ParsedWebhookEventAuthenticationResult `json:"authentication_result"`
4950-
// The base transaction amount (in cents) plus the acquirer fee field. This is the
4951-
// amount the issuer should authorize against unless the issuer is paying the
4952-
// acquirer fee on behalf of the cardholder.
5116+
// Deprecated, use `amounts`. The base transaction amount (in cents) plus the
5117+
// acquirer fee field. This is the amount the issuer should authorize against
5118+
// unless the issuer is paying the acquirer fee on behalf of the cardholder.
5119+
//
5120+
// Deprecated: deprecated
49535121
AuthorizationAmount int64 `json:"authorization_amount,nullable"`
49545122
// A fixed-width 6-digit numeric identifier that can be used to identify a
49555123
// transaction with networks.
@@ -4981,7 +5149,10 @@ type ParsedWebhookEvent struct {
49815149
// This field can have the runtime type of [ThreeDSAuthenticationCardholder].
49825150
Cardholder interface{} `json:"cardholder"`
49835151
CardholderAuthentication CardholderAuthentication `json:"cardholder_authentication,nullable"`
4984-
// 3-character alphabetic ISO 4217 code for cardholder's billing currency.
5152+
// Deprecated, use `amounts`. 3-character alphabetic ISO 4217 code for cardholder's
5153+
// billing currency.
5154+
//
5155+
// Deprecated: deprecated
49855156
CardholderCurrency string `json:"cardholder_currency"`
49865157
// Identifier assigned by the network for this dispute.
49875158
CaseID string `json:"case_id,nullable"`
@@ -5016,11 +5187,13 @@ type ParsedWebhookEvent struct {
50165187
Common interface{} `json:"common"`
50175188
// Optional field that helps identify bank accounts in receipts
50185189
CompanyID string `json:"company_id,nullable"`
5019-
// If the transaction was requested in a currency other than the settlement
5020-
// currency, this field will be populated to indicate the rate used to translate
5021-
// the merchant_amount to the amount (i.e., `merchant_amount` x `conversion_rate` =
5022-
// `amount`). Note that the `merchant_amount` is in the local currency and the
5023-
// amount is in the settlement currency.
5190+
// Deprecated, use `amounts`. If the transaction was requested in a currency other
5191+
// than the settlement currency, this field will be populated to indicate the rate
5192+
// used to translate the merchant_amount to the amount (i.e., `merchant_amount` x
5193+
// `conversion_rate` = `amount`). Note that the `merchant_amount` is in the local
5194+
// currency and the amount is in the settlement currency.
5195+
//
5196+
// Deprecated: deprecated
50245197
ConversionRate float64 `json:"conversion_rate"`
50255198
// The country that the bank account is located in using ISO 3166-1. We will only
50265199
// accept USA bank accounts e.g., USA
@@ -5173,17 +5346,21 @@ type ParsedWebhookEvent struct {
51735346
// This field can have the runtime type of [shared.Merchant],
51745347
// [ThreeDSAuthenticationMerchant].
51755348
Merchant interface{} `json:"merchant"`
5176-
// The amount that the merchant will receive, denominated in `merchant_currency`
5177-
// and in the smallest currency unit. Note the amount includes `acquirer_fee`,
5178-
// similar to `authorization_amount`. It will be different from
5179-
// `authorization_amount` if the merchant is taking payment in a different
5180-
// currency.
5349+
// Deprecated, use `amounts`. The amount that the merchant will receive,
5350+
// denominated in `merchant_currency` and in the smallest currency unit. Note the
5351+
// amount includes `acquirer_fee`, similar to `authorization_amount`. It will be
5352+
// different from `authorization_amount` if the merchant is taking payment in a
5353+
// different currency.
5354+
//
5355+
// Deprecated: deprecated
51815356
MerchantAmount int64 `json:"merchant_amount,nullable"`
51825357
// Analogous to the 'authorization_amount', but in the merchant currency.
51835358
//
51845359
// Deprecated: deprecated
51855360
MerchantAuthorizationAmount int64 `json:"merchant_authorization_amount,nullable"`
51865361
// 3-character alphabetic ISO 4217 code for the local currency of the transaction.
5362+
//
5363+
// Deprecated: deprecated
51875364
MerchantCurrency string `json:"merchant_currency"`
51885365
// Either PAYMENT_AUTHENTICATION or NON_PAYMENT_AUTHENTICATION. For
51895366
// NON_PAYMENT_AUTHENTICATION, additional_data and transaction fields are not
@@ -5339,8 +5516,10 @@ type ParsedWebhookEvent struct {
53395516
RoutingNumber string `json:"routing_number,nullable"`
53405517
// This field can have the runtime type of [[]TokenizationRuleResult].
53415518
RuleResults interface{} `json:"rule_results"`
5342-
// Amount (in cents) of the transaction that has been settled, including any
5343-
// acquirer fees
5519+
// Deprecated, use `amounts`. Amount (in cents) of the transaction that has been
5520+
// settled, including any acquirer fees.
5521+
//
5522+
// Deprecated: deprecated
53445523
SettledAmount int64 `json:"settled_amount"`
53455524
// The total net amount of cash moved. (net value of settled_gross_amount,
53465525
// interchange, fees). (This field is deprecated and will be removed in a future

0 commit comments

Comments
 (0)