solidus_mp 0.1.4 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -10
- data/app/models/solidus_mp/mp_card.rb +2 -14
- data/app/models/solidus_mp/mp_pix.rb +2 -9
- data/db/migrate/20231205142655_create_solidus_mp_pix_payment_sources.rb +0 -1
- data/db/migrate/20231221130457_add_items_to_mp_pix.rb +7 -0
- data/db/migrate/20231221141935_add_items_to_mp_card.rb +7 -0
- data/lib/solidus_mp/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98de92d2e207f5ff621a944cb8f4d361228293c85bf3ce399168b0a24f8128ef
|
4
|
+
data.tar.gz: 9f6f5b90d2e06ece8de659e16cd750781dd0cfcbac76c1b87eafb3ea4d5c88b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d0263a2f4408e083a27837083cda99f562843b2dcb564856e93c6d16019a19010d9b5ebf49e6c2a6d67395f2611c96c631178e81b011a1ca975277167539ce0
|
7
|
+
data.tar.gz: 8d16891d5d19bb303429fc5a25f31a18f884d04b14c5528a864e51bb93cc0f047a66f17a41cc96a02197caf1bb3e3eea677a508a4596a928253aa1a1a0280ea7
|
data/README.md
CHANGED
@@ -1,30 +1,22 @@
|
|
1
1
|
# Solidus Bling
|
2
2
|
|
3
|
-
[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_bling.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_bling)
|
4
|
-
[![codecov](https://codecov.io/gh/solidusio-contrib/solidus_bling/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_bling)
|
5
|
-
|
6
|
-
<!-- Explain what your extension does. -->
|
7
|
-
|
8
3
|
## Installation
|
9
4
|
|
10
5
|
Add solidus_bling to your Gemfile:
|
11
6
|
|
12
7
|
```ruby
|
13
|
-
gem '
|
8
|
+
gem 'solidus_mp'
|
14
9
|
```
|
15
10
|
|
16
11
|
Bundle your dependencies and run the installation generator:
|
17
12
|
|
18
13
|
```shell
|
19
|
-
bin/rails generate
|
14
|
+
bin/rails generate solidus_mp:install
|
20
15
|
```
|
21
16
|
|
22
17
|
```shell
|
23
18
|
bin/rails assets:precompile
|
24
19
|
```
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
20
|
## License
|
29
21
|
|
30
22
|
Copyright (c) 2023 ulysses-bull, released under the New BSD License.
|
@@ -18,20 +18,8 @@ module SolidusMp
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_api_payment payment
|
21
|
-
|
22
|
-
|
23
|
-
mp_payment = 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).create
|
24
|
-
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)
|
25
|
-
if mp_payment.status == "approved"
|
26
|
-
payment.complete
|
27
|
-
elsif mp_payment.status == "rejected"
|
28
|
-
payment.invalidate
|
29
|
-
end
|
30
|
-
rescue MpApi::TooManyRequestsError
|
31
|
-
payment.invalidate
|
32
|
-
rescue MpApi::RequestError
|
33
|
-
payment.invalidate
|
34
|
-
end
|
21
|
+
MpApi.configuration.access_token = preferences[:access_token]
|
22
|
+
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
|
35
23
|
end
|
36
24
|
|
37
25
|
def authorize(money, source, options = {})
|
@@ -18,15 +18,8 @@ module SolidusMp
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_api_payment payment
|
21
|
-
|
22
|
-
|
23
|
-
mp_payment = MpApi::Payment.new(payer_email: payment.source.email, payer_identification_type: "CPF", payment_method: "pix", payer_identification_number: payment.source.tax_id, amount: payment.amount.to_f).create
|
24
|
-
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)
|
25
|
-
rescue MpApi::TooManyRequestsError
|
26
|
-
payment.invalidate
|
27
|
-
rescue MpApi::RequestError
|
28
|
-
payment.invalidate
|
29
|
-
end
|
21
|
+
MpApi.configuration.access_token = preferences[:access_token]
|
22
|
+
MpApi::Payment.new(payer_email: payment.source.email, payer_identification_type: "CPF", payment_method: "pix", payer_identification_number: payment.source.tax_id, amount: payment.amount.to_f, statement_descriptor: payment.source.statement_descriptor, description: payment.source.description, items: payment.source.items).create
|
30
23
|
end
|
31
24
|
|
32
25
|
def authorize(money, source, options = {})
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddItemsToMpPix < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
add_column :solidus_mp_pix_payment_sources, :items, :jsonb, default: []
|
4
|
+
add_column :solidus_mp_pix_payment_sources, :statement_descriptor, :string
|
5
|
+
add_column :solidus_mp_pix_payment_sources, :description, :string
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddItemsToMpCard < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
add_column :solidus_mp_card_payment_sources, :items, :jsonb, default: []
|
4
|
+
add_column :solidus_mp_card_payment_sources, :statement_descriptor, :string
|
5
|
+
add_column :solidus_mp_card_payment_sources, :description, :string
|
6
|
+
end
|
7
|
+
end
|
data/lib/solidus_mp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_mp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -111,6 +111,8 @@ files:
|
|
111
111
|
- config/routes.rb
|
112
112
|
- db/migrate/20231205142655_create_solidus_mp_pix_payment_sources.rb
|
113
113
|
- db/migrate/20231205142931_create_solidus_mp_card_payment_sources.rb
|
114
|
+
- db/migrate/20231221130457_add_items_to_mp_pix.rb
|
115
|
+
- db/migrate/20231221141935_add_items_to_mp_card.rb
|
114
116
|
- lib/generators/solidus_mp/install/install_generator.rb
|
115
117
|
- lib/generators/solidus_mp/install/templates/app/javascript/controllers/credit_card_controller.js
|
116
118
|
- lib/generators/solidus_mp/install/templates/app/javascript/controllers/three_ds_controller.js
|
@@ -153,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
155
|
- !ruby/object:Gem::Version
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
|
-
rubygems_version: 3.4.
|
158
|
+
rubygems_version: 3.4.6
|
157
159
|
signing_key:
|
158
160
|
specification_version: 4
|
159
161
|
summary: ''
|