ac_mercado_pago 0.0.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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/mercado_pago.rb +64 -0
  3. metadata +54 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c9395ffc13a54525d0841f366c26b0c402788ab5d066e3966df7ee8110604e27
4
+ data.tar.gz: 836e665cd4f8f03eb7450d49c2dbffec02cf9a30d546b2431267f69256fa5b50
5
+ SHA512:
6
+ metadata.gz: cdee90f855a05a3c7d7431853a6b5ec0fffd70482102eb53d59e22619b511de24d0f54236ed129a227442189c938bbafddd4b54ee6880bf22bd63d867de97cd8
7
+ data.tar.gz: 471d5e77fecf1057a3aca2b837ad9957ccce4ff61320eaae744efade8f041d72cd9af94cf07a5224cf13da8c46975dd45781ce8f30c9df53a5c5ac2a4a8b33cf
@@ -0,0 +1,64 @@
1
+ require "ac"
2
+ class MercadoPago < Ac::Base
3
+ BASE_URL = "https://api.mercadopago.com/v1/"
4
+
5
+ def payment_methods
6
+ get "payment_methods"
7
+ end
8
+
9
+ def create_pix amount:, email:, identification_type:, identification_number:
10
+ body = {
11
+ transaction_amount: amount,
12
+ payment_method_id: "pix",
13
+ payer: {
14
+ email: email,
15
+ identification: {
16
+ type: identification_type,
17
+ number: identification_number
18
+ }
19
+ }
20
+ }
21
+ post "payments", body:
22
+ end
23
+
24
+ def create_card_payment amount:, card_token:, installments:, email:
25
+ body = {
26
+ transaction_amount: amount,
27
+ token: card_token,
28
+ installments: installments,
29
+ payer: {
30
+ email: email
31
+ }
32
+ }
33
+ post "payments", body:
34
+ end
35
+
36
+ def create_customer email:, first_name: nil, identification_type: nil, identification_number: nil
37
+ body = {
38
+ email: email,
39
+ first_name: first_name,
40
+ identification: {
41
+ type: identification_type,
42
+ number: identification_number
43
+ }
44
+ }.compact!
45
+ post "customers", body:
46
+ end
47
+
48
+ def create_card_token card_number:, expiration_year:, expiration_month:, security_code:, cardholder_name:
49
+ body = {
50
+ card_number: card_number,
51
+ expiration_year: expiration_year.to_i,
52
+ expiration_month: expiration_month.to_i,
53
+ security_code: security_code,
54
+ cardholder: {
55
+ name: cardholder_name
56
+ }
57
+ }
58
+ post "card_tokens", body:
59
+ end
60
+
61
+ def get_payment id:
62
+ get "payments/#{id}"
63
+ end
64
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ac_mercado_pago
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - caiogarcia1
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-03-24 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ac
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ description: A simple hello world gem
27
+ email: caiogarcia@hey.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - lib/mercado_pago.rb
33
+ homepage: https://github.com/todasessascoisas/mercado_pago
34
+ licenses:
35
+ - MIT
36
+ metadata: {}
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.6.2
52
+ specification_version: 4
53
+ summary: Mercado Pago
54
+ test_files: []