solidus_mp 0.2.3 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc5769094a8fd0753cde88b796f0dac68f9980ae3ec9ac2a1e666f5862af4bc2
|
4
|
+
data.tar.gz: da8d80ce3d9d6526f091cf74ed88a71b2b4d553eee881d8a3c4f8963ea830342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faf50651c94d20347741c1f827baa31e3b47705fb114fe4ead7e0783ea9772fc1672cf8f10e0c7a43f85471099a92b8f0203b25977eca81f643205bce64a9a45
|
7
|
+
data.tar.gz: 253ade89915d96aef0695f5f7a81069d91f6399f69e40492303bbbeb87dd225441dc06a733955aeb485223599181ec8d4300b7f8c184ff9e374a885a7f448d80
|
@@ -17,7 +17,25 @@ module SolidusMp
|
|
17
17
|
source.is_a?(payment_source_class)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def create_card_payment payment
|
21
|
+
mp_payment = create_mp_payment(payment)
|
22
|
+
payment.source.update(external_id: mp_payment.id, three_ds_url: mp_payment.three_ds_info_external_resource_url, three_ds_creq: mp_payment.three_ds_info_creq)
|
23
|
+
if mp_payment.error || mp_payment.internal_error
|
24
|
+
payment.invalidate
|
25
|
+
error_message = mp_payment.error || mp_payment.internal_error
|
26
|
+
response = failure_response(error_message)
|
27
|
+
payment.log_entries.create!(parsed_payment_response_details_with_fallback: response)
|
28
|
+
payment.source.update(error_message: mp_payment.error, status: "error")
|
29
|
+
elsif mp_payment.status == "approved"
|
30
|
+
payment.complete
|
31
|
+
payment.source.update(status: "success")
|
32
|
+
elsif mp_payment.status == "pending"
|
33
|
+
payment.source.update(status: "pending")
|
34
|
+
end
|
35
|
+
payment.source
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_mp_payment payment
|
21
39
|
MpApi.configuration.access_token = preferences[:access_token]
|
22
40
|
MpApi::Payment.new(amount: payment.amount.to_f, payment_method: payment.source.credit_card_brand, payer_email: payment.source.email, payer_identification_type: payment.source.payer_identification_type, payer_identification_number: payment.source.tax_id, token: payment.source.token, issuer_id: payment.source.issuer_id, installments: payment.source.installments, three_d_secure_mode: true, statement_descriptor: payment.source.statement_descriptor, description: payment.source.description, items: payment.source.items).create
|
23
41
|
end
|
@@ -39,6 +57,7 @@ module SolidusMp
|
|
39
57
|
mp_payment = MpApi::Payment.find_by_id(source.external_id)
|
40
58
|
end
|
41
59
|
if mp_payment.status == "approved"
|
60
|
+
source.update(status: "approved")
|
42
61
|
successful_response("Transaction Accredited", mp_payment.id)
|
43
62
|
else
|
44
63
|
failure_response(mp_payment.status_detail || mp_payment.status)
|
@@ -19,17 +19,16 @@ module SolidusMp
|
|
19
19
|
|
20
20
|
def create_pix_payment payment
|
21
21
|
mp_payment = create_mp_payment(payment)
|
22
|
-
if mp_payment.
|
22
|
+
if mp_payment.error || mp_payment.internal_error
|
23
23
|
payment.invalidate
|
24
|
-
error_message = mp_payment.
|
24
|
+
error_message = mp_payment.error || mp_payment.internal_error
|
25
25
|
response = failure_response(error_message)
|
26
26
|
payment.log_entries.create!(parsed_payment_response_details_with_fallback: response)
|
27
|
-
payment.source.update(error_message:
|
28
|
-
"error"
|
27
|
+
payment.source.update(error_message: mp_payment.error, status: "error")
|
29
28
|
elsif mp_payment.status == "pending"
|
30
|
-
payment.source.update(external_id: mp_payment.id, qr_code: mp_payment.qr_code, qr_code_base64: mp_payment.qr_code_base_64, ticket_url: mp_payment.ticket_url, status:
|
31
|
-
"pending"
|
29
|
+
payment.source.update(external_id: mp_payment.id, qr_code: mp_payment.qr_code, qr_code_base64: mp_payment.qr_code_base_64, ticket_url: mp_payment.ticket_url, status: "pending")
|
32
30
|
end
|
31
|
+
payment.source
|
33
32
|
end
|
34
33
|
|
35
34
|
def create_mp_payment payment
|
@@ -50,6 +49,7 @@ module SolidusMp
|
|
50
49
|
MpApi.configuration.access_token = preferences[:access_token]
|
51
50
|
mp_payment = MpApi::Payment.find_by_id(source.external_id)
|
52
51
|
if mp_payment.status == "approved"
|
52
|
+
source.update(status: "approved")
|
53
53
|
successful_response("Transaction Accredited", mp_payment.id)
|
54
54
|
else
|
55
55
|
failure_response(mp_payment.status_detail || mp_payment.status)
|
data/lib/solidus_mp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_mp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caio
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.4.
|
160
|
+
rubygems_version: 3.4.6
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: ''
|