pagseguro-transparente 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pagseguro/payment.rb +4 -0
- data/lib/pagseguro/payment/serializer.rb +8 -1
- data/lib/pagseguro/version.rb +1 -1
- data/spec/pagseguro/payment/serializer_spec.rb +5 -0
- data/spec/pagseguro/payment_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab12880a19ccddd101916786a109ea33609f33e9
|
4
|
+
data.tar.gz: 486667259e55a2f582a476b2d0f51b62b9ca1ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 995fa7f0e326d57756292aa75c8d430ea3b7d31cb410c92ea80f4b529e7aa0ad772486458ed11d67d7d194babd5d2ad71f075a177654bc0c8d8fa643a83b3869
|
7
|
+
data.tar.gz: 59eac8af961141f789a4aabb2b034f45b26cd79e58cb818f835ece64bcc51a1e8e40fe29eaaf0bf0fecec22e38511b7c39cdd13a6bfb7d01dc31242f3010bedc
|
data/Gemfile.lock
CHANGED
data/lib/pagseguro/payment.rb
CHANGED
@@ -2,10 +2,11 @@ module PagSeguro
|
|
2
2
|
class Payment
|
3
3
|
class Serializer
|
4
4
|
# The payment request that will be serialized.
|
5
|
-
attr_reader :payment
|
5
|
+
attr_reader :payment#, :params
|
6
6
|
|
7
7
|
def initialize(payment)
|
8
8
|
@payment = payment
|
9
|
+
@params = {}
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_params
|
@@ -20,6 +21,12 @@ module PagSeguro
|
|
20
21
|
params[:reference] = payment.reference
|
21
22
|
params[:extraAmount] = payment.extra_amount
|
22
23
|
|
24
|
+
if payment.max_installments_no_interest
|
25
|
+
params[:paymentMethodGroup1] ='CREDIT_CARD'
|
26
|
+
params[:paymentMethodConfigKey1_1] ='MAX_INSTALLMENTS_NO_INTEREST'
|
27
|
+
params[:paymentMethodConfigValue1_1] = payment.max_installments_no_interest
|
28
|
+
end
|
29
|
+
|
23
30
|
payment.items.each.with_index(1) do |item, index|
|
24
31
|
serialize_item(item, index)
|
25
32
|
end
|
data/lib/pagseguro/version.rb
CHANGED
@@ -19,6 +19,7 @@ describe PagSeguro::Payment::Serializer do
|
|
19
19
|
payment.shipping = shipping
|
20
20
|
payment.credit_card = credit_card
|
21
21
|
payment.bank = bank
|
22
|
+
payment.max_installments_no_interest = 6
|
22
23
|
payment.items = [PagSeguro::Item.new(id: '0001', description: 'Notebook Prata', amount: '24300.00', quantity: '1') ,
|
23
24
|
PagSeguro::Item.new(id: '0002', description: 'Notebook Rosa', amount: '25600.00', quantity: '2') ]
|
24
25
|
payment
|
@@ -130,4 +131,8 @@ describe PagSeguro::Payment::Serializer do
|
|
130
131
|
it { subject[:itemDescription2].should eq('Notebook Rosa') }
|
131
132
|
it { subject[:itemAmount2].should eq('25600.00') }
|
132
133
|
it { subject[:itemQuantity2].should eq('2') }
|
134
|
+
|
135
|
+
it { subject[:paymentMethodGroup1].should eq('CREDIT_CARD') }
|
136
|
+
it { subject[:paymentMethodConfigKey1_1].should eq('MAX_INSTALLMENTS_NO_INTEREST') }
|
137
|
+
it { subject[:paymentMethodConfigValue1_1].should eq(6) }
|
133
138
|
end
|
@@ -65,6 +65,7 @@ describe PagSeguro::Payment do
|
|
65
65
|
it { should respond_to(:shipping) }
|
66
66
|
it { should respond_to(:bank) }
|
67
67
|
it { should respond_to(:credit_card) }
|
68
|
+
it { should respond_to(:max_installments_no_interest) }
|
68
69
|
|
69
70
|
describe 'presence validations' do
|
70
71
|
it { should validate_presence_of(:currency) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagseguro-transparente
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cirdes Henrique
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|