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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/catarse_pagarme/credit_cards_controller.rb +2 -6
- data/app/models/catarse_pagarme/antifraud_order_wrapper.rb +5 -8
- data/lib/catarse_pagarme/version.rb +1 -1
- data/spec/models/catarse_pagarme/antifraud_order_wrapper_spec.rb +5 -4
- 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: 49e29b96cb90884167e704aac825c48f4af388a557a2ff1f99f3075d600e2644
|
4
|
+
data.tar.gz: 151e7effa7cf9dda5f58b64e3a597061857e3fce1e63baa5572be02b2bbe46d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1c50a2cdee1962128500137b884eaa6f107cbad2c1339a1974d2f81e04b398817939b567eb512560f029cf6878681a098f53c5a20e8fcf86ded5d695a915a0e
|
7
|
+
data.tar.gz: 630d6a3d226133e85f19af98ae6243f604fb850f4144e01048440e7ebc2ba95fd0166341f1a2b3c999abe2aa6a15a47a9921bf0bd948d49cf3b5628be438fb53
|
data/Gemfile.lock
CHANGED
@@ -83,11 +83,7 @@ module CatarsePagarme
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def document_number
|
86
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -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(
|
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[:
|
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
|
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.
|
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-
|
12
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: countries
|