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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba0e556245a9203284f5ac78ebe1a9c8dff646ab
4
- data.tar.gz: 20d86d5f6a342e8d5701e100efe20377026b6fc3
3
+ metadata.gz: ab12880a19ccddd101916786a109ea33609f33e9
4
+ data.tar.gz: 486667259e55a2f582a476b2d0f51b62b9ca1ba7
5
5
  SHA512:
6
- metadata.gz: fc8ded5785f398bae6fd6a8d7371137b775a3fdc9d147250c2fab93f8577aa504cbb3d2da4822c2a36c9b80eae5c2f01d2f7e8c6b7bd436f21cccb57c517ac55
7
- data.tar.gz: be6a1f9f9a85fe8ad030ecdc3f2dbdf6f704664e90128f89abf0b53f472019e4319a7cef64b07cd152108feec822a6188a84666fd867eaabde3a9f61245b1b94
6
+ metadata.gz: 995fa7f0e326d57756292aa75c8d430ea3b7d31cb410c92ea80f4b529e7aa0ad772486458ed11d67d7d194babd5d2ad71f075a177654bc0c8d8fa643a83b3869
7
+ data.tar.gz: 59eac8af961141f789a4aabb2b034f45b26cd79e58cb818f835ece64bcc51a1e8e40fe29eaaf0bf0fecec22e38511b7c39cdd13a6bfb7d01dc31242f3010bedc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagseguro-transparente (0.0.8)
4
+ pagseguro-transparente (0.0.9)
5
5
  activemodel
6
6
  httparty (~> 0.13)
7
7
  i18n (~> 0.6)
@@ -49,6 +49,10 @@ module PagSeguro
49
49
 
50
50
  attr_accessor :extra_amount
51
51
 
52
+ # Set the max installments with no interest.
53
+ # Optional.
54
+ attr_accessor :max_installments_no_interest
55
+
52
56
  # Products/items in this payment request.
53
57
  def items
54
58
  @items ||= Items.new
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PagSeguro
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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.9
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-05-20 00:00:00.000000000 Z
11
+ date: 2014-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel