balanced / balanced-api

Balanced API specification.
221 stars 72 forks source link

(sandbox) webhooks sending v1 formatted data even though marketplace has registered for v1.1 callbacks #503

Closed joeenzminger closed 10 years ago

joeenzminger commented 10 years ago

In the development sandbox, registered for v1.1 web hook, the data received is in the V1 format (referencing uri's instead of href, etc).

mjallday commented 10 years ago

@joeenzminger when creating a webhook via the dashboard it prompts you for the revision of the API you want to receive callbacks against. If creating it programatically you can pass this as a parameter. image

joeenzminger commented 10 years ago

Marshall,

I know that. The web hook is set to Revision 1.1 and it is still sending data formatted in the 1.0 format.

mjallday commented 10 years ago

can you give me the href/ID of the webhook? We'll investigate that

joeenzminger commented 10 years ago

Sure. Give me a few minutes.

joeenzminger commented 10 years ago

The marketplace name is nibl-joeenzminger

{ "callbacks": [ { "links": {}, "url": "http://nibl.joe.ijjc.co/SNS/Balanced", "method": "post", "href": "/callbacks/CB2uEYQYyoxbhzNdzhM3UDwq", "id": "CB2uEYQYyoxbhzNdzhM3UDwq", "revision": "1.1" } ], "links": {} }

joeenzminger commented 10 years ago

The documentation on the data sent for each particular callback is a little thin.....hard to know what exactly is coming through for each event type without actually getting the message and examining it.

joeenzminger commented 10 years ago

Here is a callback I just generated. Note the /v1 references

{ "occurred_at": "2014-02-01T00:05:51.649000Z", "entity": { "status": "paid", "customer_uri": "/v1/customers/CU6sMbi8BB4uDIiiRBHsTT7O", "_type": "credit", "fee": null, "description": "Publisher Payment", "state": "cleared", "created_at": "2014-02-01T00:05:51.082974Z", "amount": 420, "events_uri": "/v1/credits/CR4KSjzulE3ybYSoih97pBDc/events", "uri": "/v1/marketplaces/TEST-MP6Y3Oqj9sturaxd8EcwRUrJ/accounts/CU6sMbi8BB4uDIiiRBHsTT7O/credits/CR4KSjzulE3ybYSoih97pBDc", "bank_account_uri": "/v1/marketplaces/TEST-MP6Y3Oqj9sturaxd8EcwRUrJ/bank_accounts/BA3D4dZrjDlczhwg1gqMSzjA", "transaction_number": "CR699-438-8375", "_uris": { "events_uri": { "_type": "page", "key": "events" }, "reversals_uri": { "_type": "page", "key": "reversals" }, "bank_account_uri": { "_type": "bank_account", "key": "bank_account" }, "customer_uri": { "_type": "customer", "key": "customer" }, "account_uri": { "_type": "account", "key": "account" }, "destination_uri": { "_type": "bank_account", "key": "destination" } }, "meta": {}, "account_uri": "/v1/marketplaces/TEST-MP6Y3Oqj9sturaxd8EcwRUrJ/accounts/CU6sMbi8BB4uDIiiRBHsTT7O", "appears_on_statement_as": "nibl", "reversals_uri": "/v1/marketplaces/TEST-MP6Y3Oqj9sturaxd8EcwRUrJ/credits/CR4KSjzulE3ybYSoih97pBDc/reversals", "destination_uri": "/v1/marketplaces/TEST-MP6Y3Oqj9sturaxd8EcwRUrJ/bank_accounts/BA3D4dZrjDlczhwg1gqMSzjA", "id": "CR4KSjzulE3ybYSoih97pBDc", "available_at": "2014-02-01T00:05:51.457087Z" }, "type": "credit.created", "uri": "/events/EV9c4d9adc8ad411e3a304026ba7cac9da", "id": "EV9c4d9adc8ad411e3a304026ba7cac9da" }

joeenzminger commented 10 years ago

As a note, I did originally have a V1 webhook configured, but removed it and added the V1.1 one. Maybe some kind of caching issue?

matthewfl commented 10 years ago

@joeenzminger are you seeing only V1 type callbacks, or a combination where some are V1.1 and some are V1?

joeenzminger commented 10 years ago

Just the V1 type callbacks

joeenzminger commented 10 years ago

any updates on this. Still seeing V1 events.

mjallday commented 10 years ago

I haven't been able to replicate this yet. I created a callback on your marketplace and I'm waiting for the event to come through to inspect.

Running the code manually resulted in the correct payload to come through so we're trawling the logs to find out what's going on.

joeenzminger commented 10 years ago

In the interim, could you send me an example of a V1.1 event (specifically those related to credit)? I'm working with C# and don't have much in the way of documentation to help me make sure my JSON parsing is correct.

mjallday commented 10 years ago

Sure thing @joeenzminger. We've found an issue within the serializer for the callbacks that may be at fault. I've got a test on the way and I'll let you know once we have a fix out.

{
   "meta":{
      "last":"/events?limit=10&offset=0",
      "first":"/events?limit=10&offset=0",
      "next":null,
      "href":"/events?limit=10&offset=0",
      "limit":10,
      "offset":0,
      "total":10,
      "previous":null
   },
   "events":[
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.368000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.368171Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7aa1164c8cef11e3b47828cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.created",
         "id":"EV7aa1164c8cef11e3b47828cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.368000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.368171Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7ad410d98cef11e3ad5128cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.succeeded",
         "id":"EV7ad410d98cef11e3ad5128cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.714000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.714477Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7ad5b6d78cef11e3bd6a28cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.updated",
         "id":"EV7ad5b6d78cef11e3bd6a28cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.849000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.849300Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7aea47f58cef11e39c0328cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.updated",
         "id":"EV7aea47f58cef11e39c0328cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.982000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.982834Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7afea8198cef11e3a56e28cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.updated",
         "id":"EV7afea8198cef11e3a56e28cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.253000Z",
         "entity":{
            "customers":[
               {
                  "name":"Merchants, Inc.",
                  "links":{
                     "source":null,
                     "destination":null
                  },
                  "created_at":"2014-02-03T16:23:13.243807Z",
                  "updated_at":"2014-02-03T16:23:13.253364Z",
                  "dob_month":1,
                  "phone":"+19046281796",
                  "href":"/customers/CU3JfT5YxUPuLGrIQXNkgULJ",
                  "meta":{

                  },
                  "dob_year":1842,
                  "email":"email.1@y.com",
                  "address":{
                     "city":"San Francisco",
                     "line2":null,
                     "line1":null,
                     "state":null,
                     "postal_code":"94110",
                     "country_code":"USA"
                  },
                  "id":"CU3JfT5YxUPuLGrIQXNkgULJ",
                  "business_name":"Merchants, Inc.",
                  "ssn_last4":"xxxx",
                  "merchant_status":"underwritten",
                  "ein":"123000000"
               }
            ],
            "links":{
               "customers.source":"/resources/{customers.source}",
               "customers.card_holds":"/customers/{customers.id}/card_holds",
               "customers.bank_accounts":"/customers/{customers.id}/bank_accounts",
               "customers.debits":"/customers/{customers.id}/debits",
               "customers.destination":"/resources/{customers.destination}",
               "customers.cards":"/customers/{customers.id}/cards",
               "customers.transactions":"/customers/{customers.id}/transactions",
               "customers.refunds":"/customers/{customers.id}/refunds",
               "customers.reversals":"/customers/{customers.id}/reversals",
               "customers.orders":"/customers/{customers.id}/orders",
               "customers.credits":"/customers/{customers.id}/credits"
            }
         },
         "href":"/events/EV7a8df7c58cef11e3bc2928cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"account.created",
         "id":"EV7a8df7c58cef11e3bc2928cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.270000Z",
         "entity":{
            "bank_accounts":[
               {
                  "routing_number":"325182797",
                  "bank_name":"Banko De Ismus",
                  "account_type":"CHECKING",
                  "name":"Fit Finlay",
                  "links":{
                     "customer":"CU3JfT5YxUPuLGrIQXNkgULJ",
                     "bank_account_verification":null
                  },
                  "can_credit":true,
                  "created_at":"2014-02-03T16:23:13.270385Z",
                  "fingerprint":"12341234",
                  "updated_at":"2014-02-03T16:23:13.270386Z",
                  "href":"/bank_accounts/BA3JgWwblZWW0IfvNNd9Z6ZF",
                  "meta":{

                  },
                  "account_number":"xxxxx1234",
                  "address":{
                     "city":null,
                     "line2":null,
                     "line1":null,
                     "state":null,
                     "postal_code":null,
                     "country_code":null
                  },
                  "can_debit":true,
                  "id":"BA3JgWwblZWW0IfvNNd9Z6ZF"
               }
            ],
            "links":{
               "bank_accounts.credits":"/bank_accounts/{bank_accounts.id}/credits",
               "bank_accounts.bank_account_verifications":"/bank_accounts/{bank_accounts.id}/verifications",
               "bank_accounts.customer":"/customers/{bank_accounts.customer}",
               "bank_accounts.debits":"/bank_accounts/{bank_accounts.id}/debits",
               "bank_accounts.bank_account_verification":"/verifications/{bank_accounts.bank_account_verification}"
            }
         },
         "href":"/events/EV7a9259808cef11e3bc4628cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"bank_account.created",
         "id":"EV7a9259808cef11e3bc4628cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.310000Z",
         "entity":{
            "customers":[
               {
                  "name":null,
                  "links":{
                     "source":null,
                     "destination":null
                  },
                  "created_at":"2014-02-03T16:23:13.310741Z",
                  "updated_at":"2014-02-03T16:23:13.310742Z",
                  "dob_month":null,
                  "phone":null,
                  "href":"/customers/CU3Jkyu6WqTcQUlKXgmlQxIP",
                  "meta":{

                  },
                  "dob_year":null,
                  "email":"email.3@y.com",
                  "address":{
                     "city":null,
                     "line2":null,
                     "line1":null,
                     "state":null,
                     "postal_code":null,
                     "country_code":null
                  },
                  "id":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                  "business_name":null,
                  "ssn_last4":null,
                  "merchant_status":"underwritten",
                  "ein":null
               }
            ],
            "links":{
               "customers.source":"/resources/{customers.source}",
               "customers.card_holds":"/customers/{customers.id}/card_holds",
               "customers.bank_accounts":"/customers/{customers.id}/bank_accounts",
               "customers.debits":"/customers/{customers.id}/debits",
               "customers.destination":"/resources/{customers.destination}",
               "customers.cards":"/customers/{customers.id}/cards",
               "customers.transactions":"/customers/{customers.id}/transactions",
               "customers.refunds":"/customers/{customers.id}/refunds",
               "customers.reversals":"/customers/{customers.id}/reversals",
               "customers.orders":"/customers/{customers.id}/orders",
               "customers.credits":"/customers/{customers.id}/credits"
            }
         },
         "href":"/events/EV7a983e7a8cef11e3a62b28cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"account.created",
         "id":"EV7a983e7a8cef11e3a62b28cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.312000Z",
         "entity":{
            "bank_accounts":[
               {
                  "routing_number":"325182797",
                  "bank_name":"Banko De Ismus",
                  "account_type":"CHECKING",
                  "name":"Fit Finlay",
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "bank_account_verification":null
                  },
                  "can_credit":true,
                  "created_at":"2014-02-03T16:23:13.312498Z",
                  "fingerprint":"3bc0c2f504ca473c8c52c7a7d18aaa09",
                  "updated_at":"2014-02-03T16:23:13.312499Z",
                  "href":"/bank_accounts/BA3JkEB6XB0YMLP4hyDwHsrd",
                  "meta":{

                  },
                  "account_number":"xxxxx1234",
                  "address":{
                     "city":null,
                     "line2":null,
                     "line1":"foo",
                     "state":null,
                     "postal_code":null,
                     "country_code":null
                  },
                  "can_debit":false,
                  "id":"BA3JkEB6XB0YMLP4hyDwHsrd"
               }
            ],
            "links":{
               "bank_accounts.credits":"/bank_accounts/{bank_accounts.id}/credits",
               "bank_accounts.bank_account_verifications":"/bank_accounts/{bank_accounts.id}/verifications",
               "bank_accounts.customer":"/customers/{bank_accounts.customer}",
               "bank_accounts.debits":"/bank_accounts/{bank_accounts.id}/debits",
               "bank_accounts.bank_account_verification":"/verifications/{bank_accounts.bank_account_verification}"
            }
         },
         "href":"/events/EV7a988de38cef11e38aa528cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"bank_account.created",
         "id":"EV7a988de38cef11e38aa528cfe9603dcf"
      },
      {
         "links":{

         },
         "occurred_at":"2014-02-03T16:23:13.982000Z",
         "entity":{
            "credits":[
               {
                  "status":"succeeded",
                  "transaction_number":"CR917-358-5366",
                  "description":null,
                  "links":{
                     "customer":"CU3Jkyu6WqTcQUlKXgmlQxIP",
                     "destination":"BA3JkEB6XB0YMLP4hyDwHsrd",
                     "order":null
                  },
                  "created_at":"2014-02-03T16:23:13.323577Z",
                  "updated_at":"2014-02-03T16:23:13.982834Z",
                  "failure_reason":null,
                  "currency":"USD",
                  "amount":123,
                  "href":"/credits/CR3Jl5ARup39cw0c7DmFiX1B",
                  "meta":{

                  },
                  "failure_reason_code":null,
                  "appears_on_statement_as":"hiya.bom",
                  "id":"CR3Jl5ARup39cw0c7DmFiX1B"
               }
            ],
            "links":{
               "credits.order":"/orders/{credits.order}",
               "credits.customer":"/customers/{credits.customer}",
               "credits.destination":"/resources/{credits.destination}",
               "credits.reversals":"/credits/{credits.id}/reversals",
               "credits.events":"/credits/{credits.id}/events"
            }
         },
         "href":"/events/EV7a9aa2788cef11e3906d28cfe9603dcf",
         "callback_statuses":{
            "failed":0,
            "retrying":0,
            "pending":0,
            "succeeded":0
         },
         "type":"credit.created",
         "id":"EV7a9aa2788cef11e3906d28cfe9603dcf"
      }
   ],
   "links":{
      "events.callbacks":"/events/{events.self}/callbacks"
   }
}
joeenzminger commented 10 years ago

Webhooks coming through as expected now. Thanks!