Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Numbers always pass #94

Closed
joseym opened this issue Apr 16, 2014 · 2 comments
Closed

Test Numbers always pass #94

joseym opened this issue Apr 16, 2014 · 2 comments

Comments

@joseym
Copy link

joseym commented Apr 16, 2014

I'm attempting to set up catches for errors using the numbers specified here: https://docs.balancedpayments.com/1.1/overview/resources/#test-credit-card-numbers

However balanced-js never seems to return any errors for these cards.

@mjallday
Copy link
Contributor

The latest version of balanced.js does not validate the card until you perform an authenticated operation on the card.

e.g.

Tokenize a card that will fail (no auth token, same as balanced.js)

curl https://api.balancedpayments.com/cards \
     -H "Accept: application/vnd.api+json;revision=1.1" \
     -d "expiration_month=12" \
     -d "cvv=123" \
     -d "number= 4444444444444448" \
     -d "expiration_year=2020"
{
  "cards": [
    {
      "href": "/cards/CC1v3ZZXIHaBB3ucLEkCjfoK",
      "id": "CC1v3ZZXIHaBB3ucLEkCjfoK",
      "links": {}
    }
  ],
  "links": {}
}

Now debit the card

curl https://api.balancedpayments.com/cards/CC1v3ZZXIHaBB3ucLEkCjfoK/debits \
      -H "Accept: application/vnd.api+json;revision=1.1" \
      -u ak-test-2qEM0Znvd8LIVbZ01LbFHvHgab4fkNr3c: \
      -d amount=100
{
  "errors": [
    {
      "status": "Payment Required",
      "category_code": "card-declined",
      "additional": "Account Frozen",
      "status_code": 402,
      "category_type": "banking",
      "extras": {},
      "request_id": "OHM6a971db0c58a11e3961006429171ffad",
      "description": "R758: Account Frozen. Your request id is OHM6a971db0c58a11e3961006429171ffad."
    }
  ],
  "links": {
    "debits.customer": "/customers/{debits.customer}",
    "debits.dispute": "/disputes/{debits.dispute}",
    "debits.source": "/resources/{debits.source}",
    "debits.order": "/orders/{debits.order}",
    "debits.refunds": "/debits/{debits.id}/refunds",
    "debits.events": "/debits/{debits.id}/events"
  },
  "debits": [
    {
      "status": "failed",
      "description": null,
      "links": {
        "customer": null,
        "source": "CC1v3ZZXIHaBB3ucLEkCjfoK",
        "order": null,
        "dispute": null
      },
      "updated_at": "2014-04-16T17:13:14.243895Z",
      "created_at": "2014-04-16T17:13:13.781225Z",
      "transaction_number": "W271-400-9485",
      "failure_reason": "R758: Account Frozen.",
      "currency": "USD",
      "amount": 100,
      "failure_reason_code": "card-declined",
      "meta": {},
      "href": "/debits/WD2OFg8qYh9WnSm95IDJy2od",
      "appears_on_statement_as": "BAL*example.com",
      "id": "WD2OFg8qYh9WnSm95IDJy2od"
    }
  ]
}

I do not believe we have correctly documented this change in behavior, thanks for bringing it to our attention, we'll create an issue and get this resolved.

@joseym
Copy link
Author

joseym commented Apr 17, 2014

Very detailed, thank you.

@joseym joseym closed this as completed Apr 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants