stripe_model_callbacks 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 344d7a3dacb569caaadc32a2959cd2f740d493b3626fc6e3dabdc2f14bcf76f7
4
- data.tar.gz: 30c78d0e6dfb2acb7baa4b7a0eb99aea7893f516717f863a465bdbc9d6ed0f5c
3
+ metadata.gz: ba7a4cb71e7f2d449a43ac85eeb6c61f086fdc7858ec55b88cb3a04fdae79af4
4
+ data.tar.gz: ed0262077e01beaf939e3b42f35e9b2a812b89ab22fa52b1d98c51445bb8d256
5
5
  SHA512:
6
- metadata.gz: b0def52a911f242f016c3994b973edfadde72c9dfe565615e4493302b63de32eb2f5f50fe88a86cdd1377261792f9ccd140d281e6ddb9e77625daff1d82cec66
7
- data.tar.gz: 6dccf484db456f98641a84f71ae36cda7cb8ecfa96c68426d853ec99cf9c76dcaad2584e3f659bbf10a224e3c3205865719f90f6701e1aabf00efc03c00b4b73
6
+ metadata.gz: db828818fb5d9e4110dd8e4517da60d7e384cbfdc2a945cb0639c31aff8576dc957827b18745dfd1c127cfa070e291c82b45c10e0470ed37defdbf0efece86bd
7
+ data.tar.gz: 8150383579159ce6f3936ed2b06e38e94d2dd87d5f112c508b6f3634e7a08aae38362c41c4bd89274ce1a70808c8d2894fb0d7625b273bb30e2584d0ed5f94b1
@@ -3,7 +3,6 @@ class StripeModelCallbacks::Charge::UpdatedService < StripeModelCallbacks::BaseE
3
3
  charge.assign_from_stripe(object)
4
4
 
5
5
  if charge.save
6
- create_refunds if event.type == "charge.refunded"
7
6
  create_activity
8
7
  succeed!
9
8
  else
@@ -31,10 +30,4 @@ private
31
30
  charge.create_activity :succeeded
32
31
  end
33
32
  end
34
-
35
- def create_refunds
36
- object.refunds.each do |stripe_refund|
37
- StripeModelCallbacks::Refund::UpdatedService.reported_execute!(object: stripe_refund)
38
- end
39
- end
40
33
  end
@@ -24,6 +24,7 @@ class StripeModelCallbacks::ConfigureService < StripeModelCallbacks::BaseEventSe
24
24
  plan_events
25
25
  price_events
26
26
  product_events
27
+ refund_events
27
28
  review_events
28
29
  sku_events
29
30
  source_events
@@ -155,6 +156,14 @@ private
155
156
  end
156
157
  end
157
158
 
159
+ def refund_events
160
+ %w[created updated].each do |refund_event|
161
+ subscribe "refund.#{refund_event}" do |event|
162
+ StripeModelCallbacks::Refund::UpdatedService.execute_with_advisory_lock!(event: event)
163
+ end
164
+ end
165
+ end
166
+
158
167
  def plan_events
159
168
  %w[created deleted updated].each do |plan_event|
160
169
  subscribe "plan.#{plan_event}" do |event|
@@ -0,0 +1,5 @@
1
+ class AddTaxRateToStripeTaxRates < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :stripe_tax_rates, :tax_type, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddCountryToStripeTaxRates < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :stripe_tax_rates, :country, :string
4
+ end
5
+ end
@@ -38,28 +38,6 @@
38
38
  "receipt_email": null,
39
39
  "receipt_number": null,
40
40
  "refunded": true,
41
- "refunds": {
42
- "object": "list",
43
- "data": [
44
- {
45
- "id": "re_CGQ7INZZQPOC8U",
46
- "object": "refund",
47
- "amount": 100,
48
- "balance_transaction": "txn_CGQ7Sq2yeAIYK4",
49
- "charge": "ch_1BrtHZAT5SYrvIfdqkyvLyvX",
50
- "created": 1517772969,
51
- "currency": "usd",
52
- "metadata": {
53
- },
54
- "reason": null,
55
- "receipt_number": "1527-1121",
56
- "status": "succeeded"
57
- }
58
- ],
59
- "has_more": false,
60
- "total_count": 0,
61
- "url": "/v1/charges/ch_1BrtHZAT5SYrvIfdqkyvLyvX/refunds"
62
- },
63
41
  "review": null,
64
42
  "shipping": null,
65
43
  "source": {
@@ -0,0 +1,28 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "refund.created",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "re_CGQ7INZZQPOC8U",
13
+ "object": "refund",
14
+ "amount": 100,
15
+ "balance_transaction": "txn_CGQ7Sq2yeAIYK4",
16
+ "charge": "ch_3MI7uIIICJxvfdbR0gVMAA5h",
17
+ "created": 1675958030,
18
+ "currency": "dkk",
19
+ "metadata": {},
20
+ "payment_intent": null,
21
+ "reason": null,
22
+ "receipt_number": "1527-1121",
23
+ "source_transfer_reversal": null,
24
+ "status": "succeeded",
25
+ "transfer_reversal": null
26
+ }
27
+ }
28
+ }
@@ -12,6 +12,7 @@
12
12
  "id": "txr_00000000000000",
13
13
  "object": "tax_rate",
14
14
  "active": true,
15
+ "country": "DE",
15
16
  "created": 1608755171,
16
17
  "description": "VAT Germany",
17
18
  "display_name": "VAT",
@@ -20,7 +21,8 @@
20
21
  "livemode": false,
21
22
  "metadata": {
22
23
  },
23
- "percentage": 16
24
+ "percentage": 16,
25
+ "tax_type": "vat"
24
26
  }
25
27
  }
26
28
  }
@@ -12,6 +12,7 @@
12
12
  "id": "txr_00000000000000",
13
13
  "object": "tax_rate",
14
14
  "active": true,
15
+ "country": "DE",
15
16
  "created": 1608755201,
16
17
  "description": "VAT Germany",
17
18
  "display_name": "VAT",
@@ -20,7 +21,8 @@
20
21
  "livemode": false,
21
22
  "metadata": {
22
23
  },
23
- "percentage": 16
24
+ "percentage": 16,
25
+ "tax_type": "vat"
24
26
  },
25
27
  "previous_attributes": {
26
28
  "display_name": "Old name"
@@ -16,7 +16,7 @@ class StripeTaxRate < StripeModelCallbacks::ApplicationRecord
16
16
  StripeModelCallbacks::AttributesAssignerService.execute!(
17
17
  model: self,
18
18
  stripe_model: object,
19
- attributes: %w[display_name description jurisdiction percentage inclusive]
19
+ attributes: ["active", "country", "display_name", "description", "jurisdiction", "percentage", "inclusive", "tax_type"]
20
20
  )
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module StripeModelCallbacks
2
- VERSION = "0.1.6".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe_model_callbacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-26 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -122,34 +122,6 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 4.6.0
125
- - !ruby/object:Gem::Dependency
126
- name: appraisal
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: pry
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
125
  description: Framework for getting Stripe webhook callbacks directly to your models
154
126
  email:
155
127
  - kaspernj@gmail.com
@@ -257,6 +229,8 @@ files:
257
229
  - db/migrate/20211121155313_change_invoice_billing_to_nullable.rb
258
230
  - db/migrate/20211121155732_rename_invoices_billing_to_deprecated_billing.rb
259
231
  - db/migrate/20221223095244_rename_stripe_customers_account_balance_to_balance.rb
232
+ - db/migrate/20230129142139_add_tax_rate_to_stripe_tax_rates.rb
233
+ - db/migrate/20230129145312_add_country_to_stripe_tax_rates.rb
260
234
  - lib/stripe_model_callbacks.rb
261
235
  - lib/stripe_model_callbacks/autoload_models.rb
262
236
  - lib/stripe_model_callbacks/configuration.rb
@@ -348,6 +322,7 @@ files:
348
322
  - lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.created.json
349
323
  - lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.deleted.json
350
324
  - lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.updated.json
325
+ - lib/stripe_model_callbacks/fixtures/stripe_events/refund/refund.created.json
351
326
  - lib/stripe_model_callbacks/fixtures/stripe_events/review/review.closed.json
352
327
  - lib/stripe_model_callbacks/fixtures/stripe_events/review/review.opened.json
353
328
  - lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.created.json
@@ -417,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
392
  - !ruby/object:Gem::Version
418
393
  version: '0'
419
394
  requirements: []
420
- rubygems_version: 3.2.32
395
+ rubygems_version: 3.3.7
421
396
  signing_key:
422
397
  specification_version: 4
423
398
  summary: Framework for getting Stripe webhook callbacks directly to your models