onlinepayments-sdk-ruby 11.0.0 → 12.0.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/AGENTS.md +25 -0
- data/README.md +152 -44
- data/Rakefile +8 -0
- data/lib/onlinepayments/sdk/api_exception.rb +5 -2
- data/lib/onlinepayments/sdk/api_resource.rb +19 -12
- data/lib/onlinepayments/sdk/authentication/authenticator.rb +2 -1
- data/lib/onlinepayments/sdk/authentication/authorization_type.rb +3 -1
- data/lib/onlinepayments/sdk/authentication/v1hmac_authenticator.rb +23 -19
- data/lib/onlinepayments/sdk/authentication.rb +2 -0
- data/lib/onlinepayments/sdk/authorization_exception.rb +2 -0
- data/lib/onlinepayments/sdk/call_context.rb +3 -7
- data/lib/onlinepayments/sdk/client.rb +4 -1
- data/lib/onlinepayments/sdk/communication/communication_exception.rb +2 -1
- data/lib/onlinepayments/sdk/communication/connection.rb +2 -0
- data/lib/onlinepayments/sdk/communication/default_connection.rb +187 -206
- data/lib/onlinepayments/sdk/communication/metadata_provider.rb +37 -47
- data/lib/onlinepayments/sdk/communication/multipart_form_data_object.rb +8 -17
- data/lib/onlinepayments/sdk/communication/multipart_form_data_request.rb +2 -0
- data/lib/onlinepayments/sdk/communication/not_found_exception.rb +2 -1
- data/lib/onlinepayments/sdk/communication/param_request.rb +2 -0
- data/lib/onlinepayments/sdk/communication/pooled_connection.rb +5 -5
- data/lib/onlinepayments/sdk/communication/request_header.rb +11 -15
- data/lib/onlinepayments/sdk/communication/request_param.rb +5 -6
- data/lib/onlinepayments/sdk/communication/response_exception.rb +7 -11
- data/lib/onlinepayments/sdk/communication/response_header.rb +17 -24
- data/lib/onlinepayments/sdk/communication.rb +2 -0
- data/lib/onlinepayments/sdk/communicator.rb +100 -175
- data/lib/onlinepayments/sdk/communicator_configuration.rb +71 -53
- data/lib/onlinepayments/sdk/declined_payment_exception.rb +2 -0
- data/lib/onlinepayments/sdk/declined_payout_exception.rb +2 -0
- data/lib/onlinepayments/sdk/declined_refund_exception.rb +2 -0
- data/lib/onlinepayments/sdk/declined_transaction_exception.rb +2 -0
- data/lib/onlinepayments/sdk/domain/acceptance.rb +13 -3
- data/lib/onlinepayments/sdk/domain/account_on_file.rb +17 -6
- data/lib/onlinepayments/sdk/domain/account_on_file_attribute.rb +15 -4
- data/lib/onlinepayments/sdk/domain/account_on_file_display_hints.rb +12 -3
- data/lib/onlinepayments/sdk/domain/acquirer_information.rb +12 -3
- data/lib/onlinepayments/sdk/domain/acquirer_selection_information.rb +13 -3
- data/lib/onlinepayments/sdk/domain/add_authorization_details_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/additional_order_input.rb +19 -8
- data/lib/onlinepayments/sdk/domain/address.rb +21 -7
- data/lib/onlinepayments/sdk/domain/address_personal.rb +26 -10
- data/lib/onlinepayments/sdk/domain/airline_data.rb +83 -27
- data/lib/onlinepayments/sdk/domain/airline_flight_leg.rb +69 -21
- data/lib/onlinepayments/sdk/domain/airline_passenger.rb +30 -8
- data/lib/onlinepayments/sdk/domain/amex.rb +15 -5
- data/lib/onlinepayments/sdk/domain/amount_breakdown.rb +11 -2
- data/lib/onlinepayments/sdk/domain/amount_of_money.rb +11 -2
- data/lib/onlinepayments/sdk/domain/api_error.rb +23 -8
- data/lib/onlinepayments/sdk/domain/api_parameters.rb +22 -10
- data/lib/onlinepayments/sdk/domain/apple_pay_line_item.rb +27 -7
- data/lib/onlinepayments/sdk/domain/apple_pay_recurring_payment_request.rb +19 -7
- data/lib/onlinepayments/sdk/domain/authentication_options.rb +15 -4
- data/lib/onlinepayments/sdk/domain/auto_capture.rb +9 -1
- data/lib/onlinepayments/sdk/domain/bank_account_iban.rb +9 -1
- data/lib/onlinepayments/sdk/domain/batch_metadata.rb +13 -3
- data/lib/onlinepayments/sdk/domain/browser_data.rb +17 -5
- data/lib/onlinepayments/sdk/domain/calculate_surcharge_request.rb +13 -4
- data/lib/onlinepayments/sdk/domain/calculate_surcharge_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/cancel_payment_batch_request.rb +12 -3
- data/lib/onlinepayments/sdk/domain/cancel_payment_request.rb +21 -9
- data/lib/onlinepayments/sdk/domain/cancel_payment_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/capture.rb +17 -6
- data/lib/onlinepayments/sdk/domain/capture_output.rb +57 -23
- data/lib/onlinepayments/sdk/domain/capture_payment_batch_request.rb +12 -3
- data/lib/onlinepayments/sdk/domain/capture_payment_request.rb +23 -10
- data/lib/onlinepayments/sdk/domain/capture_response.rb +17 -6
- data/lib/onlinepayments/sdk/domain/capture_status_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/captures_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/car_rental_data.rb +57 -19
- data/lib/onlinepayments/sdk/domain/car_rental_pickup_return_data.rb +21 -7
- data/lib/onlinepayments/sdk/domain/car_rental_vehicle_data.rb +11 -2
- data/lib/onlinepayments/sdk/domain/card.rb +15 -4
- data/lib/onlinepayments/sdk/domain/card_bin_details.rb +66 -20
- data/lib/onlinepayments/sdk/domain/card_data_without_cvv.rb +13 -3
- data/lib/onlinepayments/sdk/domain/card_essentials.rb +75 -23
- data/lib/onlinepayments/sdk/domain/card_fraud_results.rb +13 -3
- data/lib/onlinepayments/sdk/domain/card_info.rb +11 -2
- data/lib/onlinepayments/sdk/domain/card_installment_details.rb +6 -1
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input.rb +122 -50
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_base.rb +93 -39
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_for_hosted_checkout.rb +16 -5
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_output.rb +88 -36
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_output_summary.rb +12 -3
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_output_summary_card.rb +9 -1
- data/lib/onlinepayments/sdk/domain/card_payout_method_specific_input.rb +18 -6
- data/lib/onlinepayments/sdk/domain/card_recurrence_details.rb +9 -1
- data/lib/onlinepayments/sdk/domain/card_source.rb +16 -5
- data/lib/onlinepayments/sdk/domain/card_token.rb +21 -7
- data/lib/onlinepayments/sdk/domain/card_without_cvv.rb +13 -3
- data/lib/onlinepayments/sdk/domain/click_to_pay.rb +9 -1
- data/lib/onlinepayments/sdk/domain/company_information.rb +9 -1
- data/lib/onlinepayments/sdk/domain/complete_payment_card_payment_method_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/complete_payment_request.rb +13 -4
- data/lib/onlinepayments/sdk/domain/complete_payment_response.rb +16 -6
- data/lib/onlinepayments/sdk/domain/contact_details.rb +17 -5
- data/lib/onlinepayments/sdk/domain/create_certificate_response.rb +11 -2
- data/lib/onlinepayments/sdk/domain/create_hosted_checkout_request.rb +38 -16
- data/lib/onlinepayments/sdk/domain/create_hosted_checkout_response.rb +20 -7
- data/lib/onlinepayments/sdk/domain/create_hosted_fields_session_request.rb +17 -6
- data/lib/onlinepayments/sdk/domain/create_hosted_fields_session_response.rb +22 -9
- data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_request.rb +23 -9
- data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_response.rb +26 -8
- data/lib/onlinepayments/sdk/domain/create_mandate_request.rb +31 -9
- data/lib/onlinepayments/sdk/domain/create_mandate_response.rb +13 -4
- data/lib/onlinepayments/sdk/domain/create_mandate_with_return_url.rb +31 -9
- data/lib/onlinepayments/sdk/domain/create_payment_link_request.rb +61 -25
- data/lib/onlinepayments/sdk/domain/create_payment_request.rb +47 -19
- data/lib/onlinepayments/sdk/domain/create_payment_response.rb +16 -6
- data/lib/onlinepayments/sdk/domain/create_payout_request.rb +29 -11
- data/lib/onlinepayments/sdk/domain/create_token_request.rb +14 -4
- data/lib/onlinepayments/sdk/domain/created_payment_output.rb +12 -3
- data/lib/onlinepayments/sdk/domain/created_token_response.rb +22 -9
- data/lib/onlinepayments/sdk/domain/credit_card_specific_input_hosted_tokenization.rb +13 -4
- data/lib/onlinepayments/sdk/domain/credit_card_validation_rules.rb +11 -2
- data/lib/onlinepayments/sdk/domain/crm_token.rb +11 -2
- data/lib/onlinepayments/sdk/domain/csr_request.rb +9 -1
- data/lib/onlinepayments/sdk/domain/currency_conversion.rb +12 -3
- data/lib/onlinepayments/sdk/domain/currency_conversion_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/currency_conversion_request.rb +13 -4
- data/lib/onlinepayments/sdk/domain/currency_conversion_response.rb +15 -5
- data/lib/onlinepayments/sdk/domain/currency_conversion_result.rb +11 -2
- data/lib/onlinepayments/sdk/domain/currency_conversion_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/cursor_pagination_info.rb +11 -2
- data/lib/onlinepayments/sdk/domain/customer.rb +42 -16
- data/lib/onlinepayments/sdk/domain/customer_account.rb +36 -12
- data/lib/onlinepayments/sdk/domain/customer_account_authentication.rb +13 -3
- data/lib/onlinepayments/sdk/domain/customer_bank_account.rb +13 -3
- data/lib/onlinepayments/sdk/domain/customer_device.rb +28 -8
- data/lib/onlinepayments/sdk/domain/customer_device_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/customer_output.rb +10 -2
- data/lib/onlinepayments/sdk/domain/customer_payment_activity.rb +13 -3
- data/lib/onlinepayments/sdk/domain/customer_token.rb +16 -6
- data/lib/onlinepayments/sdk/domain/data_object.rb +19 -2
- data/lib/onlinepayments/sdk/domain/dcc_card_source.rb +16 -5
- data/lib/onlinepayments/sdk/domain/dcc_proposal.rb +20 -8
- data/lib/onlinepayments/sdk/domain/decrypted_payment_data.rb +17 -5
- data/lib/onlinepayments/sdk/domain/detokenization_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/detokenized_token_response.rb +27 -7
- data/lib/onlinepayments/sdk/domain/directory_entry.rb +13 -3
- data/lib/onlinepayments/sdk/domain/discount.rb +9 -1
- data/lib/onlinepayments/sdk/domain/dpa_data.rb +9 -1
- data/lib/onlinepayments/sdk/domain/dpa_transaction_options.rb +10 -2
- data/lib/onlinepayments/sdk/domain/empty_validator.rb +2 -0
- data/lib/onlinepayments/sdk/domain/error_response.rb +12 -3
- data/lib/onlinepayments/sdk/domain/external_cardholder_authentication_data.rb +36 -10
- data/lib/onlinepayments/sdk/domain/external_token_linked.rb +13 -3
- data/lib/onlinepayments/sdk/domain/feedbacks.rb +12 -3
- data/lib/onlinepayments/sdk/domain/fixed_list_validator.rb +10 -2
- data/lib/onlinepayments/sdk/domain/fraud_fields.rb +14 -4
- data/lib/onlinepayments/sdk/domain/fraud_results.rb +9 -1
- data/lib/onlinepayments/sdk/domain/g_pay_three_d_secure.rb +25 -7
- data/lib/onlinepayments/sdk/domain/get_batch_status_response.rb +15 -4
- data/lib/onlinepayments/sdk/domain/get_hosted_checkout_response.rb +12 -3
- data/lib/onlinepayments/sdk/domain/get_hosted_fields_session_response.rb +12 -3
- data/lib/onlinepayments/sdk/domain/get_hosted_tokenization_response.rb +12 -3
- data/lib/onlinepayments/sdk/domain/get_iin_details_request.rb +12 -3
- data/lib/onlinepayments/sdk/domain/get_iin_details_response.rb +76 -24
- data/lib/onlinepayments/sdk/domain/get_mandate_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/get_payment_links_by_merchant_group_request.rb +16 -6
- data/lib/onlinepayments/sdk/domain/get_payment_product_groups_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/get_payment_products_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/get_privacy_policy_response.rb +9 -1
- data/lib/onlinepayments/sdk/domain/gift_card_purchase.rb +12 -3
- data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_input.rb +48 -16
- data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_output.rb +11 -2
- data/lib/onlinepayments/sdk/domain/iin_detail.rb +72 -22
- data/lib/onlinepayments/sdk/domain/import_cof_series_request.rb +33 -11
- data/lib/onlinepayments/sdk/domain/import_cof_series_response.rb +9 -1
- data/lib/onlinepayments/sdk/domain/increment_authorization_request.rb +10 -2
- data/lib/onlinepayments/sdk/domain/increment_authorization_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/label_template_element.rb +11 -2
- data/lib/onlinepayments/sdk/domain/length_validator.rb +11 -2
- data/lib/onlinepayments/sdk/domain/line_item.rb +19 -8
- data/lib/onlinepayments/sdk/domain/line_item_detail.rb +13 -3
- data/lib/onlinepayments/sdk/domain/line_item_invoice_data.rb +9 -1
- data/lib/onlinepayments/sdk/domain/loan_recipient.rb +17 -5
- data/lib/onlinepayments/sdk/domain/lodging_data.rb +9 -1
- data/lib/onlinepayments/sdk/domain/mandate_address.rb +17 -5
- data/lib/onlinepayments/sdk/domain/mandate_address_response.rb +17 -5
- data/lib/onlinepayments/sdk/domain/mandate_contact_details.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mandate_customer.rb +21 -9
- data/lib/onlinepayments/sdk/domain/mandate_customer_response.rb +21 -9
- data/lib/onlinepayments/sdk/domain/mandate_merchant_action.rb +12 -3
- data/lib/onlinepayments/sdk/domain/mandate_personal_information.rb +12 -3
- data/lib/onlinepayments/sdk/domain/mandate_personal_information_response.rb +12 -3
- data/lib/onlinepayments/sdk/domain/mandate_personal_name.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mandate_personal_name_response.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mandate_redirect_data.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mandate_response.rb +22 -8
- data/lib/onlinepayments/sdk/domain/market_place.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mastercard.rb +14 -4
- data/lib/onlinepayments/sdk/domain/merchant_action.rb +21 -9
- data/lib/onlinepayments/sdk/domain/mobile_payment_data.rb +11 -2
- data/lib/onlinepayments/sdk/domain/mobile_payment_method_hosted_checkout_specific_input.rb +17 -6
- data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_input.rb +40 -14
- data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_output.rb +22 -9
- data/lib/onlinepayments/sdk/domain/mobile_payment_product302_specific_input.rb +17 -6
- data/lib/onlinepayments/sdk/domain/mobile_payment_product320_specific_input.rb +17 -6
- data/lib/onlinepayments/sdk/domain/mobile_three_d_secure_challenge_parameters.rb +15 -4
- data/lib/onlinepayments/sdk/domain/multiple_payment_information.rb +11 -2
- data/lib/onlinepayments/sdk/domain/network_token_data.rb +19 -6
- data/lib/onlinepayments/sdk/domain/network_token_essentials.rb +19 -6
- data/lib/onlinepayments/sdk/domain/network_token_linked.rb +13 -3
- data/lib/onlinepayments/sdk/domain/omnichannel_payment_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/omnichannel_payout_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/omnichannel_refund_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/omnichannel_subsequent_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/operation_output.rb +34 -12
- data/lib/onlinepayments/sdk/domain/operation_payment_references.rb +24 -6
- data/lib/onlinepayments/sdk/domain/order.rb +44 -18
- data/lib/onlinepayments/sdk/domain/order_line_details.rb +36 -10
- data/lib/onlinepayments/sdk/domain/order_references.rb +30 -8
- data/lib/onlinepayments/sdk/domain/order_status_output.rb +18 -6
- data/lib/onlinepayments/sdk/domain/order_type_information.rb +11 -2
- data/lib/onlinepayments/sdk/domain/other_details.rb +11 -2
- data/lib/onlinepayments/sdk/domain/pagination.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_account_on_file.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_context.rb +14 -4
- data/lib/onlinepayments/sdk/domain/payment_creation_output.rb +15 -4
- data/lib/onlinepayments/sdk/domain/payment_details_response.rb +23 -10
- data/lib/onlinepayments/sdk/domain/payment_error_response.rb +15 -5
- data/lib/onlinepayments/sdk/domain/payment_link_event.rb +13 -3
- data/lib/onlinepayments/sdk/domain/payment_link_order_input.rb +15 -5
- data/lib/onlinepayments/sdk/domain/payment_link_order_output.rb +15 -5
- data/lib/onlinepayments/sdk/domain/payment_link_overview_entry.rb +37 -11
- data/lib/onlinepayments/sdk/domain/payment_link_overview_filtering.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_link_overview_response.rb +15 -5
- data/lib/onlinepayments/sdk/domain/payment_link_overview_sorting.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_link_response.rb +38 -12
- data/lib/onlinepayments/sdk/domain/payment_link_specific_input.rb +13 -3
- data/lib/onlinepayments/sdk/domain/payment_output.rb +61 -25
- data/lib/onlinepayments/sdk/domain/payment_output_summary.rb +18 -7
- data/lib/onlinepayments/sdk/domain/payment_product.rb +55 -21
- data/lib/onlinepayments/sdk/domain/payment_product11.rb +17 -5
- data/lib/onlinepayments/sdk/domain/payment_product130_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product130_specific_three_d_secure.rb +15 -4
- data/lib/onlinepayments/sdk/domain/payment_product3012.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product3012_specific_input.rb +15 -4
- data/lib/onlinepayments/sdk/domain/payment_product3013_specific_input.rb +13 -3
- data/lib/onlinepayments/sdk/domain/payment_product302_specific_data.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product3203_specific_output.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_product3204_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product3208_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product3208_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product3209_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product3209_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product320_specific_data.rb +12 -3
- data/lib/onlinepayments/sdk/domain/payment_product350.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5001.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5001_specific_output.rb +17 -5
- data/lib/onlinepayments/sdk/domain/payment_product5002_specific_data.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product5002_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5002default_brand_parameters.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5100_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product5402_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product5404.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5407.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product5407_auto_capture.rb +6 -1
- data/lib/onlinepayments/sdk/domain/payment_product5412.rb +13 -3
- data/lib/onlinepayments/sdk/domain/payment_product5500_specific_output.rb +15 -4
- data/lib/onlinepayments/sdk/domain/payment_product5704_auto_capture.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product771_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product840.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product840_customer_account.rb +30 -8
- data/lib/onlinepayments/sdk/domain/payment_product840_specific_output.rb +33 -13
- data/lib/onlinepayments/sdk/domain/payment_product_display_hints.rb +13 -3
- data/lib/onlinepayments/sdk/domain/payment_product_field.rb +17 -6
- data/lib/onlinepayments/sdk/domain/payment_product_field_data_restrictions.rb +12 -3
- data/lib/onlinepayments/sdk/domain/payment_product_field_display_element.rb +15 -4
- data/lib/onlinepayments/sdk/domain/payment_product_field_display_hints.rb +38 -12
- data/lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb +12 -3
- data/lib/onlinepayments/sdk/domain/payment_product_field_tooltip.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product_field_validators.rb +42 -18
- data/lib/onlinepayments/sdk/domain/payment_product_filter.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_product_filter_hosted_tokenization.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_checkout.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_fields.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_tokenization.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payment_product_group.rb +18 -7
- data/lib/onlinepayments/sdk/domain/payment_product_networks_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product_session302_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/payment_product_session302_specific_output.rb +9 -1
- data/lib/onlinepayments/sdk/domain/payment_product_session_request.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_product_session_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/payment_references.rb +27 -7
- data/lib/onlinepayments/sdk/domain/payment_response.rb +32 -12
- data/lib/onlinepayments/sdk/domain/payment_status_output.rb +28 -8
- data/lib/onlinepayments/sdk/domain/payment_status_output_summary.rb +16 -5
- data/lib/onlinepayments/sdk/domain/payment_summary.rb +17 -6
- data/lib/onlinepayments/sdk/domain/payments_report_response.rb +13 -4
- data/lib/onlinepayments/sdk/domain/payout_card_payment_method_specific_output.rb +17 -6
- data/lib/onlinepayments/sdk/domain/payout_error_response.rb +15 -5
- data/lib/onlinepayments/sdk/domain/payout_output.rb +27 -9
- data/lib/onlinepayments/sdk/domain/payout_response.rb +17 -6
- data/lib/onlinepayments/sdk/domain/payout_result.rb +17 -6
- data/lib/onlinepayments/sdk/domain/payout_status_output.rb +13 -3
- data/lib/onlinepayments/sdk/domain/pending_authentication.rb +9 -1
- data/lib/onlinepayments/sdk/domain/personal_information.rb +14 -4
- data/lib/onlinepayments/sdk/domain/personal_information_token.rb +10 -2
- data/lib/onlinepayments/sdk/domain/personal_name.rb +13 -3
- data/lib/onlinepayments/sdk/domain/personal_name_token.rb +11 -2
- data/lib/onlinepayments/sdk/domain/problem_details_response.rb +17 -5
- data/lib/onlinepayments/sdk/domain/product302_recurring.rb +9 -1
- data/lib/onlinepayments/sdk/domain/product320_recurring.rb +9 -1
- data/lib/onlinepayments/sdk/domain/product_directory.rb +10 -2
- data/lib/onlinepayments/sdk/domain/protection_eligibility.rb +11 -2
- data/lib/onlinepayments/sdk/domain/range_validator.rb +11 -2
- data/lib/onlinepayments/sdk/domain/rate_details.rb +17 -5
- data/lib/onlinepayments/sdk/domain/reattempt_instructions.rb +14 -4
- data/lib/onlinepayments/sdk/domain/reattempt_instructions_conditions.rb +11 -2
- data/lib/onlinepayments/sdk/domain/redirect_data.rb +11 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_input.rb +117 -53
- data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_output.rb +50 -20
- data/lib/onlinepayments/sdk/domain/redirect_payment_product11_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3103_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3112_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3116_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3203_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3204_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3302_specific_input.rb +13 -3
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3306_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product3307_specific_input.rb +2 -0
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5001_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5300_specific_input.rb +33 -9
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5301_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5402_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5403_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5406_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5407_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5408_specific_input.rb +12 -3
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5410_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5412_specific_input.rb +11 -2
- data/lib/onlinepayments/sdk/domain/redirect_payment_product5601_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product809_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirect_payment_product840_specific_input.rb +15 -4
- data/lib/onlinepayments/sdk/domain/redirect_payment_product900_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/redirection_data.rb +9 -1
- data/lib/onlinepayments/sdk/domain/refund_card_method_specific_output.rb +27 -9
- data/lib/onlinepayments/sdk/domain/refund_e_wallet_method_specific_output.rb +14 -4
- data/lib/onlinepayments/sdk/domain/refund_error_response.rb +15 -5
- data/lib/onlinepayments/sdk/domain/refund_mobile_method_specific_output.rb +13 -3
- data/lib/onlinepayments/sdk/domain/refund_output.rb +49 -19
- data/lib/onlinepayments/sdk/domain/refund_payment_batch_request.rb +12 -3
- data/lib/onlinepayments/sdk/domain/refund_payment_product840_customer_account.rb +13 -3
- data/lib/onlinepayments/sdk/domain/refund_payment_product840_specific_output.rb +10 -2
- data/lib/onlinepayments/sdk/domain/refund_redirect_method_specific_output.rb +11 -2
- data/lib/onlinepayments/sdk/domain/refund_redirect_payment_method_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/refund_redirect_payment_product900_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/refund_request.rb +39 -15
- data/lib/onlinepayments/sdk/domain/refund_response.rb +17 -6
- data/lib/onlinepayments/sdk/domain/refunds_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/regular_expression_validator.rb +9 -1
- data/lib/onlinepayments/sdk/domain/revoke_mandate_request.rb +9 -1
- data/lib/onlinepayments/sdk/domain/send_test_request.rb +9 -1
- data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input.rb +12 -3
- data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input_base.rb +12 -3
- data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_output.rb +15 -5
- data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input.rb +12 -3
- data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input_base.rb +12 -3
- data/lib/onlinepayments/sdk/domain/session_data.rb +18 -6
- data/lib/onlinepayments/sdk/domain/session_details.rb +11 -2
- data/lib/onlinepayments/sdk/domain/session_request.rb +10 -2
- data/lib/onlinepayments/sdk/domain/session_response.rb +18 -6
- data/lib/onlinepayments/sdk/domain/share_payment_link_request.rb +13 -3
- data/lib/onlinepayments/sdk/domain/shipping.rb +35 -11
- data/lib/onlinepayments/sdk/domain/shipping_detail.rb +11 -2
- data/lib/onlinepayments/sdk/domain/shipping_method.rb +15 -4
- data/lib/onlinepayments/sdk/domain/shopping_cart.rb +27 -9
- data/lib/onlinepayments/sdk/domain/shopping_cart_extension.rb +16 -13
- data/lib/onlinepayments/sdk/domain/show_form_data.rb +42 -18
- data/lib/onlinepayments/sdk/domain/show_instructions_data.rb +9 -1
- data/lib/onlinepayments/sdk/domain/split_payment_product_filter.rb +10 -2
- data/lib/onlinepayments/sdk/domain/split_payment_product_filters_hosted_checkout.rb +13 -4
- data/lib/onlinepayments/sdk/domain/sub_merchant.rb +20 -7
- data/lib/onlinepayments/sdk/domain/submit_batch_request_body.rb +38 -16
- data/lib/onlinepayments/sdk/domain/submit_batch_response.rb +11 -2
- data/lib/onlinepayments/sdk/domain/subsequent_card_payment_method_specific_input.rb +32 -10
- data/lib/onlinepayments/sdk/domain/subsequent_payment_batch_request.rb +12 -3
- data/lib/onlinepayments/sdk/domain/subsequent_payment_product5001_specific_input.rb +9 -1
- data/lib/onlinepayments/sdk/domain/subsequent_payment_request.rb +22 -8
- data/lib/onlinepayments/sdk/domain/subsequent_payment_response.rb +10 -2
- data/lib/onlinepayments/sdk/domain/surcharge.rb +23 -10
- data/lib/onlinepayments/sdk/domain/surcharge_calculation_card.rb +11 -2
- data/lib/onlinepayments/sdk/domain/surcharge_for_payment_link.rb +9 -1
- data/lib/onlinepayments/sdk/domain/surcharge_rate.rb +15 -4
- data/lib/onlinepayments/sdk/domain/surcharge_specific_input.rb +12 -3
- data/lib/onlinepayments/sdk/domain/surcharge_specific_output.rb +15 -5
- data/lib/onlinepayments/sdk/domain/test_connection.rb +9 -1
- data/lib/onlinepayments/sdk/domain/three_d_secure.rb +45 -15
- data/lib/onlinepayments/sdk/domain/three_d_secure_base.rb +34 -10
- data/lib/onlinepayments/sdk/domain/three_d_secure_data.rb +13 -3
- data/lib/onlinepayments/sdk/domain/three_d_secure_results.rb +45 -13
- data/lib/onlinepayments/sdk/domain/three_ds_input_data.rb +13 -3
- data/lib/onlinepayments/sdk/domain/token_card.rb +12 -3
- data/lib/onlinepayments/sdk/domain/token_card_data.rb +15 -5
- data/lib/onlinepayments/sdk/domain/token_card_specific_input.rb +10 -2
- data/lib/onlinepayments/sdk/domain/token_data.rb +12 -3
- data/lib/onlinepayments/sdk/domain/token_e_wallet.rb +12 -3
- data/lib/onlinepayments/sdk/domain/token_info.rb +15 -4
- data/lib/onlinepayments/sdk/domain/token_response.rb +35 -13
- data/lib/onlinepayments/sdk/domain/transaction.rb +10 -2
- data/lib/onlinepayments/sdk/domain/update_authorization_additional_data_request.rb +10 -2
- data/lib/onlinepayments/sdk/domain/uploadable_file.rb +6 -8
- data/lib/onlinepayments/sdk/domain/validate_credentials_request.rb +11 -2
- data/lib/onlinepayments/sdk/domain/validate_credentials_response.rb +9 -1
- data/lib/onlinepayments/sdk/domain/value_mapping_element.rb +12 -3
- data/lib/onlinepayments/sdk/domain/visa.rb +18 -6
- data/lib/onlinepayments/sdk/domain/visa_authentication_options.rb +13 -3
- data/lib/onlinepayments/sdk/domain.rb +2 -0
- data/lib/onlinepayments/sdk/exception_factory.rb +3 -1
- data/lib/onlinepayments/sdk/factory.rb +131 -52
- data/lib/onlinepayments/sdk/idempotence_exception.rb +2 -0
- data/lib/onlinepayments/sdk/json/default_marshaller.rb +7 -5
- data/lib/onlinepayments/sdk/json/marshaller.rb +2 -1
- data/lib/onlinepayments/sdk/json/marshaller_syntax_exception.rb +2 -0
- data/lib/onlinepayments/sdk/json.rb +2 -0
- data/lib/onlinepayments/sdk/logging/communicator_logger.rb +4 -3
- data/lib/onlinepayments/sdk/logging/log_message_builder.rb +76 -69
- data/lib/onlinepayments/sdk/logging/logging_capable.rb +2 -1
- data/lib/onlinepayments/sdk/logging/obfuscation/body_obfuscator.rb +50 -49
- data/lib/onlinepayments/sdk/logging/obfuscation/header_obfuscator.rb +12 -15
- data/lib/onlinepayments/sdk/logging/obfuscation/obfuscation_capable.rb +27 -5
- data/lib/onlinepayments/sdk/logging/obfuscation/obfuscation_rule.rb +14 -16
- data/lib/onlinepayments/sdk/logging/obfuscation.rb +2 -0
- data/lib/onlinepayments/sdk/logging/request_log_message_builder.rb +18 -14
- data/lib/onlinepayments/sdk/logging/response_log_message_builder.rb +15 -13
- data/lib/onlinepayments/sdk/logging/ruby_communicator_logger.rb +12 -13
- data/lib/onlinepayments/sdk/logging/stdout_communicator_logger.rb +7 -5
- data/lib/onlinepayments/sdk/logging.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/captures/captures_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/captures.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/cofseries/cof_series_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/cofseries.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/complete/complete_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/complete.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedcheckout/hosted_checkout_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedcheckout.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedfields.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedtokenization/hosted_tokenization_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/hostedtokenization.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/mandates.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/merchant_client.rb +6 -0
- data/lib/onlinepayments/sdk/merchant/merchantbatch/get_payments_report_params.rb +9 -0
- data/lib/onlinepayments/sdk/merchant/merchantbatch/merchant_batch_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/merchantbatch.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/paymentlinks.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/payments/payments_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/payments.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/payouts/payouts_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/payouts.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/preauthorization/pre_authorization_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/preauthorization.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/privacypolicy/get_privacy_policy_params.rb +9 -0
- data/lib/onlinepayments/sdk/merchant/privacypolicy/privacy_policy_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/privacypolicy.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/productgroups/get_product_group_params.rb +13 -0
- data/lib/onlinepayments/sdk/merchant/productgroups/get_product_groups_params.rb +13 -0
- data/lib/onlinepayments/sdk/merchant/productgroups/product_groups_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/productgroups.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/products/get_payment_product_networks_params.rb +11 -0
- data/lib/onlinepayments/sdk/merchant/products/get_payment_product_params.rb +14 -0
- data/lib/onlinepayments/sdk/merchant/products/get_payment_products_params.rb +14 -0
- data/lib/onlinepayments/sdk/merchant/products/get_product_directory_params.rb +9 -0
- data/lib/onlinepayments/sdk/merchant/products/products_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/products.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/refunds/refunds_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/refunds.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/services/services_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/services.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/sessions/sessions_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/sessions.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/subsequent/subsequent_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/subsequent.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/tokenization/get_card_data_by_payments_params.rb +8 -0
- data/lib/onlinepayments/sdk/merchant/tokenization/get_card_data_by_tokens_params.rb +8 -0
- data/lib/onlinepayments/sdk/merchant/tokenization/tokenization_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/tokenization.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/tokens.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb +2 -0
- data/lib/onlinepayments/sdk/merchant/webhooks.rb +2 -0
- data/lib/onlinepayments/sdk/merchant.rb +2 -0
- data/lib/onlinepayments/sdk/platform_exception.rb +2 -0
- data/lib/onlinepayments/sdk/problem_details_exception.rb +2 -0
- data/lib/onlinepayments/sdk/proxy_configuration.rb +22 -18
- data/lib/onlinepayments/sdk/reference_exception.rb +2 -0
- data/lib/onlinepayments/sdk/validation_exception.rb +2 -0
- data/lib/onlinepayments/sdk/version.rb +8 -0
- data/lib/onlinepayments/sdk/webhooks/api_version_mismatch_exception.rb +3 -3
- data/lib/onlinepayments/sdk/webhooks/in_memory_secret_key_store.rb +7 -4
- data/lib/onlinepayments/sdk/webhooks/secret_key_not_available_exception.rb +4 -2
- data/lib/onlinepayments/sdk/webhooks/secret_key_store.rb +2 -1
- data/lib/onlinepayments/sdk/webhooks/signature_validation_exception.rb +2 -1
- data/lib/onlinepayments/sdk/webhooks/signature_validator.rb +13 -10
- data/lib/onlinepayments/sdk/webhooks/webhooks_event.rb +38 -62
- data/lib/onlinepayments/sdk/webhooks/webhooks_helper.rb +3 -1
- data/lib/onlinepayments/sdk/webhooks.rb +2 -0
- data/lib/onlinepayments/sdk.rb +2 -0
- data/onlinepayments-sdk-ruby.gemspec +13 -8
- data/skills/worldline-direct/SKILL.md +85 -0
- data/skills/worldline-direct/examples/after_payment_operations_example.rb +75 -0
- data/skills/worldline-direct/examples/app_types.rb +170 -0
- data/skills/worldline-direct/examples/client_integration_example.rb +76 -0
- data/skills/worldline-direct/examples/client_setup.rb +57 -0
- data/skills/worldline-direct/examples/create_payment_response_handler.rb +32 -0
- data/skills/worldline-direct/examples/customer_device.rb +32 -0
- data/skills/worldline-direct/examples/error_handling_example.rb +99 -0
- data/skills/worldline-direct/examples/hosted_checkout_example.rb +181 -0
- data/skills/worldline-direct/examples/hosted_fields_example.rb +82 -0
- data/skills/worldline-direct/examples/hosted_tokenization_example.rb +79 -0
- data/skills/worldline-direct/examples/payment_attempt.rb +30 -0
- data/skills/worldline-direct/examples/payment_links_example.rb +52 -0
- data/skills/worldline-direct/examples/payment_status_example.rb +62 -0
- data/skills/worldline-direct/examples/recurring_payments_example.rb +127 -0
- data/skills/worldline-direct/examples/server_to_server_example.rb +81 -0
- data/skills/worldline-direct/examples/webhook_event_processor.rb +40 -0
- data/skills/worldline-direct/examples/webhooks_endpoint.rb +73 -0
- data/skills/worldline-direct/examples/webhooks_setup.rb +41 -0
- data/skills/worldline-direct/references/errors.md +113 -0
- data/skills/worldline-direct/references/flows.md +966 -0
- data/skills/worldline-direct/references/ruby.md +209 -0
- data/skills/worldline-direct/references/webhooks.md +167 -0
- metadata +100 -23
- data/lib/onlinepayments/sdk/domain/credit_card_validation_rules_hosted_tokenization.rb +0 -37
- data/lib/onlinepayments/sdk/domain/payment_links_response.rb +0 -35
- data/lib/onlinepayments/sdk/domain/shopping_cart_output.rb +0 -35
- data/lib/onlinepayments/sdk/merchant/paymentlinks/get_payment_links_in_bulk_params.rb +0 -28
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Ruby SDK reference
|
|
2
|
+
|
|
3
|
+
How to install and set up the Ruby SDK (`onlinepayments-sdk-ruby`), and the SDK calls for the API operations used in
|
|
4
|
+
this skill.
|
|
5
|
+
Source code and README: https://github.com/wl-online-payments-direct/sdk-ruby
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
gem install onlinepayments-sdk-ruby
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or add `gem 'onlinepayments-sdk-ruby'` to your `Gemfile` and run `bundle install`. The SDK needs Ruby 3.4 or higher and uses
|
|
14
|
+
`net-http-persistent` for HTTP and `concurrent-ruby`. `require 'onlinepayments/sdk'` loads the whole SDK. The classes have YARD comments with the
|
|
15
|
+
types of every property, parameter and return value; there are no RBS or Sorbet signatures.
|
|
16
|
+
|
|
17
|
+
## Namespaces
|
|
18
|
+
|
|
19
|
+
Use the full names; the examples do too.
|
|
20
|
+
|
|
21
|
+
| Namespace | Contains |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `OnlinePayments::SDK` | `Factory`, `CommunicatorConfiguration`, `Client`, `CallContext`, the API exceptions (`ApiException`, `DeclinedPaymentException`, ...) |
|
|
24
|
+
| `OnlinePayments::SDK::Merchant` | `MerchantClient` and the sub-clients, e.g. `Payments::PaymentsClient` |
|
|
25
|
+
| `OnlinePayments::SDK::Domain` | Every request and response class, e.g. `CreatePaymentRequest`, `Order`, `AmountOfMoney` |
|
|
26
|
+
| `OnlinePayments::SDK::Authentication` | `AuthorizationType::V1HMAC` |
|
|
27
|
+
| `OnlinePayments::SDK::Communication` | `CommunicationException`, `RequestHeader` |
|
|
28
|
+
| `OnlinePayments::SDK::Webhooks` | `WebhooksHelper`, `WebhooksEvent`, `InMemorySecretKeyStore`, `SecretKeyStore`, `SignatureValidationException`, `SecretKeyNotAvailableException`, `ApiVersionMismatchException` |
|
|
29
|
+
| `OnlinePayments::SDK::JSON` | `DefaultMarshaller` |
|
|
30
|
+
| `OnlinePayments::SDK::Logging` | `RubyCommunicatorLogger`, `StdoutCommunicatorLogger`; `Obfuscation::BodyObfuscator` and the rules `Obfuscation.obfuscate_all`, ... |
|
|
31
|
+
|
|
32
|
+
## Client setup
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# Create the client once when the application starts, reuse it for every request and close it on shutdown.
|
|
36
|
+
# Every value is validated here, so a wrong configuration stops the application at startup.
|
|
37
|
+
# @return [OnlinePayments::SDK::Client]
|
|
38
|
+
def self.create_client
|
|
39
|
+
OnlinePayments::SDK::Factory.create_client(
|
|
40
|
+
# Test or live endpoint, e.g. https://payment.direct.ecom.preprod.worldline-solutions.com (without a path).
|
|
41
|
+
api_endpoint: required_env('ONLINEPAYMENTS_API_ENDPOINT'),
|
|
42
|
+
api_key_id: required_env('ONLINEPAYMENTS_API_KEY_ID'),
|
|
43
|
+
secret_api_key: required_env('ONLINEPAYMENTS_SECRET_API_KEY'),
|
|
44
|
+
# Your company or application name; it identifies your requests in the platform logs.
|
|
45
|
+
# Required: without it, the SDK raises ArgumentError "integrator is required".
|
|
46
|
+
integrator: required_env('ONLINEPAYMENTS_INTEGRATOR'),
|
|
47
|
+
# In seconds. Both are required and must be positive, otherwise the SDK raises ArgumentError.
|
|
48
|
+
connect_timeout: 5,
|
|
49
|
+
socket_timeout: 300,
|
|
50
|
+
max_connections: 10
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# The merchant ID is your PSPID. All API calls start from the merchant client.
|
|
55
|
+
# @param client [OnlinePayments::SDK::Client]
|
|
56
|
+
# @return [OnlinePayments::SDK::Merchant::MerchantClient]
|
|
57
|
+
def self.create_merchant_client(client)
|
|
58
|
+
client.merchant(required_env('ONLINEPAYMENTS_MERCHANT_ID'))
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# The absolute public base URL of your shop, e.g. https://shop.example. The return URL of a checkout is built from
|
|
62
|
+
# it, never from the Host header of a request, which the sender controls.
|
|
63
|
+
# @return [String] without a trailing slash
|
|
64
|
+
def self.public_base_url
|
|
65
|
+
value = required_env('SHOP_PUBLIC_BASE_URL')
|
|
66
|
+
uri = URI.parse(value)
|
|
67
|
+
unless uri.is_a?(URI::HTTP) && uri.host && !uri.host.empty? && uri.query.nil? && uri.fragment.nil?
|
|
68
|
+
raise "SHOP_PUBLIC_BASE_URL must be an absolute http(s) URL without query or fragment, e.g. https://shop.example"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
value.strip.chomp('/')
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Read credentials from the environment or, better, a secret store of your platform, and never hard-code them.
|
|
75
|
+
# For local development keep them in your own environment or a local secret store, not in a file in the repository.
|
|
76
|
+
# A blank value counts as missing.
|
|
77
|
+
# @param name [String]
|
|
78
|
+
# @return [String]
|
|
79
|
+
def self.required_env(name)
|
|
80
|
+
value = ENV[name]
|
|
81
|
+
raise "Environment variable #{name} is not set" if value.nil? || value.strip.empty?
|
|
82
|
+
|
|
83
|
+
value
|
|
84
|
+
end
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `Factory.create_client` takes keyword arguments only and uses the V1HMAC authorization. `api_endpoint`,
|
|
88
|
+
`api_key_id`, `secret_api_key`, `integrator`, `connect_timeout` and `socket_timeout` are required. The `integrator`
|
|
89
|
+
must not be blank (`ArgumentError: integrator is required`). The timeouts are in seconds and must be positive
|
|
90
|
+
(`ArgumentError: connect_timeout must be positive`). `max_connections` (connection pool size) defaults to 10.
|
|
91
|
+
- `Factory.create_client_from_env` reads the same values from `ONLINEPAYMENTS_API_ENDPOINT`,
|
|
92
|
+
`ONLINEPAYMENTS_API_KEY_ID`, `ONLINEPAYMENTS_SECRET_API_KEY`, `ONLINEPAYMENTS_INTEGRATOR`,
|
|
93
|
+
`ONLINEPAYMENTS_CONNECT_TIMEOUT` and `ONLINEPAYMENTS_SOCKET_TIMEOUT`, and raises `ArgumentError` when one is missing
|
|
94
|
+
or invalid.
|
|
95
|
+
- `api_endpoint` is the scheme and host only (`https://payment.direct.ecom.preprod.worldline-solutions.com`); a path
|
|
96
|
+
raises `RuntimeError: api_endpoint should not contain a path`.
|
|
97
|
+
- `Factory.create_client_from_file(yaml_file, api_key_id, secret_api_key)` reads the other settings from a YAML file
|
|
98
|
+
with the keys `onlinePayments.api.endpoint.host`, `onlinePayments.api.authorizationType`,
|
|
99
|
+
`onlinePayments.api.integrator`, `onlinePayments.api.connectTimeout`, `onlinePayments.api.socketTimeout`, ... The
|
|
100
|
+
merchant ID is not part of the client configuration.
|
|
101
|
+
- The client holds a connection pool and is thread-safe. Create it once per process (an initializer in Rails, a
|
|
102
|
+
constant or `set` in Sinatra) and call `client.close` on shutdown, e.g. in `at_exit`. With a block,
|
|
103
|
+
`Factory.create_client(...) { |client| ... }` closes it at the end of the block.
|
|
104
|
+
`client.merchant(merchant_id)` is cheap.
|
|
105
|
+
|
|
106
|
+
## Conventions
|
|
107
|
+
|
|
108
|
+
- Calls are synchronous and return the response object. They raise exceptions (see below).
|
|
109
|
+
- Request and response classes take their attributes as keyword arguments:
|
|
110
|
+
`OnlinePayments::SDK::Domain::AmountOfMoney.new(amount: 1000, currency_code: 'EUR')`. The attributes can also be set
|
|
111
|
+
afterwards (`amount.amount = 1000`), and each attribute has a `with_<name>(value)` method that returns the object. The
|
|
112
|
+
names are the API names in snake_case (`order.amountOfMoney` is `order.amount_of_money`). Exceptions: `RETURNMAC`
|
|
113
|
+
is `returnmac`, `subsequentcardPaymentMethodSpecificInput` is `subsequentcard_payment_method_specific_input`.
|
|
114
|
+
- A misspelled attribute raises `NoMethodError` when the line runs; an unknown keyword argument raises
|
|
115
|
+
`ArgumentError`. Nothing checks this before you run the code, so copy the names from the examples or the SDK source.
|
|
116
|
+
- All attributes can be `nil` in responses: use `&.` and compare flags with `== true`.
|
|
117
|
+
- Date and time attributes (e.g. `expiration_date`) take a `DateTime`, e.g. `(Time.now + 3600).to_datetime`.
|
|
118
|
+
- `to_h` returns a `Hash` with the API property names, e.g. to send a response object to your page as JSON
|
|
119
|
+
(`response.to_h.to_json`); `from_hash(hash)` fills an object from such a hash.
|
|
120
|
+
- Every call has an optional `context` argument. Set the idempotence key with `CallContext.new(key)`, for example
|
|
121
|
+
with `SecureRandom.uuid`. The key is a positional argument: `CallContext.new(idempotence_key: key)` stores a `Hash`
|
|
122
|
+
as the key. After the call, `context.idempotence_request_timestamp` is set if the platform returned the result of an
|
|
123
|
+
earlier request with the same key. A `CallContext` is not thread-safe: create one per request. `create_hosted_checkout` and `create_payment_link`
|
|
124
|
+
ignore an idempotence key, so the examples call them without a context.
|
|
125
|
+
- Attributes marked `@deprecated` in their YARD comment are deprecated in the API. Use the replacement named there.
|
|
126
|
+
|
|
127
|
+
## API operations used in this skill
|
|
128
|
+
|
|
129
|
+
All calls start from the merchant client: `merchant = client.merchant(merchant_id)`.
|
|
130
|
+
|
|
131
|
+
| API operation | SDK call | Used in |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| CreateHostedCheckout | `merchant.hosted_checkout.create_hosted_checkout(CreateHostedCheckoutRequest)` | Hosted Checkout, recurring payments |
|
|
134
|
+
| GetHostedCheckout | `merchant.hosted_checkout.get_hosted_checkout(hosted_checkout_id)` | Hosted Checkout |
|
|
135
|
+
| CreateHostedTokenization | `merchant.hosted_tokenization.create_hosted_tokenization(CreateHostedTokenizationRequest)` | Hosted Tokenization |
|
|
136
|
+
| CreateHostedFieldsSession | `merchant.hosted_fields.create_hosted_fields_session(CreateHostedFieldsSessionRequest)` | Hosted Fields |
|
|
137
|
+
| CreateSession | `merchant.sessions.create_session(SessionRequest)` | Client integration |
|
|
138
|
+
| CreatePayment | `merchant.payments.create_payment(CreatePaymentRequest, context)` | Server-to-server, Hosted Tokenization, Hosted Fields, client integration |
|
|
139
|
+
| GetPaymentDetails | `merchant.payments.get_payment_details(payment_id)` | Payment status, webhooks, error handling |
|
|
140
|
+
| CapturePayment | `merchant.payments.capture_payment(payment_id, CapturePaymentRequest, context)` | After-payment operations |
|
|
141
|
+
| RefundPayment | `merchant.payments.refund_payment(payment_id, RefundRequest, context)` | After-payment operations |
|
|
142
|
+
| CancelPayment | `merchant.payments.cancel_payment(payment_id, CancelPaymentRequest, context)` | After-payment operations |
|
|
143
|
+
| SubsequentPayment | `merchant.subsequent.subsequent_payment(payment_id, SubsequentPaymentRequest, context)` | Recurring payments |
|
|
144
|
+
| CreatePaymentLink | `merchant.payment_links.create_payment_link(CreatePaymentLinkRequest)` | Payment Links |
|
|
145
|
+
| GetPaymentLinkById | `merchant.payment_links.get_payment_link_by_id(payment_link_id)` | Payment Links |
|
|
146
|
+
|
|
147
|
+
For anything else, use the API reference; the SDK's sub-clients and method names are the operation names there in
|
|
148
|
+
snake_case.
|
|
149
|
+
|
|
150
|
+
## Exceptions
|
|
151
|
+
|
|
152
|
+
All are in `OnlinePayments::SDK` unless noted. Rescue the specific ones before `ApiException`.
|
|
153
|
+
|
|
154
|
+
| Exception | When |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `DeclinedPaymentException` | The error response carries a payment result: a declined payment (seen with 402 and 403), also for `subsequent_payment`. The body decides, not the status. `payment_result` holds the created payment (`.payment.id`). |
|
|
157
|
+
| `DeclinedRefundException` | The error response carries a refund result (the body decides, not the status). `refund_result` holds it. |
|
|
158
|
+
| `IdempotenceException` | 409 on a call with an idempotence key, with a single error with error code `30001002`: a request with the same idempotence key is still running. Has `idempotence_key`. |
|
|
159
|
+
| `ValidationException` | 400: invalid request, including an operation that the payment's state does not allow (error `id` `ACTION_NOT_ALLOWED_ON_TRANSACTION`). |
|
|
160
|
+
| `AuthorizationException` | 403: wrong API key ID, secret or merchant ID (error `id` `ACCESS_TO_MERCHANT_NOT_ALLOWED`), or an action that is not allowed. |
|
|
161
|
+
| `ReferenceException` | 404 (object not found), 410, and a 409 that is not the idempotence case above. |
|
|
162
|
+
| `PlatformException` | 500, 502, 503. Retry only if an error has `retriable` true; for calls with an idempotence key, use a new key. |
|
|
163
|
+
| `ApiException` | Base class of all the above; any other error status, including 401 and 402 without a payment result. An error response with an empty body is a plain `ApiException` whatever its status. Other `ApiException` subclasses, `ProblemDetailsException` and `DeclinedPayoutException`, are raised by operations this skill does not use. Has `status_code`, `error_id`, `errors`, `response_body`. |
|
|
164
|
+
| `Communication::CommunicationException` | No valid response: timeout, connection error, or an error response with a non-empty body that is not JSON (a 404 like that raises a `NotFoundException`). Not an `ApiException`; the original error is in `cause`. |
|
|
165
|
+
| `Webhooks::SignatureValidationException` | Webhook signature check failed. `Webhooks::SecretKeyNotAvailableException` (unknown key ID) is a subclass. |
|
|
166
|
+
| `Webhooks::ApiVersionMismatchException` | Valid signature, but the event has another API version. Not a `SignatureValidationException`. |
|
|
167
|
+
| `JSON::MarshallerSyntaxException` | Valid signature, but the body is not valid JSON. An API call raises it too when the response has a JSON content type but invalid JSON. Not a `SignatureValidationException`. |
|
|
168
|
+
|
|
169
|
+
`errors` is an array (empty if the platform sent none) of `Domain::APIError` with `error_code`, `property_name`,
|
|
170
|
+
`message`, `http_status_code` and `retriable`.
|
|
171
|
+
|
|
172
|
+
`ApiException#to_s` appends the status and the response body to the message:
|
|
173
|
+
`the payment platform returned an error response; status_code=400; response_body='{...}'`. `e.message`,
|
|
174
|
+
`"#{e}"`, `e.inspect` and the default output of an uncaught exception all use it. The body in it is masked with the
|
|
175
|
+
SDK's logging rules (card number, CVV, personal data; the expiry date keeps its last 2 digits); `e.response_body` is
|
|
176
|
+
the unmasked body. For an error that carries a payment (a declined payment) log only `e.error_id`, `e.status_code`
|
|
177
|
+
and the `error_code` values; never `e.response_body`. For Hosted Checkout calls the error body is a plain error
|
|
178
|
+
response, so logging `e` is acceptable. The response headers are in `e.cause.headers`.
|
|
179
|
+
|
|
180
|
+
On the `GetHostedCheckout` response, `created_payment_output` (`Domain::CreatedPaymentOutput`) holds `payment` and
|
|
181
|
+
`payment_status_category` (a String, may be `nil`); decide on `payment.status_output`, not on this value.
|
|
182
|
+
|
|
183
|
+
## Webhooks
|
|
184
|
+
|
|
185
|
+
`WebhooksHelper.new(OnlinePayments::SDK::JSON::DefaultMarshaller.instance, secret_key_store)` and
|
|
186
|
+
`helper.unmarshal(body, request_headers)`, where `body` is the raw body string and `request_headers` is an array of
|
|
187
|
+
`Communication::RequestHeader.new(name, value)`. The SDK needs the `X-GCS-Signature` and `X-GCS-KeyId` headers (names
|
|
188
|
+
are compared case-insensitively); Rack gives them as
|
|
189
|
+
`request.env['HTTP_X_GCS_SIGNATURE']` and `request.env['HTTP_X_GCS_KEYID']`. The helper takes only this array, no
|
|
190
|
+
hash. If one of the two names occurs more than once in the array, it raises `SignatureValidationException`
|
|
191
|
+
(`encountered multiple occurrences of header`), as it does when one is absent: build one `RequestHeader` per received
|
|
192
|
+
value and never merge repeated headers. A header whose value is `nil` raises `TypeError` or `NoMethodError` instead:
|
|
193
|
+
answer 401 before calling `unmarshal` when a value is `nil` or empty. `secret_key_store` is
|
|
194
|
+
`InMemorySecretKeyStore.instance` after `store_secret_key(key_id, secret)`, or your own object that includes
|
|
195
|
+
`SecretKeyStore` and implements `get_secret_key(key_id)`. `unmarshal` raises `SignatureValidationException`
|
|
196
|
+
(`SecretKeyNotAvailableException` for an unknown key ID) when verification fails. After a valid signature it can
|
|
197
|
+
raise `ApiVersionMismatchException` (the SDK reads API version `v1` only) or `JSON::MarshallerSyntaxException`;
|
|
198
|
+
rescue both separately from the signature exception. It returns a `Webhooks::WebhooksEvent` with `id`, `type`,
|
|
199
|
+
`created`, `merchant_id` and one of `payment`, `refund`, `payment_link`, `payout`, `token`. Read the body with
|
|
200
|
+
`request.body.read` in Sinatra or `request.raw_post` in Rails, not as parsed params, and skip the Rails CSRF check
|
|
201
|
+
for the webhook action. See `webhooks.md` for the full handler.
|
|
202
|
+
|
|
203
|
+
## Logging
|
|
204
|
+
|
|
205
|
+
`client.enable_logging(OnlinePayments::SDK::Logging::RubyCommunicatorLogger.new(Logger.new($stdout), Logger::INFO))` or
|
|
206
|
+
`OnlinePayments::SDK::Logging::StdoutCommunicatorLogger.instance` logs requests and responses with card data and
|
|
207
|
+
secrets masked. Mask other fields with
|
|
208
|
+
`client.set_body_obfuscator(OnlinePayments::SDK::Logging::Obfuscation::BodyObfuscator.new({ 'name' => OnlinePayments::SDK::Logging::Obfuscation.obfuscate_all }))`.
|
|
209
|
+
Do not log request or response objects yourself.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Webhooks
|
|
2
|
+
|
|
3
|
+
The platform sends an HTTP POST to your endpoint when a payment, refund, payment link, payout or token changes.
|
|
4
|
+
Webhooks are how you learn the result when the customer never returns to your site, and how you learn about changes
|
|
5
|
+
made later (captures, refunds, chargebacks).
|
|
6
|
+
|
|
7
|
+
## Set up
|
|
8
|
+
|
|
9
|
+
1. In the Merchant Portal, go to Developer > Webhooks. Generate the webhook key ID and secret, and enter your
|
|
10
|
+
endpoint URL (HTTPS). The secret is displayed for 60 seconds only: store it at once. Generating a new pair
|
|
11
|
+
revokes the existing one immediately.
|
|
12
|
+
2. Store the key ID and secret like the API secret: configuration or a secret store, never in code.
|
|
13
|
+
3. You can also send up to five endpoint URLs with each request in `feedbacks.webhooksUrls`;
|
|
14
|
+
`feedbacks.webhookUrl` is deprecated.
|
|
15
|
+
4. Let the platform reach your endpoint: whitelist its IP range in your firewall (see the Firewall documentation on
|
|
16
|
+
the documentation portal).
|
|
17
|
+
5. Create the SDK's webhooks helper once at startup with a secret key store that holds the key ID and secret.
|
|
18
|
+
6. Check the setup with the `ValidateWebhookCredentials` operation (your key and secret) and the `SendTestWebhook`
|
|
19
|
+
operation (a test event, type `payment.test`; your endpoint must answer 2xx).
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
# Create the helper once. The key ID and secret come from the Merchant Portal (Developer > Webhooks).
|
|
23
|
+
# Keep them like the API secret: in a secret store of your platform or, locally, in your own environment, never in
|
|
24
|
+
# a file in the repository. A blank value stops the application at startup.
|
|
25
|
+
# In production you can pass your own object that includes OnlinePayments::SDK::Webhooks::SecretKeyStore and
|
|
26
|
+
# implements get_secret_key(key_id) on top of your secret storage.
|
|
27
|
+
# @return [OnlinePayments::SDK::Webhooks::WebhooksHelper]
|
|
28
|
+
def self.create_webhooks_helper
|
|
29
|
+
secret_key_store = OnlinePayments::SDK::Webhooks::InMemorySecretKeyStore.instance
|
|
30
|
+
secret_key_store.store_secret_key(ClientSetup.required_env('ONLINEPAYMENTS_WEBHOOKS_KEY_ID'),
|
|
31
|
+
ClientSetup.required_env('ONLINEPAYMENTS_WEBHOOKS_SECRET'))
|
|
32
|
+
OnlinePayments::SDK::Webhooks::WebhooksHelper.new(OnlinePayments::SDK::JSON::DefaultMarshaller.instance,
|
|
33
|
+
secret_key_store)
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Receive
|
|
38
|
+
|
|
39
|
+
Mandatory rule 4: verify every webhook with the SDK's webhooks helper before processing the event.
|
|
40
|
+
|
|
41
|
+
1. Read the raw request body as bytes or an unchanged string. The signature is calculated over the exact body; a
|
|
42
|
+
body that was parsed and serialised again fails verification.
|
|
43
|
+
2. Pass the body and all request headers to the helper. It checks the `X-GCS-Signature` and `X-GCS-KeyId` headers
|
|
44
|
+
and returns the parsed event. A repeated `X-GCS-Signature` or `X-GCS-KeyId` must fail verification, so never pass
|
|
45
|
+
only the first value of a header. How to pass a repeated header depends on the helper: see `ruby.md`.
|
|
46
|
+
3. If verification fails, answer with an error status and do not process the event. Do not add a way to skip
|
|
47
|
+
verification, such as a configuration flag or a check for the development environment. For local testing, use a
|
|
48
|
+
test webhook key ID and secret from the Merchant Portal, or send a test event with SendTestWebhook; both go
|
|
49
|
+
through normal verification.
|
|
50
|
+
4. Save the verified event before you answer: a database row or a persistent queue, ignoring duplicates (the
|
|
51
|
+
webhooks guide identifies a duplicate by identical `payment.id` and `type`). Then answer with HTTP 2xx right away,
|
|
52
|
+
as the guide recommends, and do the work in the background. Do nothing else before the answer.
|
|
53
|
+
5. If the event passed verification but the SDK cannot read it (API version mismatch, malformed body), the sender
|
|
54
|
+
is the platform, so do not answer with an error status. Save the raw body, log it with an alert, and answer 2xx.
|
|
55
|
+
A retry would send the same body and fail the same way; the saved body can be replayed after you upgrade the
|
|
56
|
+
SDK. Only a failed verification gets an error status.
|
|
57
|
+
|
|
58
|
+
When the platform gets no 2xx answer in time, it sends the event again: after 10 minutes, 1 hour, 2 hours, 8 hours
|
|
59
|
+
and 24 hours. Each delivery has a `retry-count` header: 0 for the first attempt, higher for a retry. Log it; it
|
|
60
|
+
tells a new event from a retry. A 2xx tells the platform the event arrived, so do not count on another delivery after
|
|
61
|
+
you answered 2xx. An event that is only in memory when the process dies can be lost, and retrying failed background
|
|
62
|
+
work does not make the platform send it again. Keep your own retry for saved events that failed. The guide also
|
|
63
|
+
recommends a back-up mechanism, so run a reconciliation job: for every order that stays pending longer than a
|
|
64
|
+
customer normally needs to pay, read the status with `GetPaymentDetails` (see "Payment status" in `flows.md`) and
|
|
65
|
+
update the order.
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
# Call this from your HTTP endpoint with the raw body and the two signature headers, e.g. in Sinatra:
|
|
69
|
+
# post '/webhooks' do
|
|
70
|
+
# status endpoint.receive(request.body.read, request.env['HTTP_X_GCS_SIGNATURE'], request.env['HTTP_X_GCS_KEYID'])
|
|
71
|
+
# end
|
|
72
|
+
# In Rails use request.raw_post, request.headers['X-GCS-Signature'] and request.headers['X-GCS-KeyId'], and skip
|
|
73
|
+
# the CSRF check for this action. Pass the body unchanged: parsing it as JSON first breaks the signature check.
|
|
74
|
+
# The web layer has already collapsed repeated headers into one value here. If your framework exposes repeated
|
|
75
|
+
# headers, pass each received value as its own RequestHeader and never merge them: the helper rejects a duplicate
|
|
76
|
+
# X-GCS-Signature or X-GCS-KeyId, and a merged value would hide it.
|
|
77
|
+
# Returns the HTTP status to answer with.
|
|
78
|
+
# @param body [String]
|
|
79
|
+
# @param signature [String, nil]
|
|
80
|
+
# @param key_id [String, nil]
|
|
81
|
+
# @return [Integer]
|
|
82
|
+
def receive(body, signature, key_id)
|
|
83
|
+
# A nil header value makes the SDK raise TypeError or NoMethodError instead of SignatureValidationException:
|
|
84
|
+
# reject it first.
|
|
85
|
+
return 401 if signature.nil? || signature.empty? || key_id.nil? || key_id.empty?
|
|
86
|
+
|
|
87
|
+
request_headers = [
|
|
88
|
+
OnlinePayments::SDK::Communication::RequestHeader.new('X-GCS-Signature', signature),
|
|
89
|
+
OnlinePayments::SDK::Communication::RequestHeader.new('X-GCS-KeyId', key_id)
|
|
90
|
+
]
|
|
91
|
+
begin
|
|
92
|
+
# Checks the signature before parsing the event.
|
|
93
|
+
webhooks_event = webhooks_helper.unmarshal(body, request_headers)
|
|
94
|
+
rescue OnlinePayments::SDK::Webhooks::SignatureValidationException
|
|
95
|
+
# Wrong or missing signature, or an unknown key ID (SecretKeyNotAvailableException is a subclass).
|
|
96
|
+
# Not sent by the platform, or the wrong secret is configured. Do nothing with it.
|
|
97
|
+
return 401
|
|
98
|
+
rescue OnlinePayments::SDK::Webhooks::ApiVersionMismatchException,
|
|
99
|
+
OnlinePayments::SDK::JSON::MarshallerSyntaxException => e
|
|
100
|
+
# The signature is valid, so the platform sent it, but this SDK cannot read it. Neither class is a subclass
|
|
101
|
+
# of SignatureValidationException. Do not answer with an error: a retry sends the same body and fails the same
|
|
102
|
+
# way. Keep the raw body to replay it after you upgrade the SDK, and raise an alert.
|
|
103
|
+
inbox.save_unreadable_body(body, e.class.name.to_s)
|
|
104
|
+
logger.error("ALERT: verified webhook that the SDK cannot read (#{e.class}), raw body saved")
|
|
105
|
+
return 200
|
|
106
|
+
end
|
|
107
|
+
# Save the verified event before you answer. Do not count on the platform sending the event again after a 2xx,
|
|
108
|
+
# so an event that only lives in memory when the process dies can be lost. The inbox ignores duplicates.
|
|
109
|
+
inbox.save_event(webhooks_event)
|
|
110
|
+
# A background job processes the saved events. Slow or failed answers are retried by the platform.
|
|
111
|
+
200
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Process
|
|
116
|
+
|
|
117
|
+
- **Duplicates are normal.** The same event can arrive more than once. Processing must be idempotent.
|
|
118
|
+
- **Order is not guaranteed.** A `payment.created` event can arrive after `payment.captured`.
|
|
119
|
+
- **Read the current status.** Treat the event as a signal: call `GetPaymentDetails` and update the order from its
|
|
120
|
+
`statusOutput` (see "Payment status" in `flows.md`). This also makes duplicates and old events harmless. The
|
|
121
|
+
`payment.id` of a payment changes when a maintenance operation (capture, refund, ...) is performed, and a hosted
|
|
122
|
+
checkout session numbers its authorization attempts (`<id>_0`, `<id>_1`, ...). The platform strongly recommends not
|
|
123
|
+
building your business operations around the ID. `GetPaymentDetails` with the ID of an earlier authorization
|
|
124
|
+
attempt returns the payment's current state, with all operations in `operations` and the latest one as `id`, so
|
|
125
|
+
reading the status by ID gives the current state even for an event about an older operation. Status changes made
|
|
126
|
+
by the platform send webhooks too, without changing the `payment.id`.
|
|
127
|
+
- **Do not log the event or the request body.** The event's `payment` contains card details and customer data (see
|
|
128
|
+
the logging rules in `errors.md`). Log the event `id`, `type` and the payment ID.
|
|
129
|
+
- **Find your order** with `payment.paymentOutput.references.merchantReference`, which holds the order reference you
|
|
130
|
+
sent. The payment ID changes when you perform a maintenance operation such as a capture or refund, so do not use it as
|
|
131
|
+
your only key.
|
|
132
|
+
- **Do not use webhooks for decisions during checkout.** While the customer waits, use `GetHostedCheckout` or
|
|
133
|
+
`GetPaymentDetails`.
|
|
134
|
+
|
|
135
|
+
```ruby
|
|
136
|
+
# Runs in the background. Events can arrive twice and out of order, so read the current
|
|
137
|
+
# status instead of trusting the event; repeating this is harmless.
|
|
138
|
+
# @param webhooks_event [OnlinePayments::SDK::Webhooks::WebhooksEvent]
|
|
139
|
+
# @return [void]
|
|
140
|
+
def process(webhooks_event)
|
|
141
|
+
payment = webhooks_event.payment
|
|
142
|
+
payment_id = payment&.id
|
|
143
|
+
# Refund, payment link, payout and token events carry other objects, e.g. webhooks_event.refund.
|
|
144
|
+
return if payment.nil? || payment_id.nil?
|
|
145
|
+
|
|
146
|
+
order_id = payment.payment_output&.references&.merchant_reference
|
|
147
|
+
return if order_id.nil? || order_id.empty?
|
|
148
|
+
|
|
149
|
+
details = merchant.payments.get_payment_details(payment_id)
|
|
150
|
+
orders.save_payment_id(order_id, details.id || payment_id)
|
|
151
|
+
orders.save_state(order_id, PaymentStatusExample.to_order_state(details.status, details.status_output))
|
|
152
|
+
end
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Event types
|
|
156
|
+
|
|
157
|
+
| Object | Types |
|
|
158
|
+
|---|---|
|
|
159
|
+
| Payment | `payment.created`, `payment.redirected`, `payment.authorization_requested`, `payment.pending_approval`, `payment.pending_completion`, `payment.pending_capture`, `payment.capture_requested`, `payment.captured`, `payment.rejected`, `payment.rejected_capture`, `payment.cancelled`, `payment.refunded` |
|
|
160
|
+
| Refund | `refund.refund_requested` |
|
|
161
|
+
| Payment link | `paymentlink.created`, `paymentlink.clicked`, `paymentlink.paid`, `paymentlink.cancelled`, `paymentlink.expired`, `paymentlink.payment.rejected`, `paymentlink.payment.cancelled` |
|
|
162
|
+
| Test | `payment.test` (sent by the SendTestWebhook operation) |
|
|
163
|
+
|
|
164
|
+
The event's `type` field holds the type. The object that changed is in the matching field of the event (`payment`,
|
|
165
|
+
`refund`, `paymentLink`, `payout`, `token`).
|
|
166
|
+
|
|
167
|
+
Webhooks guide: https://docs.direct.worldline-solutions.com/en/integration/api-developer-guide/webhooks
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onlinepayments-sdk-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 12.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Worldline Direct support team
|
|
@@ -10,19 +10,19 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: net-http-persistent
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '4.0'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '4.0'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: concurrent-ruby
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -41,16 +41,16 @@ dependencies:
|
|
|
41
41
|
name: base64
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
|
-
- - "
|
|
44
|
+
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
47
|
-
type: :
|
|
46
|
+
version: '0.2'
|
|
47
|
+
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- - "
|
|
51
|
+
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
53
|
+
version: '0.2'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: yard
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,47 +80,61 @@ dependencies:
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '3.13'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
|
-
name:
|
|
83
|
+
name: rspec_junit_formatter
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
88
|
+
version: '0.6'
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
95
|
+
version: '0.6'
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name:
|
|
97
|
+
name: simplecov
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
102
|
+
version: '0.22'
|
|
103
103
|
type: :development
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
109
|
+
version: '0.22'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name:
|
|
111
|
+
name: webmock
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '
|
|
116
|
+
version: '3.0'
|
|
117
117
|
type: :development
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
121
|
- - "~>"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '
|
|
123
|
+
version: '3.0'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: puma
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '8.0'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '8.0'
|
|
124
138
|
- !ruby/object:Gem::Dependency
|
|
125
139
|
name: rake
|
|
126
140
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -135,6 +149,48 @@ dependencies:
|
|
|
135
149
|
- - "~>"
|
|
136
150
|
- !ruby/object:Gem::Version
|
|
137
151
|
version: '13.0'
|
|
152
|
+
- !ruby/object:Gem::Dependency
|
|
153
|
+
name: rubocop
|
|
154
|
+
requirement: !ruby/object:Gem::Requirement
|
|
155
|
+
requirements:
|
|
156
|
+
- - "~>"
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: 1.92.0
|
|
159
|
+
type: :development
|
|
160
|
+
prerelease: false
|
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - "~>"
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: 1.92.0
|
|
166
|
+
- !ruby/object:Gem::Dependency
|
|
167
|
+
name: logger
|
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '1.6'
|
|
173
|
+
type: :development
|
|
174
|
+
prerelease: false
|
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - "~>"
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '1.6'
|
|
180
|
+
- !ruby/object:Gem::Dependency
|
|
181
|
+
name: dotenv
|
|
182
|
+
requirement: !ruby/object:Gem::Requirement
|
|
183
|
+
requirements:
|
|
184
|
+
- - "~>"
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: '3.1'
|
|
187
|
+
type: :development
|
|
188
|
+
prerelease: false
|
|
189
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - "~>"
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: '3.1'
|
|
138
194
|
description: SDK to communicate with the Online Payments platform using the Online
|
|
139
195
|
Payments Server API
|
|
140
196
|
email:
|
|
@@ -143,6 +199,7 @@ executables: []
|
|
|
143
199
|
extensions: []
|
|
144
200
|
extra_rdoc_files: []
|
|
145
201
|
files:
|
|
202
|
+
- AGENTS.md
|
|
146
203
|
- Gemfile
|
|
147
204
|
- LICENSE.txt
|
|
148
205
|
- README.md
|
|
@@ -261,7 +318,6 @@ files:
|
|
|
261
318
|
- lib/onlinepayments/sdk/domain/created_token_response.rb
|
|
262
319
|
- lib/onlinepayments/sdk/domain/credit_card_specific_input_hosted_tokenization.rb
|
|
263
320
|
- lib/onlinepayments/sdk/domain/credit_card_validation_rules.rb
|
|
264
|
-
- lib/onlinepayments/sdk/domain/credit_card_validation_rules_hosted_tokenization.rb
|
|
265
321
|
- lib/onlinepayments/sdk/domain/crm_token.rb
|
|
266
322
|
- lib/onlinepayments/sdk/domain/csr_request.rb
|
|
267
323
|
- lib/onlinepayments/sdk/domain/currency_conversion.rb
|
|
@@ -378,7 +434,6 @@ files:
|
|
|
378
434
|
- lib/onlinepayments/sdk/domain/payment_link_overview_sorting.rb
|
|
379
435
|
- lib/onlinepayments/sdk/domain/payment_link_response.rb
|
|
380
436
|
- lib/onlinepayments/sdk/domain/payment_link_specific_input.rb
|
|
381
|
-
- lib/onlinepayments/sdk/domain/payment_links_response.rb
|
|
382
437
|
- lib/onlinepayments/sdk/domain/payment_output.rb
|
|
383
438
|
- lib/onlinepayments/sdk/domain/payment_output_summary.rb
|
|
384
439
|
- lib/onlinepayments/sdk/domain/payment_product.rb
|
|
@@ -518,7 +573,6 @@ files:
|
|
|
518
573
|
- lib/onlinepayments/sdk/domain/shipping_method.rb
|
|
519
574
|
- lib/onlinepayments/sdk/domain/shopping_cart.rb
|
|
520
575
|
- lib/onlinepayments/sdk/domain/shopping_cart_extension.rb
|
|
521
|
-
- lib/onlinepayments/sdk/domain/shopping_cart_output.rb
|
|
522
576
|
- lib/onlinepayments/sdk/domain/show_form_data.rb
|
|
523
577
|
- lib/onlinepayments/sdk/domain/show_instructions_data.rb
|
|
524
578
|
- lib/onlinepayments/sdk/domain/split_payment_product_filter.rb
|
|
@@ -598,7 +652,6 @@ files:
|
|
|
598
652
|
- lib/onlinepayments/sdk/merchant/merchantbatch/get_payments_report_params.rb
|
|
599
653
|
- lib/onlinepayments/sdk/merchant/merchantbatch/merchant_batch_client.rb
|
|
600
654
|
- lib/onlinepayments/sdk/merchant/paymentlinks.rb
|
|
601
|
-
- lib/onlinepayments/sdk/merchant/paymentlinks/get_payment_links_in_bulk_params.rb
|
|
602
655
|
- lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb
|
|
603
656
|
- lib/onlinepayments/sdk/merchant/payments.rb
|
|
604
657
|
- lib/onlinepayments/sdk/merchant/payments/payments_client.rb
|
|
@@ -640,6 +693,7 @@ files:
|
|
|
640
693
|
- lib/onlinepayments/sdk/proxy_configuration.rb
|
|
641
694
|
- lib/onlinepayments/sdk/reference_exception.rb
|
|
642
695
|
- lib/onlinepayments/sdk/validation_exception.rb
|
|
696
|
+
- lib/onlinepayments/sdk/version.rb
|
|
643
697
|
- lib/onlinepayments/sdk/webhooks.rb
|
|
644
698
|
- lib/onlinepayments/sdk/webhooks/api_version_mismatch_exception.rb
|
|
645
699
|
- lib/onlinepayments/sdk/webhooks/in_memory_secret_key_store.rb
|
|
@@ -650,6 +704,29 @@ files:
|
|
|
650
704
|
- lib/onlinepayments/sdk/webhooks/webhooks_event.rb
|
|
651
705
|
- lib/onlinepayments/sdk/webhooks/webhooks_helper.rb
|
|
652
706
|
- onlinepayments-sdk-ruby.gemspec
|
|
707
|
+
- skills/worldline-direct/SKILL.md
|
|
708
|
+
- skills/worldline-direct/examples/after_payment_operations_example.rb
|
|
709
|
+
- skills/worldline-direct/examples/app_types.rb
|
|
710
|
+
- skills/worldline-direct/examples/client_integration_example.rb
|
|
711
|
+
- skills/worldline-direct/examples/client_setup.rb
|
|
712
|
+
- skills/worldline-direct/examples/create_payment_response_handler.rb
|
|
713
|
+
- skills/worldline-direct/examples/customer_device.rb
|
|
714
|
+
- skills/worldline-direct/examples/error_handling_example.rb
|
|
715
|
+
- skills/worldline-direct/examples/hosted_checkout_example.rb
|
|
716
|
+
- skills/worldline-direct/examples/hosted_fields_example.rb
|
|
717
|
+
- skills/worldline-direct/examples/hosted_tokenization_example.rb
|
|
718
|
+
- skills/worldline-direct/examples/payment_attempt.rb
|
|
719
|
+
- skills/worldline-direct/examples/payment_links_example.rb
|
|
720
|
+
- skills/worldline-direct/examples/payment_status_example.rb
|
|
721
|
+
- skills/worldline-direct/examples/recurring_payments_example.rb
|
|
722
|
+
- skills/worldline-direct/examples/server_to_server_example.rb
|
|
723
|
+
- skills/worldline-direct/examples/webhook_event_processor.rb
|
|
724
|
+
- skills/worldline-direct/examples/webhooks_endpoint.rb
|
|
725
|
+
- skills/worldline-direct/examples/webhooks_setup.rb
|
|
726
|
+
- skills/worldline-direct/references/errors.md
|
|
727
|
+
- skills/worldline-direct/references/flows.md
|
|
728
|
+
- skills/worldline-direct/references/ruby.md
|
|
729
|
+
- skills/worldline-direct/references/webhooks.md
|
|
653
730
|
homepage: https://github.com/wl-online-payments-direct/sdk-ruby
|
|
654
731
|
licenses:
|
|
655
732
|
- MIT
|
|
@@ -661,7 +738,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
661
738
|
requirements:
|
|
662
739
|
- - ">="
|
|
663
740
|
- !ruby/object:Gem::Version
|
|
664
|
-
version: '
|
|
741
|
+
version: '3.4'
|
|
665
742
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
666
743
|
requirements:
|
|
667
744
|
- - ">="
|