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

Filter on_behalf_of_uri #413

Closed
remear opened this issue Oct 16, 2013 · 4 comments
Closed

Filter on_behalf_of_uri #413

remear opened this issue Oct 16, 2013 · 4 comments
Assignees
Labels

Comments

@remear
Copy link
Contributor

remear commented Oct 16, 2013

Balanced::Debit.where('on_behalf_of_uri' => '/v1/customers/CU3uPsllkugzS9Ije5Elbjc3').all

resulted in:

Balanced::BadRequest: Balanced::BadRequest(400)::Bad Request:: GET https://api.balancedpayments.com/v1/marketplaces/TEST-MP1AiLUNRhKX28DrJDbd9LX1/debits?on_behalf_of_uri=%2Fv1%2Fcustomers%2FCU3uPsllkugzS9Ije5Elbjc3: : /v1/customers/CU3uPsllkugzS9Ije5Elbjc3 does not resolve to a valid account Your request id is OHM6e0eaca2360511e39fc3026ba7d31e6f.

@MDrollette
Copy link

I find it works if you use the old account_uri... but customer_uri always gives 400

@remear
Copy link
Contributor Author

remear commented Oct 24, 2013

@MDrollette This should now be fixed. The test from the issue description now works from my IRB session. Let us know if you find any other issues with this.

@remear
Copy link
Contributor Author

remear commented Jan 13, 2014

Regressed. Happens at least from balanced-python and balanced-ruby.

@remear remear reopened this Jan 13, 2014
@mjallday
Copy link
Contributor

Runnable example in case anyone wants to try and reproduce this to verify:

curl https://api.balancedpayments.com/v1/customers/CU6hFfogMISo58cfwCoe8zbp/debits -u ak-test-2n5nNOMaPjkA5GCbOWlIeCNO79mdZ8cfQ: -d "appears_on_statement_as=Statement text" -d "amount=5000" -d "description=Some descriptive text for the debit in the dashboard" -d on_behalf_of_uri="/v1/customers/CU6hFfogMISo58cfwCoe8zbp"

{
  "status": "succeeded",
  "_type": "debit",
  "description": "Some descriptive text for the debit in the dashboard",
  "events_uri": "/v1/debits/WD2u9uiIAmZL0hmcPBpeNtCM/events",
  "_uris": {
    "refunds_uri": {
      "_type": "page",
      "key": "refunds"
    },
    "events_uri": {
      "_type": "page",
      "key": "events"
    }
  },
  "hold": {
    "customer_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp",
    "_type": "hold",
    "fee": null,
    "description": "Some descriptive text for the debit in the dashboard",
    "_uris": {
      "debit_uri": {
        "_type": "debit",
        "key": "debit"
      },
      "source_uri": {
        "_type": "card",
        "key": "source"
      },
      "customer_uri": {
        "_type": "customer",
        "key": "customer"
      },
      "events_uri": {
        "_type": "page",
        "key": "events"
      }
    },
    "debit_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/debits/HL2u5X5lWiIXZOldaB4CmwAE",
    "created_at": "2014-01-13T21:33:18.812700Z",
    "is_void": false,
    "expires_at": "2014-01-20T21:33:19.484817Z",
    "uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/holds/HL2u5X5lWiIXZOldaB4CmwAE",
    "transaction_number": "HL680-441-5196",
    "amount": 5000,
    "meta": {},
    "events_uri": "/v1/holds/HL2u5X5lWiIXZOldaB4CmwAE/events",
    "source_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/cards/CC6jfetUACB4adLAohKOAPDs",
    "id": "HL2u5X5lWiIXZOldaB4CmwAE"
  },
  "id": "WD2u9uiIAmZL0hmcPBpeNtCM",
  "customer": {
    "twitter": null,
    "meta": {},
    "id": "CU6hFfogMISo58cfwCoe8zbp",
    "destination": null,
    "email": null,
    "_type": "customer",
    "source_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/cards/CC6jfetUACB4adLAohKOAPDs",
    "reversals_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/reversals",
    "phone": null,
    "_uris": {
      "holds_uri": {
        "_type": "page",
        "key": "holds"
      },
      "source_uri": {
        "_type": "card",
        "key": "source"
      },
      "bank_accounts_uri": {
        "_type": "page",
        "key": "bank_accounts"
      },
      "refunds_uri": {
        "_type": "page",
        "key": "refunds"
      },
      "debits_uri": {
        "_type": "page",
        "key": "debits"
      },
      "transactions_uri": {
        "_type": "page",
        "key": "transactions"
      },
      "reversals_uri": {
        "_type": "page",
        "key": "reversals"
      },
      "credits_uri": {
        "_type": "page",
        "key": "credits"
      },
      "cards_uri": {
        "_type": "page",
        "key": "cards"
      }
    },
    "facebook": null,
    "address": {},
    "business_name": null,
    "bank_accounts_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/bank_accounts",
    "credits_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/credits",
    "cards_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/cards",
    "holds_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/holds",
    "name": null,
    "dob": null,
    "created_at": "2014-01-09T03:12:00.894178Z",
    "is_identity_verified": false,
    "uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp",
    "refunds_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/refunds",
    "debits_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/debits",
    "transactions_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/transactions",
    "ssn_last4": null,
    "ein": null
  },
  "on_behalf_of": {
    "customer_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp",
    "_type": "account",
    "_uris": {
      "transactions_uri": {
        "_type": "page",
        "key": "transactions"
      },
      "bank_accounts_uri": {
        "_type": "page",
        "key": "bank_accounts"
      },
      "refunds_uri": {
        "_type": "page",
        "key": "refunds"
      },
      "customer_uri": {
        "_type": "customer",
        "key": "customer"
      },
      "debits_uri": {
        "_type": "page",
        "key": "debits"
      },
      "holds_uri": {
        "_type": "page",
        "key": "holds"
      },
      "reversals_uri": {
        "_type": "page",
        "key": "reversals"
      },
      "credits_uri": {
        "_type": "page",
        "key": "credits"
      },
      "cards_uri": {
        "_type": "page",
        "key": "cards"
      }
    },
    "transactions_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/transactions",
    "name": null,
    "roles": [
      "buyer"
    ],
    "created_at": "2014-01-09T03:12:00.894178Z",
    "uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp",
    "reversals_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/reversals",
    "refunds_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/refunds",
    "meta": {},
    "debits_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/debits",
    "holds_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/holds",
    "bank_accounts_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/bank_accounts",
    "email_address": null,
    "id": "CU6hFfogMISo58cfwCoe8zbp",
    "credits_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/credits",
    "cards_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/accounts/CU6hFfogMISo58cfwCoe8zbp/cards"
  },
  "fee": null,
  "refunds_uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/debits/WD2u9uiIAmZL0hmcPBpeNtCM/refunds",
  "amount": 5000,
  "created_at": "2014-01-13T21:33:18.871885Z",
  "uri": "/v1/marketplaces/TEST-MP4XNjMnFwTftDMQ8OVupCxq/debits/WD2u9uiIAmZL0hmcPBpeNtCM",
  "source": {
    "security_code_check": "passed",
    "expiration_month": 12,
    "_type": "card",
    "postal_code_check": "unknown",
    "hash": "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
    "last_four": "5100",
    "expiration_year": 2020,
    "_uris": {
      "customer_uri": {
        "_type": "customer",
        "key": "customer"
      }
    },
    "brand": "MasterCard",
    "uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp/cards/CC6jfetUACB4adLAohKOAPDs",
    "customer_uri": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp",
    "id": "CC6jfetUACB4adLAohKOAPDs",
    "card_type": "mastercard",
    "is_valid": true,
    "meta": {
      "client_ip_address": "54.237.114.86"
    },
    "country_code": null,
    "postal_code": null,
    "is_verified": true,
    "created_at": "2014-01-09T03:12:02.310670Z",
    "street_address": null,
    "name": null
  },
  "transaction_number": "W142-340-5005",
  "meta": {},
  "appears_on_statement_as": "Statement text",
  "available_at": "2014-01-13T21:33:19.961185Z"
}

curl "https://api.balancedpayments.com/v1/customers/CU6hFfogMISo58cfwCoe8zbp/debits?on_behalf_of_uri=/v1/customers/CU6hFfogMISo58cfwCoe8zbp" -u ak-test-2n5nNOMaPjkA5GCbOWlIeCNO79mdZ8cfQ:

{
  "status": "Bad Request",
  "status_code": 400,
  "_uris": {},
  "description": "/v1/customers/CU6hFfogMISo58cfwCoe8zbp does not resolve to a valid customer Your request id is OHM7cf77c547c9a11e38445026ba7d31e6f.",
  "request_id": "OHM7cf77c547c9a11e38445026ba7d31e6f"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants