Skip to content

Commit

Permalink
fixes error scenario and issue #459
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfl committed Jan 6, 2014
1 parent bf531fc commit 3830fea
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 186 deletions.
3 changes: 1 addition & 2 deletions features/refunds.feature
@@ -1,5 +1,5 @@
Feature: Refunds

Scenario: Create a refund
Given I have tokenized a customer card
And I have debited that card
Expand All @@ -8,7 +8,6 @@ Feature: Refunds
Then I should get a 201 Created status code
And the response is valid according to the "refunds" schema

@failing @gh-459
Scenario: Create a failed refund
Given I have tokenized a customer card
And I have debited that card
Expand Down
2 changes: 1 addition & 1 deletion fixtures/_models/debit.json
Expand Up @@ -106,4 +106,4 @@
"meta",
"links"
]
}
}
187 changes: 187 additions & 0 deletions fixtures/_models/error.json
@@ -0,0 +1,187 @@
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"category_code": {
"type": "string",
"enum": [
"account-insufficient-funds",
"authorization-failed",
"card-declined",
"funding-destination-declined",
"account-already-merchant",
"address-verification-failed",
"authorization-expired",
"bank-account-already-associated",
"bank-account-authentication-already-exists",
"bank-account-authentication-failed",
"bank-account-authentication-not-pending",
"bank-account-not-associated",
"bank-account-not-valid",
"business-kyc",
"business-principal-kyc",
"cannot-associate-bank-account",
"cannot-associate-card",
"cannot-associate-merchant-with-account",
"cannot-capture-authorization",
"cannot-void-authorization",
"capture-void-attempt",
"card-already-funding-src",
"card-not-associated",
"card-not-valid",
"card-not-validated",
"credit-already-reversed",
"debit-already-refunded",
"debit-not-found",
"duplicate-email-address",
"funding-destination-already-associated",
"funding-destination-cannot-reverse",
"funding-destination-not-associated",
"funding-destination-not-creditable",
"funding-source-already-associated",
"funding-source-not-associated",
"funding-source-not-authorizable",
"funding-source-not-debitable",
"funding-source-not-hold",
"funding-source-not-refundable",
"hold-not-associated-account",
"hold-not-associated-marketplace",
"identity-verification-error",
"insufficient-funds",
"marketplace-already-created",
"marketplace-cannot-prepay-fees",
"multiple-debits",
"no-funding-destination",
"no-funding-source",
"person-kyc",
"precog-logical-error",
"refund-insufficient-funds",
"reverse-void-attempt",
"unexpected-payload",
"bank-account-authentication-forbidden",
"cannot-reverse-credit",
"incomplete-account-info",
"invalid-amount",
"invalid-bank-account-number",
"invalid-reversal-amount",
"invalid-routing-number",
"precog-bad-request",
"refund-invalid-debit-state",
"not-found",
"patch-test-failed",
"request",
"order-kyc",
"method-not-allowed"
]
},
"description": {
"__example": "Human readable error message about what went wrong. Your request id is OHMasdfasdfasdfasdf",
"anyOf": [
{
"type": "string",
"enum": [
"Account balance is insufficient to issue this debit",
"An account with the given email address already exists.",
"Bank account authentication amounts do not match.",
"Bank account authentication amounts do not match.",
"Bank account authentication is not allowed.",
"Bank account authentication is not in state ``pending``.",
"Credit has already been fully reversed.",
"Credit to reversal must have ``succeeded``.",
"Debit has already been fully refunded.",
"Marketplace balance is insufficient to issue this credit",
"Marketplace escrow balance is insufficient to issue this credit.",
"Marketplace escrow balance is insufficient to issue this refund.",
"Marketplace has already been created.",
"No buyer or merchant info was provided. Either \"merchant/merchant_uri\" or\n\"card/card_uri\" fields must be present.",
"Refund amount cannot be greater than the amount of the original debit.",
"Reverse amount cannot be greater than the amount of the original credit.",
"State of debit to refund must be ``succeeded``.",
"The account has no valid funding destinations.",
"The account has no valid funding sources.",
"The account is already a merchant.",
"The bank account is already associated with an account -- it cannot be\nassociated.",
"The bank account is not associated with the given account.",
"The bank account was tokenized on a different marketplace than the one\nused for this request.",
"The card could not be validated -- either the card number or security code\nmay be wrong.",
"The card is already associated with an account -- it cannot be associated\nagain.",
"The card is not associated with the given account.",
"The card was tokenized on a different marketplace than the one used for\nthis request.",
"The given funding destination cannot have a credit created against it.",
"The given funding destination cannot reverse.",
"The given funding destination is already associated with an account.",
"The given funding destination is not associated with the account.",
"The given funding source cannot be refunded.",
"The given funding source cannot have a debit created against it.",
"The given funding source cannot have a hold created against it.",
"The given funding source cannot have an authorization created against\nit. Authorizations are only valid for card-type funding sources.",
"The given funding source is already associated with an account.",
"The given funding source is not associated with an account.",
"The merchant information was created on a different marketplace than the\none used for this request.",
"The processor did not accept the transaction.",
"The processor did not accept this hold.",
"The routing number provided for the bank account was invalid.",
"This address could not be verified.",
"This bank account has already been marked as invalid/deactivated. It cannot\nbe used again.",
"This bank account number is not alpha numeric (ascii). It can not be used.",
"This card has already been marked as invalid/deactivated. It cannot be used\nagain.",
"This card was declined by the processor.",
"This hold has already been captured or voided, and cannot be captured.",
"This hold has already been captured or voided, and cannot be voided.",
"This hold has already been captured, which cannot be reversed.",
"This hold has already been voided, which cannot be reversed.",
"This hold has already expired.",
"This hold is not associated with this account.",
"This hold is not associated with this marketplace.",
"Order escrow balanced is insufficient to issue this credit.",
"Order escrow balanced is insufficient to issue this refund.",
"Order requires merchant be underwritten."
]
},
{
"type": "string",
"pattern": ".* Your request id is OHM[a-zA-Z0-9]*\\."
},
{
"type": "null"
}
]
},
"additional": {},
"extras": {},
"status_code": {
"type": "integer",
"enum": [
400,
402,
403,
405,
404,
409
]
},
"category_type": {
"type": "string",
"enum": [
"request",
"banking",
"logical"
]
},
"request_id": {
"type": "string",
"pattern": "OHM[a-zA-Z0-9]{16,34}"
}
},
"required": [
"status",
"category_code",
"description",
"status_code",
"category_type",
"request_id"
],
"additionalProperties": false
}

0 comments on commit 3830fea

Please sign in to comment.