lucid_shopify 0.11.0 → 0.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dcddf4a0022ae6ecd4762d3f0bf79a2cc1845c90f1ac1b374d2d98756e92a33
4
- data.tar.gz: aba5d5ec84a89489c0ba7f87a55999bec6f99dcf4d7bed575c8e71f23aa7562b
3
+ metadata.gz: ffb571433eeb8cf5658df59664fcdd0a6f6263abbc0e344dbb72aca4696b9194
4
+ data.tar.gz: d6039441bdedc23549bd096089898e7904265f9b1613fea10bb9a97f23f76a36
5
5
  SHA512:
6
- metadata.gz: 78de01cbe2b28c74378d20e444a172e3124e8f33d856660bc98bedad97776d65986567cb0f5eb2ae0e8f6dd7ad2aafab0a264354dfa72ea9dd2556333bdb929f
7
- data.tar.gz: a81e06f56c4d2ab91bb0152cc43c9e649fc83bada677bc9f7f04cd282a4ecb48d37593882731acd7e9c502c1579d274d91fc653e0538e314f02b479a5a4981a6
6
+ metadata.gz: 2f670bb4a773274e4b48c5a01ae96528b0b18f0443387a6ed08dec67096efc387623949a701425ddf1cd8a5ea6479db2935e96b4567068895d6daef9a94e5053
7
+ data.tar.gz: ee826b6b538b45f0674e75db7726785a097550b7cf2207db84b6c12d3decf5fb70b075db8685da8167e40aab602e240c0a83adb1a9fa72d1ef2f3b147e21dd1f
data/lib/lucid_shopify.rb CHANGED
@@ -5,7 +5,6 @@ require 'dry/initializer'
5
5
  module LucidShopify
6
6
  autoload :ActivateCharge, 'lucid_shopify/activate_charge'
7
7
  autoload :Authorize, 'lucid_shopify/authorize'
8
- autoload :Charge, 'lucid_shopify/charge'
9
8
  autoload :Client, 'lucid_shopify/client'
10
9
  autoload :Config, 'lucid_shopify/config'
11
10
  autoload :Container, 'lucid_shopify/container'
@@ -15,12 +15,14 @@ module LucidShopify
15
15
  # Create a new recurring application charge.
16
16
  #
17
17
  # @param request_credentials [RequestCredentials]
18
- # @param charge [#to_h]
18
+ # @param charge [Hash]
19
19
  #
20
20
  # @return [Hash] the pending charge
21
21
  #
22
22
  def call(request_credentials, charge)
23
- data = @client.post_json(request_credentials, 'recurring_application_charges', charge.to_h)
23
+ data = @client.post_json(request_credentials, 'recurring_application_charges', {
24
+ return_url: LucidShopify.config.billing_callback_uri
25
+ }.merge(charge))
24
26
 
25
27
  data['recurring_application_charge']
26
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucidShopify
4
- VERSION = '0.11.0'
4
+ VERSION = '0.12.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid_shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelsey Judson
@@ -118,7 +118,6 @@ files:
118
118
  - lib/lucid_shopify.rb
119
119
  - lib/lucid_shopify/activate_charge.rb
120
120
  - lib/lucid_shopify/authorize.rb
121
- - lib/lucid_shopify/charge.rb
122
121
  - lib/lucid_shopify/client.rb
123
122
  - lib/lucid_shopify/config.rb
124
123
  - lib/lucid_shopify/container.rb
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lucid_shopify'
4
-
5
- module LucidShopify
6
- #
7
- # @example Subclass to provide application defaults
8
- # class Charge < LucidShopify::Charge
9
- # def initialize(shop)
10
- # super('Application name',
11
- # 9,
12
- # test: test?,
13
- # trial_days: shop.trial_started_at?.nil? ? 30 : nil)
14
- # end
15
- #
16
- # def test?
17
- # # ...
18
- # end
19
- # end
20
- #
21
- class Charge
22
- #
23
- # @param plan_name [String]
24
- # @param price [Integer]
25
- # @param price_cap [Integer] requires price_terms
26
- # @param price_terms [String] requires price_cap
27
- # @param test [Boolean] is this a test_charge?
28
- # @param trial_days [Integer]
29
- #
30
- def initialize(plan_name,
31
- price,
32
- price_cap: nil,
33
- price_terms: nil,
34
- test: false,
35
- trial_days: nil)
36
- @plan_name = plan_name
37
- @price = price
38
- @price_cap = price_cap
39
- @price_terms = price_terms
40
- @test = test
41
- @trial_days = trial_days
42
-
43
- freeze
44
- end
45
-
46
- #
47
- # Map to the Shopify API structure.
48
- #
49
- # @return [Hash]
50
- #
51
- def to_h
52
- {}.tap do |h|
53
- h[:name] = @plan_name
54
- h[:price] = @price
55
- h[:capped_amount] = @price_cap if usage_based_billing?
56
- h[:terms] = @price_terms if usage_based_billing?
57
- h[:return_url] = LucidShopify.config.billing_callback_uri
58
- h[:test] = @test if @test
59
- h[:trial_days] = @trial_days if @trial_days
60
- end
61
- end
62
-
63
- #
64
- # @return [Boolean]
65
- #
66
- private def usage_based_billing?
67
- @price_cap && @price_terms
68
- end
69
- end
70
- end