spree_stripe 1.2.1 → 1.2.3

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: a540c933bff10c811a20b24b6a5505e88909ca2ab850f79d8a9379bfba38cf8d
4
- data.tar.gz: 9200f901dc465383b6b514e8296181be8c99d435159bba8a3f87af170c17e897
3
+ metadata.gz: 4d1395fdcc4bb553b8cf0391c06098131b0c5529c397e60c0c1f17cc476f80bb
4
+ data.tar.gz: 7d97dde52f20fbc99547b66484ee54800a682835d5a10c7a222c5828cbf73a0c
5
5
  SHA512:
6
- metadata.gz: 94184ca73d24e1d467f595ed674ccc7f03e888ce64021d72d1bb2c22454fe010bb0ac8f57451d2e43e7d1ecca956d73398c9e14d3a77b0638203eb5ef34005b6
7
- data.tar.gz: 0357bcb45f3ff71cdb950cae6180a19a08f658b7084c15bb92c777a477d7b0fe1e264b8c259729b7d48dc3109c3c26695e92aa2b137c5636288e2573a5cee9fa
6
+ metadata.gz: fa7713aa1cd16ff77a28bdc7dc53e127d95370c58e6fbd14efef8dc6d44c2520c5e4dce52457151c8ffa97b3e8337a52761e78b78423a9183dd7b8b51feeb813
7
+ data.tar.gz: 993d3bf730afeeb71e8f50606df34ff6363eb43ebe6428b097f467e611e1a81b4a94b67a620ed536bfc57fcecf9e2ba89bab720dea84329c5993c80bbaf83f54
data/README.md CHANGED
@@ -9,7 +9,7 @@ This is the official Stripe payment gateway extension for [Spree Commerce](https
9
9
 
10
10
  This Stripe integration is bundled in the [Spree Starter](https://github.com/spree/spree_starter/) for your development convenience.
11
11
 
12
- Or you could follow the [installation instructions](https://github.com/spree/spree_stripe/edit/main/README.md#installation) below.
12
+ Or you could follow the [installation instructions](https://spreecommerce.org/docs/integrations/payments/stripe).
13
13
 
14
14
  If you like what you see, consider giving this repo a GitHub star :star:
15
15
 
@@ -1,3 +1,4 @@
1
+ //= link_tree ../images
1
2
  //= link spree_stripe/application.js
2
3
  //= link_tree ../../javascript/spree_stripe/controllers .js
3
4
  //= link_tree ../../../vendor/javascript .js
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" height="32" width="32"><g clip-path="url(#a)"><path fill="#33DDB3" d="M0 0h32v32H0z"/><path d="M7.978 10.172a1.023 1.023 0 1 1 1.136 1.7 1.023 1.023 0 0 1-1.136-1.7ZM4 10.109h1.829v11.063H4V10.109Zm24.725 3.165a26.691 26.691 0 0 1-2.234 3.895L29 21.166h-2.16L25.298 18.7c-1.55 1.766-3.084 2.63-4.563 2.63-1.802 0-2.539-1.288-2.539-2.754 0-.349.005-.778.005-1.047 0-1.932-.204-2.476-.856-2.392-1.253.168-3.156 3.022-4.395 6.03h-1.72v-7.893h1.828v3.949c1.043-1.76 1.997-3.268 3.535-3.85.895-.34 1.647-.191 2.04-.018 1.417.625 1.415 2.151 1.396 4.197-.005.27-.005.56-.005.869 0 .741.205 1.067.71 1.117.3.026.602-.041.864-.191v-9.238h1.828v7.917s1.585-1.45 3.261-4.752h2.038Zm-19.265.004H7.633v7.895h1.829v-7.895H9.46Z" fill="#1D3944"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h32v32H0z"/></clipPath></defs></svg>
@@ -18,7 +18,11 @@ export default class extends Controller {
18
18
  maxRows: Number,
19
19
  maxColumns: Number,
20
20
  buttonWidth: Number,
21
- storeUrl: String,
21
+ checkoutPath: String,
22
+ checkoutAdvancePath: String,
23
+ checkoutSelectShippingMethodPath: String,
24
+ checkoutValidateGiftCardDataPath: String,
25
+ checkoutValidateOrderForPaymentPath: String,
22
26
  returnUrl: String,
23
27
  }
24
28
 
@@ -139,7 +143,7 @@ export default class extends Controller {
139
143
  }
140
144
 
141
145
  // 1st we need to persist the address to the order
142
- const saveAddressResponse = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout`, {
146
+ const saveAddressResponse = await fetch(this.checkoutPathValue, {
143
147
  method: 'PATCH',
144
148
  headers: {
145
149
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -153,7 +157,7 @@ export default class extends Controller {
153
157
  // In case of any error here we have to allow user try again
154
158
  try {
155
159
  const response = await fetch(
156
- `${this.storeUrlValue}/api/v2/storefront/checkout/advance?state=delivery&include=shipments.shipping_rates,line_items.vendor`,
160
+ `${this.checkoutAdvancePathValue}?state=delivery&include=shipments.shipping_rates,line_items.vendor`,
157
161
  {
158
162
  method: 'PATCH',
159
163
  headers: {
@@ -197,7 +201,7 @@ export default class extends Controller {
197
201
 
198
202
  this.currentShippingOptionId = shippingRateId
199
203
 
200
- const response = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout/select_shipping_method`, {
204
+ const response = await fetch(this.checkoutSelectShippingMethodPathValue, {
201
205
  method: 'PATCH',
202
206
  headers: {
203
207
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -230,9 +234,9 @@ export default class extends Controller {
230
234
  return
231
235
  }
232
236
 
233
- if (this.giftCardCodeValue && this.giftCardAmountValue) {
237
+ if (this.giftCardCodeValue && this.giftCardAmountValue && this.checkoutValidateGiftCardDataPathValue) {
234
238
  const giftCardValidationResponse = await fetch(
235
- `${this.storeUrlValue}/api/v2/storefront/checkout/validate_gift_card_data`,
239
+ this.checkoutValidateGiftCardDataPathValue,
236
240
  {
237
241
  method: 'POST',
238
242
  headers: {
@@ -252,7 +256,7 @@ export default class extends Controller {
252
256
  }
253
257
 
254
258
  const validationResponse = await fetch(
255
- `${this.storeUrlValue}/api/v2/storefront/checkout/validate_order_for_payment?skip_state=true`,
259
+ `${this.checkoutValidateOrderForPaymentPathValue}?skip_state=true`,
256
260
  {
257
261
  method: 'POST',
258
262
  headers: {
@@ -297,7 +301,7 @@ export default class extends Controller {
297
301
  do_not_change_state: true
298
302
  }
299
303
 
300
- const updateResponse = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout`, {
304
+ const updateResponse = await fetch(this.checkoutPathValue, {
301
305
  method: 'PATCH',
302
306
  headers: {
303
307
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -307,7 +311,7 @@ export default class extends Controller {
307
311
  })
308
312
 
309
313
  if (updateResponse.status === 200) {
310
- const advanceResponse = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout/advance?state=payment`, {
314
+ const advanceResponse = await fetch(`${this.checkoutAdvancePathValue}?state=payment`, {
311
315
  method: 'PATCH',
312
316
  headers: {
313
317
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -369,7 +373,7 @@ export default class extends Controller {
369
373
 
370
374
  if (this.shippingRates?.length > 1 && this.currentShippingOptionId !== defaultShippingMethodId) {
371
375
  // reset shipping choice
372
- await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout/select_shipping_method`, {
376
+ await fetch(this.checkoutSelectShippingMethodPathValue, {
373
377
  method: 'PATCH',
374
378
  headers: {
375
379
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -380,7 +384,7 @@ export default class extends Controller {
380
384
  }
381
385
 
382
386
  // reset addresses
383
- await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout`, {
387
+ await fetch(this.checkoutPathValue, {
384
388
  method: 'PATCH',
385
389
  headers: {
386
390
  'X-Spree-Order-Token': this.orderTokenValue,
@@ -11,7 +11,9 @@ export default class extends Controller {
11
11
  colorPrimary: String,
12
12
  colorBackground: String,
13
13
  colorText: String,
14
- storeUrl: String
14
+ paymentIntentPath: String,
15
+ checkoutPath: String,
16
+ checkoutValidateOrderForPaymentPath: String
15
17
  }
16
18
 
17
19
  static targets = [
@@ -53,7 +55,7 @@ export default class extends Controller {
53
55
  }
54
56
 
55
57
  const response = await fetch(
56
- `${this.storeUrlValue}/api/v2/storefront/stripe/payment_intents/${this.paymentIntentValue.id}`,
58
+ this.paymentIntentPathValue,
57
59
  {
58
60
  method: 'PATCH',
59
61
  headers: this.spreeApiHeaders,
@@ -179,7 +181,7 @@ export default class extends Controller {
179
181
 
180
182
  async validateOrderForPayment() {
181
183
  const response = await fetch(
182
- `${this.storeUrlValue}/api/v2/storefront/checkout/validate_order_for_payment`,
184
+ this.checkoutValidateOrderForPaymentPathValue,
183
185
  {
184
186
  method: 'POST',
185
187
  headers: this.spreeApiHeaders
@@ -204,7 +206,7 @@ export default class extends Controller {
204
206
  async updateBillingAddress() {
205
207
  // billing address same as shipping address
206
208
  if (this.billingAddressCheckbox.checked) {
207
- const response = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout?include=billing_address`, {
209
+ const response = await fetch(`${this.checkoutPathValue}?include=billing_address`, {
208
210
  method: 'PATCH',
209
211
  headers: this.spreeApiHeaders,
210
212
  body: JSON.stringify({
@@ -228,7 +230,7 @@ export default class extends Controller {
228
230
  if (this.billingAddressForm.checkValidity()) {
229
231
  const formData = new FormData(this.billingAddressForm);
230
232
 
231
- const response = await fetch(`${this.storeUrlValue}/api/v2/storefront/checkout?include=billing_address`, {
233
+ const response = await fetch(`${this.checkoutPathValue}?include=billing_address`, {
232
234
  method: 'PATCH',
233
235
  headers: this.spreeApiHeaders,
234
236
  body: JSON.stringify({
@@ -7,7 +7,9 @@
7
7
  data-checkout-stripe-order-email-value="<%= @order.email %>"
8
8
  data-checkout-stripe-color-primary-value="<%= hex_color_to_rgb(theme_setting(:primary_color)) %>"
9
9
  data-checkout-stripe-color-text-value="<%= hex_color_to_rgb(theme_setting(:text_color)) %>"
10
- data-checkout-stripe-store-url-value="<%= current_store.formatted_url_or_custom_domain %>"
10
+ data-checkout-stripe-payment-intent-path-value="<%= spree.api_v2_storefront_stripe_payment_intent_path(current_stripe_payment_intent.id) %>"
11
+ data-checkout-stripe-checkout-path-value="<%= spree.api_v2_storefront_checkout_path %>"
12
+ data-checkout-stripe-checkout-validate-order-for-payment-path-value="<%= spree.validate_order_for_payment_api_v2_storefront_checkout_path %>"
11
13
  >
12
14
  <% payment_sources = checkout_payment_sources(payment_method) %>
13
15
 
@@ -17,7 +17,11 @@
17
17
  checkout_stripe_button_max_rows_value: defined?(max_rows) ? max_rows : nil,
18
18
  checkout_stripe_button_max_columns_value: defined?(max_columns) ? max_columns : nil,
19
19
  checkout_stripe_button_button_width_value: defined?(button_width) ? button_width : nil,
20
- checkout_stripe_button_store_url_value: current_store.formatted_url_or_custom_domain,
20
+ checkout_stripe_button_checkout_path_value: spree.api_v2_storefront_checkout_path,
21
+ checkout_stripe_button_checkout_advance_path_value: spree.advance_api_v2_storefront_checkout_path,
22
+ checkout_stripe_button_checkout_select_shipping_method_path_value: spree.select_shipping_method_api_v2_storefront_checkout_path,
23
+ checkout_stripe_button_checkout_validate_gift_card_data_path_value: respond_to?(:validate_gift_card_data_api_v2_storefront_checkout_path) ? spree.validate_gift_card_data_api_v2_storefront_checkout_path : nil,
24
+ checkout_stripe_button_checkout_validate_order_for_payment_path_value: spree.validate_order_for_payment_api_v2_storefront_checkout_path,
21
25
  checkout_stripe_button_return_url_value: spree.stripe_payment_intent_url(current_stripe_payment_intent)
22
26
  } do %>
23
27
  <div id="payment-request-button"></div>
@@ -1,5 +1,5 @@
1
1
  module SpreeStripe
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.3'.freeze
3
3
 
4
4
  def gem_version
5
5
  Gem::Version.new(VERSION)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vendo Connect Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-24 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree
@@ -188,6 +188,7 @@ files:
188
188
  - README.md
189
189
  - Rakefile
190
190
  - app/assets/config/spree_stripe_manifest.js
191
+ - app/assets/images/payment_icons/link.svg
191
192
  - app/controllers/spree/api/v2/storefront/stripe/base_controller.rb
192
193
  - app/controllers/spree/api/v2/storefront/stripe/payment_intents_controller.rb
193
194
  - app/controllers/spree/api/v2/storefront/stripe/setup_intents_controller.rb
@@ -278,7 +279,6 @@ files:
278
279
  - lib/spree_stripe/testing_support/factories/klarna_payment_source_factory.rb
279
280
  - lib/spree_stripe/testing_support/factories/link_payment_source_factory.rb
280
281
  - lib/spree_stripe/testing_support/factories/payment_intent_factory.rb
281
- - lib/spree_stripe/testing_support/factories/payment_source_factory.rb
282
282
  - lib/spree_stripe/testing_support/factories/przelewy24_payment_source_factory.rb
283
283
  - lib/spree_stripe/testing_support/factories/sepa_debit_payment_source_factory.rb
284
284
  - lib/spree_stripe/testing_support/factories/webhook_key_factory.rb
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
304
  version: '0'
305
305
  requirements:
306
306
  - none
307
- rubygems_version: 3.3.26
307
+ rubygems_version: 3.5.3
308
308
  signing_key:
309
309
  specification_version: 4
310
310
  summary: Official Spree Commerce Stripe payment gateway extension
@@ -1,8 +0,0 @@
1
- FactoryBot.define do
2
- factory :payment_source, class: Spree::PaymentSource do
3
- association :payment_method, factory: :payment_method
4
- gateway_payment_profile_id { 'pm_1adfg34fgfdf5245' }
5
- type { 'SpreeStripe::PaymentSources::Alipay' }
6
- user
7
- end
8
- end