solidus_core 3.0.0.rc2 → 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.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/helpers/spree/base_helper.rb +1 -1
- data/app/helpers/spree/products_helper.rb +1 -1
- data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -11
- data/app/models/concerns/spree/active_storage_adapter.rb +2 -0
- data/app/models/concerns/spree/default_price.rb +63 -10
- data/app/models/spree/adjustment.rb +6 -5
- data/app/models/spree/base.rb +0 -17
- data/app/models/spree/calculator.rb +4 -0
- data/app/models/spree/customer_return.rb +3 -2
- data/app/models/spree/image/active_storage_attachment.rb +11 -8
- data/app/models/spree/image/paperclip_attachment.rb +3 -3
- data/app/models/spree/line_item.rb +2 -2
- data/app/models/spree/order.rb +12 -7
- data/app/models/spree/payment_method/bogus_credit_card.rb +13 -9
- data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
- data/app/models/spree/payment_method.rb +3 -0
- data/app/models/spree/price.rb +1 -1
- data/app/models/spree/product/scopes.rb +5 -5
- data/app/models/spree/product.rb +12 -1
- data/app/models/spree/promotion/rules/item_total.rb +50 -6
- data/app/models/spree/promotion.rb +2 -2
- data/app/models/spree/promotion_action.rb +3 -0
- data/app/models/spree/promotion_code.rb +1 -1
- data/app/models/spree/promotion_rule.rb +4 -0
- data/app/models/spree/return_item.rb +2 -3
- data/app/models/spree/shipping_rate_tax.rb +1 -1
- data/app/models/spree/stock/availability.rb +11 -3
- data/app/models/spree/stock/simple_coordinator.rb +6 -11
- data/app/models/spree/stock_location.rb +1 -1
- data/app/models/spree/store_credit.rb +6 -1
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -1
- data/app/models/spree/taxon/active_storage_attachment.rb +2 -2
- data/app/models/spree/taxon/paperclip_attachment.rb +3 -3
- data/app/models/spree/variant/price_selector.rb +16 -3
- data/app/models/spree/variant.rb +27 -17
- data/config/locales/en.yml +2 -0
- data/db/migrate/20210312061050_change_column_null_on_prices.rb +7 -0
- data/lib/generators/solidus/install/install_generator.rb +2 -2
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -1
- data/lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt +30 -0
- data/lib/generators/solidus/update/update_generator.rb +112 -0
- data/lib/generators/spree/dummy/templates/rails/application.rb.tt +0 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +78 -35
- data/lib/spree/app_configuration.rb +70 -0
- data/lib/spree/core/engine.rb +10 -11
- data/lib/spree/core/product_filters.rb +1 -1
- data/lib/spree/core/search/base.rb +1 -1
- data/lib/spree/core/state_machines/order.rb +1 -1
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +5 -1
- data/lib/spree/core/versioned_value.rb +75 -0
- data/lib/spree/core.rb +17 -0
- data/lib/spree/deprecation.rb +1 -1
- data/lib/spree/permitted_attributes.rb +8 -2
- data/lib/spree/preferences/configuration.rb +62 -0
- data/lib/spree/preferences/persistable.rb +23 -0
- data/lib/spree/preferences/preferable.rb +8 -0
- data/lib/spree/preferences/preferable_class_methods.rb +5 -3
- data/lib/spree/preferences/preference_differentiator.rb +28 -0
- data/lib/spree/testing_support/dummy_app/database.yml +42 -22
- data/lib/spree/testing_support/dummy_app.rb +33 -17
- data/lib/spree/testing_support/fixtures/file.txt +1 -0
- data/lib/spree/testing_support.rb +1 -1
- data/lib/tasks/solidus/delete_prices_with_nil_amount.rake +8 -0
- data/solidus_core.gemspec +20 -0
- metadata +29 -8
- data/app/models/spree/tax/shipping_rate_taxer.rb +0 -24
- data/lib/tasks/migrations/migrate_address_names.rake +0 -158
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -38
- data/lib/tasks/upgrade.rake +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d8a64c0ba51b637a6a5eb82952d5920f388413f74d271920c41b6c34b00b5f
|
4
|
+
data.tar.gz: a92bbdc37bd0a9f9a53fe943542ba0f4890af67290faf937de4a57583cdb1ffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd269d1a10a861a6d76cba306cf3b42b758773d4fe4e3265986e0abfe318e40ba2468d6431ec89d472b72591a23e19684a20afa37bb48f0be71371e79736e0f
|
7
|
+
data.tar.gz: c524310230c534ebc135368fbf5d1b75def4f3b3672f8b4818b85d6e40d2fd04f1bfb03e37d0218f37d5b5bb7167499c2deff8bbd2593a8571f9b1de211d665c
|
@@ -130,7 +130,7 @@ module Spree
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def display_price(product_or_variant)
|
133
|
-
product_or_variant.
|
133
|
+
product_or_variant.price_for_options(current_pricing_options)&.money&.to_html
|
134
134
|
end
|
135
135
|
|
136
136
|
def pretty_time(time, format = :long)
|
@@ -38,7 +38,7 @@ module Spree
|
|
38
38
|
.with_prices(current_pricing_options)
|
39
39
|
.all? { |variant_with_prices| variant_with_prices.price_same_as_master?(current_pricing_options) }
|
40
40
|
|
41
|
-
variant.
|
41
|
+
variant.price_for_options(current_pricing_options)&.money&.to_html
|
42
42
|
end
|
43
43
|
|
44
44
|
# Converts line breaks in product description into <p> tags.
|
@@ -9,11 +9,9 @@ module Spree
|
|
9
9
|
class Attachment
|
10
10
|
delegate_missing_to :@attachment
|
11
11
|
|
12
|
-
DEFAULT_SIZE = '100%'
|
13
|
-
|
14
12
|
def initialize(attachment, styles: {})
|
15
13
|
@attachment = attachment
|
16
|
-
@styles = styles
|
14
|
+
@styles = normalize_styles(styles)
|
17
15
|
end
|
18
16
|
|
19
17
|
def exists?
|
@@ -21,20 +19,18 @@ module Spree
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def filename
|
24
|
-
blob
|
22
|
+
blob&.filename.to_s
|
25
23
|
end
|
26
24
|
|
27
25
|
def url(style = nil)
|
28
|
-
variant(style)
|
26
|
+
variant(style)&.url
|
29
27
|
end
|
30
28
|
|
31
29
|
def variant(style = nil)
|
32
|
-
size = style_to_size(style
|
30
|
+
size = style_to_size(style)
|
33
31
|
@attachment.variant(
|
34
|
-
|
35
|
-
strip: true
|
36
|
-
'auto-orient': true,
|
37
|
-
colorspace: 'sRGB',
|
32
|
+
resize_to_limit: size,
|
33
|
+
strip: true
|
38
34
|
).processed
|
39
35
|
end
|
40
36
|
|
@@ -61,8 +57,12 @@ module Spree
|
|
61
57
|
@attachment.metadata
|
62
58
|
end
|
63
59
|
|
60
|
+
def normalize_styles(styles)
|
61
|
+
styles.transform_values { |v| v.split('x') }
|
62
|
+
end
|
63
|
+
|
64
64
|
def style_to_size(style)
|
65
|
-
@styles.fetch(style) {
|
65
|
+
@styles.fetch(style&.to_sym) { [width, height] }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -5,23 +5,76 @@ module Spree
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
delegate :display_price, :display_amount, :price, to: :default_price, allow_nil: true
|
9
|
+
delegate :price=, to: :default_price_or_build
|
10
|
+
|
11
|
+
# @see Spree::Variant::PricingOptions.default_price_attributes
|
12
|
+
def self.default_price_attributes
|
13
|
+
Spree::Config.default_pricing_options.desired_attributes
|
14
|
+
end
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
# Returns `#prices` prioritized for being considered as default price
|
18
|
+
#
|
19
|
+
# @return [ActiveRecord::Relation<Spree::Price>]
|
20
|
+
def currently_valid_prices
|
21
|
+
prices.currently_valid
|
18
22
|
end
|
19
23
|
|
20
|
-
|
21
|
-
|
24
|
+
# Returns {#default_price} or builds it from {Spree::Variant.default_price_attributes}
|
25
|
+
#
|
26
|
+
# @return [Spree::Price, nil]
|
27
|
+
# @see Spree::Variant.default_price_attributes
|
28
|
+
def default_price_or_build
|
29
|
+
default_price ||
|
30
|
+
prices.build(self.class.default_price_attributes)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Select from {#prices} the one to be considered as the default
|
34
|
+
#
|
35
|
+
# This method works with the in-memory association, so non-persisted prices
|
36
|
+
# are taken into account. Discarded prices are also considered.
|
37
|
+
#
|
38
|
+
# A price is a candidate to be considered as the default when it meets
|
39
|
+
# {Spree::Variant.default_price_attributes} criteria. When more than one candidate is
|
40
|
+
# found, non-persisted records take preference. When more than one persisted
|
41
|
+
# candidate exists, the one most recently updated is taken or, in case of
|
42
|
+
# race condition, the one with higher id.
|
43
|
+
#
|
44
|
+
# @return [Spree::Price, nil]
|
45
|
+
# @see Spree::Variant.default_price_attributes
|
46
|
+
def default_price
|
47
|
+
prioritized_default(
|
48
|
+
prices_meeting_criteria_to_be_default(
|
49
|
+
(prices + prices.with_discarded).uniq
|
50
|
+
)
|
51
|
+
)
|
52
|
+
end
|
22
53
|
|
23
54
|
def has_default_price?
|
24
55
|
default_price.present? && !default_price.discarded?
|
25
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def prices_meeting_criteria_to_be_default(prices)
|
61
|
+
criteria = self.class.default_price_attributes.transform_keys(&:to_s)
|
62
|
+
prices.select do |price|
|
63
|
+
contender = price.attributes.slice(*criteria.keys)
|
64
|
+
criteria == contender
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def prioritized_default(prices)
|
69
|
+
prices.min do |prev, succ|
|
70
|
+
contender_one, contender_two = [succ, prev].map do |item|
|
71
|
+
[
|
72
|
+
item.updated_at || Time.zone.now,
|
73
|
+
item.id || Float::INFINITY
|
74
|
+
]
|
75
|
+
end
|
76
|
+
contender_one <=> contender_two
|
77
|
+
end
|
78
|
+
end
|
26
79
|
end
|
27
80
|
end
|
@@ -55,11 +55,12 @@ module Spree
|
|
55
55
|
#
|
56
56
|
# @param excluded_orders [Array<Spree::Order>] Orders to exclude from query
|
57
57
|
# @return [ActiveRecord::Relation] Scoped Adjustments
|
58
|
-
def self.in_completed_orders(excluded_orders: [])
|
59
|
-
joins(:order)
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
def self.in_completed_orders(excluded_orders: [], exclude_canceled: false)
|
59
|
+
result = joins(:order)
|
60
|
+
.merge(Spree::Order.complete)
|
61
|
+
.where.not(spree_orders: { id: excluded_orders })
|
62
|
+
.distinct
|
63
|
+
exclude_canceled ? result.merge(Spree::Order.not_canceled) : result
|
63
64
|
end
|
64
65
|
|
65
66
|
def finalize!
|
data/app/models/spree/base.rb
CHANGED
@@ -1,26 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Spree::Base < ActiveRecord::Base
|
4
|
-
include Spree::Preferences::Preferable
|
5
4
|
include Spree::Core::Permalinks
|
6
5
|
include Spree::RansackableAttributes
|
7
6
|
|
8
|
-
def initialize_preference_defaults
|
9
|
-
if has_attribute?(:preferences)
|
10
|
-
self.preferences = default_preferences.merge(preferences)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# Only run preference initialization on models which requires it. Improves
|
15
|
-
# performance of record initialization slightly.
|
16
|
-
def self.preference(*args)
|
17
|
-
# after_initialize can be called multiple times with the same symbol, it
|
18
|
-
# will only be called once on initialization.
|
19
|
-
serialize :preferences, Hash
|
20
|
-
after_initialize :initialize_preference_defaults
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
7
|
self.abstract_class = true
|
25
8
|
|
26
9
|
# Provides a scope that should be included any time products
|
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
4
|
+
|
3
5
|
module Spree
|
4
6
|
class Calculator < Spree::Base
|
7
|
+
include Spree::Preferences::Persistable
|
8
|
+
|
5
9
|
belongs_to :calculable, polymorphic: true, optional: true
|
6
10
|
|
7
11
|
# This method calls a compute_<computable> method. must be overriden in concrete calculator.
|
@@ -40,7 +40,8 @@ module Spree
|
|
40
40
|
# Temporarily tie a customer_return to one order
|
41
41
|
def order
|
42
42
|
return nil if return_items.blank?
|
43
|
-
|
43
|
+
|
44
|
+
return_items.first.inventory_unit&.order
|
44
45
|
end
|
45
46
|
|
46
47
|
def fully_reimbursed?
|
@@ -65,7 +66,7 @@ module Spree
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def return_items_belong_to_same_order
|
68
|
-
if return_items.reject{ |return_item| return_item.inventory_unit
|
69
|
+
if return_items.reject{ |return_item| return_item.inventory_unit&.order_id == order_id }.any?
|
69
70
|
errors.add(:base, I18n.t('spree.return_items_cannot_be_associated_with_multiple_orders'))
|
70
71
|
end
|
71
72
|
end
|
@@ -7,15 +7,18 @@ module Spree::Image::ActiveStorageAttachment
|
|
7
7
|
delegate :width, :height, to: :attachment, prefix: true
|
8
8
|
|
9
9
|
included do
|
10
|
-
has_attachment :attachment,
|
11
|
-
styles: {
|
12
|
-
mini: '48x48>',
|
13
|
-
small: '400x400>',
|
14
|
-
product: '680x680>',
|
15
|
-
large: '1200x1200>'
|
16
|
-
},
|
17
|
-
default_style: :product
|
18
10
|
validates :attachment, presence: true
|
19
11
|
validate :attachment_is_an_image
|
12
|
+
validate :supported_content_type
|
13
|
+
|
14
|
+
has_attachment :attachment,
|
15
|
+
styles: Spree::Config.product_image_styles,
|
16
|
+
default_style: Spree::Config.product_image_style_default
|
17
|
+
|
18
|
+
def supported_content_type
|
19
|
+
unless attachment.content_type.in?(Spree::Config.allowed_image_mime_types)
|
20
|
+
errors.add(:attachment, :content_type_not_supported)
|
21
|
+
end
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
@@ -7,15 +7,15 @@ module Spree::Image::PaperclipAttachment
|
|
7
7
|
validate :no_attachment_errors
|
8
8
|
|
9
9
|
has_attached_file :attachment,
|
10
|
-
styles:
|
11
|
-
default_style:
|
10
|
+
styles: Spree::Config.product_image_styles,
|
11
|
+
default_style: Spree::Config.product_image_style_default,
|
12
12
|
default_url: 'noimage/:style.png',
|
13
13
|
url: '/spree/products/:id/:style/:basename.:extension',
|
14
14
|
path: ':rails_root/public/spree/products/:id/:style/:basename.:extension',
|
15
15
|
convert_options: { all: '-strip -auto-orient -colorspace sRGB' }
|
16
16
|
validates_attachment :attachment,
|
17
17
|
presence: true,
|
18
|
-
content_type: { content_type:
|
18
|
+
content_type: { content_type: Spree::Config.allowed_image_mime_types }
|
19
19
|
|
20
20
|
# save the w,h of the original image (from which others can be calculated)
|
21
21
|
# we need to look at the write-queue for images which have not been saved yet
|
@@ -123,7 +123,7 @@ module Spree
|
|
123
123
|
# a price for this line item, even if there is no existing price
|
124
124
|
# for the associated line item in the order currency.
|
125
125
|
unless options.key?(:price) || options.key?('price')
|
126
|
-
self.money_price = variant.
|
126
|
+
self.money_price = variant.price_for_options(pricing_options)&.money
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -149,7 +149,7 @@ module Spree
|
|
149
149
|
# Set price, cost_price and currency.
|
150
150
|
def set_pricing_attributes
|
151
151
|
self.cost_price ||= variant.cost_price
|
152
|
-
self.money_price = variant.
|
152
|
+
self.money_price = variant.price_for_options(pricing_options)&.money if price.nil?
|
153
153
|
true
|
154
154
|
end
|
155
155
|
|
data/app/models/spree/order.rb
CHANGED
@@ -51,7 +51,7 @@ module Spree
|
|
51
51
|
end
|
52
52
|
|
53
53
|
self.whitelisted_ransackable_associations = %w[shipments user order_promotions promotions bill_address ship_address line_items]
|
54
|
-
self.whitelisted_ransackable_attributes = %w[
|
54
|
+
self.whitelisted_ransackable_attributes = %w[completed_at created_at email number state payment_state shipment_state total store_id]
|
55
55
|
|
56
56
|
attr_reader :coupon_code
|
57
57
|
attr_accessor :temporary_address
|
@@ -128,7 +128,7 @@ module Spree
|
|
128
128
|
before_create :create_token
|
129
129
|
before_create :link_by_email
|
130
130
|
|
131
|
-
validates :email, presence: true, if: :
|
131
|
+
validates :email, presence: true, if: :email_required?
|
132
132
|
validates :email, 'spree/email' => true, allow_blank: true
|
133
133
|
validates :guest_token, presence: { allow_nil: true }
|
134
134
|
validates :number, presence: true, uniqueness: { allow_blank: true, case_sensitive: true }
|
@@ -269,15 +269,15 @@ module Spree
|
|
269
269
|
end
|
270
270
|
|
271
271
|
def contents
|
272
|
-
@contents ||= Spree::
|
272
|
+
@contents ||= Spree::Config.order_contents_class.new(self)
|
273
273
|
end
|
274
274
|
|
275
275
|
def shipping
|
276
|
-
@shipping ||= Spree::
|
276
|
+
@shipping ||= Spree::Config.order_shipping_class.new(self)
|
277
277
|
end
|
278
278
|
|
279
279
|
def cancellations
|
280
|
-
@cancellations ||= Spree::
|
280
|
+
@cancellations ||= Spree::Config.order_cancellations_class.new(self)
|
281
281
|
end
|
282
282
|
|
283
283
|
# Associates the specified user with the order.
|
@@ -490,7 +490,7 @@ module Spree
|
|
490
490
|
raise CannotRebuildShipments.new(I18n.t('spree.cannot_rebuild_shipments_shipments_not_pending'))
|
491
491
|
else
|
492
492
|
shipments.destroy_all
|
493
|
-
|
493
|
+
shipments.push(*Spree::Config.stock.coordinator_class.new(self).shipments)
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
@@ -750,10 +750,15 @@ module Spree
|
|
750
750
|
end
|
751
751
|
|
752
752
|
# Determine if email is required (we don't want validation errors before we hit the checkout)
|
753
|
-
def
|
753
|
+
def email_required?
|
754
754
|
true unless new_record? || ['cart', 'address'].include?(state)
|
755
755
|
end
|
756
756
|
|
757
|
+
def require_email
|
758
|
+
Spree::Deprecation.warn "Use email_required? instead", caller(1)
|
759
|
+
email_required?
|
760
|
+
end
|
761
|
+
|
757
762
|
def ensure_inventory_units
|
758
763
|
if has_checkout_step?("delivery")
|
759
764
|
inventory_validator = Spree::Stock::InventoryValidator.new
|
@@ -9,6 +9,10 @@ module Spree
|
|
9
9
|
|
10
10
|
VALID_CCS = ['1', TEST_VISA, TEST_MC, TEST_AMEX, TEST_DISC].flatten
|
11
11
|
|
12
|
+
AUTHORIZATION_CODE = '12345'
|
13
|
+
FAILURE_MESSAGE = 'Bogus Gateway: Forced failure'
|
14
|
+
SUCCESS_MESSAGE = 'Bogus Gateway: Forced success'
|
15
|
+
|
12
16
|
attr_accessor :test
|
13
17
|
|
14
18
|
def gateway_class
|
@@ -26,40 +30,40 @@ module Spree
|
|
26
30
|
def authorize(_money, credit_card, _options = {})
|
27
31
|
profile_id = credit_card.gateway_customer_profile_id
|
28
32
|
if VALID_CCS.include?(credit_card.number) || (profile_id && profile_id.starts_with?('BGS-'))
|
29
|
-
ActiveMerchant::Billing::Response.new(true,
|
33
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'D' })
|
30
34
|
else
|
31
|
-
ActiveMerchant::Billing::Response.new(false,
|
35
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, { message: FAILURE_MESSAGE }, test: true)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
35
39
|
def purchase(_money, credit_card, _options = {})
|
36
40
|
profile_id = credit_card.gateway_customer_profile_id
|
37
41
|
if VALID_CCS.include?(credit_card.number) || (profile_id && profile_id.starts_with?('BGS-'))
|
38
|
-
ActiveMerchant::Billing::Response.new(true,
|
42
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'M' })
|
39
43
|
else
|
40
|
-
ActiveMerchant::Billing::Response.new(false,
|
44
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, message: FAILURE_MESSAGE, test: true)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
def credit(_money, _credit_card, _response_code, _options = {})
|
45
|
-
ActiveMerchant::Billing::Response.new(true,
|
49
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
46
50
|
end
|
47
51
|
|
48
52
|
def capture(_money, authorization, _gateway_options)
|
49
53
|
if authorization == '12345'
|
50
|
-
ActiveMerchant::Billing::Response.new(true,
|
54
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true)
|
51
55
|
else
|
52
|
-
ActiveMerchant::Billing::Response.new(false,
|
56
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, error: FAILURE_MESSAGE, test: true)
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def void(_response_code, _credit_card, _options = {})
|
57
|
-
ActiveMerchant::Billing::Response.new(true,
|
61
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
58
62
|
end
|
59
63
|
|
60
64
|
# @see Spree::PaymentMethod#try_void
|
61
65
|
def try_void(_payment)
|
62
|
-
ActiveMerchant::Billing::Response.new(true,
|
66
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
63
67
|
end
|
64
68
|
|
65
69
|
def test?
|