diff --git a/lib/stripe_mock/api/webhooks.rb b/lib/stripe_mock/api/webhooks.rb index 18b0a9b1d..1eece2aa3 100644 --- a/lib/stripe_mock/api/webhooks.rb +++ b/lib/stripe_mock/api/webhooks.rb @@ -53,6 +53,9 @@ def self.event_list 'customer.source.created', 'customer.source.deleted', 'customer.source.updated', + 'customer.card.created', + 'customer.card.deleted', + 'customer.card.updated', 'customer.created', 'customer.updated', 'customer.deleted', diff --git a/lib/stripe_mock/data.rb b/lib/stripe_mock/data.rb index c43fceef6..b2ef55701 100644 --- a/lib/stripe_mock/data.rb +++ b/lib/stripe_mock/data.rb @@ -118,12 +118,14 @@ def self.mock_customer(sources, params) currency: currency, sources: { object: "list", + has_more: false, total_count: sources.size, url: "/v1/customers/#{cus_id}/sources", data: sources }, subscriptions: { object: "list", + has_more: false, total_count: 0, url: "/v1/customers/#{cus_id}/subscriptions", data: [] @@ -337,6 +339,7 @@ def self.mock_invoice(lines, params={}) period_start: 1349738950, lines: { object: "list", + has_more: false, total_count: lines.count, url: "/v1/invoices/#{in_id}/lines", data: lines @@ -528,6 +531,7 @@ def self.mock_recipient(cards, params={}) }, cards: { object: "list", + has_more: false, url: "/v1/recipients/#{rp_id}/cards", data: cards, total_count: cards.count diff --git a/lib/stripe_mock/webhook_fixtures/customer.card.created.json b/lib/stripe_mock/webhook_fixtures/customer.card.created.json new file mode 100644 index 000000000..9a8ec4c69 --- /dev/null +++ b/lib/stripe_mock/webhook_fixtures/customer.card.created.json @@ -0,0 +1,32 @@ +{ + "created": 1326853478, + "livemode": false, + "id": "evt_00000000000000", + "type": "customer.card.created", + "object": "event", + "data": { + "object": { + "id": "card_VALID", + "object": "card", + "last4": "4242", + "type": "Visa", + "brand": "Visa", + "funding": "credit", + "exp_month": 3, + "exp_year": 2020, + "fingerprint": "wXWJT135mEK107G8", + "customer": "cus_VALID", + "country": "US", + "name": "Testy Tester", + "address_line1": null, + "address_line2": null, + "address_city": null, + "address_state": null, + "address_zip": null, + "address_country": null, + "cvc_check": "pass", + "address_line1_check": null, + "address_zip_check": null + } + } +} diff --git a/lib/stripe_mock/webhook_fixtures/customer.card.deleted.json b/lib/stripe_mock/webhook_fixtures/customer.card.deleted.json new file mode 100644 index 000000000..301cb777d --- /dev/null +++ b/lib/stripe_mock/webhook_fixtures/customer.card.deleted.json @@ -0,0 +1,32 @@ +{ + "created": 1326853478, + "livemode": false, + "id": "evt_00000000000000", + "type": "customer.card.deleted", + "object": "event", + "data": { + "object": { + "id": "card_VALID", + "object": "card", + "last4": "4242", + "type": "Visa", + "brand": "Visa", + "funding": "credit", + "exp_month": 3, + "exp_year": 2020, + "fingerprint": "wXWJT135mEK107G8", + "customer": "cus_VALID", + "country": "US", + "name": "Testy Tester", + "address_line1": null, + "address_line2": null, + "address_city": null, + "address_state": null, + "address_zip": null, + "address_country": null, + "cvc_check": "pass", + "address_line1_check": null, + "address_zip_check": null + } + } +} diff --git a/lib/stripe_mock/webhook_fixtures/customer.card.updated.json b/lib/stripe_mock/webhook_fixtures/customer.card.updated.json new file mode 100644 index 000000000..ea543693f --- /dev/null +++ b/lib/stripe_mock/webhook_fixtures/customer.card.updated.json @@ -0,0 +1,36 @@ +{ + "created": 1326853478, + "livemode": false, + "id": "evt_00000000000000", + "type": "customer.card.updated", + "object": "event", + "data": { + "object": { + "id": "card_VALID", + "object": "card", + "last4": "4242", + "type": "Visa", + "brand": "Visa", + "funding": "credit", + "exp_month": 3, + "exp_year": 2020, + "fingerprint": "wXWJT135mEK107G8", + "customer": "cus_VALID", + "country": "US", + "name": "Testy Tester", + "address_line1": null, + "address_line2": null, + "address_city": null, + "address_state": null, + "address_zip": null, + "address_country": null, + "cvc_check": "pass", + "address_line1_check": null, + "address_zip_check": null + }, + "previous_attributes": + { + "name": "Testy Tester Jr." + } + } +}