workarea-mapp_integration 0.1.1

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.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +15 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +28 -0
  6. data/Rakefile +29 -0
  7. data/app/assets/config/workarea_mapp_integration_manifest.js +0 -0
  8. data/app/assets/images/workarea/mapp_integration/.keep +0 -0
  9. data/app/assets/javascripts/workarea/mapp_integration/.keep +0 -0
  10. data/app/assets/stylesheets/workarea/mapp_integration/.keep +0 -0
  11. data/app/controllers/.keep +0 -0
  12. data/app/helpers/.keep +0 -0
  13. data/app/mailers/.keep +0 -0
  14. data/app/models/.keep +0 -0
  15. data/app/services/workarea/mapp_integration/mapp_integration_gateway.rb +242 -0
  16. data/app/views/.keep +0 -0
  17. data/app/workers/workarea/mapp_integration_create_user_worker.rb +21 -0
  18. data/app/workers/workarea/mapp_integration_email_signup_worker.rb +22 -0
  19. data/app/workers/workarea/mapp_integration_order_place_worker.rb +30 -0
  20. data/app/workers/workarea/mapp_integration_update_user_worker.rb +21 -0
  21. data/app/workers/workarea/mapp_integration_user_unsubscribe_email_newsletter_worker.rb +27 -0
  22. data/bin/rails +25 -0
  23. data/config/routes.rb +2 -0
  24. data/lib/tasks/workarea/mapp_integration_tasks.rake +4 -0
  25. data/lib/workarea/mapp_integration.rb +7 -0
  26. data/lib/workarea/mapp_integration/engine.rb +6 -0
  27. data/lib/workarea/mapp_integration/version.rb +5 -0
  28. data/test/dummy/.ruby-version +1 -0
  29. data/test/dummy/Rakefile +6 -0
  30. data/test/dummy/app/assets/config/manifest.js +3 -0
  31. data/test/dummy/app/assets/images/.keep +0 -0
  32. data/test/dummy/app/assets/javascripts/application.js +14 -0
  33. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/test/dummy/app/controllers/application_controller.rb +2 -0
  35. data/test/dummy/app/controllers/concerns/.keep +0 -0
  36. data/test/dummy/app/helpers/application_helper.rb +2 -0
  37. data/test/dummy/app/jobs/application_job.rb +2 -0
  38. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  39. data/test/dummy/app/models/concerns/.keep +0 -0
  40. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  41. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  42. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  43. data/test/dummy/bin/bundle +3 -0
  44. data/test/dummy/bin/rails +4 -0
  45. data/test/dummy/bin/rake +4 -0
  46. data/test/dummy/bin/setup +28 -0
  47. data/test/dummy/bin/update +28 -0
  48. data/test/dummy/bin/yarn +11 -0
  49. data/test/dummy/config.ru +5 -0
  50. data/test/dummy/config/application.rb +30 -0
  51. data/test/dummy/config/boot.rb +5 -0
  52. data/test/dummy/config/environment.rb +5 -0
  53. data/test/dummy/config/environments/development.rb +52 -0
  54. data/test/dummy/config/environments/production.rb +83 -0
  55. data/test/dummy/config/environments/test.rb +43 -0
  56. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  57. data/test/dummy/config/initializers/assets.rb +14 -0
  58. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  60. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  61. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  62. data/test/dummy/config/initializers/inflections.rb +16 -0
  63. data/test/dummy/config/initializers/mime_types.rb +4 -0
  64. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  65. data/test/dummy/config/locales/en.yml +33 -0
  66. data/test/dummy/config/puma.rb +37 -0
  67. data/test/dummy/config/routes.rb +3 -0
  68. data/test/dummy/config/spring.rb +6 -0
  69. data/test/dummy/lib/assets/.keep +0 -0
  70. data/test/dummy/log/.keep +0 -0
  71. data/test/dummy/package.json +5 -0
  72. data/test/dummy/public/404.html +67 -0
  73. data/test/dummy/public/422.html +67 -0
  74. data/test/dummy/public/500.html +66 -0
  75. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  76. data/test/dummy/public/apple-touch-icon.png +0 -0
  77. data/test/dummy/public/favicon.ico +0 -0
  78. data/test/integration/navigation_test.rb +7 -0
  79. data/test/test_helper.rb +11 -0
  80. data/test/workarea/mapp_integration_test.rb +7 -0
  81. data/workarea-mapp_integration.gemspec +19 -0
  82. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ae5c7353f71a5fb8ad16ae7b1c9197793c64427162c8557078b0c0c23b79f89e
4
+ data.tar.gz: 04bbfc6a9e20a4dbc160bcefc7fa0a74379475e98666d555abe8f99cdfebc59d
5
+ SHA512:
6
+ metadata.gz: 0f8c67fc7e20b37ce826ff514dc0e7a1fc6bff8dd6fca00daa747d4511647b0cafb48dd3a413ab78f57729ef12d851de3bef73b831d8fd09f2c641d295790342
7
+ data.tar.gz: 0b4f05df233b4e7d3f45625b302e2e9c14303d089c49aa421fef7ec07924a17bee0ce61cf9bb537fb490d28ec849506201255c919df8dc2e61eea4bc69d1d36a
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/log/*.log
5
+ test/dummy/node_modules/
6
+ test/dummy/yarn-error.log
7
+ test/dummy/tmp/
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in workarea-mapp_integration.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use a debugger
15
+ # gem 'byebug', group: [:development, :test]
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 Satya.Tejadvs
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Workarea::MappIntegration
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'workarea-mapp_integration'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install workarea-mapp_integration
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Workarea::MappIntegration'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ load 'rails/tasks/statistics.rake'
18
+
19
+ require 'bundler/gem_tasks'
20
+
21
+ require 'rake/testtask'
22
+
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'test'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = false
27
+ end
28
+
29
+ task default: :test
File without changes
File without changes
data/app/helpers/.keep ADDED
File without changes
data/app/mailers/.keep ADDED
File without changes
data/app/models/.keep ADDED
File without changes
@@ -0,0 +1,242 @@
1
+ require 'net/http'
2
+ require 'httparty'
3
+
4
+ module Workarea
5
+ module MappIntegration
6
+ # Sending the data to MAPP via Api upon several actions on design toscano site.
7
+ class MappIntegrationGateway
8
+ # Converting username and password to ruby basic auth.
9
+ def basic_auth
10
+ auth = "Basic " + Base64::encode64("#{Rails.application.secrets.mapp_integration[:username]}:#{Rails.application.secrets.mapp_integration[:password]}")
11
+ end
12
+
13
+ # Generating headers for succesfull api.
14
+ def headers
15
+ {
16
+ "Authorization" => basic_auth,
17
+ "Content-Type" => "application/json",
18
+ "Accept" => "application/json"
19
+ }
20
+ end
21
+
22
+ # Membership subscribe API#
23
+ def membership_subscribe_by_email(user)
24
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/membership/subscribeByEmail", headers: headers, query: membership_subscribe_by_email_api_query(user.email) )
25
+ end
26
+
27
+ def membership_subscribe_by_email_api_query(email)
28
+ {
29
+ "email" => email,
30
+ "groupId" => "#{Rails.application.secrets.mapp_integration[:group_id]}",
31
+ "subscriptionMode" => "#{Rails.application.secrets.mapp_integration[:subscription_mode]}"
32
+ }
33
+ end
34
+
35
+ # Membership Unsubscribe API#
36
+ def membership_unsubscribe_by_email(user)
37
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/membership/unsubscribeByEmail", headers: headers, query: membership_unsubscribe_by_email_api_query(user))
38
+ end
39
+
40
+ def membership_unsubscribe_by_email_api_query(user)
41
+ {
42
+ "email" => user.email,
43
+ "groupId" => "#{Rails.application.secrets.mapp_integration[:group_id]}"
44
+ }
45
+ end
46
+
47
+ # Account Creation API#
48
+ def mapp_integration_for_user_creation(user) # Method triggers when creating the account in workarea
49
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/create", headers: headers, query: user_creation_api_query(user), body: user_creation_api_body(user))
50
+ membership_subscribe_by_email(user)
51
+ user_creation_transaction_api(response)
52
+ end
53
+
54
+ def user_creation_api_query(user) # This method greps the user and assaigns the value to email.
55
+ {
56
+ "email" => user.email,
57
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:user_create_api_message_id]}"
58
+ }
59
+ end
60
+
61
+ def user_creation_api_body(user) # This method greps the user and assaigns the values and especially written for api body.
62
+ [
63
+ {
64
+ "name" => 'email',
65
+ "value" => user.email
66
+ }
67
+ ].to_json
68
+ end
69
+
70
+ def user_creation_transaction_api(response)
71
+ transaction = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/message/sendTransactional", headers: headers, query: user_creation_transaction_api_query(response), body: mapp_email_signup_transaction_api_body(response))
72
+ end
73
+
74
+ def user_creation_transaction_api_query(response)
75
+ {
76
+ "recipientId" => response.parsed_response["id"],
77
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:user_create_api_message_id]}",
78
+ "externalTransactionFormula" => "null"
79
+ }
80
+ end
81
+
82
+ # Email signup API#
83
+ def mapp_integration_email_signup_api(signup_data)
84
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/create", headers: headers, query: mapp_email_signup_api_query(signup_data), body: mapp_email_signup_api_body(signup_data))
85
+ membership_subscribe_by_email(signup_data)
86
+ mapp_email_signup_transaction_api(response)
87
+ end
88
+
89
+ def mapp_email_signup_api_query(signup_data)
90
+ {
91
+ "email" => signup_data.email
92
+ }
93
+ end
94
+
95
+ def mapp_email_signup_api_body(signup_data)
96
+ [
97
+ {
98
+ "name" => 'email',
99
+ "value" => signup_data.email
100
+ }
101
+ ].to_json
102
+ end
103
+
104
+ def mapp_email_signup_transaction_api(response)
105
+ HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/message/sendTransactional", headers: headers, query: mapp_email_signup_transaction_api_query(response), body: mapp_email_signup_transaction_api_body(response))
106
+ end
107
+
108
+ def mapp_email_signup_transaction_api_query(response)
109
+ {
110
+ "recipientId" => response.parsed_response["id"],
111
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:email_signup_api_message_id]}",
112
+ "externalTransactionFormula" => "null"
113
+ }
114
+ end
115
+
116
+ def mapp_email_signup_transaction_api_body(response)
117
+ {
118
+ "parameters" =>
119
+ [
120
+ {"name" => "Parameter Name 1","value" => "Parameter Value 1"},
121
+ {"name" => "Parameter Name 2","value" => "Parameter Value 2"}
122
+ ]
123
+ }.to_json
124
+ end
125
+ # Update User API#
126
+ def mapp_integration_for_update_user(user) # Method triggers when user is updated in workarea
127
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/updateProfileByEmail", headers: headers, query: update_user_creation_api_query(user), body: update_user_creation_api_body(user))
128
+ end
129
+
130
+ def update_user_creation_api_query(user)
131
+ {
132
+ "email" => user.email
133
+ }
134
+ end
135
+
136
+ def update_user_creation_api_body(user) # Request body for update_user api
137
+ [
138
+ {
139
+ "name" => "email",
140
+ "value" => user.email
141
+ },
142
+ {
143
+ "name" =>"email",
144
+ "value" => user.email
145
+ }
146
+ ].to_json
147
+ end
148
+
149
+ # Catalog Form API#
150
+ def mapp_email_signup_from_catalog_form(user)
151
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/create", headers: headers, query: catalog_form_user_creation_api_query(user), body: catalog_form_user_creation_api_body(user))
152
+ membership_subscribe_by_email(user)
153
+ catalog_form_transaction_api(response)
154
+ end
155
+
156
+ def catalog_form_user_creation_api_query(user)
157
+ {
158
+ "email" => user.email,
159
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:catalog_request_api_message_id]}"
160
+ }
161
+ end
162
+
163
+ def catalog_form_user_creation_api_body(user)
164
+ [
165
+ {
166
+ "name" => 'email',
167
+ "value" => user.email
168
+ }
169
+ ].to_json
170
+ end
171
+
172
+ def catalog_form_transaction_api(response)
173
+ HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/message/sendTransactional", headers: headers, query: catalog_form_transaction_api_query(response), body: mapp_email_signup_transaction_api_body(response))
174
+ end
175
+
176
+ def catalog_form_transaction_api_query(response)
177
+ {
178
+ "recipientId" => response.parsed_response["id"],
179
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:catalog_request_api_message_id]}",
180
+ "externalTransactionFormula" => "null"
181
+ }
182
+ end
183
+
184
+ # Order placed API #
185
+ # Hitting order placed api when we place order in workarea.
186
+ def mapp_integration_for_order_placed(order, user_id)
187
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/message/sendTransactionalWithEventDetails", headers: headers, query: order_placed_api_query(order, user_id), body: order_placed_api_body(order, user_id))
188
+ end
189
+
190
+ def order_placed_api_query(order, user_id)
191
+ {
192
+ "recipientId" => "#{user_id}",
193
+ "messageId" => "#{Rails.application.secrets.mapp_integration[:order_placed_api_message_id]}",
194
+ "externalTransactionFormula" => "#{order.id}"
195
+ }
196
+ end
197
+
198
+ def order_placed_api_body(order, user_id) # Calling the sendTransactionalWithEventDetails api body from order.decorator in the DT project
199
+ order.mapp_order_placed_api_body(order, user_id)
200
+ end
201
+ # Hitting user get by email api to verify the user existance. If yes, we are calling the sendTransactionalWithEventDetails api.
202
+ # If user is not present(i.e., guest user in workarea) in mapp, we are calling user_creation api and from there fetching the mappuser_id.
203
+ def get_user_by_email(order)
204
+ response = HTTParty.get("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/getByEmail", headers: headers, query: user_get_by_email_query(order.email))
205
+ user_id_from_response = response.parsed_response["id"]
206
+
207
+ begin
208
+ if user_id_from_response.nil?
209
+ guest_user_response = Workarea::MappIntegration::MappIntegrationGateway.new.user_creation_for_guest_user(order)
210
+ user_id = guest_user_response.parsed_response["id"]
211
+ Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_for_order_placed(order, user_id)
212
+ else
213
+ Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_for_order_placed(order, user_id_from_response)
214
+ end
215
+ rescue Timeout::Error => e
216
+ Rails.logger.info "Rescued #{e.message}"
217
+ end
218
+ end
219
+
220
+ def user_get_by_email_query(email)
221
+ {
222
+ "email" => email
223
+ }
224
+ end
225
+
226
+ # Creating the account in mapp for guest user in workarea.
227
+ def user_creation_for_guest_user(user)
228
+ response = HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/create", headers: headers, query: user_creation_api_query(user), body: user_creation_api_body(user))
229
+ end
230
+
231
+ # Subscribe by Email API when subscribing from billing address#
232
+ def membership_subscribe_from_billing_address(email)
233
+ HTTParty.post("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/membership/subscribeByEmail", headers: headers, query: membership_subscribe_by_email_api_query(email) )
234
+ end
235
+
236
+ def subscribe_from_billing_address_transaction(email)
237
+ response = HTTParty.get("#{Rails.application.secrets.mapp_integration[:api_endpoint]}"+"/user/getByEmail", headers: headers, query: user_get_by_email_query(email))
238
+ mapp_email_signup_transaction_api(response)
239
+ end
240
+ end
241
+ end
242
+ end
data/app/views/.keep ADDED
File without changes
@@ -0,0 +1,21 @@
1
+ module Workarea
2
+ #Worker for mapp integration includes Creating the user and membership_subscribe_by_email api's.
3
+ class MappIntegrationCreateUserWorker
4
+ include Sidekiq::Worker
5
+ include Sidekiq::CallbacksWorker
6
+
7
+ sidekiq_options(
8
+ retry: true,
9
+ enqueue_on: { Workarea::User => :create }
10
+ )
11
+
12
+ #Triggers the perform method depending on the actions represented in enqueue_on
13
+ def perform(id)
14
+ mapp_integration_flag = Rails.application.secrets.mapp_integration[:flag] rescue nil
15
+ if mapp_integration_flag == true
16
+ user = Workarea::User.find(id)
17
+ Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_for_user_creation(user)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ module Workarea
2
+ #Worker for mapp integration includes when email signup is done on the DT site.
3
+ class MappIntegrationEmailSignupWorker
4
+ include Sidekiq::Worker
5
+ include Sidekiq::CallbacksWorker
6
+
7
+ sidekiq_options(
8
+ retry: true,
9
+ enqueue_on: { Workarea::Email::Signup => :create }
10
+ )
11
+
12
+ #Triggers the perform method depending on email signup create action.
13
+ def perform(id)
14
+ mapp_integration_flag = Rails.application.secrets.mapp_integration[:flag] rescue nil
15
+ if mapp_integration_flag == true
16
+ signup_data = Workarea::Email::Signup.find(id)
17
+ #Hitting user_create and membership_subscribe_by_email api's by hitting 'mapp_integration_for_user_creation' method.
18
+ Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_email_signup_api(signup_data)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ module Workarea
2
+ #Worker for mapp integration includes hitting the order placed api.
3
+ class MappIntegrationOrderPlaceWorker
4
+ include Sidekiq::Worker
5
+ include Sidekiq::CallbacksWorker
6
+
7
+ sidekiq_options(
8
+ retry: true,
9
+ enqueue_on: { Workarea::Order => :place }
10
+ )
11
+
12
+ #Triggers the perform method depending on the order place action.
13
+ def perform(id)
14
+ mapp_integration_flag = Rails.application.secrets.mapp_integration[:flag] rescue nil
15
+ if mapp_integration_flag == true
16
+ order = Workarea::Order.find(id)
17
+ # For making 'sendTransactionalWithEventDetails' api, we are first hitting get_user_by email api.
18
+ Workarea::MappIntegration::MappIntegrationGateway.new.get_user_by_email(order)
19
+ # While doing checkout process, when user selects the sign-me-up checkbox from billing address, we are hitting "membership subscribe by email" api.
20
+ order_view_model = Workarea::Storefront::OrderViewModel.new(order)
21
+ checkbox = order_view_model.billing_address.signup_checkbox
22
+
23
+ if checkbox == true
24
+ Workarea::MappIntegration::MappIntegrationGateway.new.membership_subscribe_from_billing_address(order.email)
25
+ Workarea::MappIntegration::MappIntegrationGateway.new.subscribe_from_billing_address_transaction(order.email)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end