effective_orders 6.32.1 → 6.32.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f51ea548ef96074bb66ede0cf1656b1ccf4ac73b810a1b5d41dc84f61ff3d78
|
|
4
|
+
data.tar.gz: b884d8b50d14ecb6d55f199003c58a903ee9a086b32c65e0fc00ccb1868edbed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e8bcb7e9b5d3b9b4eb54d673db566630a125f6fd7224670d56d7094d347035be79d9a74e299b3028e1daec994d80577996c9ec6d7da3e1b91de9720518cf9e0
|
|
7
|
+
data.tar.gz: 18426d89a198672f566a65be9b82db09ed2131f41d2cc01a3a6581b75ad39df5dec195c411a2d6bf50517a700935d416f0beabba67a419ea126813efcdb68270
|
|
@@ -32,13 +32,21 @@ function helcimPayIframeEvent(event) {
|
|
|
32
32
|
window.removeEventListener('message', helcimPayIframeEvent, false);
|
|
33
33
|
|
|
34
34
|
let payment = btoa(event.data.eventMessage);
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
let $form = $('form[data-helcim-checkout]').first();
|
|
37
37
|
$form.find('input[name="helcim[payment]"]').val(payment);
|
|
38
38
|
$form.submit();
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
$('#helcimCheckout').fadeOut('slow');
|
|
41
41
|
$('#helcim-checkout-loading').text('Thank you! Processing payment information. Please wait...');
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
if(event.data.eventStatus == 'ABORTED') {
|
|
45
|
+
let payment = btoa(event.data.eventMessage);
|
|
46
|
+
|
|
47
|
+
let $form = $('form[data-helcim-checkout]').first();
|
|
48
|
+
$form.find('input[name="helcim[payment]"]').val(payment);
|
|
49
|
+
$form.submit();
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
52
|
};
|
|
@@ -17,6 +17,12 @@ module Effective
|
|
|
17
17
|
# Decode the payment payload
|
|
18
18
|
payment_payload = api.decode_payment_payload(helcim_params[:payment])
|
|
19
19
|
|
|
20
|
+
# Check for a declined payment payload
|
|
21
|
+
if payment_payload == :declined
|
|
22
|
+
return order_declined(payment: {}, provider: 'helcim', card: nil, declined_url: helcim_params[:declined_url])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Check for an unexpected payment payload
|
|
20
26
|
if payment_payload.blank?
|
|
21
27
|
flash[:danger] = 'Unable to process helcim order without payment. please try again.'
|
|
22
28
|
return order_not_processed(declined_url: helcim_params[:declined_url])
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# https://devdocs.helcim.com/docs/overview-of-helcimpayjs
|
|
2
2
|
# Effective::HelcimApi.new.health_check
|
|
3
|
+
# use card 4242, expiry 01/28, CVV 209 for a general decline
|
|
4
|
+
|
|
3
5
|
module Effective
|
|
4
6
|
class HelcimApi
|
|
5
7
|
# All required
|
|
@@ -134,12 +136,22 @@ module Effective
|
|
|
134
136
|
# "invoiceNumber"=>"#26-1760118464",
|
|
135
137
|
# "customerCode"=>"CST0000"}
|
|
136
138
|
|
|
139
|
+
# When the payment is aborted, the decoded payload is a string with the error
|
|
140
|
+
# "HelcimPay.js transaction aborted - \"Transaction declined. DECLINED - Do Not Honor\"
|
|
141
|
+
|
|
137
142
|
def decode_payment_payload(payload)
|
|
138
143
|
return if payload.blank?
|
|
139
144
|
raise('expected a string') unless payload.kind_of?(String)
|
|
140
145
|
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
decoded = (Base64.decode64(payload) rescue nil)
|
|
147
|
+
payment = (JSON.parse(decoded) rescue nil)
|
|
148
|
+
|
|
149
|
+
if payment.blank? && decoded.to_s.downcase.include?('declined')
|
|
150
|
+
return :declined
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
raise('expected payment to be a Hash') unless payment.kind_of?(Hash) || payment.blank?
|
|
154
|
+
return payment if payment.blank?
|
|
143
155
|
|
|
144
156
|
payment = payment.dig('data', 'data')
|
|
145
157
|
raise('expected payment data') unless payment.kind_of?(Hash)
|