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 +4 -4
- data/features/creating_invoices.feature +7 -5
- data/lib/bitpay/client.rb +4 -1
- data/lib/bitpay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5f07e2ece3936d90f1855bf3c7c7c47e1528943
|
4
|
+
data.tar.gz: 2d7f13e49b0a7a0ce03804c99654c171a176cd86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
14
|
-
| "5.23"
|
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"
|
23
|
-
| "3.21"
|
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"
|
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
|
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)
|
data/lib/bitpay/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|