payrex-ruby 0.2.4 → 1.0.0
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/lib/entities/billing_statement.rb +47 -0
- data/lib/entities/billing_statement_line_item.rb +27 -0
- data/lib/entities/checkout_session.rb +20 -22
- data/lib/entities/customer.rb +31 -0
- data/lib/entities/deleted.rb +15 -0
- data/lib/entities/payment_intent.rb +4 -0
- data/lib/payrex-ruby.rb +7 -2
- data/lib/services/billing_statement_line_items_service.rb +43 -0
- data/lib/services/billing_statements_service.rb +80 -0
- data/lib/services/checkout_sessions_service.rb +1 -1
- data/lib/services/customers_service.rb +53 -0
- data/lib/services/webhooks_service.rb +2 -2
- metadata +9 -5
- data/lib/entities/merchant.rb +0 -19
- data/lib/entities/payment_method.rb +0 -23
- data/lib/services/payment_methods_service.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b163d86d0573bfd9fba32aedb812a8fef70e908d6a845bb6ad140228ceb6557
|
4
|
+
data.tar.gz: 697201f56b4517e8301c2a19dd51eb5ac0169a9cf5c108d030e46e98257e5228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d752ed1ee7211e8006e0fc3389176c0ce288488fa6ac6529b11b5d5c3de10d8aa336ca6b9f73768450d9378715b1cbac6d9155385adf380d6ed0b3b1e432bd0b
|
7
|
+
data.tar.gz: 211a0f662d966a9ae5bdf1cad6d55fcec1efe60e4439fcdd3f9bbca96c53042a401e80ef19ec8aa18131ca0c8298415b4b591bfbbcdcbb66f0c78eba7cf88c3c
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Entities
|
3
|
+
class BillingStatement
|
4
|
+
attr_reader :id,
|
5
|
+
:amount,
|
6
|
+
:currency,
|
7
|
+
:customer_id,
|
8
|
+
:description,
|
9
|
+
:due_at,
|
10
|
+
:finalized_at,
|
11
|
+
:billing_statement_number,
|
12
|
+
:billing_statement_url,
|
13
|
+
:line_items,
|
14
|
+
:livemode,
|
15
|
+
:metadata,
|
16
|
+
:payment_intent,
|
17
|
+
:status,
|
18
|
+
:payment_settings,
|
19
|
+
:customer,
|
20
|
+
:created_at,
|
21
|
+
:updated_at
|
22
|
+
|
23
|
+
def initialize(api_resource)
|
24
|
+
data = api_resource.data
|
25
|
+
|
26
|
+
@id = data["id"]
|
27
|
+
@amount = data["amount"]
|
28
|
+
@currency = data["currency"]
|
29
|
+
@customer_id = data["customer_id"]
|
30
|
+
@description = data["description"]
|
31
|
+
@due_at = data["due_at"]
|
32
|
+
@finalized_at = data["finalized_at"]
|
33
|
+
@billing_statement_number = data["billing_statement_number"]
|
34
|
+
@billing_statement_url = data["billing_statement_url"]
|
35
|
+
@line_items = data["line_items"]
|
36
|
+
@livemode = data["livemode"]
|
37
|
+
@metadata = data["metadata"]
|
38
|
+
@payment_intent = data["payment_intent"]
|
39
|
+
@status = data["status"]
|
40
|
+
@payment_settings = data["payment_settings"]
|
41
|
+
@customer = data["customer"]
|
42
|
+
@created_at = data["created_at"]
|
43
|
+
@updated_at = data["updated_at"]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Entities
|
3
|
+
class BillingStatementLineItem
|
4
|
+
attr_reader :id,
|
5
|
+
:unit_price,
|
6
|
+
:quantity,
|
7
|
+
:billing_statement_id,
|
8
|
+
:description,
|
9
|
+
:livemode,
|
10
|
+
:created_at,
|
11
|
+
:updated_at
|
12
|
+
|
13
|
+
def initialize(api_resource)
|
14
|
+
data = api_resource.data
|
15
|
+
|
16
|
+
@id = data["id"]
|
17
|
+
@unit_price = data["unit_price"]
|
18
|
+
@quantity = data["quantity"]
|
19
|
+
@billing_statement_id = data["billing_statement_id"]
|
20
|
+
@description = data["description"]
|
21
|
+
@livemode = data["livemode"]
|
22
|
+
@created_at = data["created_at"]
|
23
|
+
@updated_at = data["updated_at"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -21,28 +21,26 @@ module Payrex
|
|
21
21
|
:updated_at
|
22
22
|
|
23
23
|
def initialize(api_resource)
|
24
|
-
|
25
|
-
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@created_at = api_resource.data["created_at"]
|
45
|
-
@updated_at = api_resource.data["updated_at"]
|
24
|
+
data = api_resource.data
|
25
|
+
|
26
|
+
@id = data["id"]
|
27
|
+
@customer_reference_id = data["customer_reference_id"]
|
28
|
+
@client_secret = data["client_secret"]
|
29
|
+
@status = data["status"]
|
30
|
+
@currency = data["currency"]
|
31
|
+
@line_items = data["line_items"]
|
32
|
+
@livemode = data["livemode"]
|
33
|
+
@url = data["url"]
|
34
|
+
@payment_intent = data["payment_intent"]
|
35
|
+
@metadata = data["metadata"]
|
36
|
+
@success_url = data["success_url"]
|
37
|
+
@cancel_url = data["cancel_url"]
|
38
|
+
@payment_methods = data["payment_methods"]
|
39
|
+
@description = data["description"]
|
40
|
+
@submit_type = data["submit_type"]
|
41
|
+
@expires_at = data["expires_at"]
|
42
|
+
@created_at = data["created_at"]
|
43
|
+
@updated_at = data["updated_at"]
|
46
44
|
end
|
47
45
|
end
|
48
46
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Entities
|
3
|
+
class Customer
|
4
|
+
attr_reader :id,
|
5
|
+
:billing_statement_prefix,
|
6
|
+
:currency,
|
7
|
+
:email,
|
8
|
+
:livemode,
|
9
|
+
:name,
|
10
|
+
:metadata,
|
11
|
+
:next_billing_statement_sequence_number,
|
12
|
+
:created_at,
|
13
|
+
:updated_at
|
14
|
+
|
15
|
+
def initialize(api_resource)
|
16
|
+
data = api_resource.data
|
17
|
+
|
18
|
+
@id = data["id"]
|
19
|
+
@billing_statement_prefix = data["billing_statement_prefix"]
|
20
|
+
@currency = data["currency"]
|
21
|
+
@email = data["email"]
|
22
|
+
@livemode = data["livemode"]
|
23
|
+
@name = data["name"]
|
24
|
+
@metadata = data["metadata"]
|
25
|
+
@next_billing_statement_sequence_number = data["next_billing_statement_sequence_number"]
|
26
|
+
@created_at = data["created_at"]
|
27
|
+
@updated_at = data["updated_at"]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -3,6 +3,8 @@ module Payrex
|
|
3
3
|
class PaymentIntent
|
4
4
|
attr_reader :id,
|
5
5
|
:amount,
|
6
|
+
:amount_received,
|
7
|
+
:amount_capturable,
|
6
8
|
:client_secret,
|
7
9
|
:currency,
|
8
10
|
:description,
|
@@ -22,6 +24,8 @@ module Payrex
|
|
22
24
|
def initialize(api_resource)
|
23
25
|
@id = api_resource.data["id"]
|
24
26
|
@amount = api_resource.data["amount"]
|
27
|
+
@amount_received = api_resource.data["amount_received"]
|
28
|
+
@amount_capturable = api_resource.data["amount_capturable"]
|
25
29
|
@client_secret = api_resource.data["client_secret"]
|
26
30
|
@currency = api_resource.data["currency"]
|
27
31
|
@description = api_resource.data["description"]
|
data/lib/payrex-ruby.rb
CHANGED
@@ -10,9 +10,12 @@ require_relative "http_client"
|
|
10
10
|
require_relative "payrex_error"
|
11
11
|
require_relative "entities/checkout_session"
|
12
12
|
require_relative "entities/event"
|
13
|
+
require_relative "entities/deleted"
|
14
|
+
require_relative "entities/customer"
|
15
|
+
require_relative "entities/billing_statement"
|
16
|
+
require_relative "entities/billing_statement_line_item"
|
13
17
|
require_relative "entities/listing"
|
14
18
|
require_relative "entities/payment_intent"
|
15
|
-
require_relative "entities/payment_method"
|
16
19
|
require_relative "entities/refund"
|
17
20
|
require_relative "entities/webhook"
|
18
21
|
require_relative "errors/base_error"
|
@@ -23,8 +26,10 @@ require_relative "errors/signature_invalid_error"
|
|
23
26
|
require_relative "errors/value_unexpected_error"
|
24
27
|
require_relative "services/base_service"
|
25
28
|
require_relative "services/checkout_sessions_service"
|
29
|
+
require_relative "services/customers_service"
|
30
|
+
require_relative "services/billing_statements_service"
|
31
|
+
require_relative "services/billing_statement_line_items_service"
|
26
32
|
require_relative "services/payment_intents_service"
|
27
|
-
require_relative "services/payment_methods_service"
|
28
33
|
require_relative "services/refunds_service"
|
29
34
|
require_relative "services/webhooks_service"
|
30
35
|
require_relative "services/service_factory"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Services
|
3
|
+
class BillingStatementLineItemsService < BaseService
|
4
|
+
PATH = "billing_statement_line_items"
|
5
|
+
|
6
|
+
def create(payload)
|
7
|
+
request(
|
8
|
+
method: :post,
|
9
|
+
object: Payrex::Entities::BillingStatementLineItem,
|
10
|
+
path: PATH,
|
11
|
+
payload: payload
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def retrieve(id)
|
16
|
+
request(
|
17
|
+
method: :get,
|
18
|
+
object: Payrex::Entities::BillingStatementLineItem,
|
19
|
+
path: "#{PATH}/#{id}",
|
20
|
+
payload: {}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update(id, payload)
|
25
|
+
request(
|
26
|
+
method: :put,
|
27
|
+
object: Payrex::Entities::BillingStatementLineItem,
|
28
|
+
path: "#{PATH}/#{id}",
|
29
|
+
payload: payload
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete(id)
|
34
|
+
request(
|
35
|
+
method: :delete,
|
36
|
+
object: Payrex::Entities::Deleted,
|
37
|
+
path: "#{PATH}/#{id}",
|
38
|
+
payload: {}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Services
|
3
|
+
class BillingStatementsService < BaseService
|
4
|
+
PATH = "billing_statements"
|
5
|
+
|
6
|
+
def create(payload)
|
7
|
+
request(
|
8
|
+
method: :post,
|
9
|
+
object: Payrex::Entities::BillingStatement,
|
10
|
+
path: PATH,
|
11
|
+
payload: payload
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def retrieve(id)
|
16
|
+
request(
|
17
|
+
method: :get,
|
18
|
+
object: Payrex::Entities::BillingStatement,
|
19
|
+
path: "#{PATH}/#{id}",
|
20
|
+
payload: {}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(payload = {})
|
25
|
+
request(
|
26
|
+
is_list: true,
|
27
|
+
method: :get,
|
28
|
+
object: Payrex::Entities::BillingStatement,
|
29
|
+
path: PATH,
|
30
|
+
payload: payload
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(id, payload)
|
35
|
+
request(
|
36
|
+
method: :put,
|
37
|
+
object: Payrex::Entities::BillingStatement,
|
38
|
+
path: "#{PATH}/#{id}",
|
39
|
+
payload: payload
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete(id)
|
44
|
+
request(
|
45
|
+
method: :delete,
|
46
|
+
object: Payrex::Entities::Deleted,
|
47
|
+
path: "#{PATH}/#{id}",
|
48
|
+
payload: {}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def finalize(id, payload)
|
53
|
+
request(
|
54
|
+
method: :post,
|
55
|
+
object: Payrex::Entities::BillingStatement,
|
56
|
+
path: "#{PATH}/#{id}/finalize",
|
57
|
+
payload: payload
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def void(id, payload)
|
62
|
+
request(
|
63
|
+
method: :post,
|
64
|
+
object: Payrex::Entities::BillingStatement,
|
65
|
+
path: "#{PATH}/#{id}/void",
|
66
|
+
payload: payload
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def mark_uncollectible(id, payload)
|
71
|
+
request(
|
72
|
+
method: :post,
|
73
|
+
object: Payrex::Entities::BillingStatement,
|
74
|
+
path: "#{PATH}/#{id}/mark_uncollectible",
|
75
|
+
payload: payload
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Payrex
|
2
|
+
module Services
|
3
|
+
class CustomersService < BaseService
|
4
|
+
PATH = "customers"
|
5
|
+
|
6
|
+
def create(payload)
|
7
|
+
request(
|
8
|
+
method: :post,
|
9
|
+
object: Payrex::Entities::Customer,
|
10
|
+
path: PATH,
|
11
|
+
payload: payload
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def retrieve(id)
|
16
|
+
request(
|
17
|
+
method: :get,
|
18
|
+
object: Payrex::Entities::Customer,
|
19
|
+
path: "#{PATH}/#{id}",
|
20
|
+
payload: {}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(payload = {})
|
25
|
+
request(
|
26
|
+
is_list: true,
|
27
|
+
method: :get,
|
28
|
+
object: Payrex::Entities::Customer,
|
29
|
+
path: PATH,
|
30
|
+
payload: payload
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(id, payload)
|
35
|
+
request(
|
36
|
+
method: :put,
|
37
|
+
object: Payrex::Entities::Customer,
|
38
|
+
path: "#{PATH}/#{id}",
|
39
|
+
payload: payload
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete(id)
|
44
|
+
request(
|
45
|
+
method: :delete,
|
46
|
+
object: Payrex::Entities::Deleted,
|
47
|
+
path: "#{PATH}/#{id}",
|
48
|
+
payload: {}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -47,7 +47,7 @@ module Payrex
|
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
50
|
-
def list(payload)
|
50
|
+
def list(payload = {})
|
51
51
|
request(
|
52
52
|
is_list: true,
|
53
53
|
method: :get,
|
@@ -87,7 +87,7 @@ module Payrex
|
|
87
87
|
def delete(id)
|
88
88
|
request(
|
89
89
|
method: :delete,
|
90
|
-
object: Payrex::Entities::
|
90
|
+
object: Payrex::Entities::Deleted,
|
91
91
|
path: "#{PATH}/#{id}",
|
92
92
|
payload: {}
|
93
93
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payrex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayRex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PayRex Ruby Library
|
14
14
|
email: support@payrexhq.com
|
@@ -19,12 +19,14 @@ files:
|
|
19
19
|
- lib/api_resource.rb
|
20
20
|
- lib/client.rb
|
21
21
|
- lib/config.rb
|
22
|
+
- lib/entities/billing_statement.rb
|
23
|
+
- lib/entities/billing_statement_line_item.rb
|
22
24
|
- lib/entities/checkout_session.rb
|
25
|
+
- lib/entities/customer.rb
|
26
|
+
- lib/entities/deleted.rb
|
23
27
|
- lib/entities/event.rb
|
24
28
|
- lib/entities/listing.rb
|
25
|
-
- lib/entities/merchant.rb
|
26
29
|
- lib/entities/payment_intent.rb
|
27
|
-
- lib/entities/payment_method.rb
|
28
30
|
- lib/entities/refund.rb
|
29
31
|
- lib/entities/webhook.rb
|
30
32
|
- lib/errors/authentication_invalid_error.rb
|
@@ -37,9 +39,11 @@ files:
|
|
37
39
|
- lib/payrex-ruby.rb
|
38
40
|
- lib/payrex_error.rb
|
39
41
|
- lib/services/base_service.rb
|
42
|
+
- lib/services/billing_statement_line_items_service.rb
|
43
|
+
- lib/services/billing_statements_service.rb
|
40
44
|
- lib/services/checkout_sessions_service.rb
|
45
|
+
- lib/services/customers_service.rb
|
41
46
|
- lib/services/payment_intents_service.rb
|
42
|
-
- lib/services/payment_methods_service.rb
|
43
47
|
- lib/services/refunds_service.rb
|
44
48
|
- lib/services/service_factory.rb
|
45
49
|
- lib/services/webhooks_service.rb
|
data/lib/entities/merchant.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Payrex
|
2
|
-
module Entities
|
3
|
-
class Merchant
|
4
|
-
attr_reader :id,
|
5
|
-
:connection_type,
|
6
|
-
:livemode,
|
7
|
-
:created_at,
|
8
|
-
:updated_at
|
9
|
-
|
10
|
-
def initialize(api_resource)
|
11
|
-
@id = api_resource.data["id"]
|
12
|
-
@connection_type = api_resource.data["connection_type"]
|
13
|
-
@livemode = api_resource.data["livemode"]
|
14
|
-
@created_at = api_resource.data["created_at"]
|
15
|
-
@updated_at = api_resource.data["updated_at"]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Payrex
|
2
|
-
module Entities
|
3
|
-
class PaymentMethod
|
4
|
-
attr_reader :id,
|
5
|
-
:type,
|
6
|
-
:billing_details,
|
7
|
-
:livemode,
|
8
|
-
:metadata,
|
9
|
-
:created_at,
|
10
|
-
:updated_at
|
11
|
-
|
12
|
-
def initialize(api_resource)
|
13
|
-
@id = api_resource.data["id"]
|
14
|
-
@type = api_resource.data["type"]
|
15
|
-
@billing_details = api_resource.data["billing_details"]
|
16
|
-
@livemode = api_resource.data["livemode"]
|
17
|
-
@metadata = api_resource.data["metadata"]
|
18
|
-
@created_at = api_resource.data["created_at"]
|
19
|
-
@updated_at = api_resource.data["updated_at"]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Payrex
|
2
|
-
module Services
|
3
|
-
class PaymentMethodsService < BaseService
|
4
|
-
PATH = "payment_methods"
|
5
|
-
|
6
|
-
def create(payload)
|
7
|
-
request(
|
8
|
-
method: :post,
|
9
|
-
object: Payrex::Entities::PaymentMethod,
|
10
|
-
path: PATH,
|
11
|
-
payload: payload
|
12
|
-
)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|