effective_orders 6.28.2 → 6.29.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.
- checksums.yaml +4 -4
- data/app/models/effective/helcim_api.rb +36 -12
- data/app/models/effective/order.rb +5 -1
- data/app/models/effective/order_email.rb +7 -0
- data/app/views/effective/order_emails/_info.html.haml +11 -1
- data/app/views/effective/order_emails/_items_cancelled.html.haml +9 -0
- data/app/views/effective/order_emails/_order_email.html.haml +6 -1
- data/app/views/effective/orders/_order_footer.html.haml +1 -2
- data/lib/effective_orders/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2ed83ebfbf108715d418f71ba4e4328f921e7c25bf1089bf14088273423e10a
|
4
|
+
data.tar.gz: 1d425c694ceb2941600bf6645e78375eb094dd9ca243f20c50f5385c6ead6d83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 939643e123d27170b05fa68b00d3e5a90f774bbe4ea46ffc38fa76d080e123f315d36360ad947146d993b9a790c1fd3fcd7e7ed987a31ba5e10e7bf1941144f1
|
7
|
+
data.tar.gz: d0ba5224ba9c2e787df3c1197f5e25082418fbdf1037260c09c724530b3ad32cfc5666b21de515bc99714b846d2311771fc23dcec9a5bcd24b6191a16f634f3d
|
@@ -26,10 +26,14 @@ module Effective
|
|
26
26
|
get('/connection-test')
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def get_card_transaction(id)
|
30
30
|
get("/card-transactions/#{id}")
|
31
31
|
end
|
32
32
|
|
33
|
+
def get_ach_transaction(id)
|
34
|
+
get("/ach/transactions/#{id}").try(:dig, 'transaction')
|
35
|
+
end
|
36
|
+
|
33
37
|
# Make the Preload Request
|
34
38
|
# https://devdocs.helcim.com/reference/checkout-init
|
35
39
|
def initialize_request(order)
|
@@ -110,6 +114,7 @@ module Effective
|
|
110
114
|
end
|
111
115
|
|
112
116
|
# Decode the base64 encoded JSON object that was given from the form into a Hash
|
117
|
+
# For a card transaction
|
113
118
|
# {"transactionId"=>"38142732",
|
114
119
|
# "dateCreated"=>"2025-08-15 10:10:32",
|
115
120
|
# "cardBatchId"=>"4656307",
|
@@ -126,9 +131,24 @@ module Effective
|
|
126
131
|
# "customerCode"=>"CST1022",
|
127
132
|
# "invoiceNumber"=>"#30",
|
128
133
|
# "warning"=>""}
|
134
|
+
#
|
135
|
+
# For an ACH transaction
|
136
|
+
# {"transactionId"=>"12345",
|
137
|
+
# "batchId"=>"168333,
|
138
|
+
# "dateCreated"=>"2025-10-10 11:48:47",
|
139
|
+
# "statusAuth"=>"APPROVED",
|
140
|
+
# "statusClearing"=>"OPENED",
|
141
|
+
# "type"=>"WITHDRAWAL",
|
142
|
+
# "amount"=>"1.05",
|
143
|
+
# "currency"=>"CAD",
|
144
|
+
# "approvalCode"=>"1232435435",
|
145
|
+
# "bankAccountNumber"=>"4333434",
|
146
|
+
# "bankToken"=>"3748uzocio7348",
|
147
|
+
# "invoiceNumber"=>"#26-1760118464",
|
148
|
+
# "customerCode"=>"CST0000"}
|
149
|
+
|
129
150
|
def decode_payment_payload(payload)
|
130
151
|
return if payload.blank?
|
131
|
-
|
132
152
|
raise('expected a string') unless payload.kind_of?(String)
|
133
153
|
|
134
154
|
payment = (JSON.parse(Base64.decode64(payload)) rescue nil)
|
@@ -145,7 +165,7 @@ module Effective
|
|
145
165
|
raise('expected a payment Hash') unless payment.kind_of?(Hash)
|
146
166
|
|
147
167
|
return true if (payment['status'] == 'APPROVED' && payment['type'] == 'purchase') # CC
|
148
|
-
return true if (payment['
|
168
|
+
return true if (payment['bankAccountId'].present? && payment['responseMessage'].to_s.downcase == 'approved') # ACH
|
149
169
|
|
150
170
|
false
|
151
171
|
end
|
@@ -157,11 +177,15 @@ module Effective
|
|
157
177
|
transaction_id = payment_payload['transactionId']
|
158
178
|
raise('expected a payment_payload with a transactionId') unless transaction_id.present?
|
159
179
|
|
160
|
-
payment =
|
161
|
-
|
180
|
+
payment = if payment_payload['cardBatchId'].present? && payment_payload['type'].to_s.downcase == 'purchase'
|
181
|
+
get_card_transaction(transaction_id)
|
182
|
+
elsif payment_payload['batchId'].present? && payment_payload['type'].to_s.downcase == 'withdrawal'
|
183
|
+
get_ach_transaction(transaction_id)
|
184
|
+
end
|
185
|
+
|
186
|
+
raise("expected an existing card-transaction or ach-transaction payment with params #{payment_payload}") unless payment.kind_of?(Hash)
|
162
187
|
|
163
|
-
|
164
|
-
if payment['transactionId'].to_s != payment_payload['transactionId'].to_s
|
188
|
+
unless (payment['transactionId'].to_s == payment_payload['transactionId'].to_s) || (payment['id'].to_s == payment_payload['transactionId'].to_s)
|
165
189
|
raise('expected the payment and payment_payload to have the same transactionId')
|
166
190
|
end
|
167
191
|
|
@@ -190,7 +214,7 @@ module Effective
|
|
190
214
|
|
191
215
|
def verify_payment!(order, payment)
|
192
216
|
# Validate order ids
|
193
|
-
|
217
|
+
if payment['invoiceNumber'].present? && !payment['invoiceNumber'].start_with?('#' + order.to_param)
|
194
218
|
raise("expected card-transaction invoiceNumber to be the same as the order to_param")
|
195
219
|
end
|
196
220
|
|
@@ -205,12 +229,12 @@ module Effective
|
|
205
229
|
# Takes a payment_intent and returns the card info we can store
|
206
230
|
def card_info(payment)
|
207
231
|
# Return the authorization params merged with the card info
|
208
|
-
last4 = payment['cardNumber'].to_s.last(4)
|
209
|
-
card = payment['cardType'].to_s.downcase
|
232
|
+
last4 = (payment['cardNumber'] || payment['bankAccountL4L4']).to_s.last(4)
|
210
233
|
|
211
|
-
card =
|
234
|
+
card = payment['cardType'].to_s.downcase
|
235
|
+
card = 'ACH' if card.blank? && payment['bankAccountId'].present?
|
212
236
|
|
213
|
-
active_card = "**** **** **** #{last4} #{card}" if last4.present?
|
237
|
+
active_card = "**** **** **** #{last4} #{card}".strip if last4.present?
|
214
238
|
|
215
239
|
{ 'active_card' => active_card, 'card' => card }.compact
|
216
240
|
end
|
@@ -949,6 +949,10 @@ module Effective
|
|
949
949
|
EffectiveOrders.send_email(:order_email_to_admin, self) if EffectiveOrders.send_order_receipt_to_admin
|
950
950
|
end
|
951
951
|
|
952
|
+
def send_event_registrants_cancelled_email!
|
953
|
+
EffectiveOrders.send_email(:order_email, self, event_registrants_cancelled: true)
|
954
|
+
end
|
955
|
+
|
952
956
|
def log_changes_formatted_value(attribute, value)
|
953
957
|
"#{value.to_s.first(8)}...#{value.to_s.last(4)}" if attribute == :delayed_payment_intent && value.present?
|
954
958
|
end
|
@@ -1042,7 +1046,7 @@ module Effective
|
|
1042
1046
|
when 'm', 'mc', 'master', 'mastercard' then 'MasterCard'
|
1043
1047
|
when 'a', 'ax', 'american', 'americanexpress' then 'American Express'
|
1044
1048
|
when 'd', 'discover' then 'Discover'
|
1045
|
-
when 'ach' then 'ACH
|
1049
|
+
when 'ach' then 'ACH'
|
1046
1050
|
else payment_card.to_s
|
1047
1051
|
end
|
1048
1052
|
|
@@ -27,6 +27,7 @@ module Effective
|
|
27
27
|
# The very first line of the email body
|
28
28
|
def header
|
29
29
|
if event.present? && order.purchased_or_deferred?
|
30
|
+
return "Your tickets have been cancelled" if event_registrants_cancelled?
|
30
31
|
return "Your tickets have been confirmed!" if event_none_waitlisted?
|
31
32
|
return "Some of your tickets have been confirmed, but some are on the waitlist" if event_some_waitlisted?
|
32
33
|
return "Your tickets are on the waitlist!" if event_all_waitlisted?
|
@@ -43,6 +44,7 @@ module Effective
|
|
43
44
|
|
44
45
|
def subject
|
45
46
|
if event.present? && order.purchased_or_deferred?
|
47
|
+
return "Tickets cancelled - #{event}" if event_registrants_cancelled?
|
46
48
|
return "Receipt - Order ##{order.to_param}" if order.purchased? && order.delayed_payment_date_past?
|
47
49
|
return "Confirmation - #{event}" if event_none_waitlisted?
|
48
50
|
return "Confirmation & Waitlist - #{event}" if event_some_waitlisted?
|
@@ -103,5 +105,10 @@ module Effective
|
|
103
105
|
return false unless event_registrants.present?
|
104
106
|
event_registrants.all? { |er| er.waitlisted_not_promoted? || er.archived? }
|
105
107
|
end
|
108
|
+
|
109
|
+
def event_registrants_cancelled?
|
110
|
+
opts[:event_registrants_cancelled] == true
|
111
|
+
end
|
112
|
+
|
106
113
|
end
|
107
114
|
end
|
@@ -1,4 +1,14 @@
|
|
1
|
-
- if
|
1
|
+
- if order_email.event_registrants_cancelled?
|
2
|
+
%hr
|
3
|
+
|
4
|
+
%p
|
5
|
+
%strong Important
|
6
|
+
|
7
|
+
%ul
|
8
|
+
%li No payments will be made for these tickets.
|
9
|
+
%li If payment has already been made, we will issue a refund.
|
10
|
+
|
11
|
+
- elsif order.delayed? && order.deferred? && order.delayed_payment_date_upcoming?
|
2
12
|
%hr
|
3
13
|
|
4
14
|
%p
|
@@ -1,6 +1,11 @@
|
|
1
1
|
- # This is the order email
|
2
2
|
= render('effective/order_emails/header', order_email: order_email, order: order)
|
3
3
|
= render('effective/order_emails/info', order_email: order_email, order: order)
|
4
|
-
|
4
|
+
|
5
|
+
- if order_email.event_registrants_cancelled?
|
6
|
+
= render('effective/order_emails/items_cancelled', order_email: order_email, order: order)
|
7
|
+
- else
|
8
|
+
= render('effective/order_emails/items', order_email: order_email, order: order)
|
9
|
+
|
5
10
|
= render('effective/order_emails/signature', order_email: order_email, order: order)
|
6
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.29.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-10-
|
11
|
+
date: 2025-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -292,6 +292,7 @@ files:
|
|
292
292
|
- app/views/effective/order_emails/_header.html.haml
|
293
293
|
- app/views/effective/order_emails/_info.html.haml
|
294
294
|
- app/views/effective/order_emails/_items.html.haml
|
295
|
+
- app/views/effective/order_emails/_items_cancelled.html.haml
|
295
296
|
- app/views/effective/order_emails/_order_email.html.haml
|
296
297
|
- app/views/effective/order_emails/_signature.html.haml
|
297
298
|
- app/views/effective/orders/_checkout_actions.html.haml
|