ianfleeton-paypal-express 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/VERSION +1 -1
- data/lib/paypal/payment/request.rb +1 -1
- data/lib/paypal/util.rb +7 -2
- data/spec/fake_response/DoCapture/success.txt +1 -1
- data/spec/paypal/util_spec.rb +9 -0
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd05e90f23d32893f2c0283c883597c54cc6e544614e188cb82902251fd4be7
|
4
|
+
data.tar.gz: 5f4305a6844151eac4cdb378aa659c453b86d38a3eb33af5877380c98be67b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61dc26f99f5cb71635462bda528a36ac1766f6ee99be13a9b7d02e0e89bb8c27bbe82ee846106352953dda81d180b27265366c74dd6a8b16e63f422d6172b276
|
7
|
+
data.tar.gz: 4f2c99598e1a73491c0c3bd8bc210de5a4437d0c022b32825ba6c734d2c31e7f76852f65c58bec099ddf9b50bf37bcc82c8b17af96f036651153f0493e90174d
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
data/lib/paypal/util.rb
CHANGED
@@ -5,7 +5,7 @@ module Paypal
|
|
5
5
|
|
6
6
|
def self.formatted_amount(x)
|
7
7
|
x = '0' if x == '' || x.nil?
|
8
|
-
sprintf '%0.2f', BigDecimal
|
8
|
+
sprintf '%0.2f', BigDecimal(x.to_s)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.to_numeric(x)
|
@@ -14,7 +14,12 @@ module Paypal
|
|
14
14
|
|
15
15
|
decimal = BigDecimal(string)
|
16
16
|
|
17
|
-
if decimal
|
17
|
+
if decimal != BigDecimal(string).round(2)
|
18
|
+
raise ArgumentError.new(
|
19
|
+
'Precision cannot be higher than two decimal places. ' \
|
20
|
+
'Truncate or round first.'
|
21
|
+
)
|
22
|
+
elsif decimal == x.to_i
|
18
23
|
x.to_i
|
19
24
|
else
|
20
25
|
decimal
|
@@ -1 +1 @@
|
|
1
|
-
ACK=Success&AMT=440.00&AUTHORIZATIONID=2RG78938NK8989844&BUILD=8334781&CORRELATIONID=311611c111b48&CURRENCYCODE=BRL&EXCHANGERATE=0.426354&FEEAMT=13.16&ORDERTIME=2013-11-05T17%3A34%3A56Z&PARENTTRANSACTIONID=2RG78938NK8989844&PAYMENTSTATUS=Completed&PAYMENTTYPE=instant&PENDINGREASON=None&PROTECTIONELIGIBILITY=Ineligible&PROTECTIONELIGIBILITYTYPE=None&REASONCODE=None&SETTLEAMT=181.98&
|
1
|
+
ACK=Success&AMT=440.00&AUTHORIZATIONID=2RG78938NK8989844&BUILD=8334781&CORRELATIONID=311611c111b48&CURRENCYCODE=BRL&EXCHANGERATE=0.426354&FEEAMT=13.16&ORDERTIME=2013-11-05T17%3A34%3A56Z&PARENTTRANSACTIONID=2RG78938NK8989844&PAYMENTSTATUS=Completed&PAYMENTTYPE=instant&PENDINGREASON=None&PROTECTIONELIGIBILITY=Ineligible&PROTECTIONELIGIBILITYTYPE=None&REASONCODE=None&SETTLEAMT=181.98&TIMESTAMP=2013-11-05T17%3A34%3A56Z&TRANSACTIONID=9VW4495267708531S&VERSION=88.0
|
data/spec/paypal/util_spec.rb
CHANGED
@@ -28,5 +28,14 @@ describe Paypal::Util do
|
|
28
28
|
expect(Paypal::Util.to_numeric('10.24')).to eq(BigDecimal('10.24'))
|
29
29
|
expect(Paypal::Util.to_numeric('10.25')).to eq(BigDecimal('10.25'))
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'returns zero for blank values' do
|
33
|
+
expect(Paypal::Util.to_numeric(nil)).to be_zero
|
34
|
+
expect(Paypal::Util.to_numeric('')).to be_zero
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'raises an ArgumentError when precision is higher than 2 decimals' do
|
38
|
+
expect { Paypal::Util.to_numeric('1.234') }.to raise_error(ArgumentError)
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ianfleeton-paypal-express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Fleeton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -63,22 +63,22 @@ dependencies:
|
|
63
63
|
name: rake
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '12.0'
|
69
66
|
- - ">="
|
70
67
|
- !ruby/object:Gem::Version
|
71
68
|
version: 12.0.0
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '12.0'
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "~>"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '12.0'
|
79
76
|
- - ">="
|
80
77
|
- !ruby/object:Gem::Version
|
81
78
|
version: 12.0.0
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '12.0'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: simplecov
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,22 +97,22 @@ dependencies:
|
|
97
97
|
name: rspec
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '3.5'
|
103
100
|
- - ">="
|
104
101
|
- !ruby/object:Gem::Version
|
105
102
|
version: 3.5.0
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '3.5'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - "~>"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '3.5'
|
113
110
|
- - ">="
|
114
111
|
- !ruby/object:Gem::Version
|
115
112
|
version: 3.5.0
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '3.5'
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
name: webmock
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,8 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: 1.3.6
|
255
255
|
requirements: []
|
256
|
-
|
257
|
-
rubygems_version: 2.7.6
|
256
|
+
rubygems_version: 3.0.3
|
258
257
|
signing_key:
|
259
258
|
specification_version: 4
|
260
259
|
summary: PayPal Express Checkout API Client for Instance, Recurring and Digital Goods
|