bitpay-sdk 2.3.1 → 2.3.2

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: bf3789696b7fcf3ba7b4b11df9f4c2ff3cc2d5b7
4
- data.tar.gz: 1b0a2652ea570a21344280083fb0ab89a9e62f54
3
+ metadata.gz: c5f07e2ece3936d90f1855bf3c7c7c47e1528943
4
+ data.tar.gz: 2d7f13e49b0a7a0ce03804c99654c171a176cd86
5
5
  SHA512:
6
- metadata.gz: 02cf470eaa7f2a0c05739d2f7217ffbd48811522c0f85f1a7aa9917cb57cc29f903836a30bb5ef180592ad2652f5132df11eca0e54e261c2f2ca018ec8501b09
7
- data.tar.gz: 2590256522eb97aa5290cd4ad2435633155b0391534c38d87cd24f1a90679ee7235291280fbc9bef5a6bb06ae7736a91f4a3c03ec569e472b29b7a1c21bf5eb5
6
+ metadata.gz: 2041a1d3930606a93371eb07f18af6700b51e95a3c7992093f66a702f3dc2eb4da2a45c104b14387ec3f3ddd5d783c376f112142eaaf24669783095c7140a4d2
7
+ data.tar.gz: 6b176eb98b9263f49269db988fe046c914133a62dd08d2c36e1e8d92a66cf234849261c8fda152686b6759aea36394cfcf8b51ea0562f8886486c0d5b7c9907b
@@ -1,3 +1,4 @@
1
+ @invoices
1
2
  Feature: creating an invoice
2
3
  The user won't get any money
3
4
  If they can't
@@ -10,17 +11,18 @@ Feature: creating an invoice
10
11
  When the user creates an invoice for <price> <currency>
11
12
  Then they should recieve an invoice in response for <price> <currency>
12
13
  Examples:
13
- | price | currency |
14
- | "5.23" | "USD" |
14
+ | price | currency |
15
+ | "5.23" | "USD" |
15
16
  | "10.21" | "EUR" |
17
+ | "0.225" | "BTC" |
16
18
 
17
19
  Scenario Outline: The invoice contains illegal characters
18
20
  When the user creates an invoice for <price> <currency>
19
21
  Then they will receive a BitPay::ArgumentError matching <message>
20
22
  Examples:
21
23
  | price | currency | message |
22
- | "5,023" | "USD" | "Price must be formatted as a float" |
23
- | "3.21" | "EaUR" | "Currency is invalid." |
24
+ | "5,023" | "USD" | "Price must be formatted as a float" |
25
+ | "3.21" | "EaUR" | "Currency is invalid." |
24
26
  | "" | "USD" | "Price must be formatted as a float" |
25
27
  | "Ten" | "USD" | "Price must be formatted as a float" |
26
- | "10" | "" | "Currency is invalid." |
28
+ | "10" | "" | "Currency is invalid." |
data/lib/bitpay/client.rb CHANGED
@@ -61,7 +61,10 @@ module BitPay
61
61
  # Defaults to pos facade, also works with merchant facade
62
62
  #
63
63
  def create_invoice(price:, currency:, facade: 'pos', params:{})
64
- raise BitPay::ArgumentError, "Illegal Argument: Price must be formatted as a float" unless ( price.is_a?(Numeric) || /^[[:digit:]]+(\.[[:digit:]]{2})?$/.match(price) )
64
+ raise BitPay::ArgumentError, "Illegal Argument: Price must be formatted as a float" unless
65
+ price.is_a?(Numeric) ||
66
+ /^[[:digit:]]+(\.[[:digit:]]{2})?$/.match(price) ||
67
+ currency == 'BTC' && /^[[:digit:]]+(\.[[:digit:]]{1,6})?$/.match(price)
65
68
  raise BitPay::ArgumentError, "Illegal Argument: Currency is invalid." unless /^[[:upper:]]{3}$/.match(currency)
66
69
  params.merge!({price: price, currency: currency})
67
70
  response = send_request("POST", "invoices", facade: facade, params: params)
@@ -3,5 +3,5 @@
3
3
  # or https://github.com/bitpay/php-bitpay-client/blob/master/LICENSE
4
4
 
5
5
  module BitPay
6
- VERSION = '2.3.1'
6
+ VERSION = '2.3.2'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitpay-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitpay, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json