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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb3e4f97124f0008e36bda7cfa07f473fdedd0d7
4
- data.tar.gz: cbc1a78ee7336b6d19bb76cfdbec13edfb3fc772
3
+ metadata.gz: 0cbfa1acb38c0450716cc45c53db1066d9c86561
4
+ data.tar.gz: ff6e3afd5a6fda58162b02378b72766474700dcf
5
5
  SHA512:
6
- metadata.gz: cf3693e395da38284d063141f7680e76ac8c738a10d0df00acabfba58ac5de595678a9252331ffd83c38a19a4d8a2622054ca99c58bdeebd3dc59586fa1f307f
7
- data.tar.gz: 3059e7f95c0adb675c312ff209c026a2e00450c8c45e71a9f2c5c2ef85af48d1c126e29ca6fd1ed0d51ea643220ddda424d3d750906617daeaa2bacd3dd08307
6
+ metadata.gz: cecdb875085e9b5a385604f3edb39fd450eb36ec0b19f9e32dd9182359b7c92ba38e565b6d983a04e3fffbd66f5ce3fb10b8542f3f74cfeb07532c2fab180104
7
+ data.tar.gz: 977bd72a247865681564b86ecb4f5dc7f8cca790fda629cb738cff445d220d0348a83ed4eef0f30d4c99e1a3d26a38e7ff0ac11ce115a96c648e76dda3d754b8
@@ -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
- params["card[token]"] = self.card_token
36
- params["card[cvv]"] = self.cvv
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.customer_name.blank?
40
- params["customer[email_language]"] = self.customer_email_language unless self.customer_name.blank?
41
- params["description"] = self.description unless self.customer_name.blank?
42
- params["paymentmethod[id]"] = self.paymentmethod_id unless self.customer_name.blank?
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
- return true
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
@@ -1,3 +1,3 @@
1
1
  module Aceitafacil
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aceitafacil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilbert Ribeiro