easy_pay_u_latam 0.1.23 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/app/controllers/easy_pay_u_latam/api/v1/pay_u_subscriptions_controller.rb +1 -1
- data/app/models/easy_pay_u_latam/payu_payment.rb +30 -17
- data/config/initializers/rabl.rb +2 -2
- data/lib/easy_pay_u_latam/r_api.rb +1 -17
- data/lib/easy_pay_u_latam/r_api/additional_charge.rb +2 -2
- data/lib/easy_pay_u_latam/r_api/card.rb +2 -2
- data/lib/easy_pay_u_latam/r_api/client.rb +1 -1
- data/lib/easy_pay_u_latam/r_api/invoice.rb +2 -2
- data/lib/easy_pay_u_latam/r_api/plan.rb +1 -1
- data/lib/easy_pay_u_latam/r_api/subscription.rb +2 -2
- data/lib/easy_pay_u_latam/version.rb +1 -1
- metadata +3 -102
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b787e6e14ed3b64484e153321e73725bbcab0e9658759535773ba0e0875a45
|
4
|
+
data.tar.gz: efddcb527dc5ffa4069106af5ad33de513db4a428e24a8a6367c2bc048d53e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f922ed4334656bc36ee6c63c1a82ee7c18b9e5417028e1457d09870bec536653340b2a2a5538c4581c6ec3b8dcbfe17bfcbeb5d770aeed9b0112e3d1bf25c952
|
7
|
+
data.tar.gz: c176de9c2719d0a58a9b7ba7ac29f2db6b9875af1dbdb9613831bfa9a7bfdb83fc828c61cebbd700854fbeda8664c4d813830b4be20455f40c94a2029c2140dc
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ $ rails g migration AddPayUFieldsToUsers payu_default_card:string payu_customer_
|
|
35
35
|
|
36
36
|
Only run this when recurrent payments are ON, extra fields for recurrent payments on payments table, you must run the following migration.
|
37
37
|
```bash
|
38
|
-
$ rails g migration AddRecurrentPaymentsToEasyPayULatamPayuPayments payu_plan_id:string payu_plan_code:string payu_customer_id:string payu_subscription_id:string trial_days:integer payu_credit_card_token:string
|
38
|
+
$ rails g migration AddRecurrentPaymentsToEasyPayULatamPayuPayments payu_plan_id:string payu_plan_code:string payu_customer_id:string payu_subscription_id:string trial_days:integer payu_credit_card_token:string additional_charges_data:string
|
39
39
|
```
|
40
40
|
|
41
41
|
If you want to keep a reference to plans, before this you must have created a plan model on your project, you can run the following migration (User only when recurrent payments are ON).
|
@@ -76,7 +76,8 @@ EasyPayULatam::RApi.configure do |config|
|
|
76
76
|
config.api_login = 'YOUR KEY'
|
77
77
|
config.api_key = 'YOUR KEY'
|
78
78
|
config.account_id = 'YOUR PAY U ACCOUNT ID'
|
79
|
-
config.sandbox
|
79
|
+
config.sandbox = true #Set false in production
|
80
|
+
config.api_version = "v4.3"
|
80
81
|
end
|
81
82
|
```
|
82
83
|
|
@@ -6,7 +6,7 @@ module EasyPayULatam
|
|
6
6
|
def index
|
7
7
|
client = RApi::Client.new current_user.pay_u_costumer_id
|
8
8
|
subs = RApi::Subscription.new client
|
9
|
-
|
9
|
+
|
10
10
|
unless subs.response["recurringBillList"].blank?
|
11
11
|
render status: 200, json: {subscriptions: current_user.all_payments.first(30), subscriptions_api: subs.response["recurringBillList"].last(30)}
|
12
12
|
else
|
@@ -18,41 +18,54 @@ module EasyPayULatam
|
|
18
18
|
self.status == PENDING
|
19
19
|
end
|
20
20
|
|
21
|
-
def add_charge(params)
|
21
|
+
def add_charge(params, user)
|
22
22
|
@payUConfig = EasyPayULatam.configuration
|
23
23
|
|
24
|
-
client = RApi::Client.new
|
24
|
+
client = RApi::Client.new user.pay_u_costumer_id
|
25
25
|
addcharge = RApi::AdditionalCharge.new client, self.reference_recurring_payment
|
26
26
|
addcharge.params = {
|
27
|
-
"description"
|
28
|
-
"additionalValues"
|
27
|
+
"description" => params[:description],
|
28
|
+
"additionalValues" => [
|
29
29
|
{
|
30
|
-
"name"
|
31
|
-
"value"
|
32
|
-
"currency"
|
30
|
+
"name" => "ITEM_VALUE",
|
31
|
+
"value" => params[:value],
|
32
|
+
"currency" => "COP"
|
33
33
|
},
|
34
34
|
{
|
35
|
-
"name"
|
36
|
-
"value"
|
37
|
-
"currency"
|
35
|
+
"name" => "ITEM_TAX",
|
36
|
+
"value" => "0",
|
37
|
+
"currency" => "COP"
|
38
38
|
},
|
39
39
|
{
|
40
|
-
"name"
|
41
|
-
"value"
|
42
|
-
"currency"
|
40
|
+
"name" => "ITEM_TAX_RETURN_BASE",
|
41
|
+
"value" => "0",
|
42
|
+
"currency" => "COP"
|
43
43
|
}
|
44
|
-
|
44
|
+
]
|
45
45
|
}
|
46
46
|
|
47
|
-
addcharge.create!
|
47
|
+
res = addcharge.create!
|
48
|
+
|
49
|
+
unless res["id"].blank?
|
50
|
+
self.additional_charges_data = "#{self.additional_charges_data}|#{res["id"]}·#{Date.today}"
|
51
|
+
end
|
48
52
|
|
49
53
|
addcharge
|
50
54
|
end
|
51
55
|
|
52
|
-
def
|
56
|
+
def get_additional_charges
|
57
|
+
charges = []
|
58
|
+
self.additional_charges_data.split("|").each do |charge|
|
59
|
+
data = charge.split("·")
|
60
|
+
charges.push({id: data[0], date: data[1]})
|
61
|
+
end
|
62
|
+
charges
|
63
|
+
end
|
64
|
+
|
65
|
+
def remove_charge(id, user)
|
53
66
|
@payUConfig = EasyPayULatam.configuration
|
54
67
|
|
55
|
-
client = RApi::Client.new
|
68
|
+
client = RApi::Client.new user.pay_u_costumer_id
|
56
69
|
addcharge = RApi::AdditionalCharge.new client, self.reference_recurring_payment
|
57
70
|
|
58
71
|
addcharge.delete id
|
data/config/initializers/rabl.rb
CHANGED
@@ -3,7 +3,7 @@ module EasyPayULatam
|
|
3
3
|
class << self
|
4
4
|
require "base64"
|
5
5
|
# NOTA: definir si dejar estos campos como accessors
|
6
|
-
attr_accessor :api_login, :api_key, :account_id, :sandbox
|
6
|
+
attr_accessor :api_login, :api_key, :account_id, :sandbox, :api_version
|
7
7
|
attr_reader :base_url
|
8
8
|
|
9
9
|
# recibe un bloque inicializador de variables de configuración de payu como la
|
@@ -28,20 +28,4 @@ module EasyPayULatam
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
# #development
|
32
|
-
# RApi.configure do |config|
|
33
|
-
# config.api_login = 'pRRXKOl8ikMmt9u'
|
34
|
-
# config.api_key = '4Vj8eK4rloUd272L48hsrarnUA'
|
35
|
-
# config.account_id = '512321'
|
36
|
-
# config.sandbox = true
|
37
|
-
# end
|
38
|
-
|
39
|
-
# production
|
40
|
-
# RApi.configure do |config|
|
41
|
-
# config.api_login = 'BtHXV5p7b1a74Za'
|
42
|
-
# config.api_key = 'ZNl7g0L2H54Y9ZVn51keXS2l07'
|
43
|
-
# config.account_id = '762507'
|
44
|
-
# config.sandbox = false
|
45
|
-
# end
|
46
|
-
|
47
31
|
end
|
@@ -15,11 +15,11 @@ module EasyPayULatam
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def create_url
|
18
|
-
@url = RApi.base_url + "/rest
|
18
|
+
@url = RApi.base_url + "/rest/#{RApi.api_version}/subscriptions/#{@sub_id}/recurringBillItems"
|
19
19
|
end
|
20
20
|
|
21
21
|
def url
|
22
|
-
@url = RApi.base_url + "/rest
|
22
|
+
@url = RApi.base_url + "/rest/#{RApi.api_version}/recurringBillItems/"
|
23
23
|
end
|
24
24
|
|
25
25
|
def create!
|
@@ -21,13 +21,13 @@ module EasyPayULatam
|
|
21
21
|
|
22
22
|
# llena la variable local y super con la url de este recurso
|
23
23
|
def url
|
24
|
-
@url ||= RApi.base_url + "/rest
|
24
|
+
@url ||= RApi.base_url + "/rest/#{RApi.api_version}/creditCards/"
|
25
25
|
end
|
26
26
|
|
27
27
|
# el recurso de tarjeta necesita en algunos casos alterar la URL para incluir información
|
28
28
|
# del customer, por eso se crea este metodo con la url necesario
|
29
29
|
def customer_url
|
30
|
-
@url = RApi.base_url + "/rest
|
30
|
+
@url = RApi.base_url + "/rest/#{RApi.api_version}/customers/#{@customer['id']}/creditCards/"
|
31
31
|
end
|
32
32
|
|
33
33
|
# se sobreescribe el metodo crear de request
|
@@ -34,7 +34,7 @@ module PayuLatam
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def url
|
37
|
-
@url = PayuLatam.base_url +
|
37
|
+
@url = PayuLatam.base_url + "/rest/#{RApi.api_version}/recurringBill"
|
38
38
|
end
|
39
39
|
|
40
40
|
def customer_url
|
@@ -50,4 +50,4 @@ module PayuLatam
|
|
50
50
|
@url = url "?customerId=#{@id}&dateBegin=#{@dateBegin}&dateFinal=#{@dateFinal}"
|
51
51
|
end
|
52
52
|
end
|
53
|
-
end
|
53
|
+
end
|
@@ -14,11 +14,11 @@ module EasyPayULatam
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def invoice_url
|
17
|
-
@url = RApi.base_url + "/rest
|
17
|
+
@url = RApi.base_url + "/rest/#{RApi.api_version}/recurringBill?customerId=#{@customer['id']}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def url
|
21
|
-
@url = RApi.base_url +
|
21
|
+
@url = RApi.base_url + "/rest/#{RApi.api_version}/subscriptions/"
|
22
22
|
end
|
23
23
|
|
24
24
|
def create!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_pay_u_latam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DEVPENGUIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,104 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rabl
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.13.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.13.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: jquery-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 4.3.1
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 4.3.1
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bootstrap-sass
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 3.3.6
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 3.3.6
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sass-rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '5.0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '5.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: angularjs-rails
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rails-assets-sweetalert2
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sweet-alert2-rails
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
27
|
- !ruby/object:Gem::Dependency
|
126
28
|
name: pg
|
127
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,8 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
132
|
- !ruby/object:Gem::Version
|
231
133
|
version: '0'
|
232
134
|
requirements: []
|
233
|
-
|
234
|
-
rubygems_version: 2.7.3
|
135
|
+
rubygems_version: 3.1.2
|
235
136
|
signing_key:
|
236
137
|
specification_version: 4
|
237
138
|
summary: With this gem you can use PayU Latam Web Checkout and recurrent payments
|