From eaa89d47fa4020d3810ee7df4ad2b79ff29cfc46 Mon Sep 17 00:00:00 2001 From: "Hemanth V. Alluri" Date: Sun, 9 Jun 2019 12:43:32 +0530 Subject: [PATCH] webhooks/stripe: Add fixtures for invoice and invoiceitem updates. --- .../fixtures/invoice_updated__open.json | 149 ++++++++++++++++++ .../fixtures/invoice_updated__paid.json | 125 +++++++++++++++ .../invoiceitem_updated__description.json | 41 +++++ .../invoiceitem_updated__quantity.json | 41 +++++ 4 files changed, 356 insertions(+) create mode 100644 zerver/webhooks/stripe/fixtures/invoice_updated__open.json create mode 100644 zerver/webhooks/stripe/fixtures/invoice_updated__paid.json create mode 100644 zerver/webhooks/stripe/fixtures/invoiceitem_updated__description.json create mode 100644 zerver/webhooks/stripe/fixtures/invoiceitem_updated__quantity.json diff --git a/zerver/webhooks/stripe/fixtures/invoice_updated__open.json b/zerver/webhooks/stripe/fixtures/invoice_updated__open.json new file mode 100644 index 0000000000..3cccd0eca0 --- /dev/null +++ b/zerver/webhooks/stripe/fixtures/invoice_updated__open.json @@ -0,0 +1,149 @@ +{ + "object": "event", + "type": "invoice.updated", + "pending_webhooks": 1, + "created": 1560063585, + "livemode": false, + "request": { + "idempotency_key": null, + "id": "req_wRT7KgbXvlQMfC" + }, + "data": { + "previous_attributes": { + "status": "draft", + "due_date": null, + "invoice_pdf": null, + "status_transitions": { + "finalized_at": null + }, + "number": "B7C8CA7D-DRAFT", + "ending_balance": null, + "payment_intent": null, + "hosted_invoice_url": null + }, + "object": { + "default_tax_rates": [], + "livemode": false, + "tax": null, + "number": "B7C8CA7D-0001", + "attempt_count": 0, + "currency": "usd", + "payment_intent": "pi_1EjL0HHuGUuNWDDZ6TdrsWzQ", + "default_payment_method": null, + "total": 3000, + "account_name": null, + "custom_fields": [ + { + "name": "Custom field", + "value": "test value" + } + ], + "customer_name": "Test Customer", + "customer_shipping": null, + "customer_tax_ids": [], + "invoice_pdf": "https://pay.stripe.com/invoice/invst_444pftvnD8HFMJCXHn6TQKTDMc/pdf", + "billing": "send_invoice", + "footer": "Some random help and legal information.", + "description": "Thank you for your business!", + "customer_phone": null, + "id": "in_1EjKuzHuGUuNWDDZmFUP3FxU", + "webhooks_delivered_at": 1560063257, + "charge": null, + "period_end": 1560063257, + "discount": null, + "customer_tax_exempt": "none", + "post_payment_credit_notes_amount": 0, + "metadata": {}, + "status": "open", + "due_date": 1562655586, + "pre_payment_credit_notes_amount": 0, + "customer_email": "test_customer@test.gmail.com", + "collection_method": "send_invoice", + "statement_descriptor": null, + "attempted": false, + "amount_paid": 0, + "object": "invoice", + "amount_remaining": 3000, + "paid": false, + "customer_address": null, + "auto_advance": true, + "ending_balance": 0, + "billing_reason": "manual", + "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_444pftvnD8HFMJCXHn6TQKTDMc", + "period_start": 1560063257, + "subtotal": 3000, + "tax_percent": null, + "subscription": null, + "customer": "cus_FDmT2sIGjFskP2", + "total_tax_amounts": [], + "application_fee_amount": null, + "next_payment_attempt": null, + "created": 1560063257, + "status_transitions": { + "voided_at": null, + "finalized_at": 1560063585, + "marked_uncollectible_at": null, + "paid_at": null + }, + "default_source": null, + "lines": { + "has_more": false, + "total_count": 2, + "object": "list", + "data": [ + { + "discountable": true, + "livemode": false, + "description": "Watermelons", + "subscription": null, + "proration": false, + "object": "line_item", + "period": { + "start": 1560063400, + "end": 1560063400 + }, + "tax_rates": [], + "currency": "usd", + "amount": 1000, + "invoice_item": "ii_1EjKxIHuGUuNWDDZhiVHinLl", + "tax_amounts": [], + "plan": null, + "quantity": 2, + "type": "invoiceitem", + "id": "ii_1EjKxIHuGUuNWDDZhiVHinLl", + "metadata": {} + }, + { + "discountable": true, + "livemode": false, + "description": "Apples", + "subscription": null, + "proration": false, + "object": "line_item", + "period": { + "start": 1560063257, + "end": 1560063257 + }, + "tax_rates": [], + "currency": "usd", + "amount": 2000, + "invoice_item": "ii_1EjKuzHuGUuNWDDZKrPUb2KA", + "tax_amounts": [], + "plan": null, + "quantity": 10, + "type": "invoiceitem", + "id": "ii_1EjKuzHuGUuNWDDZKrPUb2KA", + "metadata": {} + } + ], + "url": "/v1/invoices/in_1EjKuzHuGUuNWDDZmFUP3FxU/lines" + }, + "account_country": "US", + "starting_balance": 0, + "amount_due": 3000, + "receipt_number": null + } + }, + "id": "evt_1EjL0IHuGUuNWDDZCFLOYrNv", + "api_version": "2019-03-14" +} diff --git a/zerver/webhooks/stripe/fixtures/invoice_updated__paid.json b/zerver/webhooks/stripe/fixtures/invoice_updated__paid.json new file mode 100644 index 0000000000..43ac739043 --- /dev/null +++ b/zerver/webhooks/stripe/fixtures/invoice_updated__paid.json @@ -0,0 +1,125 @@ +{ + "object": "event", + "type": "invoice.updated", + "pending_webhooks": 1, + "created": 1560064810, + "livemode": false, + "request": { + "idempotency_key": null, + "id": "req_4ITsSSm2tprAwz" + }, + "data": { + "previous_attributes": { + "status": "draft", + "due_date": null, + "invoice_pdf": null, + "attempted": false, + "number": "113948B9-DRAFT", + "ending_balance": null, + "auto_advance": true, + "paid": false, + "status_transitions": { + "finalized_at": null, + "paid_at": null + }, + "hosted_invoice_url": null + }, + "object": { + "default_tax_rates": [], + "livemode": false, + "tax": null, + "number": "113948B9-0001", + "attempt_count": 0, + "currency": "usd", + "payment_intent": null, + "default_payment_method": null, + "total": 100, + "account_name": null, + "custom_fields": null, + "customer_name": "Hemanth V. Alluri", + "customer_shipping": null, + "customer_tax_ids": [], + "invoice_pdf": "https://pay.stripe.com/invoice/invst_iTAW0hYwxklggGxPhtXkSyUF8y/pdf", + "billing": "send_invoice", + "footer": null, + "description": null, + "customer_phone": null, + "id": "in_1EjLINHuGUuNWDDZjDf2WNqd", + "webhooks_delivered_at": 1560064708, + "charge": null, + "period_end": 1560064707, + "discount": null, + "customer_tax_exempt": "none", + "post_payment_credit_notes_amount": 0, + "metadata": {}, + "status": "paid", + "due_date": 1560151211, + "pre_payment_credit_notes_amount": 0, + "customer_email": "hemanth.alluri.123@gmail.com", + "collection_method": "send_invoice", + "statement_descriptor": null, + "attempted": true, + "amount_paid": 100, + "object": "invoice", + "amount_remaining": 0, + "paid": true, + "customer_address": null, + "auto_advance": false, + "ending_balance": 0, + "billing_reason": "manual", + "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_iTAW0hYwxklggGxPhtXkSyUF8y", + "period_start": 1560064707, + "subtotal": 100, + "tax_percent": null, + "subscription": null, + "customer": "cus_FDmrSwQt9Fck5M", + "total_tax_amounts": [], + "application_fee_amount": null, + "next_payment_attempt": null, + "created": 1560064707, + "status_transitions": { + "voided_at": null, + "finalized_at": 1560064810, + "marked_uncollectible_at": null, + "paid_at": 1560064810 + }, + "default_source": null, + "lines": { + "has_more": false, + "total_count": 1, + "object": "list", + "data": [ + { + "discountable": true, + "livemode": false, + "description": "Pen", + "subscription": null, + "proration": false, + "object": "line_item", + "period": { + "start": 1560064707, + "end": 1560064707 + }, + "tax_rates": [], + "currency": "usd", + "amount": 100, + "invoice_item": "ii_1EjLINHuGUuNWDDZJX6Nl48C", + "tax_amounts": [], + "plan": null, + "quantity": 1, + "type": "invoiceitem", + "id": "ii_1EjLINHuGUuNWDDZJX6Nl48C", + "metadata": {} + } + ], + "url": "/v1/invoices/in_1EjLINHuGUuNWDDZjDf2WNqd/lines" + }, + "account_country": "US", + "starting_balance": 0, + "amount_due": 100, + "receipt_number": null + } + }, + "id": "evt_1EjLK2HuGUuNWDDZZ88XyWhO", + "api_version": "2019-03-14" +} diff --git a/zerver/webhooks/stripe/fixtures/invoiceitem_updated__description.json b/zerver/webhooks/stripe/fixtures/invoiceitem_updated__description.json new file mode 100644 index 0000000000..f63191ae1b --- /dev/null +++ b/zerver/webhooks/stripe/fixtures/invoiceitem_updated__description.json @@ -0,0 +1,41 @@ +{ + "object": "event", + "type": "invoiceitem.updated", + "pending_webhooks": 1, + "created": 1560063405, + "livemode": false, + "request": { + "idempotency_key": null, + "id": "req_9TWblyRuNHDMEr" + }, + "data": { + "previous_attributes": { + "description": null + }, + "object": { + "customer": "cus_FDmT2sIGjFskP2", + "discountable": true, + "livemode": false, + "description": "Watermelons", + "subscription": null, + "proration": false, + "object": "invoiceitem", + "period": { + "start": 1560063400, + "end": 1560063400 + }, + "tax_rates": [], + "currency": "usd", + "amount": 0, + "plan": null, + "invoice": "in_1EjKuzHuGUuNWDDZmFUP3FxU", + "date": 1560063400, + "unit_amount": 0, + "quantity": 1, + "id": "ii_1EjKxIHuGUuNWDDZhiVHinLl", + "metadata": {} + } + }, + "id": "evt_1EjKxNHuGUuNWDDZXVzriO4I", + "api_version": "2019-03-14" +} diff --git a/zerver/webhooks/stripe/fixtures/invoiceitem_updated__quantity.json b/zerver/webhooks/stripe/fixtures/invoiceitem_updated__quantity.json new file mode 100644 index 0000000000..6d9eefc836 --- /dev/null +++ b/zerver/webhooks/stripe/fixtures/invoiceitem_updated__quantity.json @@ -0,0 +1,41 @@ +{ + "object": "event", + "type": "invoiceitem.updated", + "pending_webhooks": 1, + "created": 1560063407, + "livemode": false, + "request": { + "idempotency_key": null, + "id": "req_AApRWrApSzs6rP" + }, + "data": { + "previous_attributes": { + "quantity": 1 + }, + "object": { + "customer": "cus_FDmT2sIGjFskP2", + "discountable": true, + "livemode": false, + "description": "Watermelons", + "subscription": null, + "proration": false, + "object": "invoiceitem", + "period": { + "start": 1560063400, + "end": 1560063400 + }, + "tax_rates": [], + "currency": "usd", + "amount": 0, + "plan": null, + "invoice": "in_1EjKuzHuGUuNWDDZmFUP3FxU", + "date": 1560063400, + "unit_amount": 0, + "quantity": 0, + "id": "ii_1EjKxIHuGUuNWDDZhiVHinLl", + "metadata": {} + } + }, + "id": "evt_1EjKxPHuGUuNWDDZvbb9RsLf", + "api_version": "2019-03-14" +}