dpay 0.1.0 → 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 +48 -0
- data/README.md +100 -4
- data/lib/dpay/blik/blik_alias_type.rb +2 -2
- data/lib/dpay/blik/blik_service.rb +0 -9
- data/lib/dpay/card/card_service.rb +21 -5
- data/lib/dpay/client.rb +3 -1
- data/lib/dpay/errors.rb +13 -6
- data/lib/dpay/internal/checksum_calculator.rb +27 -2
- data/lib/dpay/internal/error_mapper.rb +11 -2
- data/lib/dpay/internal/php.rb +6 -0
- data/lib/dpay/ipn/ipn_event.rb +2 -0
- data/lib/dpay/ipn/ipn_type.rb +1 -0
- data/lib/dpay/payment/payment_service.rb +4 -4
- data/lib/dpay/payment/register_payment_request.rb +92 -13
- data/lib/dpay/payment/registered_payment.rb +19 -0
- data/lib/dpay/payment/return_urls.rb +3 -1
- data/lib/dpay/payment/transaction_type.rb +1 -3
- data/lib/dpay/recurring/recurring_registration.rb +162 -0
- data/lib/dpay/recurring/recurring_registration_info.rb +45 -0
- data/lib/dpay/recurring/recurring_retry_result.rb +43 -0
- data/lib/dpay/recurring/recurring_service.rb +59 -0
- data/lib/dpay/recurring/recurring_status.rb +42 -0
- data/lib/dpay/refund/refund_service.rb +10 -4
- data/lib/dpay/version.rb +1 -1
- data/lib/dpay/webhook/event_page.rb +25 -0
- data/lib/dpay/webhook/event_service.rb +76 -0
- data/lib/dpay/webhook/webhook_event.rb +42 -0
- data/lib/dpay/webhook/webhook_event_type.rb +43 -0
- data/lib/dpay/webhook/webhook_target.rb +45 -0
- data/lib/dpay/webhook/webhook_verifier.rb +110 -0
- data/lib/dpay.rb +11 -3
- data/sig/dpay/blik/blik_alias_type.rbs +0 -1
- data/sig/dpay/blik/blik_service.rbs +0 -1
- data/sig/dpay/card/card_service.rbs +1 -1
- data/sig/dpay/client.rbs +2 -0
- data/sig/dpay/errors.rbs +6 -2
- data/sig/dpay/internal/checksum_calculator.rbs +8 -1
- data/sig/dpay/internal/error_mapper.rbs +1 -0
- data/sig/dpay/internal/php.rbs +2 -0
- data/sig/dpay/ipn/ipn_event.rbs +2 -0
- data/sig/dpay/ipn/ipn_type.rbs +1 -0
- data/sig/dpay/payment/register_payment_request.rbs +13 -1
- data/sig/dpay/payment/registered_payment.rbs +6 -0
- data/sig/dpay/payment/return_urls.rbs +2 -2
- data/sig/dpay/payment/transaction_type.rbs +0 -2
- data/sig/dpay/recurring/recurring_registration.rbs +45 -0
- data/sig/dpay/{blik/blik_recurring_registration_info.rbs → recurring/recurring_registration_info.rbs} +13 -3
- data/sig/dpay/recurring/recurring_retry_result.rbs +24 -0
- data/sig/dpay/recurring/recurring_service.rbs +15 -0
- data/sig/dpay/recurring/recurring_status.rbs +27 -0
- data/sig/dpay/refund/refund_service.rbs +2 -2
- data/sig/dpay/webhook/event_page.rbs +14 -0
- data/sig/dpay/webhook/event_service.rbs +21 -0
- data/sig/dpay/webhook/webhook_event.rbs +24 -0
- data/sig/dpay/webhook/webhook_event_type.rbs +23 -0
- data/sig/dpay/webhook/webhook_target.rbs +15 -0
- data/sig/dpay/webhook/webhook_verifier.rbs +37 -0
- metadata +26 -10
- data/lib/dpay/blik/blik_recurring_registration.rb +0 -74
- data/lib/dpay/blik/blik_recurring_registration_info.rb +0 -26
- data/lib/dpay/blik/blik_recurring_status.rb +0 -28
- data/sig/dpay/blik/blik_recurring_registration.rbs +0 -24
- data/sig/dpay/blik/blik_recurring_status.rbs +0 -17
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dpay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dpay
|
|
@@ -9,8 +9,8 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
|
-
description: 'Ruby client for the dpay.pl payments API: payments,
|
|
13
|
-
BLIK, cards and
|
|
12
|
+
description: 'Ruby client for the dpay.pl payments API: payments, recurring payments,
|
|
13
|
+
refunds, banks, BLIK, cards, payouts and webhooks.'
|
|
14
14
|
email:
|
|
15
15
|
- info@dpay.pl
|
|
16
16
|
executables: []
|
|
@@ -27,9 +27,6 @@ files:
|
|
|
27
27
|
- lib/dpay/blik/blik_alias_registration.rb
|
|
28
28
|
- lib/dpay/blik/blik_alias_type.rb
|
|
29
29
|
- lib/dpay/blik/blik_app.rb
|
|
30
|
-
- lib/dpay/blik/blik_recurring_registration.rb
|
|
31
|
-
- lib/dpay/blik/blik_recurring_registration_info.rb
|
|
32
|
-
- lib/dpay/blik/blik_recurring_status.rb
|
|
33
30
|
- lib/dpay/blik/blik_service.rb
|
|
34
31
|
- lib/dpay/card/apple_pay_request.rb
|
|
35
32
|
- lib/dpay/card/card_data.rb
|
|
@@ -80,12 +77,23 @@ files:
|
|
|
80
77
|
- lib/dpay/payout/payout_details.rb
|
|
81
78
|
- lib/dpay/payout/payout_receiver.rb
|
|
82
79
|
- lib/dpay/payout/payout_service.rb
|
|
80
|
+
- lib/dpay/recurring/recurring_registration.rb
|
|
81
|
+
- lib/dpay/recurring/recurring_registration_info.rb
|
|
82
|
+
- lib/dpay/recurring/recurring_retry_result.rb
|
|
83
|
+
- lib/dpay/recurring/recurring_service.rb
|
|
84
|
+
- lib/dpay/recurring/recurring_status.rb
|
|
83
85
|
- lib/dpay/refund/refund.rb
|
|
84
86
|
- lib/dpay/refund/refund_availability.rb
|
|
85
87
|
- lib/dpay/refund/refund_service.rb
|
|
86
88
|
- lib/dpay/testing.rb
|
|
87
89
|
- lib/dpay/testing/mock_http_client.rb
|
|
88
90
|
- lib/dpay/version.rb
|
|
91
|
+
- lib/dpay/webhook/event_page.rb
|
|
92
|
+
- lib/dpay/webhook/event_service.rb
|
|
93
|
+
- lib/dpay/webhook/webhook_event.rb
|
|
94
|
+
- lib/dpay/webhook/webhook_event_type.rb
|
|
95
|
+
- lib/dpay/webhook/webhook_target.rb
|
|
96
|
+
- lib/dpay/webhook/webhook_verifier.rb
|
|
89
97
|
- sig/dpay.rbs
|
|
90
98
|
- sig/dpay/bank/bank.rbs
|
|
91
99
|
- sig/dpay/bank/bank_service.rbs
|
|
@@ -93,9 +101,6 @@ files:
|
|
|
93
101
|
- sig/dpay/blik/blik_alias_registration.rbs
|
|
94
102
|
- sig/dpay/blik/blik_alias_type.rbs
|
|
95
103
|
- sig/dpay/blik/blik_app.rbs
|
|
96
|
-
- sig/dpay/blik/blik_recurring_registration.rbs
|
|
97
|
-
- sig/dpay/blik/blik_recurring_registration_info.rbs
|
|
98
|
-
- sig/dpay/blik/blik_recurring_status.rbs
|
|
99
104
|
- sig/dpay/blik/blik_service.rbs
|
|
100
105
|
- sig/dpay/card/apple_pay_request.rbs
|
|
101
106
|
- sig/dpay/card/card_data.rbs
|
|
@@ -146,12 +151,23 @@ files:
|
|
|
146
151
|
- sig/dpay/payout/payout_details.rbs
|
|
147
152
|
- sig/dpay/payout/payout_receiver.rbs
|
|
148
153
|
- sig/dpay/payout/payout_service.rbs
|
|
154
|
+
- sig/dpay/recurring/recurring_registration.rbs
|
|
155
|
+
- sig/dpay/recurring/recurring_registration_info.rbs
|
|
156
|
+
- sig/dpay/recurring/recurring_retry_result.rbs
|
|
157
|
+
- sig/dpay/recurring/recurring_service.rbs
|
|
158
|
+
- sig/dpay/recurring/recurring_status.rbs
|
|
149
159
|
- sig/dpay/refund/refund.rbs
|
|
150
160
|
- sig/dpay/refund/refund_availability.rbs
|
|
151
161
|
- sig/dpay/refund/refund_service.rbs
|
|
152
162
|
- sig/dpay/testing.rbs
|
|
153
163
|
- sig/dpay/testing/mock_http_client.rbs
|
|
154
164
|
- sig/dpay/version.rbs
|
|
165
|
+
- sig/dpay/webhook/event_page.rbs
|
|
166
|
+
- sig/dpay/webhook/event_service.rbs
|
|
167
|
+
- sig/dpay/webhook/webhook_event.rbs
|
|
168
|
+
- sig/dpay/webhook/webhook_event_type.rbs
|
|
169
|
+
- sig/dpay/webhook/webhook_target.rbs
|
|
170
|
+
- sig/dpay/webhook/webhook_verifier.rbs
|
|
155
171
|
homepage: https://dpay.pl
|
|
156
172
|
licenses:
|
|
157
173
|
- Apache-2.0
|
|
@@ -174,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
174
190
|
- !ruby/object:Gem::Version
|
|
175
191
|
version: '0'
|
|
176
192
|
requirements: []
|
|
177
|
-
rubygems_version: 4.0.
|
|
193
|
+
rubygems_version: 4.0.16
|
|
178
194
|
specification_version: 4
|
|
179
195
|
summary: Official dpay.pl Ruby SDK
|
|
180
196
|
test_files: []
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module DPay
|
|
4
|
-
class BlikRecurringRegistration
|
|
5
|
-
MODELS = %w[A M O].freeze
|
|
6
|
-
FREQUENCY = /\A[1-9][0-9]{0,2}[DWMQY]\z/
|
|
7
|
-
DATE = /\A\d{4}-\d{2}-\d{2}\z/
|
|
8
|
-
|
|
9
|
-
def self.create(label, model, frequency)
|
|
10
|
-
new(label, model, frequency)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def initialize(label, model, frequency)
|
|
14
|
-
unless label.is_a?(String) && !label.empty? && label.length <= 50
|
|
15
|
-
raise InvalidArgumentError, "Alias label must be 1-50 characters"
|
|
16
|
-
end
|
|
17
|
-
raise InvalidArgumentError, %(Invalid recurring model "#{model}") unless MODELS.include?(model)
|
|
18
|
-
raise InvalidArgumentError, %(Invalid recurring frequency "#{frequency}") unless FREQUENCY.match?(frequency.to_s)
|
|
19
|
-
|
|
20
|
-
@label = label
|
|
21
|
-
@model = model
|
|
22
|
-
@frequency = frequency
|
|
23
|
-
@optional = {}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def with_value(value)
|
|
27
|
-
@optional["value"] = value.to_decimal
|
|
28
|
-
self
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def with_limit_amt(limit_amt)
|
|
32
|
-
@optional["limit_amt"] = limit_amt
|
|
33
|
-
self
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def with_tot_limit_amt(tot_limit_amt)
|
|
37
|
-
@optional["tot_limit_amt"] = tot_limit_amt
|
|
38
|
-
self
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def with_limit_amt_fixed(fixed)
|
|
42
|
-
@optional["is_limit_amt_fixed"] = fixed
|
|
43
|
-
self
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def with_expiration_date(expiration_date)
|
|
47
|
-
@optional["expiration_date"] = assert_date(expiration_date)
|
|
48
|
-
self
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def with_init_date(init_date)
|
|
52
|
-
@optional["init_date"] = assert_date(init_date)
|
|
53
|
-
self
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def to_h
|
|
57
|
-
base = { "label" => @label, "type" => BlikAliasType::PAYID, "model" => @model, "frequency" => @frequency }
|
|
58
|
-
|
|
59
|
-
%w[value limit_amt tot_limit_amt is_limit_amt_fixed expiration_date init_date].each do |key|
|
|
60
|
-
base[key] = @optional[key] if @optional.key?(key)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
base
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
private
|
|
67
|
-
|
|
68
|
-
def assert_date(date)
|
|
69
|
-
raise InvalidArgumentError, %(Date "#{date}" must be in YYYY-MM-DD format) unless DATE.match?(date.to_s)
|
|
70
|
-
|
|
71
|
-
date
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module DPay
|
|
4
|
-
class BlikRecurringRegistrationInfo
|
|
5
|
-
attr_reader :model, :frequency, :limit_amt, :tot_limit_amt, :limit_amt_fixed, :init_date, :label,
|
|
6
|
-
:registered_at, :raw
|
|
7
|
-
|
|
8
|
-
def self.from_api(data)
|
|
9
|
-
new(data)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def initialize(data)
|
|
13
|
-
@raw = data
|
|
14
|
-
@model = data["model"].is_a?(String) ? data["model"] : nil
|
|
15
|
-
@frequency = data["frequency"].is_a?(String) ? data["frequency"] : nil
|
|
16
|
-
@limit_amt = data["limit_amt"].is_a?(Integer) ? data["limit_amt"] : nil
|
|
17
|
-
@tot_limit_amt = data["tot_limit_amt"].is_a?(Integer) ? data["tot_limit_amt"] : nil
|
|
18
|
-
fixed = data["is_limit_amt_fixed"]
|
|
19
|
-
@limit_amt_fixed = fixed.is_a?(TrueClass) || fixed.is_a?(FalseClass) ? fixed : nil
|
|
20
|
-
@init_date = data["init_date"].is_a?(String) ? data["init_date"] : nil
|
|
21
|
-
@label = data["label"].is_a?(String) ? data["label"] : nil
|
|
22
|
-
@registered_at = data["registered_at"].is_a?(String) ? data["registered_at"] : nil
|
|
23
|
-
freeze
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module DPay
|
|
4
|
-
class BlikRecurringStatus
|
|
5
|
-
ACTIVE = "ACTIVE"
|
|
6
|
-
|
|
7
|
-
attr_reader :alias_value, :alias_type, :status, :expiration_date, :registration, :raw
|
|
8
|
-
|
|
9
|
-
def self.from_api(data)
|
|
10
|
-
new(data)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def initialize(data)
|
|
14
|
-
@raw = data
|
|
15
|
-
@alias_value = Internal::Coerce.string(data["alias_value"]) || ""
|
|
16
|
-
@alias_type = Internal::Coerce.string(data["alias_type"]) || BlikAliasType::PAYID
|
|
17
|
-
@status = data["status"].is_a?(String) ? data["status"] : nil
|
|
18
|
-
@expiration_date = data["expiration_date"].is_a?(String) ? data["expiration_date"] : nil
|
|
19
|
-
registration = data["registration"]
|
|
20
|
-
@registration = registration.is_a?(Hash) ? BlikRecurringRegistrationInfo.from_api(registration) : nil
|
|
21
|
-
freeze
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def active?
|
|
25
|
-
@status == ACTIVE
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module DPay
|
|
2
|
-
class BlikRecurringRegistration
|
|
3
|
-
MODELS: Array[String]
|
|
4
|
-
FREQUENCY: Regexp
|
|
5
|
-
DATE: Regexp
|
|
6
|
-
|
|
7
|
-
@optional: Hash[String, untyped]
|
|
8
|
-
|
|
9
|
-
def self.create: (String label, String model, String frequency) -> BlikRecurringRegistration
|
|
10
|
-
|
|
11
|
-
def initialize: (String label, String model, String frequency) -> void
|
|
12
|
-
def with_value: (Money value) -> self
|
|
13
|
-
def with_limit_amt: (Integer limit_amt) -> self
|
|
14
|
-
def with_tot_limit_amt: (Integer tot_limit_amt) -> self
|
|
15
|
-
def with_limit_amt_fixed: (bool fixed) -> self
|
|
16
|
-
def with_expiration_date: (String expiration_date) -> self
|
|
17
|
-
def with_init_date: (String init_date) -> self
|
|
18
|
-
def to_h: () -> Hash[String, untyped]
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
def assert_date: (untyped date) -> String
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module DPay
|
|
2
|
-
class BlikRecurringStatus
|
|
3
|
-
ACTIVE: String
|
|
4
|
-
|
|
5
|
-
attr_reader alias_value: String
|
|
6
|
-
attr_reader alias_type: String
|
|
7
|
-
attr_reader status: String?
|
|
8
|
-
attr_reader expiration_date: String?
|
|
9
|
-
attr_reader registration: BlikRecurringRegistrationInfo?
|
|
10
|
-
attr_reader raw: Hash[String, untyped]
|
|
11
|
-
|
|
12
|
-
def self.from_api: (Hash[String, untyped] data) -> BlikRecurringStatus
|
|
13
|
-
|
|
14
|
-
def initialize: (Hash[String, untyped] data) -> void
|
|
15
|
-
def active?: () -> bool
|
|
16
|
-
end
|
|
17
|
-
end
|