btcpay 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52f5488933179ffcc0f49464958306082484a19e10534252f0f15b7d65b85bad
4
- data.tar.gz: 167e3a925187eb02c61921411eaae5326abb3cc99eed164182fc306eb1b8b6b9
3
+ metadata.gz: 64156dcf4c8efbfa5934893814f2a50b9a254fac0b51d45dd07d2485604497b5
4
+ data.tar.gz: b2d0c5ed3728921acfa65359b6562c04f44c06702b0551fd1f78c5894813405d
5
5
  SHA512:
6
- metadata.gz: 78fbdd2dc13564140fa53d0ae5af29a8d37e3869bc819404d946e7d5215e714d3e6fef04bc4046828fa3b28f104f8c70ecddc1932c2d574563c5591ec32ebd68
7
- data.tar.gz: c1865e8b994e1cf847c3f1a547b7251c9591e2e3ca9fe7b9ce61ad687c49ebf7d47b6f4bfcb581f6d5144a60d9b26a0a67c934926a68c1948a6a61dc4da6d8c6
6
+ metadata.gz: 89e38e55a55079279a06e2da539db8fcf003e6e7a983d532451c130258bb0451b383d8e3a495b54daa325c681fcedb847f73a3eca72c94e1c0fc596bc25ceb06
7
+ data.tar.gz: 4928a00f9eb60b7d3363b1bd83448c91535ee93a280cfafe62a59732c4ae5fc0e1dc60f6b54119cc82dc6637508511b870840dbac6a3362f55b8749426e80174
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- btcpay (0.1.0)
4
+ btcpay (0.1.2)
5
5
  activesupport (> 5)
6
6
  multi_json (~> 1.15)
7
7
  rest-client (~> 2.1)
data/README.md CHANGED
@@ -96,6 +96,15 @@ All endpoints are accessed via namespaced Api resource. Example: `client.users.c
96
96
  1. `DELETE #delete(store_id)`
97
97
  1. `PUT #update(store_id, payload)`
98
98
 
99
+ - ##### Invoices:
100
+
101
+ 1. `GET #all(store_id)`
102
+ 1. `POST #create(store_id, payload)`
103
+ 1. `GET #get(store_id, invoice_id)`
104
+ 1. `DELETE #delete(store_id, invoice_id)`
105
+ 1. `POST #update_status(store_id, invoice_id, payload, status)`
106
+ 1. `POST #unarchive(store_id, invoice_id)`
107
+
99
108
  - ##### Payment Requests:
100
109
 
101
110
  1. `GET #all(store_id)`
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative 'lib/btcpay/version'
4
4
 
5
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
6
6
  spec.name = 'btcpay'
7
7
  spec.version = BtcPay::VERSION
8
8
  spec.authors = ['snogrammer']
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://gitlab.com/snogrammer/btcpay'
18
- spec.metadata['changelog_uri'] = 'https://gitlab.com/snogrammer/btcpay/CHANGELOG.md'
17
+ spec.metadata['source_code_uri'] = 'https://code.snogrammer.com/snogrammer/btcpay'
18
+ spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/CHANGELOG.md"
19
19
 
20
20
  # Specify which files should be added to the gem when it is released.
21
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -5,7 +5,7 @@ services:
5
5
  bitcoind:
6
6
  container_name: bitcoind
7
7
  restart: unless-stopped
8
- image: btcpayserver/bitcoin:0.19.0.1
8
+ image: btcpayserver/bitcoin:0.20.1
9
9
  environment:
10
10
  BITCOIN_NETWORK: regtest
11
11
  BITCOIN_EXTRA_ARGS: |
@@ -31,7 +31,7 @@ services:
31
31
  nbxplorer:
32
32
  container_name: nbxplorer
33
33
  restart: unless-stopped
34
- image: nicolasdorier/nbxplorer:2.1.34
34
+ image: nicolasdorier/nbxplorer:2.1.46
35
35
  ports:
36
36
  - "32838:32838"
37
37
  environment:
@@ -53,7 +53,7 @@ services:
53
53
  btcpay:
54
54
  container_name: btcpay
55
55
  restart: unless-stopped
56
- image: btcpayserver/btcpayserver:1.0.5.2
56
+ image: btcpayserver/btcpayserver:1.0.5.9
57
57
  ports:
58
58
  - "49392:49392"
59
59
  environment:
@@ -118,7 +118,7 @@ services:
118
118
  btcpay_db:
119
119
  container_name: btcpay_db
120
120
  restart: unless-stopped
121
- image: postgres:11.5-alpine
121
+ image: postgres:13-alpine
122
122
  environment:
123
123
  POSTGRES_USER: user
124
124
  POSTGRES_PASSWORD: password
@@ -12,6 +12,7 @@ module BtcPay
12
12
  require_relative './pull_payments'
13
13
  require_relative './server'
14
14
  require_relative './store'
15
+ require_relative './store_invoices'
15
16
  require_relative './store_payment_requests'
16
17
  require_relative './store_payouts'
17
18
  require_relative './store_pull_payments'
@@ -39,6 +39,10 @@ module BtcPay
39
39
  ##
40
40
  # services
41
41
  ##
42
+ def invoices
43
+ @invoices ||= Api::StoreInvoices.new(client: client)
44
+ end
45
+
42
46
  def payment_requests
43
47
  @payment_requests ||= Api::StorePaymentRequests.new(client: client)
44
48
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BtcPay
4
+ module Client
5
+ module Api
6
+ class StoreInvoices < Base
7
+ PATH = '/stores/:store_id/invoices'
8
+
9
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_GetInvoices
10
+ def all(store_id, **opts)
11
+ client.get(store_path(store_id), options: opts)
12
+ end
13
+
14
+ alias index all
15
+
16
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_CreateInvoice
17
+ def create(store_id, payload, **opts)
18
+ client.post(store_path(store_id), payload: payload, options: opts)
19
+ end
20
+
21
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_GetInvoice
22
+ def get(store_id, invoice_id, **opts)
23
+ client.get(store_path(store_id, invoice_id), options: opts)
24
+ end
25
+
26
+ alias find get
27
+
28
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_ArchiveInvoice
29
+ def delete(store_id, invoice_id, **opts)
30
+ client.delete(store_path(store_id, invoice_id), options: opts)
31
+ end
32
+
33
+ alias archive delete
34
+
35
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_MarkInvoiceStatus
36
+ # @see https://github.com/btcpayserver/btcpayserver/blob/master/BTCPayServer.Client/Models/InvoiceStatus.cs
37
+ def update_status(store_id, invoice_id, status = 'Complete', **opts)
38
+ client.post(store_path(store_id, invoice_id, 'status'), payload: { status: status }, options: opts)
39
+ end
40
+
41
+ # @see https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Invoices_UnarchiveInvoice
42
+ def unarchive(store_id, invoice_id, **opts)
43
+ client.post(store_path(store_id, invoice_id, 'unarchive'), payload: {}, options: opts)
44
+ end
45
+
46
+ protected
47
+
48
+ def set_base_path
49
+ @base_path = PATH.dup
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -6,11 +6,12 @@ module BtcPay
6
6
  AUTH_TOKEN_TYPE = 'token'
7
7
  BASIC_TOKEN_TYPE = 'Basic'
8
8
 
9
- attr_reader :authorization, :auth_token, :basic_auth_token, :base_url, :user_agent
9
+ attr_reader :authorization, :auth_token, :basic_auth_token, :base_url, :user_agent, :store_id
10
10
 
11
11
  def initialize(**kwargs)
12
12
  @base_url = load_url(kwargs[:base_url])
13
13
  @user_agent = kwargs[:user_agent] || "btcpay_ruby/#{BtcPay::VERSION}"
14
+ @store_id = kwargs[:store_id]
14
15
 
15
16
  load_auth_token(kwargs)
16
17
  set_authorization
@@ -21,7 +22,8 @@ module BtcPay
21
22
  auth_token: auth_token,
22
23
  basic_auth_token: basic_auth_token,
23
24
  base_url: base_url,
24
- user_agent: user_agent
25
+ user_agent: user_agent,
26
+ store_id: store_id
25
27
  }.compact
26
28
  end
27
29
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BtcPay
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btcpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - snogrammer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -178,6 +178,7 @@ files:
178
178
  - lib/btcpay/client/api/pull_payments.rb
179
179
  - lib/btcpay/client/api/server.rb
180
180
  - lib/btcpay/client/api/store.rb
181
+ - lib/btcpay/client/api/store_invoices.rb
181
182
  - lib/btcpay/client/api/store_payment_requests.rb
182
183
  - lib/btcpay/client/api/store_payouts.rb
183
184
  - lib/btcpay/client/api/store_pull_payments.rb
@@ -194,8 +195,8 @@ licenses:
194
195
  - MIT
195
196
  metadata:
196
197
  homepage_uri: https://docs.btcpayserver.org/API/Greenfield/v1/
197
- source_code_uri: https://gitlab.com/snogrammer/btcpay
198
- changelog_uri: https://gitlab.com/snogrammer/btcpay/CHANGELOG.md
198
+ source_code_uri: https://code.snogrammer.com/snogrammer/btcpay
199
+ changelog_uri: https://code.snogrammer.com/snogrammer/btcpay/CHANGELOG.md
199
200
  post_install_message:
200
201
  rdoc_options: []
201
202
  require_paths: