onlinepayments-sdk-ruby 10.1.0 → 10.3.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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/onlinepayments/sdk/communication/metadata_provider.rb +1 -1
  3. data/lib/onlinepayments/sdk/communicator.rb +1 -1
  4. data/lib/onlinepayments/sdk/domain/capture_output.rb +28 -0
  5. data/lib/onlinepayments/sdk/domain/create_hosted_fields_session_request.rb +15 -0
  6. data/lib/onlinepayments/sdk/domain/get_payment_links_by_merchant_group_request.rb +68 -0
  7. data/lib/onlinepayments/sdk/domain/import_cof_series_request.rb +15 -0
  8. data/lib/onlinepayments/sdk/domain/operation_output.rb +15 -0
  9. data/lib/onlinepayments/sdk/domain/pagination.rb +49 -0
  10. data/lib/onlinepayments/sdk/domain/payment_link_overview_entry.rb +157 -0
  11. data/lib/onlinepayments/sdk/domain/payment_link_overview_filtering.rb +57 -0
  12. data/lib/onlinepayments/sdk/domain/payment_link_overview_response.rb +69 -0
  13. data/lib/onlinepayments/sdk/domain/payment_link_overview_sorting.rb +49 -0
  14. data/lib/onlinepayments/sdk/domain/payment_output.rb +13 -0
  15. data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_fields.rb +57 -0
  16. data/lib/onlinepayments/sdk/domain/payout_output.rb +13 -0
  17. data/lib/onlinepayments/sdk/domain/refund_card_method_specific_output.rb +43 -0
  18. data/lib/onlinepayments/sdk/domain/refund_output.rb +28 -0
  19. data/lib/onlinepayments/sdk/domain/share_payment_link_request.rb +62 -0
  20. data/lib/onlinepayments/sdk/exception_factory.rb +1 -1
  21. data/lib/onlinepayments/sdk/merchant/merchant_client.rb +7 -7
  22. data/lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb +70 -0
  23. data/onlinepayments-sdk-ruby.gemspec +1 -1
  24. metadata +9 -1
@@ -0,0 +1,69 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require 'onlinepayments/sdk/domain/data_object'
5
+ require 'onlinepayments/sdk/domain/pagination'
6
+ require 'onlinepayments/sdk/domain/payment_link_overview_entry'
7
+
8
+ module OnlinePayments
9
+ module SDK
10
+ module Domain
11
+ # @attr [OnlinePayments::SDK::Domain::Pagination, nil] pagination
12
+ # @attr [Array<OnlinePayments::SDK::Domain::PaymentLinkOverviewEntry>, nil] payment_link_overview_entries
13
+ # @attr [Integer, nil] total
14
+ class PaymentLinkOverviewResponse < OnlinePayments::SDK::Domain::DataObject
15
+
16
+ attr_accessor :pagination
17
+
18
+ attr_accessor :payment_link_overview_entries
19
+
20
+ attr_accessor :total
21
+
22
+ # Sets the property and returns this same instance.
23
+ def with_pagination(value)
24
+ @pagination = value
25
+ self
26
+ end
27
+
28
+ # Sets the property and returns this same instance.
29
+ def with_payment_link_overview_entries(value)
30
+ @payment_link_overview_entries = value
31
+ self
32
+ end
33
+
34
+ # Sets the property and returns this same instance.
35
+ def with_total(value)
36
+ @total = value
37
+ self
38
+ end
39
+
40
+ # @return (Hash)
41
+ def to_h
42
+ hash = super
43
+ hash['pagination'] = @pagination.to_h unless @pagination.nil?
44
+ hash['paymentLinkOverviewEntries'] = @payment_link_overview_entries.collect{|val| val.to_h} unless @payment_link_overview_entries.nil?
45
+ hash['total'] = @total unless @total.nil?
46
+ hash
47
+ end
48
+
49
+ def from_hash(hash)
50
+ super
51
+ if hash.has_key? 'pagination'
52
+ raise TypeError, "value '%s' is not a Hash" % [hash['pagination']] unless hash['pagination'].is_a? Hash
53
+ @pagination = OnlinePayments::SDK::Domain::Pagination.new_from_hash(hash['pagination'])
54
+ end
55
+ if hash.has_key? 'paymentLinkOverviewEntries'
56
+ raise TypeError, "value '%s' is not an Array" % [hash['paymentLinkOverviewEntries']] unless hash['paymentLinkOverviewEntries'].is_a? Array
57
+ @payment_link_overview_entries = []
58
+ hash['paymentLinkOverviewEntries'].each do |e|
59
+ @payment_link_overview_entries << OnlinePayments::SDK::Domain::PaymentLinkOverviewEntry.new_from_hash(e)
60
+ end
61
+ end
62
+ if hash.has_key? 'total'
63
+ @total = hash['total']
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,49 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require 'onlinepayments/sdk/domain/data_object'
5
+
6
+ module OnlinePayments
7
+ module SDK
8
+ module Domain
9
+ # @attr [String, nil] sort_direction
10
+ # @attr [String, nil] sort_property
11
+ class PaymentLinkOverviewSorting < OnlinePayments::SDK::Domain::DataObject
12
+
13
+ attr_accessor :sort_direction
14
+
15
+ attr_accessor :sort_property
16
+
17
+ # Sets the property and returns this same instance.
18
+ def with_sort_direction(value)
19
+ @sort_direction = value
20
+ self
21
+ end
22
+
23
+ # Sets the property and returns this same instance.
24
+ def with_sort_property(value)
25
+ @sort_property = value
26
+ self
27
+ end
28
+
29
+ # @return (Hash)
30
+ def to_h
31
+ hash = super
32
+ hash['sortDirection'] = @sort_direction unless @sort_direction.nil?
33
+ hash['sortProperty'] = @sort_property unless @sort_property.nil?
34
+ hash
35
+ end
36
+
37
+ def from_hash(hash)
38
+ super
39
+ if hash.has_key? 'sortDirection'
40
+ @sort_direction = hash['sortDirection']
41
+ end
42
+ if hash.has_key? 'sortProperty'
43
+ @sort_property = hash['sortProperty']
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -25,6 +25,7 @@ module OnlinePayments
25
25
  # @attr [OnlinePayments::SDK::Domain::Discount, nil] discount
26
26
  # @attr [String, nil] merchant_parameters
27
27
  # @attr [OnlinePayments::SDK::Domain::MobilePaymentMethodSpecificOutput, nil] mobile_payment_method_specific_output
28
+ # @attr [DateTime, nil] payment_creation_date
28
29
  # @attr [String, nil] payment_method
29
30
  # @attr [OnlinePayments::SDK::Domain::RedirectPaymentMethodSpecificOutput, nil] redirect_payment_method_specific_output
30
31
  # @attr [OnlinePayments::SDK::Domain::PaymentReferences, nil] references
@@ -50,6 +51,8 @@ module OnlinePayments
50
51
 
51
52
  attr_accessor :mobile_payment_method_specific_output
52
53
 
54
+ attr_accessor :payment_creation_date
55
+
53
56
  attr_accessor :payment_method
54
57
 
55
58
  attr_accessor :redirect_payment_method_specific_output
@@ -110,6 +113,12 @@ module OnlinePayments
110
113
  self
111
114
  end
112
115
 
116
+ # Sets the property and returns this same instance.
117
+ def with_payment_creation_date(value)
118
+ @payment_creation_date = value
119
+ self
120
+ end
121
+
113
122
  # Sets the property and returns this same instance.
114
123
  def with_payment_method(value)
115
124
  @payment_method = value
@@ -157,6 +166,7 @@ module OnlinePayments
157
166
  hash['discount'] = @discount.to_h unless @discount.nil?
158
167
  hash['merchantParameters'] = @merchant_parameters unless @merchant_parameters.nil?
159
168
  hash['mobilePaymentMethodSpecificOutput'] = @mobile_payment_method_specific_output.to_h unless @mobile_payment_method_specific_output.nil?
169
+ hash['paymentCreationDate'] = @payment_creation_date.iso8601(3) unless @payment_creation_date.nil?
160
170
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
161
171
  hash['redirectPaymentMethodSpecificOutput'] = @redirect_payment_method_specific_output.to_h unless @redirect_payment_method_specific_output.nil?
162
172
  hash['references'] = @references.to_h unless @references.nil?
@@ -198,6 +208,9 @@ module OnlinePayments
198
208
  raise TypeError, "value '%s' is not a Hash" % [hash['mobilePaymentMethodSpecificOutput']] unless hash['mobilePaymentMethodSpecificOutput'].is_a? Hash
199
209
  @mobile_payment_method_specific_output = OnlinePayments::SDK::Domain::MobilePaymentMethodSpecificOutput.new_from_hash(hash['mobilePaymentMethodSpecificOutput'])
200
210
  end
211
+ if hash.has_key? 'paymentCreationDate'
212
+ @payment_creation_date = DateTime.parse(hash['paymentCreationDate'])
213
+ end
201
214
  if hash.has_key? 'paymentMethod'
202
215
  @payment_method = hash['paymentMethod']
203
216
  end
@@ -0,0 +1,57 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require 'onlinepayments/sdk/domain/data_object'
5
+
6
+ module OnlinePayments
7
+ module SDK
8
+ module Domain
9
+ # @attr [Array<Integer>, nil] exclude
10
+ # @attr [Array<Integer>, nil] restrict_to
11
+ class PaymentProductFiltersHostedFields < OnlinePayments::SDK::Domain::DataObject
12
+
13
+ attr_accessor :exclude
14
+
15
+ attr_accessor :restrict_to
16
+
17
+ # Sets the property and returns this same instance.
18
+ def with_exclude(value)
19
+ @exclude = value
20
+ self
21
+ end
22
+
23
+ # Sets the property and returns this same instance.
24
+ def with_restrict_to(value)
25
+ @restrict_to = value
26
+ self
27
+ end
28
+
29
+ # @return (Hash)
30
+ def to_h
31
+ hash = super
32
+ hash['exclude'] = @exclude unless @exclude.nil?
33
+ hash['restrictTo'] = @restrict_to unless @restrict_to.nil?
34
+ hash
35
+ end
36
+
37
+ def from_hash(hash)
38
+ super
39
+ if hash.has_key? 'exclude'
40
+ raise TypeError, "value '%s' is not an Array" % [hash['exclude']] unless hash['exclude'].is_a? Array
41
+ @exclude = []
42
+ hash['exclude'].each do |e|
43
+ @exclude << e
44
+ end
45
+ end
46
+ if hash.has_key? 'restrictTo'
47
+ raise TypeError, "value '%s' is not an Array" % [hash['restrictTo']] unless hash['restrictTo'].is_a? Array
48
+ @restrict_to = []
49
+ hash['restrictTo'].each do |e|
50
+ @restrict_to << e
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -12,6 +12,7 @@ module OnlinePayments
12
12
  module SDK
13
13
  module Domain
14
14
  # @attr [OnlinePayments::SDK::Domain::AmountOfMoney, nil] amount_of_money
15
+ # @attr [DateTime, nil] payment_creation_date
15
16
  # @attr [OnlinePayments::SDK::Domain::PayoutCardPaymentMethodSpecificOutput, nil] payout_card_payment_method_specific_output
16
17
  # @attr [String, nil] payout_reason
17
18
  # @attr [OnlinePayments::SDK::Domain::PaymentReferences, nil] references
@@ -20,6 +21,8 @@ module OnlinePayments
20
21
 
21
22
  attr_accessor :amount_of_money
22
23
 
24
+ attr_accessor :payment_creation_date
25
+
23
26
  attr_accessor :payout_card_payment_method_specific_output
24
27
 
25
28
  attr_accessor :payout_reason
@@ -34,6 +37,12 @@ module OnlinePayments
34
37
  self
35
38
  end
36
39
 
40
+ # Sets the property and returns this same instance.
41
+ def with_payment_creation_date(value)
42
+ @payment_creation_date = value
43
+ self
44
+ end
45
+
37
46
  # Sets the property and returns this same instance.
38
47
  def with_payout_card_payment_method_specific_output(value)
39
48
  @payout_card_payment_method_specific_output = value
@@ -62,6 +71,7 @@ module OnlinePayments
62
71
  def to_h
63
72
  hash = super
64
73
  hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil?
74
+ hash['paymentCreationDate'] = @payment_creation_date.iso8601(3) unless @payment_creation_date.nil?
65
75
  hash['payoutCardPaymentMethodSpecificOutput'] = @payout_card_payment_method_specific_output.to_h unless @payout_card_payment_method_specific_output.nil?
66
76
  hash['payoutReason'] = @payout_reason unless @payout_reason.nil?
67
77
  hash['references'] = @references.to_h unless @references.nil?
@@ -75,6 +85,9 @@ module OnlinePayments
75
85
  raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
76
86
  @amount_of_money = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
77
87
  end
88
+ if hash.has_key? 'paymentCreationDate'
89
+ @payment_creation_date = DateTime.parse(hash['paymentCreationDate'])
90
+ end
78
91
  if hash.has_key? 'payoutCardPaymentMethodSpecificOutput'
79
92
  raise TypeError, "value '%s' is not a Hash" % [hash['payoutCardPaymentMethodSpecificOutput']] unless hash['payoutCardPaymentMethodSpecificOutput'].is_a? Hash
80
93
  @payout_card_payment_method_specific_output = OnlinePayments::SDK::Domain::PayoutCardPaymentMethodSpecificOutput.new_from_hash(hash['payoutCardPaymentMethodSpecificOutput'])
@@ -1,29 +1,58 @@
1
1
  #
2
2
  # This file was automatically generated.
3
3
  #
4
+ require 'onlinepayments/sdk/domain/acceptance'
4
5
  require 'onlinepayments/sdk/domain/currency_conversion'
5
6
  require 'onlinepayments/sdk/domain/data_object'
7
+ require 'onlinepayments/sdk/domain/reattempt_instructions'
6
8
 
7
9
  module OnlinePayments
8
10
  module SDK
9
11
  module Domain
12
+ # @attr [OnlinePayments::SDK::Domain::Acceptance, nil] acceptance
13
+ # @attr [String, nil] authorisation_code
10
14
  # @attr [OnlinePayments::SDK::Domain::CurrencyConversion, nil] currency_conversion
15
+ # @attr [OnlinePayments::SDK::Domain::ReattemptInstructions, nil] reattempt_instructions
11
16
  # @attr [Integer, nil] total_amount_paid
12
17
  # @attr [Integer, nil] total_amount_refunded
13
18
  class RefundCardMethodSpecificOutput < OnlinePayments::SDK::Domain::DataObject
14
19
 
20
+ attr_accessor :acceptance
21
+
22
+ attr_accessor :authorisation_code
23
+
15
24
  attr_accessor :currency_conversion
16
25
 
26
+ attr_accessor :reattempt_instructions
27
+
17
28
  attr_accessor :total_amount_paid
18
29
 
19
30
  attr_accessor :total_amount_refunded
20
31
 
32
+ # Sets the property and returns this same instance.
33
+ def with_acceptance(value)
34
+ @acceptance = value
35
+ self
36
+ end
37
+
38
+ # Sets the property and returns this same instance.
39
+ def with_authorisation_code(value)
40
+ @authorisation_code = value
41
+ self
42
+ end
43
+
21
44
  # Sets the property and returns this same instance.
22
45
  def with_currency_conversion(value)
23
46
  @currency_conversion = value
24
47
  self
25
48
  end
26
49
 
50
+ # Sets the property and returns this same instance.
51
+ def with_reattempt_instructions(value)
52
+ @reattempt_instructions = value
53
+ self
54
+ end
55
+
27
56
  # Sets the property and returns this same instance.
28
57
  def with_total_amount_paid(value)
29
58
  @total_amount_paid = value
@@ -39,7 +68,10 @@ module OnlinePayments
39
68
  # @return (Hash)
40
69
  def to_h
41
70
  hash = super
71
+ hash['acceptance'] = @acceptance.to_h unless @acceptance.nil?
72
+ hash['authorisationCode'] = @authorisation_code unless @authorisation_code.nil?
42
73
  hash['currencyConversion'] = @currency_conversion.to_h unless @currency_conversion.nil?
74
+ hash['reattemptInstructions'] = @reattempt_instructions.to_h unless @reattempt_instructions.nil?
43
75
  hash['totalAmountPaid'] = @total_amount_paid unless @total_amount_paid.nil?
44
76
  hash['totalAmountRefunded'] = @total_amount_refunded unless @total_amount_refunded.nil?
45
77
  hash
@@ -47,10 +79,21 @@ module OnlinePayments
47
79
 
48
80
  def from_hash(hash)
49
81
  super
82
+ if hash.has_key? 'acceptance'
83
+ raise TypeError, "value '%s' is not a Hash" % [hash['acceptance']] unless hash['acceptance'].is_a? Hash
84
+ @acceptance = OnlinePayments::SDK::Domain::Acceptance.new_from_hash(hash['acceptance'])
85
+ end
86
+ if hash.has_key? 'authorisationCode'
87
+ @authorisation_code = hash['authorisationCode']
88
+ end
50
89
  if hash.has_key? 'currencyConversion'
51
90
  raise TypeError, "value '%s' is not a Hash" % [hash['currencyConversion']] unless hash['currencyConversion'].is_a? Hash
52
91
  @currency_conversion = OnlinePayments::SDK::Domain::CurrencyConversion.new_from_hash(hash['currencyConversion'])
53
92
  end
93
+ if hash.has_key? 'reattemptInstructions'
94
+ raise TypeError, "value '%s' is not a Hash" % [hash['reattemptInstructions']] unless hash['reattemptInstructions'].is_a? Hash
95
+ @reattempt_instructions = OnlinePayments::SDK::Domain::ReattemptInstructions.new_from_hash(hash['reattemptInstructions'])
96
+ end
54
97
  if hash.has_key? 'totalAmountPaid'
55
98
  @total_amount_paid = hash['totalAmountPaid']
56
99
  end
@@ -1,6 +1,8 @@
1
1
  #
2
2
  # This file was automatically generated.
3
3
  #
4
+ require 'date'
5
+
4
6
  require 'onlinepayments/sdk/domain/amount_of_money'
5
7
  require 'onlinepayments/sdk/domain/data_object'
6
8
  require 'onlinepayments/sdk/domain/operation_payment_references'
@@ -20,9 +22,11 @@ module OnlinePayments
20
22
  # @attr [String, nil] merchant_parameters
21
23
  # @attr [OnlinePayments::SDK::Domain::RefundMobileMethodSpecificOutput, nil] mobile_refund_method_specific_output
22
24
  # @attr [OnlinePayments::SDK::Domain::OperationPaymentReferences, nil] operation_references
25
+ # @attr [DateTime, nil] payment_creation_date
23
26
  # @attr [String, nil] payment_method
24
27
  # @attr [OnlinePayments::SDK::Domain::RefundRedirectMethodSpecificOutput, nil] redirect_refund_method_specific_output
25
28
  # @attr [OnlinePayments::SDK::Domain::PaymentReferences, nil] references
29
+ # @attr [DateTime, nil] transaction_date
26
30
  class RefundOutput < OnlinePayments::SDK::Domain::DataObject
27
31
 
28
32
  attr_accessor :amount_of_money
@@ -39,12 +43,16 @@ module OnlinePayments
39
43
 
40
44
  attr_accessor :operation_references
41
45
 
46
+ attr_accessor :payment_creation_date
47
+
42
48
  attr_accessor :payment_method
43
49
 
44
50
  attr_accessor :redirect_refund_method_specific_output
45
51
 
46
52
  attr_accessor :references
47
53
 
54
+ attr_accessor :transaction_date
55
+
48
56
  # Sets the property and returns this same instance.
49
57
  def with_amount_of_money(value)
50
58
  @amount_of_money = value
@@ -87,6 +95,12 @@ module OnlinePayments
87
95
  self
88
96
  end
89
97
 
98
+ # Sets the property and returns this same instance.
99
+ def with_payment_creation_date(value)
100
+ @payment_creation_date = value
101
+ self
102
+ end
103
+
90
104
  # Sets the property and returns this same instance.
91
105
  def with_payment_method(value)
92
106
  @payment_method = value
@@ -105,6 +119,12 @@ module OnlinePayments
105
119
  self
106
120
  end
107
121
 
122
+ # Sets the property and returns this same instance.
123
+ def with_transaction_date(value)
124
+ @transaction_date = value
125
+ self
126
+ end
127
+
108
128
  # @return (Hash)
109
129
  def to_h
110
130
  hash = super
@@ -115,9 +135,11 @@ module OnlinePayments
115
135
  hash['merchantParameters'] = @merchant_parameters unless @merchant_parameters.nil?
116
136
  hash['mobileRefundMethodSpecificOutput'] = @mobile_refund_method_specific_output.to_h unless @mobile_refund_method_specific_output.nil?
117
137
  hash['operationReferences'] = @operation_references.to_h unless @operation_references.nil?
138
+ hash['paymentCreationDate'] = @payment_creation_date.iso8601(3) unless @payment_creation_date.nil?
118
139
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
119
140
  hash['redirectRefundMethodSpecificOutput'] = @redirect_refund_method_specific_output.to_h unless @redirect_refund_method_specific_output.nil?
120
141
  hash['references'] = @references.to_h unless @references.nil?
142
+ hash['transactionDate'] = @transaction_date.iso8601(3) unless @transaction_date.nil?
121
143
  hash
122
144
  end
123
145
 
@@ -149,6 +171,9 @@ module OnlinePayments
149
171
  raise TypeError, "value '%s' is not a Hash" % [hash['operationReferences']] unless hash['operationReferences'].is_a? Hash
150
172
  @operation_references = OnlinePayments::SDK::Domain::OperationPaymentReferences.new_from_hash(hash['operationReferences'])
151
173
  end
174
+ if hash.has_key? 'paymentCreationDate'
175
+ @payment_creation_date = DateTime.parse(hash['paymentCreationDate'])
176
+ end
152
177
  if hash.has_key? 'paymentMethod'
153
178
  @payment_method = hash['paymentMethod']
154
179
  end
@@ -160,6 +185,9 @@ module OnlinePayments
160
185
  raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
161
186
  @references = OnlinePayments::SDK::Domain::PaymentReferences.new_from_hash(hash['references'])
162
187
  end
188
+ if hash.has_key? 'transactionDate'
189
+ @transaction_date = DateTime.parse(hash['transactionDate'])
190
+ end
163
191
  end
164
192
  end
165
193
  end
@@ -0,0 +1,62 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require 'onlinepayments/sdk/domain/data_object'
5
+
6
+ module OnlinePayments
7
+ module SDK
8
+ module Domain
9
+ # @attr [String, nil] channel
10
+ # @attr [String, nil] locale
11
+ # @attr [String, nil] recipient
12
+ class SharePaymentLinkRequest < OnlinePayments::SDK::Domain::DataObject
13
+
14
+ attr_accessor :channel
15
+
16
+ attr_accessor :locale
17
+
18
+ attr_accessor :recipient
19
+
20
+ # Sets the property and returns this same instance.
21
+ def with_channel(value)
22
+ @channel = value
23
+ self
24
+ end
25
+
26
+ # Sets the property and returns this same instance.
27
+ def with_locale(value)
28
+ @locale = value
29
+ self
30
+ end
31
+
32
+ # Sets the property and returns this same instance.
33
+ def with_recipient(value)
34
+ @recipient = value
35
+ self
36
+ end
37
+
38
+ # @return (Hash)
39
+ def to_h
40
+ hash = super
41
+ hash['channel'] = @channel unless @channel.nil?
42
+ hash['locale'] = @locale unless @locale.nil?
43
+ hash['recipient'] = @recipient unless @recipient.nil?
44
+ hash
45
+ end
46
+
47
+ def from_hash(hash)
48
+ super
49
+ if hash.has_key? 'channel'
50
+ @channel = hash['channel']
51
+ end
52
+ if hash.has_key? 'locale'
53
+ @locale = hash['locale']
54
+ end
55
+ if hash.has_key? 'recipient'
56
+ @recipient = hash['recipient']
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -76,7 +76,7 @@ module OnlinePayments
76
76
  def self.is_idempotence_error(errors, context)
77
77
  !context&.idempotence_key.nil? &&
78
78
  errors&.length == 1 &&
79
- errors[0]&.error_code == '1409'
79
+ errors[0]&.error_code == '30001002'
80
80
  end
81
81
  end
82
82
  end
@@ -65,6 +65,13 @@ module OnlinePayments
65
65
  OnlinePayments::SDK::Merchant::Payments::PaymentsClient.new(self, nil)
66
66
  end
67
67
 
68
+ # Resource /v2/{merchantId}/paymentlinks/{paymentLinkId}/share
69
+ #
70
+ # @return [OnlinePayments::SDK::Merchant::PaymentLinks::PaymentLinksClient]
71
+ def payment_links
72
+ OnlinePayments::SDK::Merchant::PaymentLinks::PaymentLinksClient.new(self, nil)
73
+ end
74
+
68
75
  # Resource /v2/{merchantId}/payments/{paymentId}/captures
69
76
  #
70
77
  # @return [OnlinePayments::SDK::Merchant::Captures::CapturesClient]
@@ -177,13 +184,6 @@ module OnlinePayments
177
184
  OnlinePayments::SDK::Merchant::PrivacyPolicy::PrivacyPolicyClient.new(self, nil)
178
185
  end
179
186
 
180
- # Resource /v2/{merchantId}/paymentlinks
181
- #
182
- # @return [OnlinePayments::SDK::Merchant::PaymentLinks::PaymentLinksClient]
183
- def payment_links
184
- OnlinePayments::SDK::Merchant::PaymentLinks::PaymentLinksClient.new(self, nil)
185
- end
186
-
187
187
  # Resource /v2/{merchantId}/merchant-batches
188
188
  #
189
189
  # @return [OnlinePayments::SDK::Merchant::MerchantBatch::MerchantBatchClient]
@@ -5,6 +5,7 @@ require 'onlinepayments/sdk/api_resource'
5
5
  require 'onlinepayments/sdk/exception_factory'
6
6
  require 'onlinepayments/sdk/communication/response_exception'
7
7
  require 'onlinepayments/sdk/domain/error_response'
8
+ require 'onlinepayments/sdk/domain/payment_link_overview_response'
8
9
  require 'onlinepayments/sdk/domain/payment_link_response'
9
10
 
10
11
  module OnlinePayments
@@ -20,6 +21,40 @@ module OnlinePayments
20
21
  super(parent: parent, path_context: path_context)
21
22
  end
22
23
 
24
+ # Resource /v2/!{merchantId}/paymentlinks/!{paymentLinkId}/share - Share the specified payment link to a customer.
25
+ #
26
+ # @param payment_link_id [String]
27
+ # @param body [OnlinePayments::SDK::Domain::SharePaymentLinkRequest]
28
+ # @param context [OnlinePayments::SDK::CallContext, nil]
29
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
30
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
31
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
32
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
33
+ # or there was a conflict (HTTP status code 404, 409 or 410)
34
+ # @raise [OnlinePayments::SDK::PlatformException] if something went wrong at the payment platform,
35
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
36
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
37
+ # @raise [OnlinePayments::SDK::ApiException] if the payment platform returned any other error
38
+ def share(payment_link_id, body, context = nil)
39
+ path_context = {
40
+ 'paymentLinkId'.freeze => payment_link_id,
41
+ }
42
+ uri = instantiate_uri('/v2/{merchantId}/paymentlinks/{paymentLinkId}/share', path_context)
43
+
44
+
45
+ @communicator.post(
46
+ uri,
47
+ client_headers,
48
+ nil,
49
+ body,
50
+ nil,
51
+ context)
52
+ rescue OnlinePayments::SDK::Communication::ResponseException => e
53
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
54
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
55
+ raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
56
+ end
57
+
23
58
  # Resource /v2/!{merchantId}/paymentlinks - Create payment link
24
59
  #
25
60
  # @param body [OnlinePayments::SDK::Domain::CreatePaymentLinkRequest]
@@ -51,6 +86,41 @@ module OnlinePayments
51
86
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
52
87
  end
53
88
 
89
+ # Resource /v2/merchant-groups/!{merchantGroupId}/paymentlinks/search - Retrieve payment links for a merchant group
90
+ #
91
+ # @param merchant_group_id [String]
92
+ # @param body [OnlinePayments::SDK::Domain::GetPaymentLinksByMerchantGroupRequest]
93
+ # @param context [OnlinePayments::SDK::CallContext, nil]
94
+ # @return [OnlinePayments::SDK::Domain::PaymentLinkOverviewResponse]
95
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
96
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
97
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
98
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
99
+ # or there was a conflict (HTTP status code 404, 409 or 410)
100
+ # @raise [OnlinePayments::SDK::PlatformException] if something went wrong at the payment platform,
101
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
102
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
103
+ # @raise [OnlinePayments::SDK::ApiException] if the payment platform returned any other error
104
+ def get_payment_links_by_merchant_group_id(merchant_group_id, body, context = nil)
105
+ path_context = {
106
+ 'merchantGroupId'.freeze => merchant_group_id,
107
+ }
108
+ uri = instantiate_uri('/v2/merchant-groups/{merchantGroupId}/paymentlinks/search', path_context)
109
+
110
+
111
+ @communicator.post(
112
+ uri,
113
+ client_headers,
114
+ nil,
115
+ body,
116
+ OnlinePayments::SDK::Domain::PaymentLinkOverviewResponse,
117
+ context)
118
+ rescue OnlinePayments::SDK::Communication::ResponseException => e
119
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
120
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
121
+ raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
122
+ end
123
+
54
124
  # Resource /v2/!{merchantId}/paymentlinks/!{paymentLinkId} - Get payment link by ID
55
125
  #
56
126
  # @param payment_link_id [String]
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'onlinepayments-sdk-ruby'
3
- spec.version = '10.1.0'
3
+ spec.version = '10.3.0'
4
4
  spec.authors = ['Worldline Direct support team']
5
5
  spec.email = ['82139942+worldline-direct-support-team@users.noreply.github.com']
6
6
  spec.summary = %q{SDK to communicate with the Online Payments platform using the Online Payments Server API}