summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2021-02-12 14:37:00 +0100
committerGitHub <noreply@github.com>2021-02-12 14:37:00 +0100
commite526705dcbccf1255ea4b4646a6aabededf08fc7 (patch)
tree6df94d24f7a1722adc3b8520bda6f599b8275af8 /lib
parentbdd6c1c0fc18a78296c7abef0fe778ad31d25948 (diff)
parentd6616516443b30be84eadb6db5fed901d8097cee (diff)
Merge pull request #200 from nvandoorn/use-name-in-customer-serializer
Use `name` in customer serializer
Diffstat (limited to 'lib')
-rw-r--r--lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb b/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
index 700c1c6..cd17af3 100644
--- a/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
+++ b/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
@@ -9,11 +9,20 @@ module SolidusSubscriptions
source_id: object.id,
email: object.user.email,
properties: {
- first_name: object.shipping_address_to_use.firstname,
- last_name: object.shipping_address_to_use.lastname,
+ name: name
},
}
end
+
+ private
+
+ def name
+ if ::Spree.solidus_gem_version < Gem::Version.new('2.11.0')
+ "#{object.shipping_address_to_use.first_name} #{object.shipping_address_to_use.last_name}"
+ else
+ object.shipping_address_to_use.name
+ end
+ end
end
end
end