frontgo 0.1.1 → 0.2.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/CHANGELOG.md +41 -0
- data/README.md +1 -1
- data/lib/frontgo/connection.rb +6 -4
- data/lib/frontgo/credit.rb +3 -3
- data/lib/frontgo/customer.rb +3 -3
- data/lib/frontgo/order.rb +13 -13
- data/lib/frontgo/refund.rb +1 -1
- data/lib/frontgo/reservation.rb +10 -10
- data/lib/frontgo/subscription.rb +9 -9
- data/lib/frontgo/terminal.rb +8 -8
- data/lib/frontgo/version.rb +1 -1
- data/lib/frontgo.rb +29 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 533fb35c0c54d45c9054ccf59fc3a49e2244b2f1e1b91dad113f4dcc1ceda88a
|
|
4
|
+
data.tar.gz: baabc43b1d1328aaf3dc24c2bd38fd3104bab62c288f3a1a9ad6642ca1f1a101
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a60f1d44f769fb474695f7a1829c1fc2b06e057a307f108b470151ab2369e0985e5ad8128acb0693a647ee03e06c99b5ee05c1fafe8a00106178666665416290
|
|
7
|
+
data.tar.gz: c6e8b549cec6bc37b8613acdbad1f02afa49487cdc228a86204401bf62ca333f948269875cb54fff35f62007afd6072ef2c86dab21c2c9e70194affaf5004f15
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2024-12-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Support for multiple FrontPayment API environments (production and demo)
|
|
12
|
+
- New `demo` parameter in Client initialization to easily switch between environments
|
|
13
|
+
- Documentation for Client initialization parameters
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **BREAKING**: Client initialization now requires named parameters - `Frontgo::Client.new(key: 'your-key')` instead of positional arguments
|
|
17
|
+
- **BREAKING**: API methods now return the full Faraday response object instead of just the response body, allowing access to status codes and headers
|
|
18
|
+
- Default environment is now production (`https://apigo.frontpayment.no/api/v1`)
|
|
19
|
+
- Demo environment available at `https://demo-api.frontpayment.no/api/v1/` when `demo: true` is passed
|
|
20
|
+
|
|
21
|
+
## [0.1.1] - 2024-12-19
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Test coverage for `Order.get_order_status_by_uuid` method
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- All Standard Ruby style guide violations
|
|
28
|
+
- Class naming conventions - renamed to singular form for better Ruby conventions
|
|
29
|
+
|
|
30
|
+
## [0.1.0] - 2024-12-19
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- Initial release of the Frontgo gem
|
|
34
|
+
- Full support for FrontPayment API endpoints:
|
|
35
|
+
- **Orders**: Create payment sessions, get order status
|
|
36
|
+
- **Customers**: Manage customer records
|
|
37
|
+
- **Subscriptions**: Handle recurring payments
|
|
38
|
+
- **Refunds**: Process refunds
|
|
39
|
+
- **Reservations**: Manage payment reservations
|
|
40
|
+
- **Terminal**: Terminal payment operations
|
|
41
|
+
- **Credit**: Credit-related operations
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ And then install
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
19
|
-
client = Frontgo::Client.new(
|
|
19
|
+
client = Frontgo::Client.new(key: 'your-api-key') # add demo: true to make calls to non-production instance.
|
|
20
20
|
|
|
21
21
|
# Create payment session
|
|
22
22
|
client.create_session_for_one_time_payment_link({
|
data/lib/frontgo/connection.rb
CHANGED
|
@@ -7,8 +7,7 @@ module Frontgo
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def get(uri, params = {}, headers: {})
|
|
10
|
-
|
|
11
|
-
response.body
|
|
10
|
+
@connection.get(uri, params, headers)
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
def put(uri, body = {}, headers: {})
|
|
@@ -19,11 +18,14 @@ module Frontgo
|
|
|
19
18
|
request :delete, uri, nil, headers
|
|
20
19
|
end
|
|
21
20
|
|
|
21
|
+
def url_prefix
|
|
22
|
+
@connection.url_prefix
|
|
23
|
+
end
|
|
24
|
+
|
|
22
25
|
private
|
|
23
26
|
|
|
24
27
|
def request(method, url, body, headers)
|
|
25
|
-
|
|
26
|
-
response.body
|
|
28
|
+
@connection.run_request method, url, body, headers
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
end
|
data/lib/frontgo/credit.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Frontgo
|
|
|
14
14
|
# personalId: "ckFXQWJqeFlieE06ZDU3NGJlNTczMGYx"
|
|
15
15
|
# })
|
|
16
16
|
def credit_check_private(params)
|
|
17
|
-
post "
|
|
17
|
+
post "connect/credit/check/private", params
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# @example Credit check for corporate customer
|
|
@@ -22,13 +22,13 @@ module Frontgo
|
|
|
22
22
|
# organizationId: "998379342"
|
|
23
23
|
# })
|
|
24
24
|
def credit_check_corporate(params)
|
|
25
|
-
post "
|
|
25
|
+
post "connect/credit/check/corporate", params
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# @example Get credit check history list
|
|
29
29
|
# client.get_credit_check_list
|
|
30
30
|
def get_credit_check_list
|
|
31
|
-
get "
|
|
31
|
+
get "connect/credit/check/list"
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/frontgo/customer.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Frontgo
|
|
|
6
6
|
# @example Get customer details
|
|
7
7
|
# client.get_customer_details_by_uuid("CSRT1511414842")
|
|
8
8
|
def get_customer_details_by_uuid(uuid)
|
|
9
|
-
get "
|
|
9
|
+
get "connect/customers/details/#{uuid}"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# @example Update private customer
|
|
@@ -33,7 +33,7 @@ module Frontgo
|
|
|
33
33
|
# }
|
|
34
34
|
# })
|
|
35
35
|
def update_private_customer(uuid, params)
|
|
36
|
-
put "
|
|
36
|
+
put "connect/customers/update/private/#{uuid}", params
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# @example Update corporate customer
|
|
@@ -70,7 +70,7 @@ module Frontgo
|
|
|
70
70
|
# }
|
|
71
71
|
# })
|
|
72
72
|
def update_corporate_customer(uuid, params)
|
|
73
|
-
put "
|
|
73
|
+
put "connect/customers/update/corporate/#{uuid}", params
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
end
|
data/lib/frontgo/order.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Frontgo
|
|
|
12
12
|
# callback: { success: "https://example.com/success", failure: "https://example.com/failure" }
|
|
13
13
|
# })
|
|
14
14
|
def create_session_for_one_time_payment_link(params)
|
|
15
|
-
post "
|
|
15
|
+
post "connect/orders/regular/submit", params
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# @example Create an invoice order session
|
|
@@ -25,7 +25,7 @@ module Frontgo
|
|
|
25
25
|
# separateInvoices: true
|
|
26
26
|
# })
|
|
27
27
|
def create_session_for_invoice_order(params)
|
|
28
|
-
post "
|
|
28
|
+
post "connect/orders/regular/submit", params
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Can be filtered by status type as query (?type=)
|
|
@@ -36,19 +36,19 @@ module Frontgo
|
|
|
36
36
|
# @example Get only invoiced orders
|
|
37
37
|
# client.get_all_order_status(type: 'invoiced')
|
|
38
38
|
def get_all_order_status(params = {})
|
|
39
|
-
get "
|
|
39
|
+
get "connect/orders/status", params
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# @example Get order status by UUID
|
|
43
43
|
# client.get_order_status_by_uuid("ODR347888404")
|
|
44
44
|
def get_order_status_by_uuid(uuid)
|
|
45
|
-
get "
|
|
45
|
+
get "connect/orders/status/#{uuid}"
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# @example Get detailed order information
|
|
49
49
|
# client.get_order_details_by_uuid("ODR986760186")
|
|
50
50
|
def get_order_details_by_uuid(uuid)
|
|
51
|
-
get "
|
|
51
|
+
get "connect/orders/details/#{uuid}"
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# @example Send E-Faktura invoice
|
|
@@ -63,7 +63,7 @@ module Frontgo
|
|
|
63
63
|
# orderSummary: { subTotal: 51.00, totalTax: 0.00, grandTotal: 51.00 }
|
|
64
64
|
# })
|
|
65
65
|
def send_e_faktura(params)
|
|
66
|
-
post "
|
|
66
|
+
post "connect/orders/invoice/create/faktura", params
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# @example Send EHF invoice for corporate customers
|
|
@@ -78,7 +78,7 @@ module Frontgo
|
|
|
78
78
|
# orderSummary: { subTotal: 51.00, totalTax: 0.00, grandTotal: 51.00 }
|
|
79
79
|
# })
|
|
80
80
|
def send_ehf_invoice(params)
|
|
81
|
-
post "
|
|
81
|
+
post "connect/orders/invoice/create/ehf", params
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
# @example Cancel an order
|
|
@@ -86,7 +86,7 @@ module Frontgo
|
|
|
86
86
|
# cancellationNote: "Customer requested cancellation"
|
|
87
87
|
# })
|
|
88
88
|
def cancel_order(order_uuid, params)
|
|
89
|
-
post "
|
|
89
|
+
post "connect/orders/cancel/#{order_uuid}", params
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# @example Send payment link to customer
|
|
@@ -101,7 +101,7 @@ module Frontgo
|
|
|
101
101
|
# orderSummary: { subTotal: 51.00, totalTax: 0.00, grandTotal: 51.00 }
|
|
102
102
|
# })
|
|
103
103
|
def send_payment_link(params)
|
|
104
|
-
post "
|
|
104
|
+
post "connect/orders/payment-link/create", params
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
# @example Send regular invoice
|
|
@@ -117,7 +117,7 @@ module Frontgo
|
|
|
117
117
|
# separateInvoices: true
|
|
118
118
|
# })
|
|
119
119
|
def send_invoice(params)
|
|
120
|
-
post "
|
|
120
|
+
post "connect/orders/invoice/create", params
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
# @example Resend payment link to customer
|
|
@@ -127,7 +127,7 @@ module Frontgo
|
|
|
127
127
|
# email: "customer@example.com"
|
|
128
128
|
# })
|
|
129
129
|
def resend_payment_link(uuid, params)
|
|
130
|
-
post "
|
|
130
|
+
post "connect/orders/resend/#{uuid}", params
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
# @example Refund an order (full or partial)
|
|
@@ -140,13 +140,13 @@ module Frontgo
|
|
|
140
140
|
# ]
|
|
141
141
|
# })
|
|
142
142
|
def refund_order(uuid, params)
|
|
143
|
-
post "
|
|
143
|
+
post "connect/orders/refund/#{uuid}", params
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
# @example Get invoice number for an order
|
|
147
147
|
# client.get_invoice_number_by_uuid("ODR2005869234")
|
|
148
148
|
def get_invoice_number_by_uuid(uuid)
|
|
149
|
-
get "
|
|
149
|
+
get "connect/orders/invoice-number/#{uuid}"
|
|
150
150
|
end
|
|
151
151
|
end
|
|
152
152
|
end
|
data/lib/frontgo/refund.rb
CHANGED
data/lib/frontgo/reservation.rb
CHANGED
|
@@ -18,13 +18,13 @@ module Frontgo
|
|
|
18
18
|
# settings: { isChargePartiallyRefundable: true }
|
|
19
19
|
# })
|
|
20
20
|
def submit_reservation(params)
|
|
21
|
-
post "
|
|
21
|
+
post "connect/reservations/submit", params
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# @example Get reservation details by UUID
|
|
25
25
|
# client.get_reservation_details_by_uuid("RES3633019929")
|
|
26
26
|
def get_reservation_details_by_uuid(uuid)
|
|
27
|
-
get "
|
|
27
|
+
get "connect/reservations/details/#{uuid}"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# @example Cancel a reservation
|
|
@@ -32,7 +32,7 @@ module Frontgo
|
|
|
32
32
|
# note: "Customer requested cancellation"
|
|
33
33
|
# })
|
|
34
34
|
def cancel_reservation(uuid, params)
|
|
35
|
-
post "
|
|
35
|
+
post "connect/reservations/cancel/#{uuid}", params
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# @example Capture funds from a reservation
|
|
@@ -45,7 +45,7 @@ module Frontgo
|
|
|
45
45
|
# additionalText: "Capture for services rendered"
|
|
46
46
|
# })
|
|
47
47
|
def capture_reservation(uuid, params)
|
|
48
|
-
post "
|
|
48
|
+
post "connect/reservations/capture/#{uuid}", params
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# @example Charge additional amount from reservation
|
|
@@ -62,7 +62,7 @@ module Frontgo
|
|
|
62
62
|
# additionalText: "Extra service charge"
|
|
63
63
|
# })
|
|
64
64
|
def charge_reservation(uuid, params)
|
|
65
|
-
post "
|
|
65
|
+
post "connect/reservations/charge/#{uuid}", params
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# @example Complete a reservation
|
|
@@ -70,7 +70,7 @@ module Frontgo
|
|
|
70
70
|
# note: "Service completed successfully"
|
|
71
71
|
# })
|
|
72
72
|
def complete_reservation(uuid, params)
|
|
73
|
-
post "
|
|
73
|
+
post "connect/reservations/complete/#{uuid}", params
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
# @example Resend reservation payment link
|
|
@@ -80,7 +80,7 @@ module Frontgo
|
|
|
80
80
|
# email: "customer@example.com"
|
|
81
81
|
# })
|
|
82
82
|
def resend_reservation(uuid, params)
|
|
83
|
-
post "
|
|
83
|
+
post "connect/reservations/resend/#{uuid}", params
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
# @example Refund a reservation (from captured or charged amounts)
|
|
@@ -95,7 +95,7 @@ module Frontgo
|
|
|
95
95
|
# reference: "CHA3852658817"
|
|
96
96
|
# })
|
|
97
97
|
def refund_reservation(uuid, params)
|
|
98
|
-
post "
|
|
98
|
+
post "connect/reservations/refund/#{uuid}", params
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
# @example Create reservation session for checkout
|
|
@@ -116,7 +116,7 @@ module Frontgo
|
|
|
116
116
|
# settings: { isChargePartiallyRefundable: true }
|
|
117
117
|
# })
|
|
118
118
|
def create_session_for_reservation(params)
|
|
119
|
-
post "
|
|
119
|
+
post "connect/reservations/create", params
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
# @example Get reservation history by time frame
|
|
@@ -124,7 +124,7 @@ module Frontgo
|
|
|
124
124
|
# @example Get last 24 hours (when no timestamps provided, defaults to last 24 hours)
|
|
125
125
|
# client.get_reservation_history_by_time_frame("", "")
|
|
126
126
|
def get_reservation_history_by_time_frame(start_timestamp, end_timestamp)
|
|
127
|
-
get "
|
|
127
|
+
get "connect/reservations/history/#{start_timestamp}/#{end_timestamp}"
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
end
|
data/lib/frontgo/subscription.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Frontgo
|
|
|
11
11
|
# customerDetails: { name: "John Doe", email: "john@example.com" }
|
|
12
12
|
# })
|
|
13
13
|
def create_subscription(params)
|
|
14
|
-
post "
|
|
14
|
+
post "connect/subscription/submit", params
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
# @example Create subscription session for checkout
|
|
@@ -22,7 +22,7 @@ module Frontgo
|
|
|
22
22
|
# callback: { success: "https://example.com/success", failure: "https://example.com/failure" }
|
|
23
23
|
# })
|
|
24
24
|
def create_session_for_subscription_payment(params)
|
|
25
|
-
post "
|
|
25
|
+
post "connect/subscription/create", params
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# @example Get all subscriptions
|
|
@@ -32,7 +32,7 @@ module Frontgo
|
|
|
32
32
|
# @example Filter by phone and date range
|
|
33
33
|
# client.get_subscription_list(nil, { phone: '+47123456789', startDate: '2023-01-01', endDate: '2023-12-31' })
|
|
34
34
|
def get_subscription_list(status = nil, params = {})
|
|
35
|
-
endpoint = status ? "
|
|
35
|
+
endpoint = status ? "connect/subscriptions/list/#{status}" : "connect/subscriptions/list"
|
|
36
36
|
get endpoint, params
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -43,20 +43,20 @@ module Frontgo
|
|
|
43
43
|
# @example Filter by subscription UUID
|
|
44
44
|
# client.get_failed_payment_list(nil, { subscriptionUuid: 'SUB123456789' })
|
|
45
45
|
def get_failed_payment_list(status = nil, params = {})
|
|
46
|
-
endpoint = status ? "
|
|
46
|
+
endpoint = status ? "connect/subscriptions/failed/list/#{status}" : "connect/subscriptions/failed/list"
|
|
47
47
|
get endpoint, params
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
# @example Get subscription details
|
|
51
51
|
# client.get_subscription_details_by_uuid('SUB123456789')
|
|
52
52
|
def get_subscription_details_by_uuid(uuid)
|
|
53
|
-
get "
|
|
53
|
+
get "connect/subscriptions/details/#{uuid}"
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
# @example Get failed payment details
|
|
57
57
|
# client.get_failed_payment_details('ODR123456789')
|
|
58
58
|
def get_failed_payment_details(order_uuid)
|
|
59
|
-
get "
|
|
59
|
+
get "connect/subscriptions/failed/details/#{order_uuid}"
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# @example Resend subscription payment link
|
|
@@ -67,13 +67,13 @@ module Frontgo
|
|
|
67
67
|
# email: 'customer@example.com'
|
|
68
68
|
# })
|
|
69
69
|
def resend_subscription(uuid, params)
|
|
70
|
-
post "
|
|
70
|
+
post "connect/subscriptions/resend/#{uuid}", params
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# @example Cancel subscription
|
|
74
74
|
# client.cancel_subscription('SUB123456789', { note: 'Customer requested cancellation' })
|
|
75
75
|
def cancel_subscription(uuid, params)
|
|
76
|
-
post "
|
|
76
|
+
post "connect/subscriptions/cancel/#{uuid}", params
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
# @example Refund specific subscription cycles
|
|
@@ -82,7 +82,7 @@ module Frontgo
|
|
|
82
82
|
# amount: 200.00
|
|
83
83
|
# })
|
|
84
84
|
def refund_subscription_cycle(uuid, params)
|
|
85
|
-
post "
|
|
85
|
+
post "connect/subscriptions/cycles/refund/#{uuid}", params
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
end
|
data/lib/frontgo/terminal.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Frontgo
|
|
|
6
6
|
# @example Get terminal lists for organization
|
|
7
7
|
# client.get_terminal_lists("ORG2074299506")
|
|
8
8
|
def get_terminal_lists(organization_uuid)
|
|
9
|
-
get "
|
|
9
|
+
get "connect/terminal/lists/#{organization_uuid}"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# @example Create terminal order with callback
|
|
@@ -29,25 +29,25 @@ module Frontgo
|
|
|
29
29
|
# callbackUrl: "https://example-callback.com"
|
|
30
30
|
# })
|
|
31
31
|
def create_terminal_order(params)
|
|
32
|
-
post "
|
|
32
|
+
post "connect/terminal/orders/create", params
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# @example Cancel terminal order payment
|
|
36
36
|
# client.cancel_terminal_order("ODR123456789", { type: "payment" })
|
|
37
37
|
def cancel_terminal_order(order_uuid, params)
|
|
38
|
-
post "
|
|
38
|
+
post "connect/terminal/orders/cancel/#{order_uuid}", params
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# @example Resend terminal order to terminal
|
|
42
42
|
# client.resend_terminal_order("ODR123456789")
|
|
43
43
|
def resend_terminal_order(order_uuid)
|
|
44
|
-
post "
|
|
44
|
+
post "connect/terminal/orders/resend/#{order_uuid}", {}
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# @example Check payment status
|
|
48
48
|
# client.get_payment_status("ODR123456789")
|
|
49
49
|
def get_payment_status(order_uuid)
|
|
50
|
-
get "
|
|
50
|
+
get "connect/terminal/orders/payment-status/#{order_uuid}"
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# @example Refund terminal order
|
|
@@ -65,19 +65,19 @@ module Frontgo
|
|
|
65
65
|
# isReversal: true
|
|
66
66
|
# })
|
|
67
67
|
def refund_terminal_order(order_uuid, params)
|
|
68
|
-
post "
|
|
68
|
+
post "connect/terminal/orders/refund/#{order_uuid}", params
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# @example Check refund status
|
|
72
72
|
# client.get_refund_status("ODR123456789")
|
|
73
73
|
def get_refund_status(order_uuid)
|
|
74
|
-
get "
|
|
74
|
+
get "connect/terminal/orders/refund-status/#{order_uuid}"
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# @example Cancel refund request
|
|
78
78
|
# client.cancel_refund_request("ODR123456789", { type: "refund" })
|
|
79
79
|
def cancel_refund_request(order_uuid, params)
|
|
80
|
-
post "
|
|
80
|
+
post "connect/terminal/orders/cancel/#{order_uuid}", params
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
end
|
data/lib/frontgo/version.rb
CHANGED
data/lib/frontgo.rb
CHANGED
|
@@ -24,7 +24,15 @@ module Frontgo
|
|
|
24
24
|
include Terminal
|
|
25
25
|
include Credit
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
# Initializes the client.
|
|
28
|
+
#
|
|
29
|
+
# @param key [String] Bearer key
|
|
30
|
+
# @param demo [Boolean] Optionally target the demo environment
|
|
31
|
+
#
|
|
32
|
+
# @return [Client] A fully initialized client
|
|
33
|
+
|
|
34
|
+
def initialize(key:, demo: false)
|
|
35
|
+
@demo = demo || false
|
|
28
36
|
@connection = Faraday.new(base_url) do |conn|
|
|
29
37
|
conn.headers["Authorization"] = "Bearer #{key}"
|
|
30
38
|
conn.request :json
|
|
@@ -32,5 +40,25 @@ module Frontgo
|
|
|
32
40
|
conn.response :raise_error
|
|
33
41
|
end
|
|
34
42
|
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# Checks if the client is using the demo environment
|
|
47
|
+
#
|
|
48
|
+
# @return [Boolean]
|
|
49
|
+
def demo?
|
|
50
|
+
@demo
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Retrieves the base URL to use when making api requests.
|
|
54
|
+
#
|
|
55
|
+
# @return [String]
|
|
56
|
+
def base_url
|
|
57
|
+
if demo?
|
|
58
|
+
"https://demo-api.frontpayment.no/api/v1/"
|
|
59
|
+
else
|
|
60
|
+
"https://apigo.frontpayment.no/api/v1"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
35
63
|
end
|
|
36
64
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: frontgo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stanislav (Stas) Katkov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -34,6 +34,7 @@ extra_rdoc_files: []
|
|
|
34
34
|
files:
|
|
35
35
|
- ".editorconfig"
|
|
36
36
|
- ".standard.yml"
|
|
37
|
+
- CHANGELOG.md
|
|
37
38
|
- LICENSE.txt
|
|
38
39
|
- README.md
|
|
39
40
|
- Rakefile
|
|
@@ -55,6 +56,7 @@ metadata:
|
|
|
55
56
|
allowed_push_host: https://rubygems.org
|
|
56
57
|
homepage_uri: https://github.com/skatkov/frontgo
|
|
57
58
|
source_code_uri: https://github.com/skatkov/frontgo
|
|
59
|
+
changelog_uri: https://github.com/skatkov/frontgo/blob/master/CHANGELOG.md
|
|
58
60
|
post_install_message:
|
|
59
61
|
rdoc_options: []
|
|
60
62
|
require_paths:
|