sumup 0.0.1

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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +18 -0
  3. data/LICENSE +201 -0
  4. data/README.md +188 -0
  5. data/lib/sumup/client.rb +213 -0
  6. data/lib/sumup/errors.rb +45 -0
  7. data/lib/sumup/event_types.rb +115 -0
  8. data/lib/sumup/events.rb +168 -0
  9. data/lib/sumup/model.rb +109 -0
  10. data/lib/sumup/pagination.rb +92 -0
  11. data/lib/sumup/resource.rb +36 -0
  12. data/lib/sumup/resources/checkouts.rb +155 -0
  13. data/lib/sumup/resources/customers.rb +89 -0
  14. data/lib/sumup/resources/members.rb +93 -0
  15. data/lib/sumup/resources/memberships.rb +23 -0
  16. data/lib/sumup/resources/merchants.rb +51 -0
  17. data/lib/sumup/resources/payouts.rb +29 -0
  18. data/lib/sumup/resources/readers.rb +264 -0
  19. data/lib/sumup/resources/receipts.rb +23 -0
  20. data/lib/sumup/resources/roles.rb +89 -0
  21. data/lib/sumup/resources/sales.rb +66 -0
  22. data/lib/sumup/resources/tokens.rb +31 -0
  23. data/lib/sumup/resources/transactions.rb +61 -0
  24. data/lib/sumup/resources.rb +83 -0
  25. data/lib/sumup/transport.rb +40 -0
  26. data/lib/sumup/types.rb +4720 -0
  27. data/lib/sumup/version.rb +5 -0
  28. data/lib/sumup.rb +13 -0
  29. data/sig/sumup/events.rbs +64 -0
  30. data/sig/sumup/resources/checkouts.rbs +35 -0
  31. data/sig/sumup/resources/customers.rbs +25 -0
  32. data/sig/sumup/resources/members.rbs +25 -0
  33. data/sig/sumup/resources/memberships.rbs +13 -0
  34. data/sig/sumup/resources/merchants.rbs +17 -0
  35. data/sig/sumup/resources/payouts.rbs +13 -0
  36. data/sig/sumup/resources/readers.rbs +45 -0
  37. data/sig/sumup/resources/receipts.rbs +13 -0
  38. data/sig/sumup/resources/roles.rbs +25 -0
  39. data/sig/sumup/resources/sales.rbs +19 -0
  40. data/sig/sumup/resources/tokens.rbs +15 -0
  41. data/sig/sumup/resources/transactions.rbs +19 -0
  42. data/sig/sumup/types.rbs +1635 -0
  43. data/sig/sumup.rbs +183 -0
  44. metadata +149 -0
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Customers < Resource
8
+ # Creates a customer using the `customer_id` you supply. Choose an identifier that maps to the payer in your own system and reuse it when retrieving the customer or associating checkouts and saved payment instruments with them.
9
+ # @return [Types::Customer]
10
+ def create(body: UNSET, options: nil, **body_fields)
11
+ payload = request_body(body, body_fields)
12
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
13
+ @client.request(method: "POST", path: "/v0.1/customers",
14
+ query: {}, body: payload, options: options,
15
+ response_type: {201 => [:model, "Customer"]}, with_response: false)
16
+ end
17
+
18
+ def create_with_response(body: UNSET, options: nil, **body_fields)
19
+ payload = request_body(body, body_fields)
20
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
21
+ @client.request(method: "POST", path: "/v0.1/customers",
22
+ query: {}, body: payload, options: options,
23
+ response_type: {201 => [:model, "Customer"]}, with_response: true)
24
+ end
25
+
26
+ # Retrieves a saved customer using the `customer_id` you supplied when creating the customer.
27
+ # @return [Types::Customer]
28
+ def get(customer_id:, options: nil)
29
+ @client.request(method: "GET", path: "/v0.1/customers/#{path_segment(customer_id)}",
30
+ query: {}, options: options,
31
+ response_type: {200 => [:model, "Customer"]}, with_response: false)
32
+ end
33
+
34
+ def get_with_response(customer_id:, options: nil)
35
+ @client.request(method: "GET", path: "/v0.1/customers/#{path_segment(customer_id)}",
36
+ query: {}, options: options,
37
+ response_type: {200 => [:model, "Customer"]}, with_response: true)
38
+ end
39
+
40
+ # Updates an identified saved customer resource's personal details.
41
+ #
42
+ # The request only overwrites the parameters included in the request, all other parameters will remain with their initially assigned values.
43
+ # @return [Types::Customer]
44
+ def update(customer_id:, body: UNSET, options: nil, **body_fields)
45
+ payload = request_body(body, body_fields)
46
+ payload = {} if payload.equal?(UNSET)
47
+ @client.request(method: "PUT", path: "/v0.1/customers/#{path_segment(customer_id)}",
48
+ query: {}, body: payload, options: options,
49
+ response_type: {200 => [:model, "Customer"]}, with_response: false)
50
+ end
51
+
52
+ def update_with_response(customer_id:, body: UNSET, options: nil, **body_fields)
53
+ payload = request_body(body, body_fields)
54
+ payload = {} if payload.equal?(UNSET)
55
+ @client.request(method: "PUT", path: "/v0.1/customers/#{path_segment(customer_id)}",
56
+ query: {}, body: payload, options: options,
57
+ response_type: {200 => [:model, "Customer"]}, with_response: true)
58
+ end
59
+
60
+ # Lists all payment instrument resources that are saved for an identified customer.
61
+ # @return [Array[Types::PaymentInstrumentResponse]]
62
+ def list_payment_instruments(customer_id:, options: nil)
63
+ @client.request(method: "GET", path: "/v0.1/customers/#{path_segment(customer_id)}/payment-instruments",
64
+ query: {}, options: options,
65
+ response_type: {200 => [:array, [:model, "PaymentInstrumentResponse"]]}, with_response: false)
66
+ end
67
+
68
+ def list_payment_instruments_with_response(customer_id:, options: nil)
69
+ @client.request(method: "GET", path: "/v0.1/customers/#{path_segment(customer_id)}/payment-instruments",
70
+ query: {}, options: options,
71
+ response_type: {200 => [:array, [:model, "PaymentInstrumentResponse"]]}, with_response: true)
72
+ end
73
+
74
+ # Deactivates an identified card payment instrument resource for a customer.
75
+ # @return [nil]
76
+ def deactivate_payment_instrument(customer_id:, token:, options: nil)
77
+ @client.request(method: "DELETE", path: "/v0.1/customers/#{path_segment(customer_id)}/payment-instruments/#{path_segment(token)}",
78
+ query: {}, options: options,
79
+ response_type: {204 => :nil}, with_response: false)
80
+ end
81
+
82
+ def deactivate_payment_instrument_with_response(customer_id:, token:, options: nil)
83
+ @client.request(method: "DELETE", path: "/v0.1/customers/#{path_segment(customer_id)}/payment-instruments/#{path_segment(token)}",
84
+ query: {}, options: options,
85
+ response_type: {204 => :nil}, with_response: true)
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Members < Resource
8
+ # Lists merchant members.
9
+ # @return [Types::ListMerchantMembersResponse]
10
+ def list(merchant_code:, offset: UNSET, limit: UNSET, scroll: UNSET, email: UNSET, user_id: UNSET, status: UNSET, roles: UNSET, options: nil)
11
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members",
12
+ query: {"offset" => offset, "limit" => limit, "scroll" => scroll, "email" => email, "user.id" => user_id, "status" => status, "roles" => roles}, options: options,
13
+ response_type: {200 => [:model, "ListMerchantMembersResponse"]}, with_response: false)
14
+ end
15
+
16
+ def list_with_response(merchant_code:, offset: UNSET, limit: UNSET, scroll: UNSET, email: UNSET, user_id: UNSET, status: UNSET, roles: UNSET, options: nil)
17
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members",
18
+ query: {"offset" => offset, "limit" => limit, "scroll" => scroll, "email" => email, "user.id" => user_id, "status" => status, "roles" => roles}, options: options,
19
+ response_type: {200 => [:model, "ListMerchantMembersResponse"]}, with_response: true)
20
+ end
21
+
22
+ # Adds a member to the merchant account with the specified roles.
23
+ #
24
+ # By default, sends an invitation email to the provided address. The recipient must accept the invitation to join the account.
25
+ # When `is_managed_user` is `true`, creates a managed user with the provided password and optional nickname and assigns the roles directly, without sending an invitation.
26
+ # @return [Types::Member]
27
+ def create(merchant_code:, body: UNSET, options: nil, **body_fields)
28
+ payload = request_body(body, body_fields)
29
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
30
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members",
31
+ query: {}, body: payload, options: options,
32
+ response_type: {201 => [:model, "Member"]}, with_response: false)
33
+ end
34
+
35
+ def create_with_response(merchant_code:, body: UNSET, options: nil, **body_fields)
36
+ payload = request_body(body, body_fields)
37
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
38
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members",
39
+ query: {}, body: payload, options: options,
40
+ response_type: {201 => [:model, "Member"]}, with_response: true)
41
+ end
42
+
43
+ # Retrieve a merchant member.
44
+ # @return [Types::Member]
45
+ def get(merchant_code:, member_id:, options: nil)
46
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
47
+ query: {}, options: options,
48
+ response_type: {200 => [:model, "Member"]}, with_response: false)
49
+ end
50
+
51
+ def get_with_response(merchant_code:, member_id:, options: nil)
52
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
53
+ query: {}, options: options,
54
+ response_type: {200 => [:model, "Member"]}, with_response: true)
55
+ end
56
+
57
+ # Updates a merchant member and returns the updated member.
58
+ #
59
+ # Providing `roles` replaces the member's assigned roles and can grant or revoke access. Providing `metadata` replaces the entire metadata object.
60
+ # For managed users, `user.nickname` changes the display name and `user.password` replaces the password. Updating the password also enables the managed user account.
61
+ # @return [Types::Member]
62
+ def update(merchant_code:, member_id:, body: UNSET, options: nil, **body_fields)
63
+ payload = request_body(body, body_fields)
64
+ payload = {} if payload.equal?(UNSET)
65
+ @client.request(method: "PUT", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
66
+ query: {}, body: payload, options: options,
67
+ response_type: {200 => [:model, "Member"]}, with_response: false)
68
+ end
69
+
70
+ def update_with_response(merchant_code:, member_id:, body: UNSET, options: nil, **body_fields)
71
+ payload = request_body(body, body_fields)
72
+ payload = {} if payload.equal?(UNSET)
73
+ @client.request(method: "PUT", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
74
+ query: {}, body: payload, options: options,
75
+ response_type: {200 => [:model, "Member"]}, with_response: true)
76
+ end
77
+
78
+ # Deletes a merchant member.
79
+ # @return [nil]
80
+ def delete(merchant_code:, member_id:, options: nil)
81
+ @client.request(method: "DELETE", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
82
+ query: {}, options: options,
83
+ response_type: {200 => :nil}, with_response: false)
84
+ end
85
+
86
+ def delete_with_response(merchant_code:, member_id:, options: nil)
87
+ @client.request(method: "DELETE", path: "/v0.1/merchants/#{path_segment(merchant_code)}/members/#{path_segment(member_id)}",
88
+ query: {}, options: options,
89
+ response_type: {200 => :nil}, with_response: true)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Memberships < Resource
8
+ # List memberships of the current user.
9
+ # @return [Types::ListMembershipsResponse]
10
+ def list(offset: UNSET, limit: UNSET, kind: UNSET, status: UNSET, resource_type: UNSET, resource_attributes_sandbox: UNSET, resource_name: UNSET, resource_id: UNSET, resource_parent_id: UNSET, resource_parent_type: UNSET, roles: UNSET, options: nil)
11
+ @client.request(method: "GET", path: "/v0.1/memberships",
12
+ query: {"offset" => offset, "limit" => limit, "kind" => kind, "status" => status, "resource.type" => resource_type, "resource.attributes.sandbox" => resource_attributes_sandbox, "resource.name" => resource_name, "resource.id" => resource_id, "resource.parent.id" => resource_parent_id, "resource.parent.type" => resource_parent_type, "roles" => roles}, options: options,
13
+ response_type: {200 => [:model, "ListMembershipsResponse"]}, with_response: false)
14
+ end
15
+
16
+ def list_with_response(offset: UNSET, limit: UNSET, kind: UNSET, status: UNSET, resource_type: UNSET, resource_attributes_sandbox: UNSET, resource_name: UNSET, resource_id: UNSET, resource_parent_id: UNSET, resource_parent_type: UNSET, roles: UNSET, options: nil)
17
+ @client.request(method: "GET", path: "/v0.1/memberships",
18
+ query: {"offset" => offset, "limit" => limit, "kind" => kind, "status" => status, "resource.type" => resource_type, "resource.attributes.sandbox" => resource_attributes_sandbox, "resource.name" => resource_name, "resource.id" => resource_id, "resource.parent.id" => resource_parent_id, "resource.parent.type" => resource_parent_type, "roles" => roles}, options: options,
19
+ response_type: {200 => [:model, "ListMembershipsResponse"]}, with_response: true)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Merchants < Resource
8
+ # Returns a Merchant for a valid Merchant code.
9
+ # @return [Types::Merchant]
10
+ def get(merchant_code:, options: nil)
11
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}",
12
+ query: {}, options: options,
13
+ response_type: {200 => [:model, "Merchant"]}, with_response: false)
14
+ end
15
+
16
+ def get_with_response(merchant_code:, options: nil)
17
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}",
18
+ query: {}, options: options,
19
+ response_type: {200 => [:model, "Merchant"]}, with_response: true)
20
+ end
21
+
22
+ # Returns the Persons related to a Merchant.
23
+ # @return [Types::ListPersonsResponseBody]
24
+ def list_persons(merchant_code:, options: nil)
25
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}/persons",
26
+ query: {}, options: options,
27
+ response_type: {200 => [:model, "ListPersonsResponseBody"]}, with_response: false)
28
+ end
29
+
30
+ def list_persons_with_response(merchant_code:, options: nil)
31
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}/persons",
32
+ query: {}, options: options,
33
+ response_type: {200 => [:model, "ListPersonsResponseBody"]}, with_response: true)
34
+ end
35
+
36
+ # Returns a single Person related to a Merchant.
37
+ # @return [Types::Person]
38
+ def get_person(merchant_code:, person_id:, options: nil)
39
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}/persons/#{path_segment(person_id)}",
40
+ query: {}, options: options,
41
+ response_type: {200 => [:model, "Person"]}, with_response: false)
42
+ end
43
+
44
+ def get_person_with_response(merchant_code:, person_id:, options: nil)
45
+ @client.request(method: "GET", path: "/v1/merchants/#{path_segment(merchant_code)}/persons/#{path_segment(person_id)}",
46
+ query: {}, options: options,
47
+ response_type: {200 => [:model, "Person"]}, with_response: true)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Payouts < Resource
8
+ # Lists payout and payout-deduction records for the specified merchant account within the requested date range.
9
+ #
10
+ # The response can include:
11
+ # - regular payouts (`type = PAYOUT`)
12
+ # - deduction records for refunds, chargebacks, direct debit returns, or balance adjustments
13
+ #
14
+ # Results are sorted by payout date in the requested `order`.
15
+ # @return [(Array[Types::FinancialPayout] | String)]
16
+ def list(merchant_code:, start_date:, end_date:, format: UNSET, limit: UNSET, order: UNSET, options: nil)
17
+ @client.request(method: "GET", path: "/v1.0/merchants/#{path_segment(merchant_code)}/payouts",
18
+ query: {"start_date" => start_date, "end_date" => end_date, "format" => format, "limit" => limit, "order" => order}, options: options,
19
+ response_type: {200 => [:union, [[:array, [:model, "FinancialPayout"]], :string]]}, with_response: false)
20
+ end
21
+
22
+ def list_with_response(merchant_code:, start_date:, end_date:, format: UNSET, limit: UNSET, order: UNSET, options: nil)
23
+ @client.request(method: "GET", path: "/v1.0/merchants/#{path_segment(merchant_code)}/payouts",
24
+ query: {"start_date" => start_date, "end_date" => end_date, "format" => format, "limit" => limit, "order" => order}, options: options,
25
+ response_type: {200 => [:union, [[:array, [:model, "FinancialPayout"]], :string]]}, with_response: true)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,264 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Readers < Resource
8
+ # Initiates a payment on the SumUp Go terminal identified by the reader ID.
9
+ #
10
+ # Use `client_transaction_id` as an idempotency key: retrying the request with the same value returns the result of the original payment instead of creating a duplicate.
11
+ # @return [Types::ReaderPaymentResponse]
12
+ def create_go_checkout(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
13
+ payload = request_body(body, body_fields)
14
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
15
+ @client.request(method: "POST", path: "/v0/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/go-checkout",
16
+ query: {}, body: payload, options: options,
17
+ response_type: {200 => [:model, "ReaderPaymentResponse"]}, with_response: false)
18
+ end
19
+
20
+ def create_go_checkout_with_response(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
21
+ payload = request_body(body, body_fields)
22
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
23
+ @client.request(method: "POST", path: "/v0/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/go-checkout",
24
+ query: {}, body: payload, options: options,
25
+ response_type: {200 => [:model, "ReaderPaymentResponse"]}, with_response: true)
26
+ end
27
+
28
+ # List all readers of the merchant.
29
+ # @return [Types::ListReadersResponse]
30
+ def list(merchant_code:, options: nil)
31
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers",
32
+ query: {}, options: options,
33
+ response_type: {200 => [:model, "ListReadersResponse"]}, with_response: false)
34
+ end
35
+
36
+ def list_with_response(merchant_code:, options: nil)
37
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers",
38
+ query: {}, options: options,
39
+ response_type: {200 => [:model, "ListReadersResponse"]}, with_response: true)
40
+ end
41
+
42
+ # Create a new Reader for the merchant account.
43
+ # @return [Types::Reader]
44
+ def create(merchant_code:, body: UNSET, options: nil, **body_fields)
45
+ payload = request_body(body, body_fields)
46
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
47
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers",
48
+ query: {}, body: payload, options: options,
49
+ response_type: {201 => [:model, "Reader"]}, with_response: false)
50
+ end
51
+
52
+ def create_with_response(merchant_code:, body: UNSET, options: nil, **body_fields)
53
+ payload = request_body(body, body_fields)
54
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
55
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers",
56
+ query: {}, body: payload, options: options,
57
+ response_type: {201 => [:model, "Reader"]}, with_response: true)
58
+ end
59
+
60
+ # Retrieve a Reader.
61
+ # @return [Types::Reader]
62
+ def get(merchant_code:, reader_id:, if_modified_since: UNSET, options: nil)
63
+ options = merge_header_options(options, {"If-Modified-Since" => if_modified_since})
64
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
65
+ query: {}, options: options,
66
+ response_type: {200 => [:model, "Reader"]}, with_response: false)
67
+ end
68
+
69
+ def get_with_response(merchant_code:, reader_id:, if_modified_since: UNSET, options: nil)
70
+ options = merge_header_options(options, {"If-Modified-Since" => if_modified_since})
71
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
72
+ query: {}, options: options,
73
+ response_type: {200 => [:model, "Reader"]}, with_response: true)
74
+ end
75
+
76
+ # Delete a reader.
77
+ # @return [nil]
78
+ def delete(merchant_code:, reader_id:, options: nil)
79
+ @client.request(method: "DELETE", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
80
+ query: {}, options: options,
81
+ response_type: {200 => :nil}, with_response: false)
82
+ end
83
+
84
+ def delete_with_response(merchant_code:, reader_id:, options: nil)
85
+ @client.request(method: "DELETE", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
86
+ query: {}, options: options,
87
+ response_type: {200 => :nil}, with_response: true)
88
+ end
89
+
90
+ # Updates a reader's name or metadata and returns the updated reader.
91
+ #
92
+ # Providing `metadata` replaces the entire metadata object; include all entries that should be retained. Omitted fields remain unchanged.
93
+ # @return [Types::Reader]
94
+ def update(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
95
+ payload = request_body(body, body_fields)
96
+ payload = {} if payload.equal?(UNSET)
97
+ @client.request(method: "PATCH", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
98
+ query: {}, body: payload, options: options,
99
+ response_type: {200 => [:model, "Reader"]}, with_response: false)
100
+ end
101
+
102
+ def update_with_response(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
103
+ payload = request_body(body, body_fields)
104
+ payload = {} if payload.equal?(UNSET)
105
+ @client.request(method: "PATCH", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}",
106
+ query: {}, body: payload, options: options,
107
+ response_type: {200 => [:model, "Reader"]}, with_response: true)
108
+ end
109
+
110
+ # Creates a Checkout for a Reader.
111
+ #
112
+ # This process is asynchronous and the actual transaction may take some time to be started on the device.
113
+ #
114
+ #
115
+ # There are some caveats when using this endpoint:
116
+ # * The target device must be online, otherwise checkout won't be accepted
117
+ # * After the checkout is accepted, the system has 60 seconds to start the payment on the target device. During this time, any other checkout for the same device will be rejected.
118
+ #
119
+ #
120
+ # **Note**: If the target device is a Solo, it must be in version 3.3.24.3 or higher.
121
+ #
122
+ #
123
+ # Optionally include an `affiliate` object to attach integrator metadata to the payment.
124
+ # Provide both `app_id` and `key` when including this object.
125
+ # @return [Types::CreateReaderCheckoutResponse]
126
+ def create_checkout(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
127
+ payload = request_body(body, body_fields)
128
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
129
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/checkout",
130
+ query: {}, body: payload, options: options,
131
+ response_type: {201 => [:model, "CreateReaderCheckoutResponse"]}, with_response: false)
132
+ end
133
+
134
+ def create_checkout_with_response(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
135
+ payload = request_body(body, body_fields)
136
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
137
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/checkout",
138
+ query: {}, body: payload, options: options,
139
+ response_type: {201 => [:model, "CreateReaderCheckoutResponse"]}, with_response: true)
140
+ end
141
+
142
+ # Provides the last known status for a Reader.
143
+ #
144
+ # This endpoint allows you to retrieve updates from the connected card reader, including the current screen being displayed during the payment process and the device status (battery level, connectivity, and update state).
145
+ #
146
+ # Supported States
147
+ #
148
+ # * `IDLE` – Reader ready for next transaction
149
+ # * `SELECTING_TIP` – Waiting for tip input
150
+ # * `WAITING_FOR_CARD` – Awaiting card insert/tap
151
+ # * `WAITING_FOR_PIN` – Waiting for PIN entry
152
+ # * `WAITING_FOR_SIGNATURE` – Waiting for customer signature
153
+ # * `UPDATING_FIRMWARE` – Firmware update in progress
154
+ #
155
+ # Device Status
156
+ #
157
+ # * `ONLINE` – Device connected and operational
158
+ # * `OFFLINE` – Device disconnected (last state persisted)
159
+ #
160
+ # **Note**: If the target device is a Solo, it must be in version 3.3.39.0 or higher.
161
+ # @return [Types::StatusResponse]
162
+ def get_status(merchant_code:, reader_id:, options: nil)
163
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/status",
164
+ query: {}, options: options,
165
+ response_type: {200 => [:model, "StatusResponse"]}, with_response: false)
166
+ end
167
+
168
+ def get_status_with_response(merchant_code:, reader_id:, options: nil)
169
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/status",
170
+ query: {}, options: options,
171
+ response_type: {200 => [:model, "StatusResponse"]}, with_response: true)
172
+ end
173
+
174
+ # Returns the menu lock settings for a Solo reader.
175
+ #
176
+ # For an online reader, returns the current settings. For an offline reader,
177
+ # returns the last saved settings, which may differ from its current configuration.
178
+ # Returns `404` if the reader is offline and no saved settings are available.
179
+ #
180
+ # The response may include the menu lock PIN.
181
+ # @return [Types::GetReaderSettingsResponse]
182
+ def get_reader_settings(merchant_code:, reader_id:, options: nil)
183
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/settings",
184
+ query: {}, options: options,
185
+ response_type: {200 => [:model, "GetReaderSettingsResponse"]}, with_response: false)
186
+ end
187
+
188
+ def get_reader_settings_with_response(merchant_code:, reader_id:, options: nil)
189
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/settings",
190
+ query: {}, options: options,
191
+ response_type: {200 => [:model, "GetReaderSettingsResponse"]}, with_response: true)
192
+ end
193
+
194
+ # Updates the menu lock settings for a Solo reader. The reader must be online.
195
+ # A successful response confirms that the reader applied the update.
196
+ #
197
+ # Include at least one of `menu_lock.enabled` or `menu_lock.passcode`.
198
+ # Omitted settings keep their current values. The response contains only the
199
+ # settings included in the request.
200
+ #
201
+ # When enabling menu lock for a reader without a PIN, include a four-digit PIN
202
+ # in `menu_lock.passcode` in the same request.
203
+ # @return [Types::UpdateReaderSettingsResponse]
204
+ def update_reader_settings(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
205
+ payload = request_body(body, body_fields)
206
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
207
+ @client.request(method: "PATCH", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/settings",
208
+ query: {}, body: payload, options: options,
209
+ response_type: {200 => [:model, "UpdateReaderSettingsResponse"]}, with_response: false)
210
+ end
211
+
212
+ def update_reader_settings_with_response(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
213
+ payload = request_body(body, body_fields)
214
+ raise ArgumentError, "request body is required" if payload.equal?(UNSET)
215
+ @client.request(method: "PATCH", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/settings",
216
+ query: {}, body: payload, options: options,
217
+ response_type: {200 => [:model, "UpdateReaderSettingsResponse"]}, with_response: true)
218
+ end
219
+
220
+ # Terminate a Reader Checkout stops the current transaction on the target device.
221
+ #
222
+ # This process is asynchronous and the actual termination may take some time to be performed on the device.
223
+ #
224
+ #
225
+ # There are some caveats when using this endpoint:
226
+ # * The target device must be online, otherwise terminate won't be accepted
227
+ # * The action will succeed only if the device is waiting for cardholder action: e.g: waiting for card, waiting for PIN, etc.
228
+ # * There is no confirmation of the termination.
229
+ #
230
+ # If a transaction is successfully terminated and `return_url` was provided on Checkout, the transaction status will be sent as `failed` to the provided URL.
231
+ #
232
+ #
233
+ # **Note**: If the target device is a Solo, it must be in version 3.3.28.0 or higher.
234
+ # @return [untyped]
235
+ def terminate_checkout(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
236
+ payload = request_body(body, body_fields)
237
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/terminate",
238
+ query: {}, body: payload, options: options,
239
+ response_type: {202 => :any}, with_response: false)
240
+ end
241
+
242
+ def terminate_checkout_with_response(merchant_code:, reader_id:, body: UNSET, options: nil, **body_fields)
243
+ payload = request_body(body, body_fields)
244
+ @client.request(method: "POST", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/terminate",
245
+ query: {}, body: payload, options: options,
246
+ response_type: {202 => :any}, with_response: true)
247
+ end
248
+
249
+ # Get a Checkout for a Reader.
250
+ # @return [Types::GetReaderCheckoutResponse]
251
+ def get_checkout(merchant_code:, reader_id:, checkout_id:, options: nil)
252
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/checkout/#{path_segment(checkout_id)}",
253
+ query: {}, options: options,
254
+ response_type: {200 => [:model, "GetReaderCheckoutResponse"]}, with_response: false)
255
+ end
256
+
257
+ def get_checkout_with_response(merchant_code:, reader_id:, checkout_id:, options: nil)
258
+ @client.request(method: "GET", path: "/v0.1/merchants/#{path_segment(merchant_code)}/readers/#{path_segment(reader_id)}/checkout/#{path_segment(checkout_id)}",
259
+ query: {}, options: options,
260
+ response_type: {200 => [:model, "GetReaderCheckoutResponse"]}, with_response: true)
261
+ end
262
+ end
263
+ end
264
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen. DO NOT EDIT.
4
+
5
+ module SumUp
6
+ module Resources
7
+ class Receipts < Resource
8
+ # Retrieves structured receipt data for a transaction belonging to the merchant specified by `mid`. The path accepts either the SumUp transaction ID or transaction code. Provide `tx_event_id` to include a specific transaction event, such as a refund, on the receipt.
9
+ # @return [Types::Receipt]
10
+ def get(transaction_id:, mid:, tx_event_id: UNSET, options: nil)
11
+ @client.request(method: "GET", path: "/v1.1/receipts/#{path_segment(transaction_id)}",
12
+ query: {"mid" => mid, "tx_event_id" => tx_event_id}, options: options,
13
+ response_type: {200 => [:model, "Receipt"]}, with_response: false)
14
+ end
15
+
16
+ def get_with_response(transaction_id:, mid:, tx_event_id: UNSET, options: nil)
17
+ @client.request(method: "GET", path: "/v1.1/receipts/#{path_segment(transaction_id)}",
18
+ query: {"mid" => mid, "tx_event_id" => tx_event_id}, options: options,
19
+ response_type: {200 => [:model, "Receipt"]}, with_response: true)
20
+ end
21
+ end
22
+ end
23
+ end