onlinepayments-sdk-ruby 10.4.0 → 11.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/AGENTS.md +23 -0
  3. data/README.md +22 -0
  4. data/lib/onlinepayments/sdk/communication/metadata_provider.rb +1 -1
  5. data/lib/onlinepayments/sdk/domain/card_installment_details.rb +36 -0
  6. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input.rb +30 -0
  7. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_base.rb +30 -0
  8. data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_request.rb +13 -0
  9. data/lib/onlinepayments/sdk/domain/payment_product5407_auto_capture.rb +36 -0
  10. data/lib/onlinepayments/sdk/domain/redirect_payment_product5407_specific_input.rb +9 -9
  11. data/lib/onlinepayments/sdk/factory.rb +6 -0
  12. data/lib/onlinepayments/sdk/merchant/merchant_client.rb +4 -0
  13. data/onlinepayments-sdk-ruby.gemspec +2 -2
  14. data/skills/worldline-direct/SKILL.md +85 -0
  15. data/skills/worldline-direct/examples/after_payment_operations_example.rb +75 -0
  16. data/skills/worldline-direct/examples/app_types.rb +170 -0
  17. data/skills/worldline-direct/examples/client_integration_example.rb +76 -0
  18. data/skills/worldline-direct/examples/client_setup.rb +60 -0
  19. data/skills/worldline-direct/examples/create_payment_response_handler.rb +32 -0
  20. data/skills/worldline-direct/examples/customer_device.rb +32 -0
  21. data/skills/worldline-direct/examples/error_handling_example.rb +99 -0
  22. data/skills/worldline-direct/examples/hosted_checkout_example.rb +181 -0
  23. data/skills/worldline-direct/examples/hosted_fields_example.rb +82 -0
  24. data/skills/worldline-direct/examples/hosted_tokenization_example.rb +79 -0
  25. data/skills/worldline-direct/examples/payment_attempt.rb +30 -0
  26. data/skills/worldline-direct/examples/payment_links_example.rb +52 -0
  27. data/skills/worldline-direct/examples/payment_status_example.rb +62 -0
  28. data/skills/worldline-direct/examples/recurring_payments_example.rb +127 -0
  29. data/skills/worldline-direct/examples/server_to_server_example.rb +81 -0
  30. data/skills/worldline-direct/examples/webhook_event_processor.rb +40 -0
  31. data/skills/worldline-direct/examples/webhooks_endpoint.rb +73 -0
  32. data/skills/worldline-direct/examples/webhooks_setup.rb +41 -0
  33. data/skills/worldline-direct/references/errors.md +113 -0
  34. data/skills/worldline-direct/references/flows.md +966 -0
  35. data/skills/worldline-direct/references/ruby.md +208 -0
  36. data/skills/worldline-direct/references/webhooks.md +167 -0
  37. metadata +27 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be175774d72ab58efa9d7b2fec7142301c37f5f73277be1daf578fe06eef22b9
4
- data.tar.gz: 59bc44db1900bf83f9177218339358098fd45dd99b4b41bbc20a53f680b544c4
3
+ metadata.gz: 421b66130f7d15ee91b211d68a7997280aaa1822676e3101703eb0eb05a95d0b
4
+ data.tar.gz: 9fbd7a9a28ba4be33a072303c0b6965f1da0fe64cf84d7622508561d587e1d44
5
5
  SHA512:
6
- metadata.gz: 3cb7299d7d69fccef1ba76f2d588cf27d7e472f907152de16bc3493aff0a3780a6cbb1152d9933bf68455a561389cdce7f510c5e119c78f2fbcf98e609a2afd3
7
- data.tar.gz: d2e86d31e8767f72d9731113068811829596f6c64b98dcbb00624da51cb14a445e706f26d285197ae5126fd7bb784ddb98167997ad72ae5a380f6ad8db3c5202
6
+ metadata.gz: c8c3d7a3c41d5d184711b07b7a9db3c5f3bcf6a20db6485ab622333ce862ab43b490455c6be02e2bc63ad0f7e2a19b86989a07263112d0a6e2b9bf4b4b3f29e6
7
+ data.tar.gz: fd7b0e1e2fa0e1faa989d46b8b85cee85a018aa577fcb43d91a3b04b3270ae50510f2004befd08930f1210d3ed0025e3b40735f3ea7c321fe9e3458e05b875b0
data/AGENTS.md ADDED
@@ -0,0 +1,23 @@
1
+ # AGENTS.md
2
+
3
+ ## Using this SDK in your project
4
+
5
+ If you are writing code that integrates Worldline Direct with this SDK, read the agent skill
6
+ for this SDK version first and use the code it shows. Do not write SDK calls from memory.
7
+
8
+ - In this gem: `skills/worldline-direct/SKILL.md`
9
+ (gem folder: `bundle info onlinepayments-sdk-ruby --path`)
10
+ - Online: https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/11.1.0/skills/worldline-direct/SKILL.md
11
+
12
+ The skill matches SDK version 11.1.0. If your installed version is different, use the skill
13
+ from your installed gem.
14
+
15
+ ## Working on this SDK
16
+
17
+ - SDK source: `lib/onlinepayments/sdk/`; unit tests: `spec/lib/`; integration tests: `spec/integration/`.
18
+ - Install the test dependencies with `gem install rake rspec webmock sinatra`.
19
+ - Run the unit tests with `rake unit`, the integration tests with `rake integration`, and both with `rake spec`.
20
+ - The integration tests need the environment variables `onlinePayments_api_v1hmac_apiKeyId`,
21
+ `onlinePayments_api_v1hmac_secretApiKey` and `onlinePayments_api_merchantId`.
22
+ - Generate the documentation with `rake yard` (output in `doc/`).
23
+ - See `README.md` for details.
data/README.md CHANGED
@@ -61,6 +61,28 @@ To install the SDK using `gem`, execute the following command:
61
61
  ```
62
62
  3. Feel free to delete the unzipped archive, the zip file, and the gem file at this point; they are no longer required.
63
63
 
64
+ ## Working with AI agents
65
+
66
+ The SDK comes with an agent skill for AI coding agents such as Claude Code, Codex, GitHub Copilot and Cursor. It tells the agent how to choose an integration method, which steps each flow needs, which rules every integration must follow, and gives code examples that are type-checked against this SDK version.
67
+
68
+ The skill for this version is available:
69
+
70
+ * online, as plain Markdown for agents: https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/11.1.0/skills/worldline-direct/SKILL.md
71
+ * online, on GitHub: https://github.com/wl-online-payments-direct/sdk-ruby/blob/11.1.0/skills/worldline-direct/SKILL.md
72
+ * in the installed gem: `skills/worldline-direct/` in the gem folder, e.g. `vendor/bundle/ruby/<ruby version>/gems/onlinepayments-sdk-ruby-<version>/skills/worldline-direct/` when Bundler installs into `vendor/bundle`. `bundle info onlinepayments-sdk-ruby --path` prints the gem folder; without Bundler, `gem contents onlinepayments-sdk-ruby | grep SKILL.md` prints the path of the skill.
73
+ * in this repository: `skills/worldline-direct/`
74
+
75
+ To make your agent use it, add this to the `AGENTS.md` or `CLAUDE.md` file of your project:
76
+
77
+ ```
78
+ For the Worldline Direct integration (onlinepayments-sdk-ruby), read and follow the agent skill
79
+ skills/worldline-direct/SKILL.md in the folder of the installed onlinepayments-sdk-ruby gem (bundle info onlinepayments-sdk-ruby --path)
80
+ (online: https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/11.1.0/skills/worldline-direct/SKILL.md)
81
+ Use the code shown in the skill; do not write SDK calls from memory.
82
+ ```
83
+
84
+ Agents that support the Agent Skills format can also load the folder directly, for example by copying `skills/worldline-direct/` from the gem folder to `.claude/skills/worldline-direct/` in your project for Claude Code.
85
+
64
86
  ## Uninstalling
65
87
 
66
88
  After the Ruby SDK has been installed, it can be uninstalled using the
@@ -13,7 +13,7 @@ module OnlinePayments
13
13
  class MetadataProvider
14
14
  private
15
15
 
16
- SDK_VERSION = '10.4.0'.freeze
16
+ SDK_VERSION = '11.1.0'.freeze
17
17
  SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'.freeze
18
18
  PROHIBITED_HEADERS = [SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization'].sort!.freeze
19
19
  CHARSET = 'utf-8'.freeze
@@ -0,0 +1,36 @@
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] installment_payment_sequence_indicator
10
+ class CardInstallmentDetails < OnlinePayments::SDK::Domain::DataObject
11
+
12
+ attr_accessor :installment_payment_sequence_indicator
13
+
14
+ # Sets the property and returns this same instance.
15
+ def with_installment_payment_sequence_indicator(value)
16
+ @installment_payment_sequence_indicator = value
17
+ self
18
+ end
19
+
20
+ # @return (Hash)
21
+ def to_h
22
+ hash = super
23
+ hash['installmentPaymentSequenceIndicator'] = @installment_payment_sequence_indicator unless @installment_payment_sequence_indicator.nil?
24
+ hash
25
+ end
26
+
27
+ def from_hash(hash)
28
+ super
29
+ if hash.has_key? 'installmentPaymentSequenceIndicator'
30
+ @installment_payment_sequence_indicator = hash['installmentPaymentSequenceIndicator']
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -3,7 +3,9 @@
3
3
  #
4
4
  require 'onlinepayments/sdk/domain/auto_capture'
5
5
  require 'onlinepayments/sdk/domain/card'
6
+ require 'onlinepayments/sdk/domain/card_installment_details'
6
7
  require 'onlinepayments/sdk/domain/card_recurrence_details'
8
+ require 'onlinepayments/sdk/domain/credit_card_validation_rules'
7
9
  require 'onlinepayments/sdk/domain/currency_conversion_input'
8
10
  require 'onlinepayments/sdk/domain/data_object'
9
11
  require 'onlinepayments/sdk/domain/market_place'
@@ -30,6 +32,7 @@ module OnlinePayments
30
32
  # @attr [String, nil] cobrand_selection_indicator
31
33
  # @attr [OnlinePayments::SDK::Domain::CurrencyConversionInput, nil] currency_conversion
32
34
  # @attr [String, nil] initial_scheme_transaction_id
35
+ # @attr [OnlinePayments::SDK::Domain::CardInstallmentDetails, nil] installment
33
36
  # @attr [true/false, nil] is_recurring
34
37
  # @attr [OnlinePayments::SDK::Domain::MarketPlace, nil] market_place
35
38
  # @attr [OnlinePayments::SDK::Domain::MultiplePaymentInformation, nil] multiple_payment_information
@@ -52,6 +55,7 @@ module OnlinePayments
52
55
  # @attr [String, nil] transaction_channel
53
56
  # @attr [String, nil] unscheduled_card_on_file_requestor
54
57
  # @attr [String, nil] unscheduled_card_on_file_sequence_indicator
58
+ # @attr [OnlinePayments::SDK::Domain::CreditCardValidationRules, nil] validation_rules
55
59
  class CardPaymentMethodSpecificInput < OnlinePayments::SDK::Domain::DataObject
56
60
 
57
61
  attr_accessor :allow_dynamic_linking
@@ -72,6 +76,8 @@ module OnlinePayments
72
76
 
73
77
  attr_accessor :initial_scheme_transaction_id
74
78
 
79
+ attr_accessor :installment
80
+
75
81
  attr_accessor :is_recurring
76
82
 
77
83
  attr_accessor :market_place
@@ -117,6 +123,8 @@ module OnlinePayments
117
123
 
118
124
  attr_accessor :unscheduled_card_on_file_sequence_indicator
119
125
 
126
+ attr_accessor :validation_rules
127
+
120
128
  # Sets the property and returns this same instance.
121
129
  def with_allow_dynamic_linking(value)
122
130
  @allow_dynamic_linking = value
@@ -171,6 +179,12 @@ module OnlinePayments
171
179
  self
172
180
  end
173
181
 
182
+ # Sets the property and returns this same instance.
183
+ def with_installment(value)
184
+ @installment = value
185
+ self
186
+ end
187
+
174
188
  # Sets the property and returns this same instance.
175
189
  def with_is_recurring(value)
176
190
  @is_recurring = value
@@ -303,6 +317,12 @@ module OnlinePayments
303
317
  self
304
318
  end
305
319
 
320
+ # Sets the property and returns this same instance.
321
+ def with_validation_rules(value)
322
+ @validation_rules = value
323
+ self
324
+ end
325
+
306
326
  # @return (Hash)
307
327
  def to_h
308
328
  hash = super
@@ -315,6 +335,7 @@ module OnlinePayments
315
335
  hash['cobrandSelectionIndicator'] = @cobrand_selection_indicator unless @cobrand_selection_indicator.nil?
316
336
  hash['currencyConversion'] = @currency_conversion.to_h unless @currency_conversion.nil?
317
337
  hash['initialSchemeTransactionId'] = @initial_scheme_transaction_id unless @initial_scheme_transaction_id.nil?
338
+ hash['installment'] = @installment.to_h unless @installment.nil?
318
339
  hash['isRecurring'] = @is_recurring unless @is_recurring.nil?
319
340
  hash['marketPlace'] = @market_place.to_h unless @market_place.nil?
320
341
  hash['multiplePaymentInformation'] = @multiple_payment_information.to_h unless @multiple_payment_information.nil?
@@ -337,6 +358,7 @@ module OnlinePayments
337
358
  hash['transactionChannel'] = @transaction_channel unless @transaction_channel.nil?
338
359
  hash['unscheduledCardOnFileRequestor'] = @unscheduled_card_on_file_requestor unless @unscheduled_card_on_file_requestor.nil?
339
360
  hash['unscheduledCardOnFileSequenceIndicator'] = @unscheduled_card_on_file_sequence_indicator unless @unscheduled_card_on_file_sequence_indicator.nil?
361
+ hash['validationRules'] = @validation_rules.to_h unless @validation_rules.nil?
340
362
  hash
341
363
  end
342
364
 
@@ -372,6 +394,10 @@ module OnlinePayments
372
394
  if hash.has_key? 'initialSchemeTransactionId'
373
395
  @initial_scheme_transaction_id = hash['initialSchemeTransactionId']
374
396
  end
397
+ if hash.has_key? 'installment'
398
+ raise TypeError, "value '%s' is not a Hash" % [hash['installment']] unless hash['installment'].is_a? Hash
399
+ @installment = OnlinePayments::SDK::Domain::CardInstallmentDetails.new_from_hash(hash['installment'])
400
+ end
375
401
  if hash.has_key? 'isRecurring'
376
402
  @is_recurring = hash['isRecurring']
377
403
  end
@@ -450,6 +476,10 @@ module OnlinePayments
450
476
  if hash.has_key? 'unscheduledCardOnFileSequenceIndicator'
451
477
  @unscheduled_card_on_file_sequence_indicator = hash['unscheduledCardOnFileSequenceIndicator']
452
478
  end
479
+ if hash.has_key? 'validationRules'
480
+ raise TypeError, "value '%s' is not a Hash" % [hash['validationRules']] unless hash['validationRules'].is_a? Hash
481
+ @validation_rules = OnlinePayments::SDK::Domain::CreditCardValidationRules.new_from_hash(hash['validationRules'])
482
+ end
453
483
  end
454
484
  end
455
485
  end
@@ -2,7 +2,9 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'onlinepayments/sdk/domain/auto_capture'
5
+ require 'onlinepayments/sdk/domain/card_installment_details'
5
6
  require 'onlinepayments/sdk/domain/card_recurrence_details'
7
+ require 'onlinepayments/sdk/domain/credit_card_validation_rules'
6
8
  require 'onlinepayments/sdk/domain/currency_conversion_specific_input'
7
9
  require 'onlinepayments/sdk/domain/data_object'
8
10
  require 'onlinepayments/sdk/domain/market_place'
@@ -24,6 +26,7 @@ module OnlinePayments
24
26
  # @attr [OnlinePayments::SDK::Domain::AutoCapture, nil] auto_capture
25
27
  # @attr [OnlinePayments::SDK::Domain::CurrencyConversionSpecificInput, nil] currency_conversion_specific_input
26
28
  # @attr [String, nil] initial_scheme_transaction_id
29
+ # @attr [OnlinePayments::SDK::Domain::CardInstallmentDetails, nil] installment
27
30
  # @attr [OnlinePayments::SDK::Domain::MarketPlace, nil] market_place
28
31
  # @attr [OnlinePayments::SDK::Domain::MultiplePaymentInformation, nil] multiple_payment_information
29
32
  # @attr [OnlinePayments::SDK::Domain::PaymentProduct130SpecificInput, nil] payment_product130_specific_input
@@ -41,6 +44,7 @@ module OnlinePayments
41
44
  # @attr [String, nil] transaction_channel
42
45
  # @attr [String, nil] unscheduled_card_on_file_requestor
43
46
  # @attr [String, nil] unscheduled_card_on_file_sequence_indicator
47
+ # @attr [OnlinePayments::SDK::Domain::CreditCardValidationRules, nil] validation_rules
44
48
  class CardPaymentMethodSpecificInputBase < OnlinePayments::SDK::Domain::DataObject
45
49
 
46
50
  attr_accessor :allow_dynamic_linking
@@ -53,6 +57,8 @@ module OnlinePayments
53
57
 
54
58
  attr_accessor :initial_scheme_transaction_id
55
59
 
60
+ attr_accessor :installment
61
+
56
62
  attr_accessor :market_place
57
63
 
58
64
  attr_accessor :multiple_payment_information
@@ -87,6 +93,8 @@ module OnlinePayments
87
93
 
88
94
  attr_accessor :unscheduled_card_on_file_sequence_indicator
89
95
 
96
+ attr_accessor :validation_rules
97
+
90
98
  # Sets the property and returns this same instance.
91
99
  def with_allow_dynamic_linking(value)
92
100
  @allow_dynamic_linking = value
@@ -117,6 +125,12 @@ module OnlinePayments
117
125
  self
118
126
  end
119
127
 
128
+ # Sets the property and returns this same instance.
129
+ def with_installment(value)
130
+ @installment = value
131
+ self
132
+ end
133
+
120
134
  # Sets the property and returns this same instance.
121
135
  def with_market_place(value)
122
136
  @market_place = value
@@ -219,6 +233,12 @@ module OnlinePayments
219
233
  self
220
234
  end
221
235
 
236
+ # Sets the property and returns this same instance.
237
+ def with_validation_rules(value)
238
+ @validation_rules = value
239
+ self
240
+ end
241
+
222
242
  # @return (Hash)
223
243
  def to_h
224
244
  hash = super
@@ -227,6 +247,7 @@ module OnlinePayments
227
247
  hash['autoCapture'] = @auto_capture.to_h unless @auto_capture.nil?
228
248
  hash['currencyConversionSpecificInput'] = @currency_conversion_specific_input.to_h unless @currency_conversion_specific_input.nil?
229
249
  hash['initialSchemeTransactionId'] = @initial_scheme_transaction_id unless @initial_scheme_transaction_id.nil?
250
+ hash['installment'] = @installment.to_h unless @installment.nil?
230
251
  hash['marketPlace'] = @market_place.to_h unless @market_place.nil?
231
252
  hash['multiplePaymentInformation'] = @multiple_payment_information.to_h unless @multiple_payment_information.nil?
232
253
  hash['paymentProduct130SpecificInput'] = @payment_product130_specific_input.to_h unless @payment_product130_specific_input.nil?
@@ -244,6 +265,7 @@ module OnlinePayments
244
265
  hash['transactionChannel'] = @transaction_channel unless @transaction_channel.nil?
245
266
  hash['unscheduledCardOnFileRequestor'] = @unscheduled_card_on_file_requestor unless @unscheduled_card_on_file_requestor.nil?
246
267
  hash['unscheduledCardOnFileSequenceIndicator'] = @unscheduled_card_on_file_sequence_indicator unless @unscheduled_card_on_file_sequence_indicator.nil?
268
+ hash['validationRules'] = @validation_rules.to_h unless @validation_rules.nil?
247
269
  hash
248
270
  end
249
271
 
@@ -266,6 +288,10 @@ module OnlinePayments
266
288
  if hash.has_key? 'initialSchemeTransactionId'
267
289
  @initial_scheme_transaction_id = hash['initialSchemeTransactionId']
268
290
  end
291
+ if hash.has_key? 'installment'
292
+ raise TypeError, "value '%s' is not a Hash" % [hash['installment']] unless hash['installment'].is_a? Hash
293
+ @installment = OnlinePayments::SDK::Domain::CardInstallmentDetails.new_from_hash(hash['installment'])
294
+ end
269
295
  if hash.has_key? 'marketPlace'
270
296
  raise TypeError, "value '%s' is not a Hash" % [hash['marketPlace']] unless hash['marketPlace'].is_a? Hash
271
297
  @market_place = OnlinePayments::SDK::Domain::MarketPlace.new_from_hash(hash['marketPlace'])
@@ -328,6 +354,10 @@ module OnlinePayments
328
354
  if hash.has_key? 'unscheduledCardOnFileSequenceIndicator'
329
355
  @unscheduled_card_on_file_sequence_indicator = hash['unscheduledCardOnFileSequenceIndicator']
330
356
  end
357
+ if hash.has_key? 'validationRules'
358
+ raise TypeError, "value '%s' is not a Hash" % [hash['validationRules']] unless hash['validationRules'].is_a? Hash
359
+ @validation_rules = OnlinePayments::SDK::Domain::CreditCardValidationRules.new_from_hash(hash['validationRules'])
360
+ end
331
361
  end
332
362
  end
333
363
  end
@@ -11,6 +11,7 @@ module OnlinePayments
11
11
  # @attr [true/false, nil] ask_consumer_consent
12
12
  # @attr [OnlinePayments::SDK::Domain::CreditCardSpecificInputHostedTokenization, nil] credit_card_specific_input
13
13
  # @attr [String, nil] locale
14
+ # @attr [String, nil] origin
14
15
  # @attr [OnlinePayments::SDK::Domain::PaymentProductFiltersHostedTokenization, nil] payment_product_filters
15
16
  # @attr [String, nil] tokens
16
17
  # @attr [String, nil] variant
@@ -22,6 +23,8 @@ module OnlinePayments
22
23
 
23
24
  attr_accessor :locale
24
25
 
26
+ attr_accessor :origin
27
+
25
28
  attr_accessor :payment_product_filters
26
29
 
27
30
  attr_accessor :tokens
@@ -46,6 +49,12 @@ module OnlinePayments
46
49
  self
47
50
  end
48
51
 
52
+ # Sets the property and returns this same instance.
53
+ def with_origin(value)
54
+ @origin = value
55
+ self
56
+ end
57
+
49
58
  # Sets the property and returns this same instance.
50
59
  def with_payment_product_filters(value)
51
60
  @payment_product_filters = value
@@ -70,6 +79,7 @@ module OnlinePayments
70
79
  hash['askConsumerConsent'] = @ask_consumer_consent unless @ask_consumer_consent.nil?
71
80
  hash['creditCardSpecificInput'] = @credit_card_specific_input.to_h unless @credit_card_specific_input.nil?
72
81
  hash['locale'] = @locale unless @locale.nil?
82
+ hash['origin'] = @origin unless @origin.nil?
73
83
  hash['paymentProductFilters'] = @payment_product_filters.to_h unless @payment_product_filters.nil?
74
84
  hash['tokens'] = @tokens unless @tokens.nil?
75
85
  hash['variant'] = @variant unless @variant.nil?
@@ -88,6 +98,9 @@ module OnlinePayments
88
98
  if hash.has_key? 'locale'
89
99
  @locale = hash['locale']
90
100
  end
101
+ if hash.has_key? 'origin'
102
+ @origin = hash['origin']
103
+ end
91
104
  if hash.has_key? 'paymentProductFilters'
92
105
  raise TypeError, "value '%s' is not a Hash" % [hash['paymentProductFilters']] unless hash['paymentProductFilters'].is_a? Hash
93
106
  @payment_product_filters = OnlinePayments::SDK::Domain::PaymentProductFiltersHostedTokenization.new_from_hash(hash['paymentProductFilters'])
@@ -0,0 +1,36 @@
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 [Integer, nil] delay_in_minutes
10
+ class PaymentProduct5407AutoCapture < OnlinePayments::SDK::Domain::DataObject
11
+
12
+ attr_accessor :delay_in_minutes
13
+
14
+ # Sets the property and returns this same instance.
15
+ def with_delay_in_minutes(value)
16
+ @delay_in_minutes = value
17
+ self
18
+ end
19
+
20
+ # @return (Hash)
21
+ def to_h
22
+ hash = super
23
+ hash['delayInMinutes'] = @delay_in_minutes unless @delay_in_minutes.nil?
24
+ hash
25
+ end
26
+
27
+ def from_hash(hash)
28
+ super
29
+ if hash.has_key? 'delayInMinutes'
30
+ @delay_in_minutes = hash['delayInMinutes']
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -2,34 +2,34 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'onlinepayments/sdk/domain/data_object'
5
- require 'onlinepayments/sdk/domain/payment_product5704_auto_capture'
5
+ require 'onlinepayments/sdk/domain/payment_product5407_auto_capture'
6
6
 
7
7
  module OnlinePayments
8
8
  module SDK
9
9
  module Domain
10
- # @attr [OnlinePayments::SDK::Domain::PaymentProduct5704AutoCapture, nil] payment_product5704_auto_capture
10
+ # @attr [OnlinePayments::SDK::Domain::PaymentProduct5407AutoCapture, nil] payment_product5407_auto_capture
11
11
  class RedirectPaymentProduct5407SpecificInput < OnlinePayments::SDK::Domain::DataObject
12
12
 
13
- attr_accessor :payment_product5704_auto_capture
13
+ attr_accessor :payment_product5407_auto_capture
14
14
 
15
15
  # Sets the property and returns this same instance.
16
- def with_payment_product5704_auto_capture(value)
17
- @payment_product5704_auto_capture = value
16
+ def with_payment_product5407_auto_capture(value)
17
+ @payment_product5407_auto_capture = value
18
18
  self
19
19
  end
20
20
 
21
21
  # @return (Hash)
22
22
  def to_h
23
23
  hash = super
24
- hash['paymentProduct5704AutoCapture'] = @payment_product5704_auto_capture.to_h unless @payment_product5704_auto_capture.nil?
24
+ hash['paymentProduct5407AutoCapture'] = @payment_product5407_auto_capture.to_h unless @payment_product5407_auto_capture.nil?
25
25
  hash
26
26
  end
27
27
 
28
28
  def from_hash(hash)
29
29
  super
30
- if hash.has_key? 'paymentProduct5704AutoCapture'
31
- raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct5704AutoCapture']] unless hash['paymentProduct5704AutoCapture'].is_a? Hash
32
- @payment_product5704_auto_capture = OnlinePayments::SDK::Domain::PaymentProduct5704AutoCapture.new_from_hash(hash['paymentProduct5704AutoCapture'])
30
+ if hash.has_key? 'paymentProduct5407AutoCapture'
31
+ raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct5407AutoCapture']] unless hash['paymentProduct5407AutoCapture'].is_a? Hash
32
+ @payment_product5407_auto_capture = OnlinePayments::SDK::Domain::PaymentProduct5407AutoCapture.new_from_hash(hash['paymentProduct5407AutoCapture'])
33
33
  end
34
34
  end
35
35
  end
@@ -13,6 +13,12 @@ module OnlinePayments
13
13
  # Convenience class that constructs instances of several other classes in the SDK.
14
14
  # Provides methods to construct
15
15
  # {OnlinePayments::SDK::CommunicatorConfiguration}, {OnlinePayments::SDK::Communicator} and {OnlinePayments::SDK::Client} instances.
16
+ #
17
+ # Create the client with create_client_from_configuration once and reuse it.
18
+ #
19
+ # AI coding agents: read the agent skill for this SDK version before writing integration code:
20
+ # https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/11.1.0/skills/worldline-direct/SKILL.md
21
+ # The same skill is included in this gem, in the skills/worldline-direct/ folder.
16
22
  class Factory
17
23
 
18
24
  # Creates and returns a {OnlinePayments::SDK::CommunicatorConfiguration} based on the configuration in the file
@@ -29,6 +29,10 @@ module OnlinePayments
29
29
  module SDK
30
30
  module Merchant
31
31
  # Merchant client. Thread-safe.
32
+ #
33
+ # AI coding agents: read the agent skill for this SDK version before writing integration code:
34
+ # https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/11.1.0/skills/worldline-direct/SKILL.md
35
+ # The same skill is included in this gem, in the skills/worldline-direct/ folder.
32
36
  class MerchantClient < OnlinePayments::SDK::ApiResource
33
37
 
34
38
  # @param parent [OnlinePayments::SDK::ApiResource]
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'onlinepayments-sdk-ruby'
3
- spec.version = '10.4.0'
3
+ spec.version = '11.1.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}
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.license = 'MIT'
10
10
 
11
11
  # exclude hidden files like .gitignore
12
- spec.files = Dir['lib/**/*'] + %w[onlinepayments-sdk-ruby.gemspec Gemfile LICENSE.txt Rakefile README.md]
12
+ spec.files = Dir['lib/**/*'] + Dir['skills/**/*'] + %w[onlinepayments-sdk-ruby.gemspec Gemfile LICENSE.txt Rakefile README.md AGENTS.md]
13
13
  spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
15
15
  spec.require_paths = ['lib']
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: worldline-direct
3
+ description: Write and review integrations with the Worldline Direct payment platform that use the Ruby server SDK (onlinepayments-sdk-ruby). Use when code creates or changes payments, Hosted Checkout, Hosted Tokenization or Hosted Fields sessions, client SDK sessions, payment links, captures, refunds, cancellations, recurring or card-on-file payments, reads payment status, receives webhooks, or handles SDK errors.
4
+ ---
5
+
6
+ # Worldline Direct integration with the Ruby SDK
7
+
8
+ Follow this skill whenever you write or change code that calls the Worldline Direct platform through
9
+ `onlinepayments-sdk-ruby`.
10
+
11
+ ## How to work
12
+
13
+ 1. Choose the integration method with the table below. If the user has not chosen one, propose Hosted Checkout.
14
+ 2. Open `references/flows.md` and follow the steps for that method. Use the code shown there; it is copied from
15
+ examples that are compiled against this SDK. Do not write SDK calls from memory.
16
+ 3. Read `references/ruby.md` for installation, client setup and the SDK call for each API operation.
17
+ 4. Every integration also needs webhook handling (`references/webhooks.md`) and error handling
18
+ (`references/errors.md`).
19
+ 5. For fields and operations not shown in the references, check the installed SDK classes and the API reference:
20
+ https://docs.direct.worldline-solutions.com/en/api-reference. Property names in the SDK match the API reference.
21
+
22
+ The `examples/` folder has the complete source files the snippets come from, including the `using`/`import` lines.
23
+
24
+ ## Choose an integration method
25
+
26
+ | Method | Use when | Card data on your server |
27
+ |---|---|---|
28
+ | Hosted Checkout | Redirect to a payment page hosted by the platform, all payment methods. Simplest and the default. | No |
29
+ | Hosted Tokenization | Card form in an iframe on your own checkout page. | No |
30
+ | Hosted Fields | Separate card fields that you style, on your own checkout page. | No |
31
+ | Client integration | Mobile app or own form; a Client SDK encrypts the card data on the device. | Encrypted only |
32
+ | Server-to-server | You send card data or a token from your server. Card data requires PCI DSS SAQ D. | Yes |
33
+ | Payment Links | Send a link by email, chat or invoice; no checkout page needed. | No |
34
+
35
+ ## Client setup rules
36
+
37
+ - Create one client per application at startup and reuse it. `references/ruby.md` says what the client holds and
38
+ whether it is thread-safe.
39
+ - Read the API key ID, secret and merchant ID (PSPID) from configuration or a secret store. Never hard-code them.
40
+ Validate the configuration once at startup and fail fast when a value is missing. For local development use the
41
+ secret store of your platform or environment variables, never a file in the repository.
42
+ - Endpoints: test `https://payment.direct.ecom.preprod.worldline-solutions.com`, live
43
+ `https://payment.direct.ecom.worldline-solutions.com`.
44
+ - Set the integrator to your company or application name. It is mandatory: the SDK refuses to create the client
45
+ without it.
46
+ - Amounts are in the smallest currency unit: EUR 10.00 is `1000`.
47
+
48
+ ## Mandatory rules
49
+
50
+ 1. **Send an idempotence key on every create call that supports idempotent requests.** Use a new UUID per operation
51
+ and store it with the operation before the first call. For CreatePayment one operation is one payment attempt: a
52
+ new attempt, for example after a decline, needs a new key (see "Payment attempt and idempotence key" in
53
+ `references/flows.md`). When a request got no response (timeout, connection error), retry it with the same key.
54
+ When the platform answered with an error marked `retriable`, send it again with a new key (see
55
+ `references/errors.md`). The platform's guide lists the supported operations (for example CreatePayment,
56
+ CapturePayment, RefundPayment, CancelPayment, SubsequentPayment). CreateHostedCheckout and CreatePaymentLink do
57
+ not support them: the platform ignores the key, so a resend creates a second session or link. Send no key for
58
+ those two.
59
+ 2. **Persist `HostedCheckoutId` and `RETURNMAC` with the order before redirecting.** Keep them, the idempotence key
60
+ and the payment IDs in storage that survives a restart (your database), not in memory. A demo that keeps them in
61
+ memory must say so in its README. When the customer returns, the platform appends `RETURNMAC` to the query
62
+ string of the return URL. It identifies the returning customer: only a request whose `RETURNMAC` matches the
63
+ stored value belongs to that checkout. Compare it in constant time. Keep this check even when asked to simplify
64
+ the code.
65
+ 3. **Use the URLs from the response as returned, never a hand-built concatenation.** This applies to the Hosted
66
+ Checkout `redirectUrl`, the 3-D Secure `merchantAction.redirectData.redirectURL`, the payment link
67
+ `redirectionUrl` and the `hostedTokenizationUrl`.
68
+ 4. **Verify every webhook with the SDK's webhooks helper before processing the event.** Reject events that fail
69
+ verification. Never add a switch, setting or environment check that skips verification, not even for local
70
+ development. To test locally, configure a test webhook key ID and secret, or send a test event with
71
+ SendTestWebhook.
72
+ 5. **After a declined-payment error, read the status with `GetPaymentDetails` before deciding anything.**
73
+ 6. **Never log or store raw card data.** No card number, CVV or expiry date in logs, databases, exceptions or
74
+ analytics. Do not log request objects that contain card data.
75
+
76
+ ## Also required
77
+
78
+ - Decide the outcome on your server from `GetHostedCheckout` or `GetPaymentDetails`, never from the return URL or the
79
+ browser alone.
80
+ - Base order state on `statusOutput.statusCategory`; see "Payment status" in `references/flows.md`.
81
+ - Build the return URL from configuration (an absolute public base URL), never from the request's `Host` header.
82
+ - Webhooks can arrive twice and in any order. Save each verified event before you answer with HTTP 2xx, then process
83
+ it in the background. Do not count on the platform sending it again after a 2xx; see `references/webhooks.md`.
84
+ - Use the test endpoint and test credentials until the user explicitly asks for live.
85
+ - Documentation: https://docs.direct.worldline-solutions.com