dpay 0.1.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.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +29 -0
  3. data/LICENSE +201 -0
  4. data/README.md +191 -0
  5. data/lib/dpay/bank/bank.rb +28 -0
  6. data/lib/dpay/bank/bank_service.rb +28 -0
  7. data/lib/dpay/blik/blik_alias.rb +27 -0
  8. data/lib/dpay/blik/blik_alias_registration.rb +21 -0
  9. data/lib/dpay/blik/blik_alias_type.rb +18 -0
  10. data/lib/dpay/blik/blik_app.rb +17 -0
  11. data/lib/dpay/blik/blik_recurring_registration.rb +74 -0
  12. data/lib/dpay/blik/blik_recurring_registration_info.rb +26 -0
  13. data/lib/dpay/blik/blik_recurring_status.rb +28 -0
  14. data/lib/dpay/blik/blik_service.rb +51 -0
  15. data/lib/dpay/card/apple_pay_request.rb +38 -0
  16. data/lib/dpay/card/card_data.rb +30 -0
  17. data/lib/dpay/card/card_encryptor.rb +27 -0
  18. data/lib/dpay/card/card_payment_request.rb +59 -0
  19. data/lib/dpay/card/card_payment_result.rb +58 -0
  20. data/lib/dpay/card/card_recurring_frequency.rb +23 -0
  21. data/lib/dpay/card/card_recurring_operation.rb +19 -0
  22. data/lib/dpay/card/card_recurring_registration.rb +69 -0
  23. data/lib/dpay/card/card_service.rb +47 -0
  24. data/lib/dpay/card/dcc_decision.rb +18 -0
  25. data/lib/dpay/card/dcc_markup.rb +18 -0
  26. data/lib/dpay/card/dcc_offer.rb +36 -0
  27. data/lib/dpay/card/google_pay_request.rb +35 -0
  28. data/lib/dpay/card/redirect_type.rb +20 -0
  29. data/lib/dpay/client.rb +26 -0
  30. data/lib/dpay/config.rb +39 -0
  31. data/lib/dpay/currency.rb +19 -0
  32. data/lib/dpay/errors.rb +77 -0
  33. data/lib/dpay/http/client.rb +11 -0
  34. data/lib/dpay/http/net_http_client.rb +52 -0
  35. data/lib/dpay/http/request.rb +17 -0
  36. data/lib/dpay/http/response.rb +29 -0
  37. data/lib/dpay/internal/api_requestor.rb +65 -0
  38. data/lib/dpay/internal/base_urls.rb +38 -0
  39. data/lib/dpay/internal/checksum_calculator.rb +26 -0
  40. data/lib/dpay/internal/coerce.rb +46 -0
  41. data/lib/dpay/internal/error_mapper.rb +90 -0
  42. data/lib/dpay/internal/php.rb +71 -0
  43. data/lib/dpay/ipn/ipn_event.rb +84 -0
  44. data/lib/dpay/ipn/ipn_type.rb +19 -0
  45. data/lib/dpay/ipn/ipn_verifier.rb +57 -0
  46. data/lib/dpay/money.rb +85 -0
  47. data/lib/dpay/payment/device_info.rb +42 -0
  48. data/lib/dpay/payment/invoice_details.rb +48 -0
  49. data/lib/dpay/payment/payer.rb +26 -0
  50. data/lib/dpay/payment/payment_service.rb +35 -0
  51. data/lib/dpay/payment/payout_fee_mode.rb +18 -0
  52. data/lib/dpay/payment/payout_instruction.rb +26 -0
  53. data/lib/dpay/payment/payout_position.rb +23 -0
  54. data/lib/dpay/payment/register_payment_request.rb +246 -0
  55. data/lib/dpay/payment/registered_payment.rb +42 -0
  56. data/lib/dpay/payment/return_urls.rb +20 -0
  57. data/lib/dpay/payment/transaction.rb +54 -0
  58. data/lib/dpay/payment/transaction_refund.rb +21 -0
  59. data/lib/dpay/payment/transaction_status.rb +21 -0
  60. data/lib/dpay/payment/transaction_type.rb +23 -0
  61. data/lib/dpay/payout/payout_details.rb +50 -0
  62. data/lib/dpay/payout/payout_receiver.rb +22 -0
  63. data/lib/dpay/payout/payout_service.rb +23 -0
  64. data/lib/dpay/refund/refund.rb +22 -0
  65. data/lib/dpay/refund/refund_availability.rb +23 -0
  66. data/lib/dpay/refund/refund_service.rb +46 -0
  67. data/lib/dpay/testing/mock_http_client.rb +51 -0
  68. data/lib/dpay/testing.rb +4 -0
  69. data/lib/dpay/version.rb +5 -0
  70. data/lib/dpay.rb +68 -0
  71. data/sig/dpay/bank/bank.rbs +17 -0
  72. data/sig/dpay/bank/bank_service.rbs +13 -0
  73. data/sig/dpay/blik/blik_alias.rbs +17 -0
  74. data/sig/dpay/blik/blik_alias_registration.rbs +6 -0
  75. data/sig/dpay/blik/blik_alias_type.rbs +11 -0
  76. data/sig/dpay/blik/blik_app.rbs +10 -0
  77. data/sig/dpay/blik/blik_recurring_registration.rbs +24 -0
  78. data/sig/dpay/blik/blik_recurring_registration_info.rbs +17 -0
  79. data/sig/dpay/blik/blik_recurring_status.rbs +17 -0
  80. data/sig/dpay/blik/blik_service.rbs +13 -0
  81. data/sig/dpay/card/apple_pay_request.rbs +13 -0
  82. data/sig/dpay/card/card_data.rbs +15 -0
  83. data/sig/dpay/card/card_encryptor.rbs +9 -0
  84. data/sig/dpay/card/card_payment_request.rbs +17 -0
  85. data/sig/dpay/card/card_payment_result.rbs +22 -0
  86. data/sig/dpay/card/card_recurring_frequency.rbs +16 -0
  87. data/sig/dpay/card/card_recurring_operation.rbs +12 -0
  88. data/sig/dpay/card/card_recurring_registration.rbs +22 -0
  89. data/sig/dpay/card/card_service.rbs +16 -0
  90. data/sig/dpay/card/dcc_decision.rbs +11 -0
  91. data/sig/dpay/card/dcc_markup.rbs +10 -0
  92. data/sig/dpay/card/dcc_offer.rbs +21 -0
  93. data/sig/dpay/card/google_pay_request.rbs +12 -0
  94. data/sig/dpay/card/redirect_type.rbs +13 -0
  95. data/sig/dpay/client.rbs +21 -0
  96. data/sig/dpay/config.rbs +25 -0
  97. data/sig/dpay/currency.rbs +11 -0
  98. data/sig/dpay/errors.rbs +86 -0
  99. data/sig/dpay/http/client.rbs +7 -0
  100. data/sig/dpay/http/net_http_client.rbs +15 -0
  101. data/sig/dpay/http/request.rbs +12 -0
  102. data/sig/dpay/http/response.rbs +15 -0
  103. data/sig/dpay/internal/api_requestor.rbs +23 -0
  104. data/sig/dpay/internal/base_urls.rbs +13 -0
  105. data/sig/dpay/internal/checksum_calculator.rbs +9 -0
  106. data/sig/dpay/internal/coerce.rbs +12 -0
  107. data/sig/dpay/internal/error_mapper.rbs +16 -0
  108. data/sig/dpay/internal/php.rbs +16 -0
  109. data/sig/dpay/ipn/ipn_event.rbs +28 -0
  110. data/sig/dpay/ipn/ipn_type.rbs +12 -0
  111. data/sig/dpay/ipn/ipn_verifier.rbs +11 -0
  112. data/sig/dpay/money.rbs +25 -0
  113. data/sig/dpay/payment/device_info.rbs +25 -0
  114. data/sig/dpay/payment/invoice_details.rbs +17 -0
  115. data/sig/dpay/payment/payer.rbs +14 -0
  116. data/sig/dpay/payment/payment_service.rbs +11 -0
  117. data/sig/dpay/payment/payout_fee_mode.rbs +11 -0
  118. data/sig/dpay/payment/payout_instruction.rbs +8 -0
  119. data/sig/dpay/payment/payout_position.rbs +10 -0
  120. data/sig/dpay/payment/register_payment_request.rbs +56 -0
  121. data/sig/dpay/payment/registered_payment.rbs +20 -0
  122. data/sig/dpay/payment/return_urls.rbs +11 -0
  123. data/sig/dpay/payment/transaction.rbs +25 -0
  124. data/sig/dpay/payment/transaction_refund.rbs +14 -0
  125. data/sig/dpay/payment/transaction_status.rbs +14 -0
  126. data/sig/dpay/payment/transaction_type.rbs +16 -0
  127. data/sig/dpay/payout/payout_details.rbs +24 -0
  128. data/sig/dpay/payout/payout_receiver.rbs +15 -0
  129. data/sig/dpay/payout/payout_service.rbs +6 -0
  130. data/sig/dpay/refund/refund.rbs +11 -0
  131. data/sig/dpay/refund/refund_availability.rbs +12 -0
  132. data/sig/dpay/refund/refund_service.rbs +14 -0
  133. data/sig/dpay/testing/mock_http_client.rbs +16 -0
  134. data/sig/dpay/testing.rbs +4 -0
  135. data/sig/dpay/version.rbs +3 -0
  136. data/sig/dpay.rbs +2 -0
  137. metadata +180 -0
@@ -0,0 +1,16 @@
1
+ module DPay
2
+ class CardService
3
+ def initialize: (Internal::ApiRequestor api) -> void
4
+ def public_key: () -> String
5
+ def pay_otp: (String transaction_id, CardPaymentRequest request) -> CardPaymentResult
6
+ def pre_auth: (String transaction_id, CardPaymentRequest request) -> CardPaymentResult
7
+ def capture: (String transaction_id, Money amount) -> CardPaymentResult
8
+ def cancel: (String transaction_id, ?Money? amount) -> CardPaymentResult
9
+ def google_pay: (String transaction_id, GooglePayRequest request) -> CardPaymentResult
10
+ def apple_pay: (String transaction_id, ApplePayRequest request) -> CardPaymentResult
11
+
12
+ private
13
+
14
+ def post: (String transaction_id, String suffix, Hash[String, untyped] body) -> CardPaymentResult
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ module DccDecision
3
+ ACCEPT: String
4
+ REJECT: String
5
+
6
+ ALL: Array[String]
7
+
8
+ def self.valid?: (untyped value) -> bool
9
+ def self.assert_valid: (untyped value) -> void
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module DPay
2
+ class DccMarkup
3
+ attr_reader rate: Float
4
+ attr_reader additional_info: String?
5
+
6
+ def self.from_api: (Hash[String, untyped] data) -> DccMarkup
7
+
8
+ def initialize: (Hash[String, untyped] data) -> void
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module DPay
2
+ class DccOffer
3
+ attr_reader currency_conversion_id: String
4
+ attr_reader original_amount: Money
5
+ attr_reader converted_amount: Money
6
+ attr_reader exchange_rate: Float
7
+ attr_reader valid_until: String
8
+ attr_reader declaration_text: String
9
+ attr_reader markup: Array[DccMarkup]
10
+ attr_reader raw: Hash[String, untyped]
11
+
12
+ def self.from_api: (Hash[String, untyped] data) -> DccOffer
13
+
14
+ def initialize: (Hash[String, untyped] data) -> void
15
+ def european_economic_area?: () -> bool
16
+
17
+ private
18
+
19
+ def currency: (untyped value) -> String
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ module DPay
2
+ class GooglePayRequest
3
+ @leading: Hash[String, untyped]
4
+
5
+ def self.create: (String token, DeviceInfo device_info) -> GooglePayRequest
6
+
7
+ def initialize: (String token, DeviceInfo device_info) -> void
8
+ def with_email: (String email) -> self
9
+ def with_channel_id: (Integer channel_id) -> self
10
+ def to_body: () -> Hash[String, untyped]
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module DPay
2
+ module RedirectType
3
+ SUCCESS: String
4
+ FORM: String
5
+ URL: String
6
+ DCC_OFFER: String
7
+
8
+ ALL: Array[String]
9
+
10
+ def self.valid?: (untyped value) -> bool
11
+ def self.assert_valid: (untyped value) -> void
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module DPay
2
+ class Client
3
+ VERSION: String
4
+
5
+ attr_reader config: Config
6
+ attr_reader payments: PaymentService
7
+ attr_reader refunds: RefundService
8
+ attr_reader banks: BankService
9
+ attr_reader blik: BlikService
10
+ attr_reader cards: CardService
11
+ attr_reader payouts: PayoutService
12
+
13
+ def initialize: (
14
+ service: String,
15
+ secret_hash: String,
16
+ ?timeout: Integer,
17
+ ?http_client: untyped?,
18
+ ?base_urls: Hash[untyped, String]?
19
+ ) -> void
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ module DPay
2
+ class Config
3
+ DEFAULT_TIMEOUT: Integer
4
+
5
+ attr_reader service: String
6
+ attr_reader secret_hash: String
7
+ attr_reader timeout: Integer
8
+ attr_reader http_client: untyped
9
+ attr_reader base_urls: Internal::BaseUrls
10
+
11
+ def initialize: (
12
+ service: String,
13
+ secret_hash: String,
14
+ ?timeout: Integer,
15
+ ?http_client: untyped?,
16
+ ?base_urls: Hash[untyped, String]?
17
+ ) -> void
18
+
19
+ private
20
+
21
+ def non_empty_string: (untyped value, String name) -> String
22
+ def positive_integer: (untyped value) -> Integer
23
+ def transport: (untyped value) -> untyped
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ module Currency
3
+ PLN: String
4
+ EUR: String
5
+ CZK: String
6
+ CODE: Regexp
7
+
8
+ def self.valid?: (untyped code) -> bool
9
+ def self.assert_valid: (untyped code) -> void
10
+ end
11
+ end
@@ -0,0 +1,86 @@
1
+ module DPay
2
+ module Error
3
+ end
4
+
5
+ class InvalidArgumentError < ArgumentError
6
+ include Error
7
+ end
8
+
9
+ class TransportError < StandardError
10
+ include Error
11
+ end
12
+
13
+ class SignatureVerificationError < StandardError
14
+ include Error
15
+ end
16
+
17
+ class CardEncryptionError < StandardError
18
+ include Error
19
+ end
20
+
21
+ class ApiError < StandardError
22
+ include Error
23
+
24
+ attr_reader http_status: Integer
25
+ attr_reader error_code: String?
26
+ attr_reader field_errors: Hash[String, Array[String]]
27
+ attr_reader raw_body: String
28
+
29
+ def initialize: (
30
+ String message,
31
+ Integer http_status,
32
+ ?String? error_code,
33
+ ?Hash[String, Array[String]] field_errors,
34
+ ?String raw_body
35
+ ) -> void
36
+ end
37
+
38
+ class AuthenticationError < ApiError
39
+ end
40
+
41
+ class InvalidRequestError < ApiError
42
+ end
43
+
44
+ class AccessDeniedError < ApiError
45
+ end
46
+
47
+ class NotFoundError < ApiError
48
+ end
49
+
50
+ class ApiServerError < ApiError
51
+ end
52
+
53
+ class RateLimitError < ApiError
54
+ attr_reader retry_after: Integer?
55
+ attr_reader limit: Integer?
56
+ attr_reader remaining: Integer?
57
+
58
+ def initialize: (
59
+ String message,
60
+ Integer http_status,
61
+ ?Integer? retry_after,
62
+ ?Integer? limit,
63
+ ?Integer? remaining,
64
+ ?String raw_body
65
+ ) -> void
66
+ end
67
+
68
+ class PaymentRejectedError < ApiError
69
+ attr_reader transaction_id: String?
70
+
71
+ def self.from_api: (Hash[String, untyped] data) -> PaymentRejectedError
72
+
73
+ def initialize: (
74
+ String message,
75
+ Integer http_status,
76
+ ?String? error_code,
77
+ ?Hash[String, Array[String]] field_errors,
78
+ ?String raw_body,
79
+ ?String? transaction_id
80
+ ) -> void
81
+ end
82
+
83
+ class CardPaymentError < ApiError
84
+ def self.from_api: (Hash[String, untyped] data) -> CardPaymentError
85
+ end
86
+ end
@@ -0,0 +1,7 @@
1
+ module DPay
2
+ module HTTP
3
+ class Client
4
+ def request: (Request api_request) -> Response
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ module DPay
2
+ module HTTP
3
+ class NetHTTPClient < Client
4
+ CONNECT_TIMEOUT: Integer
5
+ NETWORK_ERRORS: Array[Class]
6
+
7
+ def initialize: (?Integer timeout) -> void
8
+ def request: (Request api_request) -> Response
9
+
10
+ private
11
+
12
+ def build_request: (URI::HTTP uri, Request api_request) -> untyped
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module DPay
2
+ module HTTP
3
+ class Request
4
+ attr_reader method: String
5
+ attr_reader url: String
6
+ attr_reader headers: Hash[String, String]
7
+ attr_reader body: String?
8
+
9
+ def initialize: (String method, String url, ?Hash[String, String] headers, ?String? body) -> void
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module DPay
2
+ module HTTP
3
+ class Response
4
+ @headers: Hash[String, String]
5
+
6
+ attr_reader status: Integer
7
+ attr_reader headers: Hash[String, String]
8
+ attr_reader body: String
9
+
10
+ def initialize: (Integer status, Hash[String, String] headers, String body) -> void
11
+ def header: (String name) -> String?
12
+ def decode_json: () -> untyped
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module DPay
2
+ module Internal
3
+ class ApiRequestor
4
+ USER_AGENT: String
5
+
6
+ attr_reader config: Config
7
+ attr_reader checksum: ChecksumCalculator
8
+
9
+ def initialize: (Config config, untyped http_client) -> void
10
+ def service: () -> String
11
+ def post_json: (Symbol host, String path, Hash[String, untyped] body) -> Hash[String, untyped]
12
+ def get_json: (Symbol host, String path) -> Hash[String, untyped]
13
+ def get_text: (Symbol host, String path) -> String
14
+ def send_request: (String method, Symbol host, String path, Hash[String, untyped]? body) -> HTTP::Response
15
+ def send_raw: (String method, Symbol host, String path, Hash[String, untyped]? body) -> HTTP::Response
16
+ def map_error: (HTTP::Response response) -> ApiError
17
+
18
+ private
19
+
20
+ def decode: (HTTP::Response response) -> Hash[String, untyped]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module DPay
2
+ module Internal
3
+ class BaseUrls
4
+ API_PAYMENTS: Symbol
5
+ PANEL: Symbol
6
+ GATEWAY: Symbol
7
+ DEFAULTS: Hash[Symbol, String]
8
+
9
+ def initialize: (?Hash[untyped, String] overrides) -> void
10
+ def resolve: (Symbol host) -> String
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module DPay
2
+ module Internal
3
+ class ChecksumCalculator
4
+ def initialize: (String secret_hash) -> void
5
+ def secret_second: (String service, Array[untyped] fields) -> String
6
+ def ordered_body: (Array[untyped] values) -> String
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module DPay
2
+ module Internal
3
+ module Coerce
4
+ def self?.string: (untyped value) -> String?
5
+ def self?.money: (untyped value, ?String currency) -> Money
6
+ def self?.boolean: (untyped value) -> bool
7
+ def self?.integer: (Integer | Float | String | bool | nil value) -> Integer
8
+ def self?.optional_integer: (Integer | Float | String | bool | nil value) -> Integer?
9
+ def self?.list: (untyped value) -> Array[Hash[String, untyped]]
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ module DPay
2
+ module Internal
3
+ module ErrorMapper
4
+ DEFAULT_MESSAGE: String
5
+
6
+ def self?.map: (HTTP::Response response) -> ApiError
7
+ def self?.error_class: (Integer status) -> singleton(ApiError)
8
+ def self?.extract_message: (Hash[String, untyped] data) -> String
9
+ def self?.rate_limit: (HTTP::Response response, String message) -> RateLimitError
10
+ def self?.normalize_field_errors: (untyped errors) -> Hash[String, Array[String]]
11
+ def self?.normalize_messages: (untyped messages) -> Array[String]?
12
+ def self?.scalar?: (untyped value) -> bool
13
+ def self?.int_header: (HTTP::Response response, String name) -> Integer?
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module DPay
2
+ module Internal
3
+ module PHP
4
+ SAFE_INTEGRAL_FLOAT: Integer
5
+ NON_UNRESERVED: Regexp
6
+
7
+ def self?.strval: (untyped value) -> String
8
+ def self?.round: (Float value) -> Integer
9
+ def self?.json_encode: (untyped data, ?escape_slashes: bool) -> String
10
+ def self?.raw_url_encode: (untyped value) -> String
11
+ def self?.float_to_string: (Float value) -> String
12
+ def self?.normalize_floats: (untyped value) -> untyped
13
+ def self?.integral_float?: (Float value) -> bool
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ module DPay
2
+ class IpnEvent
3
+ ACK: String
4
+
5
+ attr_reader raw: Hash[String, untyped]
6
+
7
+ def self.from_verified_payload: (Hash[String, untyped] payload) -> IpnEvent
8
+
9
+ def initialize: (Hash[String, untyped] payload) -> void
10
+ def id: () -> String
11
+ def amount: () -> String
12
+ def type: () -> String
13
+ def signature: () -> String
14
+ def email: () -> String?
15
+ def custom: () -> String?
16
+ def capture_payment_id: () -> String?
17
+ def attempt: () -> Integer
18
+ def version: () -> Integer
19
+ def transfer?: () -> bool
20
+ def capture?: () -> bool
21
+ def dcb?: () -> bool
22
+
23
+ private
24
+
25
+ def scalar: (String key) -> String?
26
+ def integer: (String key) -> Integer
27
+ end
28
+ end
@@ -0,0 +1,12 @@
1
+ module DPay
2
+ module IpnType
3
+ TRANSFER: String
4
+ CAPTURE: String
5
+ DCB: String
6
+
7
+ ALL: Array[String]
8
+
9
+ def self.valid?: (untyped value) -> bool
10
+ def self.assert_valid: (untyped value) -> void
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ module IpnVerifier
3
+ REQUIRED_FIELDS: Array[String]
4
+ INVALID_PAYLOAD: String
5
+
6
+ def self?.construct_event: (untyped raw_body, String secret_hash) -> IpnEvent
7
+ def self?.parse: (untyped raw_body) -> Hash[String, untyped]
8
+ def self?.expected_signature: (Hash[String, untyped] payload, String secret_hash) -> String
9
+ def self?.secure_compare: (String expected, String actual) -> bool
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ module DPay
2
+ class Money
3
+ DECIMAL: Regexp
4
+
5
+ attr_reader minor: Integer
6
+ attr_reader currency: String
7
+
8
+ def self.pln: (Integer minor) -> Money
9
+ def self.of: (Integer minor, String currency) -> Money
10
+ def self.from_decimal: (String decimal, String currency) -> Money
11
+ def self.from_api_number: (untyped value, String currency) -> Money
12
+ def self.try_from_api_number: (untyped value, String currency) -> Money?
13
+
14
+ def initialize: (Integer minor, String currency) -> void
15
+ def to_decimal: () -> String
16
+ def negative?: () -> bool
17
+ def ==: (untyped other) -> bool
18
+ def hash: () -> Integer
19
+ def to_s: () -> String
20
+
21
+ private
22
+
23
+ def self.parse_decimal: (untyped decimal) -> Integer?
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module DPay
2
+ class DeviceInfo
3
+ def self.create: (
4
+ browser_accept_header: String,
5
+ browser_language: String,
6
+ browser_color_depth: Integer,
7
+ browser_screen_height: Integer,
8
+ browser_screen_width: Integer,
9
+ browser_tz: Integer,
10
+ browser_user_agent: String,
11
+ system_family: String,
12
+ geo_localization: String,
13
+ device_id: String,
14
+ application_name: String
15
+ ) -> DeviceInfo
16
+
17
+ def initialize: (Hash[String, untyped] fields) -> void
18
+ def with_browser_java_enabled: (bool enabled) -> self
19
+ def to_h: () -> Hash[String, untyped]
20
+
21
+ private
22
+
23
+ def self.bounded: (untyped value, String label) -> String
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ module DPay
2
+ class InvoiceDetails
3
+ DATE: Regexp
4
+
5
+ @data: Hash[String, untyped]
6
+
7
+ def self.create: () -> InvoiceDetails
8
+
9
+ def initialize: () -> void
10
+ def with_payer_nip: (String payer_nip) -> self
11
+ def with_payer_name: (String payer_name) -> self
12
+ def with_invoice_number: (String invoice_number) -> self
13
+ def with_payment_due_date: (String payment_due_date) -> self
14
+ def with_vat_amount: (Money vat_amount) -> self
15
+ def to_h: () -> Hash[String, untyped]
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module DPay
2
+ class Payer
3
+ EMAIL: Regexp
4
+
5
+ attr_reader email: String?
6
+ attr_reader first_name: String?
7
+ attr_reader last_name: String?
8
+
9
+ def self.create: () -> Payer
10
+
11
+ def with_email: (String email) -> self
12
+ def with_name: (String first_name, String last_name) -> self
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ class PaymentService
3
+ def initialize: (Internal::ApiRequestor api) -> void
4
+ def register: (RegisterPaymentRequest request) -> RegisteredPayment
5
+ def details: (String transaction_id) -> Transaction
6
+
7
+ private
8
+
9
+ def rejected?: (Hash[String, untyped] data) -> bool
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ module PayoutFeeMode
3
+ NET: String
4
+ GROSS: String
5
+
6
+ ALL: Array[String]
7
+
8
+ def self.valid?: (untyped value) -> bool
9
+ def self.assert_valid: (untyped value) -> void
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module DPay
2
+ class PayoutInstruction
3
+ def self.create: (Array[PayoutPosition] positions, ?String fee_mode) -> PayoutInstruction
4
+
5
+ def initialize: (Array[PayoutPosition] positions, ?String fee_mode) -> void
6
+ def to_h: () -> Hash[String, untyped]
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module DPay
2
+ class PayoutPosition
3
+ attr_reader iban: String
4
+ attr_reader title: String
5
+ attr_reader amount: Money
6
+
7
+ def initialize: (String iban, String title, Money amount) -> void
8
+ def to_h: () -> Hash[String, untyped]
9
+ end
10
+ end
@@ -0,0 +1,56 @@
1
+ module DPay
2
+ class RegisterPaymentRequest
3
+ BLIK_CODE: Regexp
4
+ PARTNER_PLATFORM: Regexp
5
+ HTTP_URL: Regexp
6
+ TOGGLES: Hash[String, Symbol]
7
+
8
+ @optional: Hash[String, untyped]
9
+
10
+ attr_reader amount: Money
11
+
12
+ def self.create: (Money amount, String transaction_type, ReturnUrls urls) -> RegisterPaymentRequest
13
+
14
+ def initialize: (Money amount, String transaction_type, ReturnUrls urls) -> void
15
+
16
+ def with_description: (String description) -> self
17
+ def with_custom: (untyped custom) -> self
18
+ def with_payer: (Payer payer) -> self
19
+ def with_accept_tos: (bool accept_tos) -> self
20
+ def with_channel: (String channel) -> self
21
+ def with_credit_card: (bool enabled) -> self
22
+ def with_paysafecard: (bool enabled) -> self
23
+ def with_blik: (bool enabled) -> self
24
+ def with_installment: (bool enabled) -> self
25
+ def with_paypal: (bool enabled) -> self
26
+ def with_no_banks: (bool disabled) -> self
27
+ def with_phone_number: (String phone_number, String currency_code) -> self
28
+ def with_currency_code: (String currency_code) -> self
29
+ def with_partner_platform: (String partner_platform) -> self
30
+ def with_blik_code: (String blik_code, String user_agent, String user_ip) -> self
31
+ def with_blik_alias: (String alias_value, String user_agent, String user_ip) -> self
32
+ def with_register_blik_alias: (BlikAliasRegistration registration) -> self
33
+ def with_register_blik_recurring_alias: (BlikRecurringRegistration registration) -> self
34
+ def with_alias_ipn_url: (String url) -> self
35
+ def with_no_delay: (bool no_delay) -> self
36
+ def with_card_recurring: (CardRecurringRegistration registration) -> self
37
+ def with_card_recurring_alias: (String alias_value) -> self
38
+ def with_authorize_only: (bool authorize_only) -> self
39
+ def with_card_recurring_operation: (String operation) -> self
40
+ def with_payout: (PayoutInstruction payout) -> self
41
+ def with_billing_address: (Hash[String, untyped] billing_address) -> self
42
+ def with_shipping_address: (Hash[String, untyped] shipping_address) -> self
43
+ def with_device_info: (DeviceInfo device_info) -> self
44
+ def with_products: (Array[Hash[String, untyped]] products) -> self
45
+ def with_efaktura: (?InvoiceDetails? invoice) -> self
46
+
47
+ def to_body: (String service) -> Hash[String, untyped]
48
+
49
+ private
50
+
51
+ def set: (String key, untyped value) -> self
52
+ def append: (Hash[String, untyped] body, String key) -> void
53
+ def append_payer: (Hash[String, untyped] body) -> void
54
+ def append_toggles: (Hash[String, untyped] body) -> void
55
+ end
56
+ end
@@ -0,0 +1,20 @@
1
+ module DPay
2
+ class RegisteredPayment
3
+ REDIRECT: Regexp
4
+ PAID: String
5
+ INTERNAL_PROCESSING: String
6
+
7
+ attr_reader transaction_id: String
8
+ attr_reader message: String
9
+ attr_reader ipksef: String?
10
+ attr_reader raw: Hash[String, untyped]
11
+
12
+ def self.from_api: (Hash[String, untyped] data) -> RegisteredPayment
13
+
14
+ def initialize: (Hash[String, untyped] data) -> void
15
+ def redirect_url: () -> String?
16
+ def paid?: () -> bool
17
+ def internal_processing?: () -> bool
18
+ def card_recurring_alias: () -> String?
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ module DPay
2
+ class ReturnUrls
3
+ HTTP_URL: Regexp
4
+
5
+ attr_reader success: String
6
+ attr_reader fail: String
7
+ attr_reader ipn: String
8
+
9
+ def initialize: (String success, String fail, String ipn) -> void
10
+ end
11
+ end