square_api_client/models/enums/error_code.rs
1//! Model for ErrorCode enum
2
3use serde::{Deserialize, Serialize};
4
5/// Indicates which high-level category of error has occurred during a request to the Connect API.
6#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
7#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8pub enum ErrorCode {
9 /// A general server error occurred.
10 InternalServerError,
11 /// A general authorization error occurred.
12 Unauthorized,
13 /// The provided access token has expired.
14 AccessTokenExpired,
15 /// The provided access token has been revoked.
16 AccessTokenRevoked,
17 /// The provided client has been disabled.
18 ClientDisabled,
19 /// A general access error occurred.
20 Forbidden,
21 /// The provided access token does not have permission to execute the requested action.
22 InsufficientScopes,
23 /// The calling application was disabled.
24 ApplicationDisabled,
25 /// The calling application was created prior to 2016-03-30 and is not compatible with v2 Square
26 /// API calls.
27 V1Application,
28 /// The calling application is using an access token created prior to 2016-03-30 and is not
29 /// compatible with v2 Square API calls.
30 V1AccessToken,
31 /// The location provided in the API call is not enabled for credit card processing.
32 CardProcessingNotEnabled,
33 /// A required subscription was not found for the merchant
34 MerchantSubscriptionNotFound,
35 /// A general error occurred with the request.
36 BadRequest,
37 /// The request is missing a required path, query, or body parameter.
38 MissingRequiredParameter,
39 /// The value provided in the request is the wrong type. For example, a string instead of an
40 /// integer.
41 IncorrectType,
42 /// Formatting for the provided time value is incorrect.
43 InvalidTime,
44 /// The time range provided in the request is invalid. For example, the end time is before the
45 /// start time.
46 InvalidTimeRange,
47 /// The provided value is invalid. For example, including `%` in a phone number.
48 InvalidValue,
49 /// The pagination cursor included in the request is invalid.
50 InvalidCursor,
51 /// The query parameters provided is invalid for the requested endpoint.
52 UnknownQueryParameter,
53 /// One or more of the request parameters conflict with each other.
54 ConflictingParameters,
55 /// The request body is not a JSON object.
56 ExpectedJsonBody,
57 /// The provided sort order is not a valid key. Currently, sort order must be `ASC` or `DESC`.
58 InvalidSortOrder,
59 /// The provided value does not match an expected regular expression.
60 ValueRegexMismatch,
61 /// The provided string value is shorter than the minimum length allowed.
62 ValueTooShort,
63 /// The provided string value is longer than the maximum length allowed.
64 ValueTooLong,
65 /// The provided value is less than the supported minimum.
66 ValueTooLow,
67 /// The provided value is greater than the supported maximum.
68 ValueTooHigh,
69 /// The provided value has a default (empty) value such as a blank string.
70 ValueEmpty,
71 /// The provided array has too many elements.
72 ArrayLengthTooLong,
73 /// The provided array has too few elements.
74 ArrayLengthTooShort,
75 /// The provided array is empty.
76 ArrayEmpty,
77 /// The endpoint expected the provided value to be a boolean.
78 ExpectedBoolean,
79 /// The endpoint expected the provided value to be an integer.
80 ExpectedInteger,
81 /// The endpoint expected the provided value to be a float.
82 ExpectedFloat,
83 /// The endpoint expected the provided value to be a string.
84 ExpectedString,
85 /// The endpoint expected the provided value to be a JSON object.
86 ExpectedObject,
87 /// The endpoint expected the provided value to be an array or list.
88 ExpectedArray,
89 /// The endpoint expected the provided value to be a map or associative array.
90 ExpectedMap,
91 /// The endpoint expected the provided value to be an array encoded in base64.
92 ExpectedBase64EncodedByteArray,
93 /// One or more objects in the array does not match the array type.
94 InvalidArrayValue,
95 /// The provided static string is not valid for the field.
96 InvalidEnumValue,
97 /// Invalid content type header.
98 InvalidContentType,
99 /// Only relevant for applications created prior to 2016-03-30. Indicates there was an error
100 /// while parsing form values.
101 InvalidFormValue,
102 /// The provided customer id can't be found in the merchant's customers list.
103 CustomerNotFound,
104 /// A general error occurred.
105 OneInstrumentExpected,
106 /// A general error occurred.
107 NoFieldsSet,
108 /// Too many entries in the map field.
109 TooManyMapEntries,
110 /// The length of one of the provided keys in the map is too short.
111 MapKeyLengthTooShort,
112 /// The length of one of the provided keys in the map is too long.
113 MapKeyLengthTooLong,
114 /// The provided customer does not have a recorded name.
115 CustomerMissingName,
116 /// The provided customer does not have a recorded email.
117 CustomerMissingEmail,
118 /// The subscription cannot be paused longer than the duration of the current phase.
119 InvalidPauseLength,
120 /// The subscription cannot be paused/resumed on the given date.
121 InvalidDate,
122 /// The card issuer declined the request because the card is expired.
123 CardExpired,
124 /// The expiration date for the payment card is invalid. For example, it indicates a date in the
125 /// past.
126 InvalidExpiration,
127 /// The expiration year for the payment card is invalid. For example, it indicates a year in the
128 /// past or contains invalid characters.
129 InvalidExpirationYear,
130 /// The expiration date for the payment card is invalid. For example, it contains invalid
131 /// characters.
132 InvalidExpirationDate,
133 /// The credit card provided is not from a supported issuer.
134 UnsupportedCardBrand,
135 /// The entry method for the credit card (swipe, dip, tap) is not supported.
136 UnsupportedEntryMethod,
137 /// The encrypted card information is invalid.
138 InvalidEncryptedCard,
139 /// The credit card cannot be validated based on the provided details.
140 InvalidCard,
141 /// Square received a decline without any additional information. If the payment information
142 /// seems correct, the buyer can contact their issuer to ask for more information.
143 GenericDecline,
144 /// The card issuer declined the request because the CVV value is invalid.
145 CvvFailure,
146 /// The card issuer declined the request because the postal code is invalid.
147 AddressVerificationFailure,
148 /// The issuer was not able to locate the account on record.
149 InvalidAccount,
150 /// The currency associated with the payment is not valid for the provided funding source. For
151 /// example, a gift card funded in USD cannot be used to process payments in GBP.
152 CurrencyMismatch,
153 /// The funding source has insufficient funds to cover the payment.
154 InsufficientFunds,
155 /// The Square account does not have the permissions to accept this payment. For example, Square
156 /// may limit which merchants are allowed to receive gift card payments.
157 InsufficientPermissions,
158 /// The card issuer has declined the transaction due to restrictions on where the card can be
159 /// used. For example, a gift card is limited to a single merchant.
160 CardholderInsufficientPermissions,
161 /// The Square account cannot take payments in the specified region. A Square account can take
162 /// payments only from the region where the account was created.
163 InvalidLocation,
164 /// The card issuer has determined the payment amount is either too high or too low. The API
165 /// returns the error code mostly for credit cards (for example, the card reached the credit
166 /// limit). However, sometimes the issuer bank can indicate the error for debit or prepaid cards
167 /// (for example, card has insufficient funds).
168 TransactionLimit,
169 /// The card issuer declined the request because the issuer requires voice authorization from
170 /// the cardholder.
171 VoiceFailure,
172 /// The specified card number is invalid. For example, it is of incorrect length or is
173 /// incorrectly formatted.
174 PanFailure,
175 /// The card expiration date is either invalid or indicates that the card is expired.
176 ExpirationFailure,
177 /// The card is not supported either in the geographic region or by the [merchant category
178 /// code](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code)
179 /// (MCC).
180 CardNotSupported,
181 /// The card issuer declined the request because the PIN is invalid.
182 InvalidPin,
183 /// The payment is missing a required PIN.
184 MissingPin,
185 /// The payment is missing a required `ACCOUNT_TYPE` parameter.
186 MissingAccountType,
187 /// The postal code is incorrectly formatted.
188 InvalidPostalCode,
189 /// The `app_fee_money` on a payment is too high.
190 InvalidFees,
191 /// The card must be swiped, tapped, or dipped. Payments attempted by manually entering the card
192 /// number are declined.
193 ManuallyEnteredPaymentNotSupported,
194 /// Square declined the request because the payment amount exceeded the processing limit for
195 /// this merchant.
196 PaymentLimitExceeded,
197 /// When a Gift Card is a payment source, you can allow taking a partial payment by adding the
198 /// `accept_partial_authorization` parameter in the request. However, taking such a partial
199 /// payment does not work if your request also includes `tip_money`, `app_fee_money`, or both.
200 /// Square declines such payments and returns the `GIFT_CARD_AVAILABLE_AMOUNT` error. For more
201 /// information, see [CreatePayment errors (additional
202 /// information)](https://developer.squareup.com/docs/payments-api/error-codes#createpayment-errors-additional-information).
203 GiftCardAvailableAmount,
204 /// The account provided cannot carry out transactions.
205 AccountUnusable,
206 /// Bank account rejected or was not authorized for the payment.
207 BuyerRefusedPayment,
208 /// The application tried to update a delayed-capture payment that has expired.
209 DelayedTransactionExpired,
210 /// The application tried to cancel a delayed-capture payment that was already cancelled.
211 DelayedTransactionCanceled,
212 /// The application tried to capture a delayed-capture payment that was already captured.
213 DelayedTransactionCaptured,
214 /// The application tried to update a delayed-capture payment that failed.
215 DelayedTransactionFailed,
216 /// The provided card token (nonce) has expired.
217 CardTokenExpired,
218 /// The provided card token (nonce) was already used to process payment.
219 CardTokenUsed,
220 /// The requested payment amount is too high for the provided payment source.
221 AmountTooHigh,
222 /// The API request references an unsupported instrument type.
223 UnsupportedInstrumentType,
224 /// The requested refund amount exceeds the amount available to refund.
225 RefundAmountInvalid,
226 /// The payment already has a pending refund.
227 RefundAlreadyPending,
228 /// The payment is not refundable. For example, a previous refund has already been rejected and
229 /// no new refunds can be accepted.
230 PaymentNotRefundable,
231 /// Request failed - The card issuer declined the refund.
232 RefundDeclined,
233 /// Generic error - the provided card data is invalid.
234 InvalidCardData,
235 /// The provided source id was already used to create a card.
236 SourceUsed,
237 /// The provided source id has expired.
238 SourceExpired,
239 /// The referenced loyalty program reward tier is not supported. This could happen if the reward
240 /// tier created in a first party application is incompatible with the Loyalty API.
241 UnsupportedLoyaltyRewardTier,
242 /// Generic error - the given location does not matching what is expected.
243 LocationMismatch,
244 /// The provided idempotency key has already been used.
245 IdempotencyKeyReused,
246 /// General error - the value provided was unexpected.
247 UnexpectedValue,
248 /// The API request is not supported in sandbox.
249 SandboxNotSupported,
250 /// The provided email address is invalid.
251 InvalidEmailAddress,
252 /// The provided phone number is invalid.
253 InvalidPhoneNumber,
254 /// The provided checkout URL has expired.
255 CheckoutExpired,
256 /// Bad certificate.
257 BadCertificate,
258 /// The provided Square-Version is incorrectly formatted.
259 InvalidSquareVersionFormat,
260 /// The provided Square-Version is incompatible with the requested action.
261 ApiVersionIncompatible,
262 /// The card was declined.
263 CardDeclined,
264 /// The CVV could not be verified.
265 VerifyCvvFailure,
266 /// The AVS could not be verified.
267 VerifyAvsFailure,
268 /// The payment card was declined with a request for the card holder to call the issuer.
269 CardDeclinedCallIssure,
270 /// The payment card was declined with a request for additional verification.
271 CardDeclinedVerificationRequired,
272 /// The card expiration date is either missing or incorrectly formatted.
273 BadExpiration,
274 /// The card issuer requires that the card be read using a chip reader.
275 ChipInsertionRequired,
276 /// The card has exhausted its available pin entry retries set by the card issuer. Resolving the
277 /// error typically requires the card holder to contact the card issuer.
278 AllowablePinTriesExceeded,
279 /// The card issuer declined the refund.
280 ReservationDeclined,
281 /// Not Found - a general error occurred.
282 NotFound,
283 /// Square could not find the associated Apple Pay certificate.
284 ApplePaymentProcessingCertificateHashNotFound,
285 /// Method Not Allowed - a general error occurred.
286 MethodNotAllowed,
287 /// Not Acceptable - a general error occurred.
288 NotAcceptable,
289 /// Request Timeout - a general error occurred.
290 RequestTimeout,
291 /// Conflict - a general error occurred.
292 Conflict,
293 /// The target resource is no longer available and this condition is likely to be permanent.
294 Gone,
295 /// Request Entity Too Large - a general error occurred.
296 RequestEntityTooLarge,
297 /// Unsupported Media Type - a general error occurred.
298 UnsupportedMediaType,
299 /// Unprocessable Entity - a general error occurred.
300 UnprocessableEntity,
301 /// Rate Limited - a general error occurred.
302 RateLimited,
303 /// Not Implemented - a general error occurred.
304 NotImplemented,
305 /// Bad Gateway - a general error occurred.
306 BadGateway,
307 /// Service Unavailable - a general error occurred.
308 ServiceUnavailable,
309 /// A temporary internal error occurred. You can safely retry your call using the same
310 /// idempotency key.
311 TemporaryError,
312 /// Gateway Timeout - a general error occurred.
313 GatewayTimeout,
314}