payu-latam 1.0.3 → 1.0.4
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 +4 -4
- data/README.md +7 -1
- data/lib/pay_u/configuration.rb +15 -11
- data/lib/pay_u/confirmation.rb +2 -0
- data/lib/pay_u/order.rb +2 -0
- data/lib/pay_u/response.rb +1 -0
- data/lib/pay_u/version.rb +1 -1
- data/spec/pay_u/confirmation_spec.rb +2 -0
- data/spec/pay_u/response_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31fc3c85a8c91289b08086e4014a342e7e1286392084d201777af477d04c2527
|
|
4
|
+
data.tar.gz: a0dfb2d47a50c2ddf4fb97b7c2ddee2d946c4b850047014c95e4940843771c9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4356567d6cea5573bf2dff86f31bb1e7b127fb9358ec2e9fb134f026cd1fe1c0ef168e072de1d75d9a7e7289166fa9e05cb495233b0e29eb6445fdf0e75188b
|
|
7
|
+
data.tar.gz: 5950fd9cf46beece7118ef322ab4cba7b6b53397c21c3b2f53ba5c790e7063e8b434e0c0a34132397ac569088a8f46c27b601638e92165784135ebed8b3ba0e3
|
data/README.md
CHANGED
|
@@ -18,7 +18,7 @@ require "pay_u"
|
|
|
18
18
|
|
|
19
19
|
PayU.configure do |config|
|
|
20
20
|
config.api_key = "4Vj8eK4rloUd272L48hsrarnUA" # Replace with your own API key
|
|
21
|
-
config.merchant_id =
|
|
21
|
+
config.merchant_id = 508_029 # Replace with your own merchant ID
|
|
22
22
|
config.test = true # Test mode
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -31,6 +31,12 @@ order = PayU::Order.new(
|
|
|
31
31
|
order.form.params
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
## Sandbox
|
|
35
|
+
|
|
36
|
+
- Sandbox endpoint
|
|
37
|
+
- Test mode in your account
|
|
38
|
+
- Test param in params
|
|
39
|
+
|
|
34
40
|
## Testing
|
|
35
41
|
|
|
36
42
|
rspec
|
data/lib/pay_u/configuration.rb
CHANGED
|
@@ -9,21 +9,25 @@ module PayU
|
|
|
9
9
|
attribute :response_url, String
|
|
10
10
|
attribute :confirmation_url, String
|
|
11
11
|
|
|
12
|
+
SANDBOX_API_KEY = "4Vj8eK4rloUd272L48hsrarnUA".freeze
|
|
13
|
+
SANDBOX_MERCHANT_ID = 508_029
|
|
14
|
+
SANDBOX_ACCOUNT_IDS = {
|
|
15
|
+
AR: 512_322,
|
|
16
|
+
BR: 512_327,
|
|
17
|
+
CL: 512_325,
|
|
18
|
+
CO: 512_321,
|
|
19
|
+
MX: 512_324,
|
|
20
|
+
PA: 512_326,
|
|
21
|
+
PE: 512_323,
|
|
22
|
+
}.freeze
|
|
23
|
+
|
|
12
24
|
def initialize(params = {})
|
|
13
25
|
super(params)
|
|
14
26
|
|
|
15
|
-
self.api_key = ENV.fetch("PAYU_API_KEY",
|
|
16
|
-
self.merchant_id = ENV.fetch("PAYU_MERCHANT_ID",
|
|
27
|
+
self.api_key = ENV.fetch("PAYU_API_KEY", SANDBOX_API_KEY) if api_key.nil?
|
|
28
|
+
self.merchant_id = ENV.fetch("PAYU_MERCHANT_ID", SANDBOX_MERCHANT_ID) if merchant_id.nil?
|
|
17
29
|
self.test = ENV.fetch("PAYU_TEST", true) if test.nil?
|
|
18
|
-
self.account_ids =
|
|
19
|
-
AR: 512_322,
|
|
20
|
-
BR: 512_327,
|
|
21
|
-
CL: 512_325,
|
|
22
|
-
CO: 512_321,
|
|
23
|
-
MX: 512_324,
|
|
24
|
-
PA: 512_326,
|
|
25
|
-
PE: 512_323,
|
|
26
|
-
}
|
|
30
|
+
self.account_ids = SANDBOX_ACCOUNT_IDS if account_ids.nil?
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
|
data/lib/pay_u/confirmation.rb
CHANGED
|
@@ -16,12 +16,14 @@ class PayU::Confirmation
|
|
|
16
16
|
currency: params[:currency],
|
|
17
17
|
status_code: params[:state_pol].to_i,
|
|
18
18
|
response_code: params[:response_code_pol].to_i,
|
|
19
|
+
response_message: params[:response_message_pol],
|
|
19
20
|
payment_method_code: params[:payment_method_type].to_i,
|
|
20
21
|
email: params[:email_buyer],
|
|
21
22
|
transaction_id: params[:transaction_id],
|
|
22
23
|
extra_1: params[:extra1],
|
|
23
24
|
extra_2: params[:extra2],
|
|
24
25
|
extra_3: params[:extra3],
|
|
26
|
+
cc_number: params[:cc_number],
|
|
25
27
|
)
|
|
26
28
|
@signer = PayU::Signer::Confirmation.new(@order.attributes)
|
|
27
29
|
end
|
data/lib/pay_u/order.rb
CHANGED
|
@@ -16,12 +16,14 @@ class PayU::Order
|
|
|
16
16
|
attribute :tax_return_base, BigDecimal
|
|
17
17
|
attribute :status_code, Integer
|
|
18
18
|
attribute :response_code, Integer
|
|
19
|
+
attribute :response_message, String
|
|
19
20
|
attribute :payment_method_code, Integer
|
|
20
21
|
attribute :email, String
|
|
21
22
|
attribute :transaction_id, String
|
|
22
23
|
attribute :extra_1, String
|
|
23
24
|
attribute :extra_2, String
|
|
24
25
|
attribute :extra_3, String
|
|
26
|
+
attribute :cc_number, String
|
|
25
27
|
|
|
26
28
|
def initialize(params)
|
|
27
29
|
super(params)
|
data/lib/pay_u/response.rb
CHANGED
|
@@ -16,6 +16,7 @@ class PayU::Response
|
|
|
16
16
|
currency: params[:currency],
|
|
17
17
|
status_code: params[:transactionState].to_i,
|
|
18
18
|
response_code: params[:polResponseCode].to_i,
|
|
19
|
+
response_message: params[:lapResponseCode],
|
|
19
20
|
payment_method_code: params[:polPaymentMethodType].to_i,
|
|
20
21
|
email: params[:buyerEmail],
|
|
21
22
|
transaction_id: params[:transactionId],
|
data/lib/pay_u/version.rb
CHANGED
|
@@ -5,9 +5,11 @@ RSpec.describe PayU::Confirmation do
|
|
|
5
5
|
it "creates object from callback" do
|
|
6
6
|
confirmation = PayU::Confirmation.new(Fixtures.confirmation)
|
|
7
7
|
|
|
8
|
+
expect(confirmation.order.approved?).to be_truthy
|
|
8
9
|
expect(confirmation.order.amount).to eq(Fixtures.confirmation[:value].to_f)
|
|
9
10
|
expect(confirmation.order.reference_code).to eq(Fixtures.confirmation[:reference_sale])
|
|
10
11
|
expect(confirmation.order.transaction_id).to eq(Fixtures.confirmation[:transaction_id])
|
|
12
|
+
expect(confirmation.order.response_message).to eq("APPROVED")
|
|
11
13
|
expect(confirmation.order.extra_1).to eq(Fixtures.confirmation[:extra1])
|
|
12
14
|
expect(confirmation.order.extra_2).to eq(Fixtures.confirmation[:extra2])
|
|
13
15
|
expect(confirmation.order.extra_3).to eq(Fixtures.confirmation[:extra3])
|
data/spec/pay_u/response_spec.rb
CHANGED
|
@@ -5,9 +5,11 @@ RSpec.describe PayU::Response do
|
|
|
5
5
|
it "creates object from callback" do
|
|
6
6
|
response = PayU::Response.new(Fixtures.response)
|
|
7
7
|
|
|
8
|
+
expect(response.order.approved?).to be_truthy
|
|
8
9
|
expect(response.order.amount).to eq(Fixtures.response[:TX_VALUE].to_f)
|
|
9
10
|
expect(response.order.reference_code).to eq(Fixtures.response[:referenceCode])
|
|
10
11
|
expect(response.order.transaction_id).to eq(Fixtures.response[:transactionId])
|
|
12
|
+
expect(response.order.response_message).to eq("APPROVED")
|
|
11
13
|
expect(response.order.extra_1).to eq(Fixtures.response[:extra1])
|
|
12
14
|
expect(response.order.extra_2).to eq(Fixtures.response[:extra2])
|
|
13
15
|
expect(response.order.extra_3).to eq(Fixtures.response[:extra3])
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: payu-latam
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Slang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-01-
|
|
11
|
+
date: 2019-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: virtus
|