dwolla-ruby 2.4.4 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Njc2MjU0ZjBjNjU0OTBjYTlkZjdiZGZjZmQyZDk5ZGU1YTI1OTZhNg==
4
+ YmUyYzdjOTYwMGM4NmMzZmZhZTQ5M2NjY2Y0MzVlNmNmM2FhYTQwNQ==
5
5
  data.tar.gz: !binary |-
6
- NjRjYWY1Y2I1NmQwMDFiNmQ1NzVmODgyNjY0MWFhNWM2NmNiNzc0Yw==
6
+ ZDI1YWVkZTMwNzUzZmI4N2Q3NmY5MGUwMzMyYWE3NzMyZmJmNjczNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGRiMjQyZDlkNWNkMDBhM2ZiZjFiNzE0NTFmYjYwMjliYjk4NTQyZTllY2Y4
10
- ZWExNjk2YWJlOTZkNTQwZDUyNmZjMDJlYjY0NWZkYWRlMGQ3ZjE2YzkyOGFj
11
- NmZhNDhlMWNhYjIxODU4OTJkYzgzYWIzODA5MzhiYzcxZTNlZGE=
9
+ ODdmZmEwMDU1ZDEyZWI5MzQxNDczYmNmY2U5YTU1ZDQzZWM1ZTFjMmEzNDUw
10
+ YmRjZjQwNzI5N2QyMThjMTE4MThlZmUxODYwMjExNWU2YjAyNDg1ODI4MTUz
11
+ MTcyMTY5Y2RkMWZhYTU1YWJmYTdjMmVjZDI1NzdkYWI0MDA0ZGY=
12
12
  data.tar.gz: !binary |-
13
- ZDkyNDc1MmQ2YTJjMTQ5MmM1NWY0OTcyYTI3MmRhMjVjZmU5ODc5MGZkYTRk
14
- ZmI4Yjg5YzEzZmMzMDQwZjYxNTA4MjUzOTM3ZDJkYWJiNDk5MzhmZjQ3MzFj
15
- ZDhjOTJjY2RhMWIxNjkwZmU4ZGIwNmE5NjY3MGVkMWM4MGM5NGQ=
13
+ YzM4NjEyYzc4NjNjYzA1YzExNzUwMjMyN2NhY2MwYTgxNGYxYmI1NzBmMmU5
14
+ NjZmZGJkZDg3NDE4MTRkNWEyYjljNTU1NmEyODU2Yjg1MWJjYTk0MWFhOTk0
15
+ NDgyNGJjZTc3N2E0MGEyNjM5YWUxYjIyMzc4ZWY1NzM2Nzg2NWI=
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/Dwolla/dwolla-ruby.png?branch=master)](https://travis-ci.org/Dwolla/dwolla-ruby)
5
5
 
6
6
  ## Version
7
- 2.4.4
7
+ 2.4.5
8
8
 
9
9
  ## Requirements
10
10
  - [Ruby](http://www.ruby-lang.org/)
@@ -32,6 +32,11 @@ This repo includes various usage examples, including:
32
32
 
33
33
  ## Changelog
34
34
 
35
+ 2.4.5 [merge pull request by [dustMason0](https://github.com/dustMason)]
36
+
37
+ * Fix floating point calculation errors
38
+ * Refactor the offsite gateway class
39
+
35
40
  2.4.4
36
41
 
37
42
  * Globalize the OAuth scope variable
@@ -5,10 +5,10 @@ module Dwolla
5
5
  @tax = 0
6
6
  @shipping = 0
7
7
  @notes = nil
8
- @facilitatorAmount = nil
9
- @testMode = false
10
- @allowFundingSources = true
11
- @orderId = nil
8
+ @facilitator_amount = nil
9
+ @test_mode = false
10
+ @allow_funding_sources = true
11
+ @order_id = nil
12
12
 
13
13
  def self.clear_session
14
14
  @products = []
@@ -16,10 +16,22 @@ module Dwolla
16
16
  @tax = 0
17
17
  @shipping = 0
18
18
  @notes = nil
19
- @facilitatorAmount = nil
20
- @testMode = false
21
- @allowFundingSources = true
22
- @orderId = nil
19
+ @facilitator_amount = nil
20
+ @test_mode = false
21
+ @allow_funding_sources = true
22
+ @order_id = nil
23
+ end
24
+
25
+ class << self
26
+ attr_writer :tax
27
+ attr_writer :shipping
28
+ attr_writer :notes
29
+ attr_writer :order_id
30
+ attr_writer :redirect
31
+ attr_writer :callback
32
+ attr_writer :test_mode
33
+ attr_writer :allow_funding_sources
34
+ attr_writer :facilitator_amount
23
35
  end
24
36
 
25
37
  def self.add_product(name=nil, description=nil, price=nil, quantity=1)
@@ -46,47 +58,21 @@ module Dwolla
46
58
  @discount = -(discount.abs)
47
59
  end
48
60
 
49
- def self.tax=(tax)
50
- @tax = tax
51
- end
52
-
53
- def self.shipping=(shipping)
54
- @shipping = shipping
55
- end
56
-
57
- def self.notes=(notes)
58
- @notes = notes
59
- end
60
-
61
- def self.order_id=(order_id)
62
- @orderId = order_id
63
- end
64
-
65
- def self.redirect=(redirect)
66
- @redirect = redirect
67
- end
68
-
69
- def self.callback=(callback)
70
- @callback = callback
71
- end
72
-
73
- def self.test=(test)
74
- @testMode = test
75
- end
76
-
77
61
  def self.get_checkout_url(destinationId)
78
62
  params = {
79
63
  :key => Dwolla::api_key,
80
64
  :secret => Dwolla::api_secret,
81
- :allowFundingSources => @allowFundingSources,
82
- :test => @testMode,
65
+ :allowFundingSources => @allow_funding_sources,
66
+ :test => @test_mode,
83
67
  :callback => @callback,
84
68
  :redirect => @redirect,
85
- :orderId => @orderId,
69
+ :orderId => @order_id,
70
+ :notes => @notes,
86
71
  :purchaseOrder => {
87
72
  :customerInfo => @customerInfo,
88
73
  :destinationId => destinationId,
89
74
  :orderItems => @products,
75
+ :facilitatorAmount => @facilitator_amount,
90
76
  :discount => @discount,
91
77
  :shipping => @shipping,
92
78
  :tax => @tax,
@@ -94,6 +80,8 @@ module Dwolla
94
80
  }
95
81
  }
96
82
 
83
+ pp params
84
+
97
85
  resp = Dwolla.request(:post, request_url, params, {}, false, false, true)
98
86
  raise APIError.new(resp['Message']) unless resp['Result'] == 'Success'
99
87
 
@@ -138,7 +126,7 @@ module Dwolla
138
126
  end
139
127
 
140
128
  def self.calculate_total
141
- total = 0
129
+ total = 0.0
142
130
 
143
131
  @products.each { |product|
144
132
  total += product[:price] * product[:quantity]
@@ -148,7 +136,7 @@ module Dwolla
148
136
  total += @tax
149
137
  total += @discount
150
138
 
151
- return total
139
+ return total.round(2)
152
140
  end
153
141
  end
154
142
  end
@@ -1,3 +1,3 @@
1
1
  module Dwolla
2
- VERSION = "2.4.4"
2
+ VERSION = "2.4.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dwolla-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Schonfeld