aceitafacil 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aceitafacil/payment.rb +19 -7
- data/lib/aceitafacil/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cbfa1acb38c0450716cc45c53db1066d9c86561
|
4
|
+
data.tar.gz: ff6e3afd5a6fda58162b02378b72766474700dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cecdb875085e9b5a385604f3edb39fd450eb36ec0b19f9e32dd9182359b7c92ba38e565b6d983a04e3fffbd66f5ce3fb10b8542f3f74cfeb07532c2fab180104
|
7
|
+
data.tar.gz: 977bd72a247865681564b86ecb4f5dc7f8cca790fda629cb738cff445d220d0348a83ed4eef0f30d4c99e1a3d26a38e7ff0ac11ce115a96c648e76dda3d754b8
|
data/lib/aceitafacil/payment.rb
CHANGED
@@ -29,17 +29,25 @@ module Aceitafacil
|
|
29
29
|
self.items = params[:items]
|
30
30
|
end
|
31
31
|
|
32
|
+
def is_credit_card?
|
33
|
+
return true if self.paymentmethod_id == 1
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
32
37
|
def params
|
33
38
|
params = {}
|
34
39
|
|
35
|
-
|
36
|
-
|
40
|
+
if is_credit_card?
|
41
|
+
params["card[token]"] = self.card_token
|
42
|
+
params["card[cvv]"] = self.cvv
|
43
|
+
end
|
44
|
+
|
37
45
|
params["customer[id]"] = self.customer_id.to_i
|
38
46
|
params["customer[name]"] = self.customer_name unless self.customer_name.blank?
|
39
|
-
params["customer[email]"] = self.customer_email unless self.
|
40
|
-
params["customer[email_language]"] = self.customer_email_language unless self.
|
41
|
-
params["description"] = self.description unless self.
|
42
|
-
params["paymentmethod[id]"] = self.paymentmethod_id unless self.
|
47
|
+
params["customer[email]"] = self.customer_email unless self.customer_email.blank?
|
48
|
+
params["customer[email_language]"] = self.customer_email_language unless self.customer_email_language.blank?
|
49
|
+
params["description"] = self.description unless self.description.blank?
|
50
|
+
params["paymentmethod[id]"] = self.paymentmethod_id unless self.paymentmethod_id.blank?
|
43
51
|
params["total_amount"] = Aceitafacil::Utils.format_number(self.total_amount)
|
44
52
|
|
45
53
|
self.items.each_with_index do |item, index|
|
@@ -82,7 +90,11 @@ module Aceitafacil
|
|
82
90
|
self.period_start = json["period_start"]
|
83
91
|
self.period_end = json["period_end"]
|
84
92
|
|
85
|
-
|
93
|
+
if is_credit_card?
|
94
|
+
return true
|
95
|
+
else
|
96
|
+
return json["boleto"]["url"]
|
97
|
+
end
|
86
98
|
end
|
87
99
|
end
|
88
100
|
end
|
data/lib/aceitafacil/version.rb
CHANGED