stripe_model_callbacks 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -1
- data/app/models/stripe_model_callbacks/application_record.rb +17 -0
- data/app/services/stripe_model_callbacks/account/external_account/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/attributes_assigner_service.rb +1 -1
- data/app/services/stripe_model_callbacks/base_service.rb +35 -3
- data/app/services/stripe_model_callbacks/charge/dispute_updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/charge/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/configure_service.rb +52 -24
- data/app/services/stripe_model_callbacks/coupon/sync_all.rb +9 -0
- data/app/services/stripe_model_callbacks/coupon/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/bank_account/deleted_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/deleted_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/discount_updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/source_updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/subscription/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/customer/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/event_mocker_service.rb +1 -1
- data/app/services/stripe_model_callbacks/invoice/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/invoice_item/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/notifier_service.rb +1 -1
- data/app/services/stripe_model_callbacks/order/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/payout/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/plan/sync_all.rb +9 -0
- data/app/services/stripe_model_callbacks/plan/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/price/updated_service.rb +14 -0
- data/app/services/stripe_model_callbacks/product/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/recipient/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/refund/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/review/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/sku/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/source/updated_service.rb +1 -1
- data/app/services/stripe_model_callbacks/subscription/state_checker_service.rb +2 -2
- data/app/services/stripe_model_callbacks/subscription_schedule/updated_service.rb +46 -0
- data/app/services/stripe_model_callbacks/sync_everything.rb +8 -0
- data/app/services/stripe_model_callbacks/sync_from_stripe.rb +29 -0
- data/app/services/stripe_model_callbacks/tax_rate/updated_service.rb +27 -0
- data/app/services/stripe_model_callbacks/transfer/updated_service.rb +1 -1
- data/db/migrate/20200317160513_add_auto_advance_and_billing_reason_to_stripe_invoices.rb +6 -0
- data/db/migrate/20200317160602_add_status_and_status_transitions_to_stripe_invoices.rb +10 -0
- data/db/migrate/20200317180115_add_product_type_to_products.rb +5 -0
- data/db/migrate/20200317181224_rename_stripe_invoices_application_fee_to_application_fee_amount.rb +6 -0
- data/db/migrate/20200320105158_make_stripe_invoices_forgive_optional.rb +5 -0
- data/db/migrate/20200320114859_make_stripe_invoice_closed_optional.rb +5 -0
- data/db/migrate/20200323143634_add_amount_paid_and_remaining_and_invoice_url_and_pdf.rb +11 -0
- data/db/migrate/20200331074940_add_unit_label_to_stripe_products.rb +5 -0
- data/db/migrate/20200331075241_add_metered_info_to_stripe_plans.rb +9 -0
- data/db/migrate/20200513131105_create_stripe_subscription_schedules.rb +31 -0
- data/db/migrate/20200513131120_create_stripe_subscription_schedule_phases.rb +21 -0
- data/db/migrate/20200513131640_create_stripe_subscription_schedule_phase_plans.rb +13 -0
- data/db/migrate/20200514132247_add_stripe_id_uniq_to_stripe_invoices.rb +8 -0
- data/db/migrate/20200520152604_change_stripe_subscription_schedule_phase_id_to_bigint.rb +27 -0
- data/db/migrate/20200529144649_add_latest_invoice_id_to_stripe_subscription.rb +5 -0
- data/db/migrate/20201223173035_rename_stripe_subscriptions_start_to_start_date.rb +5 -0
- data/db/migrate/20201223202117_create_stripe_tax_rates.rb +15 -0
- data/db/migrate/20201224120534_create_stripe_subscription_default_tax_rates.rb +9 -0
- data/db/migrate/20201224122058_create_stripe_prices.rb +26 -0
- data/db/migrate/20201224123838_add_stripe_price_to_stripe_subscription_items.rb +6 -0
- data/db/migrate/20211121155313_change_invoice_billing_to_nullable.rb +5 -0
- data/db/migrate/20211121155732_rename_invoices_billing_to_deprecated_billing.rb +5 -0
- data/lib/stripe_model_callbacks/configuration.rb +1 -1
- data/lib/stripe_model_callbacks/factories/stripe_bank_accounts.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_cards.rb +7 -0
- data/lib/stripe_model_callbacks/factories/stripe_charges.rb +11 -0
- data/lib/stripe_model_callbacks/factories/stripe_coupons.rb +21 -0
- data/lib/stripe_model_callbacks/factories/stripe_customers.rb +17 -0
- data/lib/stripe_model_callbacks/factories/stripe_discounts.rb +6 -0
- data/lib/stripe_model_callbacks/factories/stripe_disputes.rb +7 -0
- data/lib/stripe_model_callbacks/factories/stripe_invoice_items.rb +11 -0
- data/lib/stripe_model_callbacks/factories/stripe_invoices.rb +16 -0
- data/lib/stripe_model_callbacks/factories/stripe_order_items.rb +8 -0
- data/lib/stripe_model_callbacks/factories/stripe_orders.rb +9 -0
- data/lib/stripe_model_callbacks/factories/stripe_payouts.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_plans.rb +30 -0
- data/lib/stripe_model_callbacks/factories/stripe_prices.rb +3 -0
- data/lib/stripe_model_callbacks/factories/stripe_products.rb +18 -0
- data/lib/stripe_model_callbacks/factories/stripe_recipients.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_refunds.rb +9 -0
- data/lib/stripe_model_callbacks/factories/stripe_reviews.rb +6 -0
- data/lib/stripe_model_callbacks/factories/stripe_skus.rb +7 -0
- data/lib/stripe_model_callbacks/factories/stripe_sources.rb +8 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscription_default_tax_rates.rb +6 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscription_items.rb +19 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule.rb.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule_phase_plan.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule_phases.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_subscriptions.rb +40 -0
- data/lib/stripe_model_callbacks/factories/stripe_tax_rates.rb +5 -0
- data/lib/stripe_model_callbacks/factories/stripe_transfers.rb +8 -0
- data/lib/stripe_model_callbacks/factory_bot_definitions.rb +1 -1
- data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.created.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.deleted.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.updated.json +31 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.closed.json +65 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.created.json +65 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.funds_reinstated.json +65 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.funds_withdrawn.json +65 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.updated.json +96 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.refund.updated.json +28 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.refunded.json +98 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.created.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.deleted.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.updated.json +31 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.bank_account.deleted.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.created.json +36 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.deleted.json +47 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.created.json +36 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.deleted.json +36 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.updated.json +55 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.created.card.json +80 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.created.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.deleted.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.expiring.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.updated.json +56 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.created.2020-12-24.json +112 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.created.json +84 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.deleted.json +83 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.trial_will_end.json +88 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.updated.json +100 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.updated.json +50 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.created.json +135 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.payment_failed.json +100 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.payment_succeeded.json +207 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.sent.json +100 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.upcoming.json +100 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.updated.json +105 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.voided.json +152 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/invoiceitem/invoiceitem.created.json +34 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/order/order.created.json +72 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/order/order.updated.json +74 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.canceled.json +35 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.created.json +35 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.failed.json +35 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.paid.json +35 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.updated.json +37 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.created.json +32 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.deleted.json +27 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.updated.json +30 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.created.json +37 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.deleted.json +37 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.updated.json +40 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.created.json +49 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.deleted.json +48 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.updated.json +50 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.created.json +37 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.deleted.json +37 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.updated.json +39 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/review/review.closed.json +21 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/review/review.opened.json +21 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.created.json +36 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.deleted.json +36 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.updated.json +38 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.canceled.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.chargeable.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.failed.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.mandate_notification.json +53 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.transaction_created.json +21 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.canceled.json +81 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.created.json +77 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.updated.json +87 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/tax_rate/tax_rate.created.json +26 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/tax_rate/tax_rate.updated.json +29 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.created.json +41 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.reversed.json +40 -0
- data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.updated.json +44 -0
- data/lib/stripe_model_callbacks/models/stripe_bank_account.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_card.rb +2 -1
- data/lib/stripe_model_callbacks/models/stripe_charge.rb +3 -0
- data/lib/stripe_model_callbacks/models/stripe_coupon.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_customer.rb +4 -2
- data/lib/stripe_model_callbacks/models/stripe_discount.rb +10 -3
- data/lib/stripe_model_callbacks/models/stripe_dispute.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_invoice.rb +62 -7
- data/lib/stripe_model_callbacks/models/stripe_invoice_item.rb +2 -0
- data/lib/stripe_model_callbacks/models/stripe_order.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_order_item.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_payout.rb +2 -1
- data/lib/stripe_model_callbacks/models/stripe_plan.rb +4 -1
- data/lib/stripe_model_callbacks/models/stripe_price.rb +27 -0
- data/lib/stripe_model_callbacks/models/stripe_product.rb +17 -7
- data/lib/stripe_model_callbacks/models/stripe_recipient.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_refund.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_review.rb +1 -0
- data/lib/stripe_model_callbacks/models/stripe_sku.rb +13 -6
- data/lib/stripe_model_callbacks/models/stripe_source.rb +4 -2
- data/lib/stripe_model_callbacks/models/stripe_subscription.rb +56 -6
- data/lib/stripe_model_callbacks/models/stripe_subscription_default_tax_rate.rb +4 -0
- data/lib/stripe_model_callbacks/models/stripe_subscription_item.rb +19 -1
- data/lib/stripe_model_callbacks/models/stripe_subscription_schedule.rb +94 -0
- data/lib/stripe_model_callbacks/models/stripe_subscription_schedule_phase.rb +67 -0
- data/lib/stripe_model_callbacks/models/stripe_subscription_schedule_phase_plan.rb +37 -0
- data/lib/stripe_model_callbacks/models/stripe_tax_rate.rb +22 -0
- data/lib/stripe_model_callbacks/models/stripe_transfer.rb +1 -0
- data/lib/stripe_model_callbacks/version.rb +1 -1
- data/lib/stripe_model_callbacks.rb +1 -0
- metadata +163 -11
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "source.failed",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "src_00000000000000",
|
13
|
+
"object": "source",
|
14
|
+
"amount": null,
|
15
|
+
"client_secret": "src_client_secret_CGz4B3s2LM5ZBtZuTHwuPxgc",
|
16
|
+
"created": 1517902949,
|
17
|
+
"currency": "usd",
|
18
|
+
"flow": "receiver",
|
19
|
+
"livemode": false,
|
20
|
+
"metadata": {
|
21
|
+
},
|
22
|
+
"owner": {
|
23
|
+
"address": null,
|
24
|
+
"email": "jenny.rosen@example.com",
|
25
|
+
"name": null,
|
26
|
+
"phone": null,
|
27
|
+
"verified_address": null,
|
28
|
+
"verified_email": null,
|
29
|
+
"verified_name": null,
|
30
|
+
"verified_phone": null
|
31
|
+
},
|
32
|
+
"receiver": {
|
33
|
+
"address": "121042882-38381234567890123",
|
34
|
+
"amount_charged": 0,
|
35
|
+
"amount_received": 0,
|
36
|
+
"amount_returned": 0,
|
37
|
+
"refund_attributes_method": "email",
|
38
|
+
"refund_attributes_status": "missing"
|
39
|
+
},
|
40
|
+
"statement_descriptor": null,
|
41
|
+
"status": "pending",
|
42
|
+
"type": "ach_credit_transfer",
|
43
|
+
"usage": "reusable",
|
44
|
+
"ach_credit_transfer": {
|
45
|
+
"account_number": "test_52796e3294dc",
|
46
|
+
"routing_number": "110000000",
|
47
|
+
"fingerprint": "ecpwEzmBOSMOqQTL",
|
48
|
+
"bank_name": "TEST BANK",
|
49
|
+
"swift_code": "TSTEZ122"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.mandate_notification.json
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "source.mandate_notification",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "src_00000000000000",
|
13
|
+
"object": "source",
|
14
|
+
"amount": null,
|
15
|
+
"client_secret": "src_client_secret_CGz5Ss7pgMg0MVqljzgoEEUs",
|
16
|
+
"created": 1517903015,
|
17
|
+
"currency": "usd",
|
18
|
+
"flow": "receiver",
|
19
|
+
"livemode": false,
|
20
|
+
"metadata": {
|
21
|
+
},
|
22
|
+
"owner": {
|
23
|
+
"address": null,
|
24
|
+
"email": "jenny.rosen@example.com",
|
25
|
+
"name": null,
|
26
|
+
"phone": null,
|
27
|
+
"verified_address": null,
|
28
|
+
"verified_email": null,
|
29
|
+
"verified_name": null,
|
30
|
+
"verified_phone": null
|
31
|
+
},
|
32
|
+
"receiver": {
|
33
|
+
"address": "121042882-38381234567890123",
|
34
|
+
"amount_charged": 0,
|
35
|
+
"amount_received": 0,
|
36
|
+
"amount_returned": 0,
|
37
|
+
"refund_attributes_method": "email",
|
38
|
+
"refund_attributes_status": "missing"
|
39
|
+
},
|
40
|
+
"statement_descriptor": null,
|
41
|
+
"status": "pending",
|
42
|
+
"type": "ach_credit_transfer",
|
43
|
+
"usage": "reusable",
|
44
|
+
"ach_credit_transfer": {
|
45
|
+
"account_number": "test_52796e3294dc",
|
46
|
+
"routing_number": "110000000",
|
47
|
+
"fingerprint": "ecpwEzmBOSMOqQTL",
|
48
|
+
"bank_name": "TEST BANK",
|
49
|
+
"swift_code": "TSTEZ122"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "source.transaction.created",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "btctxn_00000000000000",
|
13
|
+
"object": "bitcoin_transaction",
|
14
|
+
"amount": 300,
|
15
|
+
"bitcoin_amount": 3000000,
|
16
|
+
"created": 1517906694,
|
17
|
+
"currency": "usd",
|
18
|
+
"receiver": "btcrcv_1B2J9N2eZvKYlo2C9nVfoiuu"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
{
|
2
|
+
"id": "evt_1GhxvLJ3a8kmO8fmoOLr4v1Z",
|
3
|
+
"object": "event",
|
4
|
+
"api_version": "2019-05-16",
|
5
|
+
"created": 1589289211,
|
6
|
+
"data": {
|
7
|
+
"object": {
|
8
|
+
"id": "sub_sched_1GhwDXJ3a8kmO8fmxeer3WCy",
|
9
|
+
"object": "subscription_schedule",
|
10
|
+
"billing": "charge_automatically",
|
11
|
+
"billing_thresholds": null,
|
12
|
+
"canceled_at": 1589289211,
|
13
|
+
"collection_method": "charge_automatically",
|
14
|
+
"completed_at": null,
|
15
|
+
"created": 1589282651,
|
16
|
+
"current_phase": null,
|
17
|
+
"customer": "cus_HG9JJV3LEHUjhO",
|
18
|
+
"default_payment_method": null,
|
19
|
+
"default_settings": {
|
20
|
+
"billing_thresholds": null,
|
21
|
+
"collection_method": "charge_automatically",
|
22
|
+
"default_payment_method": null,
|
23
|
+
"default_source": null,
|
24
|
+
"invoice_settings": null
|
25
|
+
},
|
26
|
+
"default_source": null,
|
27
|
+
"end_behavior": "cancel",
|
28
|
+
"invoice_settings": null,
|
29
|
+
"livemode": false,
|
30
|
+
"metadata": {
|
31
|
+
},
|
32
|
+
"phases": [
|
33
|
+
{
|
34
|
+
"add_invoice_items": [
|
35
|
+
],
|
36
|
+
"application_fee_percent": null,
|
37
|
+
"billing_thresholds": null,
|
38
|
+
"collection_method": "charge_automatically",
|
39
|
+
"coupon": null,
|
40
|
+
"default_payment_method": null,
|
41
|
+
"default_tax_rates": [
|
42
|
+
],
|
43
|
+
"end_date": 1606780800,
|
44
|
+
"invoice_settings": null,
|
45
|
+
"plans": [
|
46
|
+
{
|
47
|
+
"billing_thresholds": null,
|
48
|
+
"plan": "plan_HG4dIu1k8KqRWi",
|
49
|
+
"price": "plan_HG4dIu1k8KqRWi",
|
50
|
+
"quantity": 1,
|
51
|
+
"tax_rates": [
|
52
|
+
]
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"prorate": true,
|
56
|
+
"proration_behavior": "create_prorations",
|
57
|
+
"start_date": 1590969600,
|
58
|
+
"tax_percent": null,
|
59
|
+
"trial_end": null
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"released_at": null,
|
63
|
+
"released_subscription": null,
|
64
|
+
"renewal_behavior": "cancel",
|
65
|
+
"renewal_interval": null,
|
66
|
+
"status": "canceled",
|
67
|
+
"subscription": null
|
68
|
+
},
|
69
|
+
"previous_attributes": {
|
70
|
+
"canceled_at": null,
|
71
|
+
"status": "not_started"
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"livemode": false,
|
75
|
+
"pending_webhooks": 2,
|
76
|
+
"request": {
|
77
|
+
"id": "req_FZViwblmeNHmTw",
|
78
|
+
"idempotency_key": null
|
79
|
+
},
|
80
|
+
"type": "subscription_schedule.canceled"
|
81
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
{
|
2
|
+
"id": "evt_1GhwDXJ3a8kmO8fm05cNl8dF",
|
3
|
+
"object": "event",
|
4
|
+
"api_version": "2019-05-16",
|
5
|
+
"created": 1589282651,
|
6
|
+
"data": {
|
7
|
+
"object": {
|
8
|
+
"id": "sub_sched_1GhwDXJ3a8kmO8fm97mybWCy",
|
9
|
+
"object": "subscription_schedule",
|
10
|
+
"billing": "charge_automatically",
|
11
|
+
"billing_thresholds": null,
|
12
|
+
"canceled_at": null,
|
13
|
+
"collection_method": "charge_automatically",
|
14
|
+
"completed_at": null,
|
15
|
+
"created": 1589282651,
|
16
|
+
"current_phase": null,
|
17
|
+
"customer": "cus_HG9JJV3LEHUjhO",
|
18
|
+
"default_payment_method": null,
|
19
|
+
"default_settings": {
|
20
|
+
"billing_thresholds": null,
|
21
|
+
"collection_method": "charge_automatically",
|
22
|
+
"default_payment_method": null,
|
23
|
+
"default_source": null,
|
24
|
+
"invoice_settings": null
|
25
|
+
},
|
26
|
+
"default_source": null,
|
27
|
+
"end_behavior": "cancel",
|
28
|
+
"invoice_settings": null,
|
29
|
+
"livemode": false,
|
30
|
+
"metadata": {
|
31
|
+
},
|
32
|
+
"phases": [
|
33
|
+
{
|
34
|
+
"add_invoice_items": [
|
35
|
+
],
|
36
|
+
"application_fee_percent": null,
|
37
|
+
"billing_thresholds": null,
|
38
|
+
"collection_method": "charge_automatically",
|
39
|
+
"coupon": null,
|
40
|
+
"default_payment_method": null,
|
41
|
+
"default_tax_rates": [
|
42
|
+
],
|
43
|
+
"end_date": 1606780800,
|
44
|
+
"invoice_settings": null,
|
45
|
+
"plans": [
|
46
|
+
{
|
47
|
+
"billing_thresholds": null,
|
48
|
+
"plan": "plan_HG4dIu1k8KqRWi",
|
49
|
+
"price": "plan_HG4dIu1k8KqRWi",
|
50
|
+
"quantity": 2,
|
51
|
+
"tax_rates": [
|
52
|
+
]
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"prorate": true,
|
56
|
+
"proration_behavior": "create_prorations",
|
57
|
+
"start_date": 1590969600,
|
58
|
+
"tax_percent": null,
|
59
|
+
"trial_end": null
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"released_at": null,
|
63
|
+
"released_subscription": null,
|
64
|
+
"renewal_behavior": "cancel",
|
65
|
+
"renewal_interval": null,
|
66
|
+
"status": "not_started",
|
67
|
+
"subscription": null
|
68
|
+
}
|
69
|
+
},
|
70
|
+
"livemode": false,
|
71
|
+
"pending_webhooks": 1,
|
72
|
+
"request": {
|
73
|
+
"id": "req_5afiaPgOrP3nYc",
|
74
|
+
"idempotency_key": null
|
75
|
+
},
|
76
|
+
"type": "subscription_schedule.created"
|
77
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
{
|
2
|
+
"id": "evt_1Ghw7aJ3a8kmO8fm2vPIdi50",
|
3
|
+
"object": "event",
|
4
|
+
"api_version": "2019-05-16",
|
5
|
+
"created": 1589282282,
|
6
|
+
"data": {
|
7
|
+
"object": {
|
8
|
+
"id": "sub_sched_1GhdpNJ3a8kmO8fmNG2vKBYY",
|
9
|
+
"object": "subscription_schedule",
|
10
|
+
"billing": "charge_automatically",
|
11
|
+
"billing_thresholds": null,
|
12
|
+
"canceled_at": null,
|
13
|
+
"collection_method": "charge_automatically",
|
14
|
+
"completed_at": null,
|
15
|
+
"created": 1589211961,
|
16
|
+
"current_phase": null,
|
17
|
+
"customer": "cus_HG9VgDZsSjwhZG",
|
18
|
+
"default_payment_method": null,
|
19
|
+
"default_settings": {
|
20
|
+
"billing_thresholds": null,
|
21
|
+
"collection_method": "charge_automatically",
|
22
|
+
"default_payment_method": null,
|
23
|
+
"default_source": null,
|
24
|
+
"invoice_settings": {
|
25
|
+
"days_until_due": null
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"default_source": null,
|
29
|
+
"end_behavior": "release",
|
30
|
+
"invoice_settings": {
|
31
|
+
"days_until_due": null
|
32
|
+
},
|
33
|
+
"livemode": false,
|
34
|
+
"metadata": {
|
35
|
+
},
|
36
|
+
"phases": [
|
37
|
+
{
|
38
|
+
"add_invoice_items": [
|
39
|
+
],
|
40
|
+
"application_fee_percent": null,
|
41
|
+
"billing_thresholds": null,
|
42
|
+
"collection_method": "charge_automatically",
|
43
|
+
"coupon": null,
|
44
|
+
"default_payment_method": null,
|
45
|
+
"default_tax_rates": [
|
46
|
+
],
|
47
|
+
"end_date": 1623456000,
|
48
|
+
"invoice_settings": null,
|
49
|
+
"plans": [
|
50
|
+
{
|
51
|
+
"billing_thresholds": null,
|
52
|
+
"plan": "plan_HG4dIu1k8KqRWi",
|
53
|
+
"price": "plan_HG4dIu1k8KqRWi",
|
54
|
+
"quantity": 1,
|
55
|
+
"tax_rates": [
|
56
|
+
]
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"prorate": true,
|
60
|
+
"proration_behavior": "create_prorations",
|
61
|
+
"start_date": 1620777600,
|
62
|
+
"tax_percent": null,
|
63
|
+
"trial_end": null
|
64
|
+
}
|
65
|
+
],
|
66
|
+
"released_at": null,
|
67
|
+
"released_subscription": null,
|
68
|
+
"renewal_behavior": "release",
|
69
|
+
"renewal_interval": null,
|
70
|
+
"status": "not_started",
|
71
|
+
"subscription": null
|
72
|
+
},
|
73
|
+
"previous_attributes": {
|
74
|
+
"default_settings": {
|
75
|
+
"invoice_settings": null
|
76
|
+
},
|
77
|
+
"invoice_settings": null
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"livemode": false,
|
81
|
+
"pending_webhooks": 2,
|
82
|
+
"request": {
|
83
|
+
"id": "req_sx6SHFvO3ZyCYh",
|
84
|
+
"idempotency_key": null
|
85
|
+
},
|
86
|
+
"type": "subscription_schedule.updated"
|
87
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "tax_rate.created",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-02-06",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "txr_00000000000000",
|
13
|
+
"object": "tax_rate",
|
14
|
+
"active": true,
|
15
|
+
"created": 1608755171,
|
16
|
+
"description": "VAT Germany",
|
17
|
+
"display_name": "VAT",
|
18
|
+
"inclusive": false,
|
19
|
+
"jurisdiction": "DE",
|
20
|
+
"livemode": false,
|
21
|
+
"metadata": {
|
22
|
+
},
|
23
|
+
"percentage": 16
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "tax_rate.updated",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-02-06",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "txr_00000000000000",
|
13
|
+
"object": "tax_rate",
|
14
|
+
"active": true,
|
15
|
+
"created": 1608755201,
|
16
|
+
"description": "VAT Germany",
|
17
|
+
"display_name": "VAT",
|
18
|
+
"inclusive": false,
|
19
|
+
"jurisdiction": "DE",
|
20
|
+
"livemode": false,
|
21
|
+
"metadata": {
|
22
|
+
},
|
23
|
+
"percentage": 16
|
24
|
+
},
|
25
|
+
"previous_attributes": {
|
26
|
+
"display_name": "Old name"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "transfer.created",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "tr_00000000000000",
|
13
|
+
"object": "transfer",
|
14
|
+
"amount": 1100,
|
15
|
+
"amount_reversed": 0,
|
16
|
+
"balance_transaction": "txn_00000000000000",
|
17
|
+
"created": 1517907211,
|
18
|
+
"currency": "usd",
|
19
|
+
"description": null,
|
20
|
+
"destination": "acct_1Brq15AT5SYrvIfd",
|
21
|
+
"destination_payment": "py_CH0DW4ihzdQQCd",
|
22
|
+
"livemode": false,
|
23
|
+
"metadata": {
|
24
|
+
},
|
25
|
+
"reversals": {
|
26
|
+
"object": "list",
|
27
|
+
"data": [
|
28
|
+
|
29
|
+
],
|
30
|
+
"has_more": false,
|
31
|
+
"total_count": 0,
|
32
|
+
"url": "/v1/transfers/tr_1BsSClAT5SYrvIfdN12tbSTG/reversals"
|
33
|
+
},
|
34
|
+
"reversed": false,
|
35
|
+
"source_transaction": null,
|
36
|
+
"source_type": "card",
|
37
|
+
"transfer_group": null,
|
38
|
+
"status": "pending"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "transfer.reversed",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "tr_00000000000000",
|
13
|
+
"object": "transfer",
|
14
|
+
"amount": 1100,
|
15
|
+
"amount_reversed": 0,
|
16
|
+
"balance_transaction": "txn_00000000000000",
|
17
|
+
"created": 1517907289,
|
18
|
+
"currency": "usd",
|
19
|
+
"description": null,
|
20
|
+
"destination": "acct_1Brq15AT5SYrvIfd",
|
21
|
+
"destination_payment": "py_CH0EOf6bFQq9g2",
|
22
|
+
"livemode": false,
|
23
|
+
"metadata": {
|
24
|
+
},
|
25
|
+
"reversals": {
|
26
|
+
"object": "list",
|
27
|
+
"data": [
|
28
|
+
|
29
|
+
],
|
30
|
+
"has_more": false,
|
31
|
+
"total_count": 0,
|
32
|
+
"url": "/v1/transfers/tr_1BsSE1AT5SYrvIfdP8OdqFvQ/reversals"
|
33
|
+
},
|
34
|
+
"reversed": false,
|
35
|
+
"source_transaction": null,
|
36
|
+
"source_type": "card",
|
37
|
+
"transfer_group": null
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"livemode": false,
|
4
|
+
"id": "evt_00000000000000",
|
5
|
+
"type": "transfer.updated",
|
6
|
+
"object": "event",
|
7
|
+
"request": null,
|
8
|
+
"pending_webhooks": 1,
|
9
|
+
"api_version": "2018-01-23",
|
10
|
+
"data": {
|
11
|
+
"object": {
|
12
|
+
"id": "tr_00000000000000",
|
13
|
+
"object": "transfer",
|
14
|
+
"amount": 1100,
|
15
|
+
"amount_reversed": 0,
|
16
|
+
"balance_transaction": "txn_00000000000000",
|
17
|
+
"created": 1517907302,
|
18
|
+
"currency": "usd",
|
19
|
+
"description": null,
|
20
|
+
"destination": "acct_1Brq15AT5SYrvIfd",
|
21
|
+
"destination_payment": "py_CH0EWJqnvFoKjv",
|
22
|
+
"livemode": false,
|
23
|
+
"metadata": {
|
24
|
+
},
|
25
|
+
"reversals": {
|
26
|
+
"object": "list",
|
27
|
+
"data": [
|
28
|
+
|
29
|
+
],
|
30
|
+
"has_more": false,
|
31
|
+
"total_count": 0,
|
32
|
+
"url": "/v1/transfers/tr_1BsSEEAT5SYrvIfdWexl6CKu/reversals"
|
33
|
+
},
|
34
|
+
"reversed": false,
|
35
|
+
"source_transaction": null,
|
36
|
+
"source_type": "card",
|
37
|
+
"transfer_group": null,
|
38
|
+
"status": "pending"
|
39
|
+
},
|
40
|
+
"previous_attributes": {
|
41
|
+
"description": "Old description"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
@@ -6,6 +6,7 @@ class StripeCard < StripeModelCallbacks::ApplicationRecord
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def assign_from_stripe(object)
|
9
|
+
check_object_is_stripe_class(object)
|
9
10
|
self.stripe_customer_id = object.customer if object.respond_to?(:customer)
|
10
11
|
|
11
12
|
StripeModelCallbacks::AttributesAssignerService.execute!(
|
@@ -20,6 +21,6 @@ class StripeCard < StripeModelCallbacks::ApplicationRecord
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def to_stripe
|
23
|
-
@to_stripe ||= Stripe::Customer.
|
24
|
+
@to_stripe ||= Stripe::Customer.retrieve_source(stripe_customer_id, stripe_id)
|
24
25
|
end
|
25
26
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class StripeCharge < StripeModelCallbacks::ApplicationRecord
|
2
2
|
belongs_to :stripe_customer, optional: true, primary_key: "stripe_id"
|
3
|
+
belongs_to :stripe_invoice, optional: true, primary_key: "stripe_id"
|
4
|
+
belongs_to :stripe_source, optional: true, primary_key: "stripe_id"
|
3
5
|
has_many :stripe_orders, primary_key: "stripe_id"
|
4
6
|
has_many :stripe_refunds, primary_key: "stripe_id"
|
5
7
|
has_many :stripe_reviews, primary_key: "stripe_id"
|
@@ -13,6 +15,7 @@ class StripeCharge < StripeModelCallbacks::ApplicationRecord
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def assign_from_stripe(object)
|
18
|
+
check_object_is_stripe_class(object)
|
16
19
|
assign_attributes(
|
17
20
|
created: Time.zone.at(object.created),
|
18
21
|
stripe_customer_id: object.customer,
|
@@ -8,6 +8,7 @@ class StripeCoupon < StripeModelCallbacks::ApplicationRecord
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def assign_from_stripe(object)
|
11
|
+
check_object_is_stripe_class(object)
|
11
12
|
assign_attributes(
|
12
13
|
amount_off: object.amount_off ? Money.new(object.amount_off, object.currency) : nil,
|
13
14
|
stripe_valid: object.valid
|
@@ -6,17 +6,19 @@ class StripeCustomer < StripeModelCallbacks::ApplicationRecord
|
|
6
6
|
has_many :stripe_invoice_items, primary_key: "stripe_id"
|
7
7
|
has_many :stripe_orders, primary_key: "stripe_id"
|
8
8
|
has_many :stripe_subscriptions, primary_key: "stripe_id"
|
9
|
+
has_many :stripe_subscription_schedules, primary_key: "stripe_id"
|
9
10
|
|
10
11
|
def self.stripe_class
|
11
12
|
Stripe::Customer
|
12
13
|
end
|
13
14
|
|
14
15
|
def assign_from_stripe(object)
|
16
|
+
check_object_is_stripe_class(object)
|
15
17
|
StripeModelCallbacks::AttributesAssignerService.execute!(
|
16
18
|
model: self, stripe_model: object,
|
17
19
|
attributes: %w[
|
18
|
-
account_balance currency created delinquent description discount email
|
19
|
-
livemode metadata
|
20
|
+
account_balance currency created default_source delinquent description discount email
|
21
|
+
id livemode metadata
|
20
22
|
]
|
21
23
|
)
|
22
24
|
end
|
@@ -14,12 +14,19 @@ class StripeDiscount < StripeModelCallbacks::ApplicationRecord
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def assign_from_stripe(object)
|
17
|
+
check_object_is_stripe_class(object)
|
18
|
+
if object.respond_to?(:customer)
|
19
|
+
customer_id = object.customer
|
20
|
+
else
|
21
|
+
customer_id = Stripe::Subscription.retrieve(object.subscription).customer
|
22
|
+
end
|
23
|
+
|
17
24
|
assign_attributes(
|
18
25
|
created: object.respond_to?(:created) ? Time.zone.at(object.created) : nil,
|
19
26
|
start: Time.zone.at(object.start),
|
20
27
|
end: object.end ? Time.zone.at(object.end) : nil,
|
21
28
|
stripe_coupon_id: object.coupon.id,
|
22
|
-
stripe_customer_id:
|
29
|
+
stripe_customer_id: customer_id,
|
23
30
|
stripe_subscription_id: object.subscription
|
24
31
|
)
|
25
32
|
|
@@ -32,11 +39,11 @@ private
|
|
32
39
|
def assign_coupon_attributes(object)
|
33
40
|
assign_attributes(
|
34
41
|
coupon_amount_off_cents: object.coupon.amount_off ? Money.new(object.coupon.amount_off, object.coupon.currency) : nil,
|
35
|
-
coupon_created: Time.zone.at(object.coupon.created),
|
42
|
+
coupon_created: object.coupon.respond_to?(:created) ? Time.zone.at(object.coupon.created) : nil,
|
36
43
|
coupon_currency: object.coupon.currency,
|
37
44
|
coupon_duration: object.coupon.duration,
|
38
45
|
coupon_duration_in_months: object.coupon.duration_in_months,
|
39
|
-
coupon_livemode: object.coupon.livemode
|
46
|
+
coupon_livemode: object.coupon.respond_to?(:livemode) ? object.coupon.livemode : nil
|
40
47
|
)
|
41
48
|
end
|
42
49
|
|
@@ -6,6 +6,7 @@ class StripeDispute < StripeModelCallbacks::ApplicationRecord
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def assign_from_stripe(object)
|
9
|
+
check_object_is_stripe_class(object)
|
9
10
|
assign_attributes(
|
10
11
|
amount: Money.new(object.amount, object.currency),
|
11
12
|
balance_transaction_id: object.balance_transaction,
|