shopify-gold 3.0.1 → 3.1.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: c030cdd2491bfaaa608daf0872d00a666c02de89075ebdfc02e2db16c9b4fc1a
4
- data.tar.gz: f09f58ef6ed29763f352985b06a4b69d4c178aa98a344be6c3b7d4d18692de88
3
+ metadata.gz: a1a04a46085510f9e78a365b0febc70394fae810d130d6ed4fcbc33add97ae7a
4
+ data.tar.gz: f3e0329c1a333700ab7bd44fa85dc34323ff446947d6a73928fbaa0519868afa
5
5
  SHA512:
6
- metadata.gz: 0b4ec8a6c8c13d9dc81de919fe16d9da5ec952ed1573f8f437a853499013a1511aa3862e0474f4137f7cd1313cd9a15369a5def927f59e50b3c2fcf8d1b6c70d
7
- data.tar.gz: 2790090bddf8bf32067ddc50fbfeecea31b90b8c0aa017111a696153e1825400d50f0e1d00ac2cadc45f2988b34b29b019a74d5d4fe9ff1d20a57b34af9e9365
6
+ metadata.gz: e93d381fb0fcfc778334acf3ebbfe6c39a7106510e558afc6ad929ec6c731e5c5cd861cad1cf52acab2460539424b1ef4b2600f7e36fbc1183dbaed940dd12cb
7
+ data.tar.gz: 580b47448d8e229aa0bd63a15f2522771cb5b82a7438aa3630316a9416abdfefc3407ff59962c5306dc74c616eebb3b6b3980ea4fb29148c93a0b5f795ea5adb
data/README.md CHANGED
@@ -196,7 +196,7 @@ before_action :confront_mandatory_billing_action
196
196
  ```
197
197
 
198
198
  You can override any view file by matching Gold's path pattern under `views`. The
199
- most notable are likely
199
+ most notable are likely `views/gold/billing/terms.html` and `views/gold/billing/tier.html`
200
200
 
201
201
  ## Admin interface
202
202
  Gold can manage billing for each shop through an admin interface. First, you'll
@@ -71,6 +71,7 @@ module Gold
71
71
  when PendingCharge
72
72
  Gold.logger.info("[#{billing.id}] Charge is pending")
73
73
  @confirmation_url = outcome.confirmation_url
74
+ # Will render view with confirmation URL
74
75
  when AcceptedCharge
75
76
  Gold.logger.info("[#{billing.id}] Charge is accepted")
76
77
  redirect_to outcome.return_url
@@ -105,7 +106,7 @@ module Gold
105
106
  case outcome
106
107
  when ActiveCharge
107
108
  ApplyTierOp.new(billing).call
108
- redirect_to main_app.root_url
109
+ outer_redirect_to_main
109
110
  when DeclinedCharge
110
111
  redirect_to declined_charge_url
111
112
  when ExpiredCharge
@@ -156,6 +157,19 @@ module Gold
156
157
 
157
158
  private
158
159
 
160
+ # If embedded app, redirect directly through the Shopify admin. This can provide
161
+ # a better experience than the page rendering and JS kicking off a redirect
162
+ def outer_redirect_to_main
163
+ if ShopifyApp.configuration.embedded_app
164
+ shopify_domain = billing.shop.shopify_domain
165
+ api_key = ShopifyApp.configuration.api_key
166
+ fullpath = "/admin/apps/#{api_key}#{main_app.root_path}"
167
+ redirect_to URI::HTTPS.build(host: shopify_domain, path: fullpath).to_s
168
+ else
169
+ redirect_to main_app.root_url
170
+ end
171
+ end
172
+
159
173
  # Redirect to the appropriate location based on the return value from
160
174
  # ChargeOp.
161
175
  def handle_charge_outcome(outcome)
@@ -173,7 +187,7 @@ module Gold
173
187
  redirect_to outcome.return_url
174
188
  when PendingCharge
175
189
  Gold.logger.info("[#{billing.id}] Charge is pending")
176
- redirect_to outcome.confirmation_url
190
+ fullpage_redirect_to outcome.confirmation_url
177
191
  end
178
192
  end
179
193
 
data/lib/gold/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gold
2
- VERSION = "3.0.1".freeze
2
+ VERSION = "3.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-gold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-20 00:00:00.000000000 Z
12
+ date: 2019-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails