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 +8 -8
- data/README.md +6 -1
- data/lib/dwolla/offsite_gateway.rb +29 -41
- data/lib/dwolla/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmUyYzdjOTYwMGM4NmMzZmZhZTQ5M2NjY2Y0MzVlNmNmM2FhYTQwNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDI1YWVkZTMwNzUzZmI4N2Q3NmY5MGUwMzMyYWE3NzMyZmJmNjczNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODdmZmEwMDU1ZDEyZWI5MzQxNDczYmNmY2U5YTU1ZDQzZWM1ZTFjMmEzNDUw
|
10
|
+
YmRjZjQwNzI5N2QyMThjMTE4MThlZmUxODYwMjExNWU2YjAyNDg1ODI4MTUz
|
11
|
+
MTcyMTY5Y2RkMWZhYTU1YWJmYTdjMmVjZDI1NzdkYWI0MDA0ZGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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.
|
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
|
-
@
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
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
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
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 => @
|
82
|
-
:test => @
|
65
|
+
:allowFundingSources => @allow_funding_sources,
|
66
|
+
:test => @test_mode,
|
83
67
|
:callback => @callback,
|
84
68
|
:redirect => @redirect,
|
85
|
-
: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
|
data/lib/dwolla/version.rb
CHANGED