ianfleeton-paypal-express 0.8.4 → 0.8.7

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
  SHA256:
3
- metadata.gz: 860b0d8f5a56c23d0d48d2306949be8ab7687e93cb8c54d57c875f5d44ebb349
4
- data.tar.gz: d36695184583cef8c027cfab2b150fcb9b348a5a2d8de0823b6b6b017bc59d45
3
+ metadata.gz: 71ac73ad025a882ac48652beda11a73a210542510a68bd78241d703d63e4c247
4
+ data.tar.gz: da4b3eb65c1cec27cd472be7ad76a90e8ca613036e2d1a22c6bf21b20e2b68f1
5
5
  SHA512:
6
- metadata.gz: c703ea1e91682f791c9adac0babfa33282a721380ebd082d65c3a0967c4c3cd3f14b5d12ea90ba2d12c7d5f5a59f6c9e189adf4ef2b6915945bd669694c7abe8
7
- data.tar.gz: 3e9de3ff947c7d5fd75bfb7c21e4aa16c70d857ec64f7a6eb8172fd05b98fd209c514b5f4ca74a1c6f105344ba507201b0a02f342a0c81a357972f74b386cc31
6
+ metadata.gz: ceb6a50e6b03db89ab182df3e0a1956f950c17dcc32471375552b521d8d13c095b08874b2569bb25a0ebd0dbb88c8bc6c1873f7f7a363c322bbb3a83f7a7d162
7
+ data.tar.gz: eeee0431bbf8f9b714444d1c869688488a6cef87e45c89146390a1bb45ce2357fa2d3f6aaf0b0c5c276828d82f4f1a162ad84fb28aad6515b2c80f1532f89d6a
data/.travis.yml CHANGED
@@ -2,11 +2,11 @@ before_install:
2
2
  - gem install bundler
3
3
 
4
4
  rvm:
5
- - 2.2.9
6
- - 2.3.6
7
- - 2.4.3
8
- - 2.5.0
5
+ - 2.7.2
6
+ - 3.0.0
7
+ - 3.1.0
9
8
 
10
9
  env:
11
- - RAILS_VERSION="~> 4.2"
12
- - RAILS_VERSION="~> 5.0"
10
+ - RAILS_VERSION="~> 5.2"
11
+ - RAILS_VERSION="~> 6.0"
12
+ - RAILS_VERSION="~> 7.0"
data/README.rdoc CHANGED
@@ -6,6 +6,11 @@ Express Checkout for Digital Goods is also supported.
6
6
 
7
7
  {<img src="https://travis-ci.org/ianfleeton/paypal-express.svg" />}[https://travis-ci.org/ianfleeton/paypal-express]
8
8
 
9
+ == Deprecation warning
10
+
11
+ Many, or perhaps all, of the APIs used in this gem have been {deprecated}[https://developer.paypal.com/docs/archive/express-checkout/] since January 2017.
12
+ Exercise caution with the values returned by the APIs.
13
+ For example, it has been {reported}[https://github.com/ianfleeton/paypal-express/issues/21] that GetTransaction can return incorrect values for a payer's verification status.
9
14
 
10
15
  == Why this fork?
11
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.4
1
+ 0.8.7
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.add_dependency 'activesupport', '>= 2.3', '< 6'
17
+ s.add_dependency 'activesupport', '>= 2.3', '< 8'
18
18
  s.add_dependency 'rest-client', '~> 2.0'
19
19
  s.add_dependency 'attr_required', '~> 1.0'
20
20
  s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
@@ -59,7 +59,7 @@ module Paypal
59
59
 
60
60
  def items_amount
61
61
  self.items.sum do |item|
62
- item.quantity * BigDecimal.new((item.amount || 0).to_s)
62
+ item.quantity * BigDecimal((item.amount || 0).to_s)
63
63
  end
64
64
  end
65
65
  end
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.new(x.to_s).round(2)
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 == x.to_i
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&TAXAMT=0.00&TIMESTAMP=2013-11-05T17%3A34%3A56Z&TRANSACTIONID=9VW4495267708531S&TRANSACTIONTYPE=expresscheckout&VERSION=88.0
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
@@ -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,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ianfleeton-paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Fleeton
8
8
  - nov matake
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-19 00:00:00.000000000 Z
12
+ date: 2022-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '2.3'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6'
23
+ version: '8'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '2.3'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6'
33
+ version: '8'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rest-client
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -237,7 +237,7 @@ homepage: http://github.com/ianfleeton/paypal-express
237
237
  licenses:
238
238
  - MIT
239
239
  metadata: {}
240
- post_install_message:
240
+ post_install_message:
241
241
  rdoc_options:
242
242
  - "--charset=UTF-8"
243
243
  require_paths:
@@ -253,9 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  - !ruby/object:Gem::Version
254
254
  version: 1.3.6
255
255
  requirements: []
256
- rubyforge_project:
257
- rubygems_version: 2.7.6
258
- signing_key:
256
+ rubygems_version: 3.2.32
257
+ signing_key:
259
258
  specification_version: 4
260
259
  summary: PayPal Express Checkout API Client for Instance, Recurring and Digital Goods
261
260
  Payment.