catarse_pagarme 2.14.12 → 2.14.13

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
  SHA256:
3
- metadata.gz: c52bfe0429ba2976126325031d6c5372a549e0e054e7b210d0771be827f6322a
4
- data.tar.gz: 72f750266694d8661a6b807c9331f0ac1263679c743b0bb01b99ca9bbebf453b
3
+ metadata.gz: 49e29b96cb90884167e704aac825c48f4af388a557a2ff1f99f3075d600e2644
4
+ data.tar.gz: 151e7effa7cf9dda5f58b64e3a597061857e3fce1e63baa5572be02b2bbe46d4
5
5
  SHA512:
6
- metadata.gz: 914fcfc46b1cb2a8a78ca6875552d6ef8de296449ef36033a0312661ec3dabf60028d20e42d75dc2112d3149964e368afa26f0e2b62be2a1cb56b961a689c3f7
7
- data.tar.gz: 979286b6207d4af8d9cf93a4ee14099bc79a03361e02f8bf1825387e97c28d9a6380d7a0f0ead484b649f7676f5a147c6f36f9b714f319805bab483f0249a373
6
+ metadata.gz: b1c50a2cdee1962128500137b884eaa6f107cbad2c1339a1974d2f81e04b398817939b567eb512560f029cf6878681a098f53c5a20e8fcf86ded5d695a915a0e
7
+ data.tar.gz: 630d6a3d226133e85f19af98ae6243f604fb850f4144e01048440e7ebc2ba95fd0166341f1a2b3c999abe2aa6a15a47a9921bf0bd948d49cf3b5628be438fb53
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.14.12)
4
+ catarse_pagarme (2.14.13)
5
5
  countries (= 3.0.0)
6
6
  konduto-ruby (= 2.1.0)
7
7
  pagarme (= 2.1.4)
@@ -83,11 +83,7 @@ module CatarsePagarme
83
83
  end
84
84
 
85
85
  def document_number
86
- user_document = contribution.user.cpf.try(:gsub, /[-.\/_\s]/, '')
87
- card_owner_document = contribution.card_owner_document.try(:gsub, /[-.\/_\s]/, '')
88
- fallback_document = '00000000000'
89
-
90
- user_document || card_owner_document || fallback_document
86
+ contribution.user.cpf.try(:gsub, /[-.\/_\s]/, '')
91
87
  end
92
88
 
93
89
  def phone_matches
@@ -137,7 +133,7 @@ module CatarsePagarme
137
133
 
138
134
  def address_hash
139
135
  {
140
- country: contribution.country.try(:name),
136
+ country_code: contribution.country.try(:code),
141
137
  state: contribution.address_state,
142
138
  city: contribution.address_city,
143
139
  zipcode: contribution.address_zip_code.try(:gsub, /[-.\/_\s]/, ''),
@@ -71,14 +71,15 @@ module CatarsePagarme
71
71
 
72
72
  def customer_attributes
73
73
  customer = self.attributes.dig(:customer)
74
+ tax_id = customer[:document_number].present? ? { tax_id: customer[:document_number] } : {}
75
+
74
76
  {
75
77
  id: customer[:id].to_s,
76
- tax_id: customer[:document_number],
77
78
  name: customer[:name],
78
79
  email: customer[:email],
79
80
  phone1: customer[:phone].to_h.values.join,
80
81
  created_at: self.attributes.dig(:antifraud_metadata, :register, :registered_at)
81
- }
82
+ }.merge(tax_id)
82
83
  end
83
84
 
84
85
  def payment_attributes
@@ -99,7 +100,8 @@ module CatarsePagarme
99
100
  city: billing_data.dig(:address, :city),
100
101
  state: billing_data.dig(:address, :state),
101
102
  zip: billing_data.dig(:address, :zipcode),
102
- }.merge(card_country_code)
103
+ country: billing_data.dig(:address, :country_code),
104
+ }
103
105
  end
104
106
 
105
107
  def shipping_address_attributes
@@ -139,10 +141,5 @@ module CatarsePagarme
139
141
  expiration_date = self.transaction.card.expiration_date
140
142
  "#{expiration_date[0..1]}20#{expiration_date[2..3]}"
141
143
  end
142
-
143
- def card_country_code
144
- country = ::ISO3166::Country.find_country_by_name(self.transaction.card.country)
145
- country.present? ? { country: country.try(:alpha2) } : {}
146
- end
147
144
  end
148
145
  end
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.14.12"
2
+ VERSION = "2.14.13"
3
3
  end
@@ -245,14 +245,15 @@ describe CatarsePagarme::AntifraudOrderWrapper do
245
245
  street: 'R. A',
246
246
  city: 'New City',
247
247
  state: 'NC',
248
- zipcode: '1245'
248
+ zipcode: '1245',
249
+ country_code: 'BR'
249
250
  }
250
251
  }
251
252
  }
252
253
  }
253
254
  end
254
255
 
255
- let(:transaction) { double(card: double(country: 'BRAZIL', holder_name: 'holder name')) }
256
+ let(:transaction) { double(card: double(holder_name: 'holder name')) }
256
257
 
257
258
  before do
258
259
  subject.attributes = attributes
@@ -267,7 +268,7 @@ describe CatarsePagarme::AntifraudOrderWrapper do
267
268
  expect(billing_address_attributes[:city]).to eq 'New City'
268
269
  expect(billing_address_attributes[:state]).to eq 'NC'
269
270
  expect(billing_address_attributes[:zip]).to eq '1245'
270
- expect(billing_address_attributes[:country]).to eq 'BR'
271
+ expect(billing_address_attributes[:country_code]).to eq 'BR'
271
272
  end
272
273
  end
273
274
 
@@ -290,7 +291,7 @@ describe CatarsePagarme::AntifraudOrderWrapper do
290
291
  }
291
292
  end
292
293
 
293
- let(:transaction) { double(card: double(country: 'BRAZIL')) }
294
+ let(:transaction) { double(card: double) }
294
295
 
295
296
  before do
296
297
  subject.attributes = attributes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_pagarme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.12
4
+ version: 2.14.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-08 00:00:00.000000000 Z
12
+ date: 2020-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: countries