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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
#
|
|
2
4
|
# This file was automatically generated.
|
|
3
5
|
#
|
|
@@ -24,6 +26,16 @@ module OnlinePayments
|
|
|
24
26
|
|
|
25
27
|
attr_accessor :srci_dpa_id
|
|
26
28
|
|
|
29
|
+
# Creates a new instance; every attribute can be given as a keyword argument.
|
|
30
|
+
def initialize(authentication_options: nil, encryption_key: nil, n_modulus: nil, src_initiator_id: nil, srci_dpa_id: nil)
|
|
31
|
+
super()
|
|
32
|
+
@authentication_options = authentication_options
|
|
33
|
+
@encryption_key = encryption_key
|
|
34
|
+
@n_modulus = n_modulus
|
|
35
|
+
@src_initiator_id = src_initiator_id
|
|
36
|
+
@srci_dpa_id = srci_dpa_id
|
|
37
|
+
end
|
|
38
|
+
|
|
27
39
|
# Sets the property and returns this same instance.
|
|
28
40
|
def with_authentication_options(value)
|
|
29
41
|
@authentication_options = value
|
|
@@ -67,20 +79,20 @@ module OnlinePayments
|
|
|
67
79
|
|
|
68
80
|
def from_hash(hash)
|
|
69
81
|
super
|
|
70
|
-
if hash.
|
|
71
|
-
raise TypeError, "value '
|
|
82
|
+
if hash.key? 'authenticationOptions'
|
|
83
|
+
raise TypeError, "value '#{hash['authenticationOptions']}' is not a Hash" unless hash['authenticationOptions'].is_a? Hash
|
|
72
84
|
@authentication_options = OnlinePayments::SDK::Domain::VisaAuthenticationOptions.new_from_hash(hash['authenticationOptions'])
|
|
73
85
|
end
|
|
74
|
-
if hash.
|
|
86
|
+
if hash.key? 'encryptionKey'
|
|
75
87
|
@encryption_key = hash['encryptionKey']
|
|
76
88
|
end
|
|
77
|
-
if hash.
|
|
89
|
+
if hash.key? 'nModulus'
|
|
78
90
|
@n_modulus = hash['nModulus']
|
|
79
91
|
end
|
|
80
|
-
if hash.
|
|
92
|
+
if hash.key? 'srcInitiatorId'
|
|
81
93
|
@src_initiator_id = hash['srcInitiatorId']
|
|
82
94
|
end
|
|
83
|
-
if hash.
|
|
95
|
+
if hash.key? 'srciDpaId'
|
|
84
96
|
@srci_dpa_id = hash['srciDpaId']
|
|
85
97
|
end
|
|
86
98
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
#
|
|
2
4
|
# This file was automatically generated.
|
|
3
5
|
#
|
|
@@ -17,6 +19,14 @@ module OnlinePayments
|
|
|
17
19
|
|
|
18
20
|
attr_accessor :merchant_name
|
|
19
21
|
|
|
22
|
+
# Creates a new instance; every attribute can be given as a keyword argument.
|
|
23
|
+
def initialize(acquirer_bin: nil, acquirer_merchant_id: nil, merchant_name: nil)
|
|
24
|
+
super()
|
|
25
|
+
@acquirer_bin = acquirer_bin
|
|
26
|
+
@acquirer_merchant_id = acquirer_merchant_id
|
|
27
|
+
@merchant_name = merchant_name
|
|
28
|
+
end
|
|
29
|
+
|
|
20
30
|
# Sets the property and returns this same instance.
|
|
21
31
|
def with_acquirer_bin(value)
|
|
22
32
|
@acquirer_bin = value
|
|
@@ -46,13 +56,13 @@ module OnlinePayments
|
|
|
46
56
|
|
|
47
57
|
def from_hash(hash)
|
|
48
58
|
super
|
|
49
|
-
if hash.
|
|
59
|
+
if hash.key? 'acquirerBIN'
|
|
50
60
|
@acquirer_bin = hash['acquirerBIN']
|
|
51
61
|
end
|
|
52
|
-
if hash.
|
|
62
|
+
if hash.key? 'acquirerMerchantId'
|
|
53
63
|
@acquirer_merchant_id = hash['acquirerMerchantId']
|
|
54
64
|
end
|
|
55
|
-
if hash.
|
|
65
|
+
if hash.key? 'merchantName'
|
|
56
66
|
@merchant_name = hash['merchantName']
|
|
57
67
|
end
|
|
58
68
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
#
|
|
2
4
|
# This file was automatically generated.
|
|
3
5
|
#
|
|
@@ -37,7 +39,7 @@ module OnlinePayments
|
|
|
37
39
|
return ProblemDetailsException.new(status_code, response_body, error_object)
|
|
38
40
|
end
|
|
39
41
|
return ApiException.new(status_code, response_body, nil, nil) if error_object.nil?
|
|
40
|
-
raise ArgumentError
|
|
42
|
+
raise ArgumentError, "unsupported error object type: #{error_object.class.name}" unless error_object.is_a?(OnlinePayments::SDK::Domain::ErrorResponse)
|
|
41
43
|
create_exception_from_response_fields(status_code, response_body, error_object.error_id, error_object.errors, context)
|
|
42
44
|
end
|
|
43
45
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'yaml'
|
|
2
4
|
require 'onlinepayments/sdk/client'
|
|
3
5
|
require 'onlinepayments/sdk/communicator'
|
|
@@ -13,8 +15,13 @@ module OnlinePayments
|
|
|
13
15
|
# Convenience class that constructs instances of several other classes in the SDK.
|
|
14
16
|
# Provides methods to construct
|
|
15
17
|
# {OnlinePayments::SDK::CommunicatorConfiguration}, {OnlinePayments::SDK::Communicator} and {OnlinePayments::SDK::Client} instances.
|
|
18
|
+
#
|
|
19
|
+
# Create the client with create_client or create_client_from_env once and reuse it.
|
|
20
|
+
#
|
|
21
|
+
# AI coding agents: read the agent skill for this SDK version before writing integration code:
|
|
22
|
+
# https://raw.githubusercontent.com/wl-online-payments-direct/sdk-ruby/12.0.0/skills/worldline-direct/SKILL.md
|
|
23
|
+
# The same skill is included in this gem, in the skills/worldline-direct/ folder.
|
|
16
24
|
class Factory
|
|
17
|
-
|
|
18
25
|
# Creates and returns a {OnlinePayments::SDK::CommunicatorConfiguration} based on the configuration in the file
|
|
19
26
|
# located at _configuration_file_name_.
|
|
20
27
|
#
|
|
@@ -23,7 +30,7 @@ module OnlinePayments
|
|
|
23
30
|
# @param secret_api_key [String] Secret key used for authentication to the Online Payments platform.
|
|
24
31
|
# @return [OnlinePayments::SDK::CommunicatorConfiguration] The created communicator configuration
|
|
25
32
|
def self.create_configuration(configuration_file_name, api_key_id, secret_api_key)
|
|
26
|
-
properties = YAML
|
|
33
|
+
properties = YAML.load_file(configuration_file_name)
|
|
27
34
|
CommunicatorConfiguration.new(properties: properties,
|
|
28
35
|
api_key_id: api_key_id,
|
|
29
36
|
secret_api_key: secret_api_key)
|
|
@@ -36,27 +43,20 @@ module OnlinePayments
|
|
|
36
43
|
# @param configuration [OnlinePayments::SDK::CommunicatorConfiguration] configuration settings to be used by the client.
|
|
37
44
|
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider] stores the metadata for the communicating client.
|
|
38
45
|
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments platform.
|
|
39
|
-
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
46
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
47
|
+
# Payments platform.
|
|
40
48
|
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
41
49
|
# @return [OnlinePayments::SDK::Communicator] The created communicator
|
|
42
50
|
def self.create_communicator_from_configuration(configuration, metadata_provider: nil,
|
|
43
51
|
connection: nil, authenticator: nil, marshaller: nil)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
unless connection
|
|
49
|
-
connection = Communication::DefaultConnection.new({ connect_timeout: configuration.connect_timeout,
|
|
52
|
+
metadata_provider ||= Communication::MetadataProvider.new(configuration.integrator,
|
|
53
|
+
shopping_cart_extension: configuration.shopping_cart_extension)
|
|
54
|
+
connection ||= Communication::DefaultConnection.new({ connect_timeout: configuration.connect_timeout,
|
|
50
55
|
socket_timeout: configuration.socket_timeout,
|
|
51
56
|
max_connections: configuration.max_connections,
|
|
52
57
|
proxy_configuration: configuration.proxy_configuration })
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
authenticator = get_authenticator(configuration)
|
|
56
|
-
end
|
|
57
|
-
unless marshaller
|
|
58
|
-
marshaller = JSON::DefaultMarshaller.instance
|
|
59
|
-
end
|
|
58
|
+
authenticator ||= get_authenticator(configuration)
|
|
59
|
+
marshaller ||= JSON::DefaultMarshaller.instance
|
|
60
60
|
Communicator.new(configuration.api_endpoint, connection, authenticator, metadata_provider, marshaller)
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -68,15 +68,17 @@ module OnlinePayments
|
|
|
68
68
|
# @param api_key_id [String] Key id for the Online Payments platform.
|
|
69
69
|
# @param secret_api_key [String] Secret key used for authentication to the Online Payments platform.
|
|
70
70
|
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider] stores the metadata for the communicating client.
|
|
71
|
-
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments
|
|
72
|
-
#
|
|
71
|
+
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments
|
|
72
|
+
# platform.
|
|
73
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
74
|
+
# Payments platform.
|
|
73
75
|
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
74
76
|
# @return [OnlinePayments::SDK::Communicator] The created communicator
|
|
75
77
|
def self.create_communicator_from_file(configuration_file_name, api_key_id, secret_api_key,
|
|
76
78
|
metadata_provider: nil, connection: nil, authenticator: nil, marshaller: nil)
|
|
77
79
|
configuration = create_configuration(configuration_file_name, api_key_id, secret_api_key)
|
|
78
80
|
create_communicator_from_configuration(configuration, metadata_provider: metadata_provider, connection: connection,
|
|
79
|
-
|
|
81
|
+
authenticator: authenticator, marshaller: marshaller)
|
|
80
82
|
end
|
|
81
83
|
|
|
82
84
|
# Creates and returns an {OnlinePayments::SDK::Client} that provides the a high-level interface with the Online Payments platform.
|
|
@@ -91,21 +93,20 @@ module OnlinePayments
|
|
|
91
93
|
# @param configuration [OnlinePayments::SDK::CommunicatorConfiguration] contains configuration settings to be used by the client.
|
|
92
94
|
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider] stores the metadata for the communicating client.
|
|
93
95
|
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments platform.
|
|
94
|
-
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
96
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
97
|
+
# Payments platform.
|
|
95
98
|
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
96
99
|
# @return [OnlinePayments::SDK::Client] The created client
|
|
97
100
|
def self.create_client_from_configuration(configuration, metadata_provider: nil, connection: nil, authenticator: nil, marshaller: nil)
|
|
98
101
|
communicator = create_communicator_from_configuration(configuration, metadata_provider: metadata_provider, connection: connection,
|
|
99
|
-
|
|
102
|
+
authenticator: authenticator, marshaller: marshaller)
|
|
100
103
|
client = Client.new(communicator)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
else
|
|
108
|
-
return client
|
|
104
|
+
return client unless block_given?
|
|
105
|
+
|
|
106
|
+
begin
|
|
107
|
+
yield client
|
|
108
|
+
ensure
|
|
109
|
+
client.close
|
|
109
110
|
end
|
|
110
111
|
end
|
|
111
112
|
|
|
@@ -122,14 +123,12 @@ module OnlinePayments
|
|
|
122
123
|
# @return [OnlinePayments::SDK::Client] The created client
|
|
123
124
|
def self.create_client_from_communicator(communicator)
|
|
124
125
|
client = Client.new(communicator)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
else
|
|
132
|
-
return client
|
|
126
|
+
return client unless block_given?
|
|
127
|
+
|
|
128
|
+
begin
|
|
129
|
+
yield client
|
|
130
|
+
ensure
|
|
131
|
+
client.close
|
|
133
132
|
end
|
|
134
133
|
end
|
|
135
134
|
|
|
@@ -146,8 +145,10 @@ module OnlinePayments
|
|
|
146
145
|
# @param api_key_id [String] Key id for the Online Payments platform.
|
|
147
146
|
# @param secret_api_key [String] Secret key used for authentication to the Online Payments platform.
|
|
148
147
|
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider] stores the metadata for the communicating client.
|
|
149
|
-
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments
|
|
150
|
-
#
|
|
148
|
+
# @param connection [OnlinePayments::SDK::Communication::Connection] connection that can be used to communicate with the Online Payments
|
|
149
|
+
# platform.
|
|
150
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator] authenticator that can authenticate messages sent to the Online
|
|
151
|
+
# Payments platform.
|
|
151
152
|
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
152
153
|
# @return [OnlinePayments::SDK::Client] The created client
|
|
153
154
|
def self.create_client_from_file(configuration_file_name, api_key_id, secret_api_key,
|
|
@@ -156,26 +157,104 @@ module OnlinePayments
|
|
|
156
157
|
metadata_provider: metadata_provider, connection: connection,
|
|
157
158
|
authenticator: authenticator, marshaller: marshaller)
|
|
158
159
|
client = Client.new(communicator)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
else
|
|
166
|
-
return client
|
|
160
|
+
return client unless block_given?
|
|
161
|
+
|
|
162
|
+
begin
|
|
163
|
+
yield client
|
|
164
|
+
ensure
|
|
165
|
+
client.close
|
|
167
166
|
end
|
|
168
167
|
end
|
|
169
168
|
|
|
170
|
-
|
|
169
|
+
# Creates and returns an {OnlinePayments::SDK::Client} from the given values, using the V1HMAC authorization type.
|
|
170
|
+
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
|
171
|
+
#
|
|
172
|
+
# @example Providing a code block
|
|
173
|
+
# Factory.create_client(api_endpoint: 'https://payment.direct.ecom.preprod.worldline-solutions.com',
|
|
174
|
+
# api_key_id: api_key_id, secret_api_key: secret_api_key, integrator: 'MyShop',
|
|
175
|
+
# connect_timeout: 10, socket_timeout: 60) do |client|
|
|
176
|
+
# # use client as needed
|
|
177
|
+
# end
|
|
178
|
+
# # client is closed here
|
|
179
|
+
#
|
|
180
|
+
# @param api_endpoint [String] the base URL to the Online Payments platform.
|
|
181
|
+
# @param api_key_id [String] key id for the Online Payments platform.
|
|
182
|
+
# @param secret_api_key [String] secret key used for authentication to the Online Payments platform.
|
|
183
|
+
# @param integrator [String] name of the integrator.
|
|
184
|
+
# @param connect_timeout [Integer] the number of seconds before a connection attempt with the Online Payments platform times out.
|
|
185
|
+
# @param socket_timeout [Integer] the number of seconds before a timeout occurs when transmitting data to or from the Online Payments
|
|
186
|
+
# platform.
|
|
187
|
+
# @param max_connections [Integer, nil] the number of connections with the Online Payments platform that are kept alive in the
|
|
188
|
+
# connection pool.
|
|
189
|
+
# @param proxy_configuration [OnlinePayments::SDK::ProxyConfiguration, nil] the proxy to use.
|
|
190
|
+
# @param shopping_cart_extension [OnlinePayments::SDK::Domain::ShoppingCartExtension, nil] shopping cart-related metadata.
|
|
191
|
+
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider, nil] stores the metadata for the communicating client.
|
|
192
|
+
# @param connection [OnlinePayments::SDK::Communication::Connection, nil] connection that can be used to communicate with the
|
|
193
|
+
# Online Payments platform.
|
|
194
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator, nil] authenticator that can authenticate messages sent to
|
|
195
|
+
# the Online Payments platform.
|
|
196
|
+
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller, nil] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
197
|
+
# @return [OnlinePayments::SDK::Client] The created client
|
|
198
|
+
# @raise [ArgumentError] if a timeout is not a positive number
|
|
199
|
+
def self.create_client(api_endpoint:, api_key_id:, secret_api_key:, integrator:, connect_timeout:, socket_timeout:,
|
|
200
|
+
max_connections: nil, proxy_configuration: nil, shopping_cart_extension: nil,
|
|
201
|
+
metadata_provider: nil, connection: nil, authenticator: nil, marshaller: nil, &)
|
|
202
|
+
validate_timeouts(connect_timeout, socket_timeout)
|
|
203
|
+
configuration = CommunicatorConfiguration.new(api_endpoint: api_endpoint, api_key_id: api_key_id, secret_api_key: secret_api_key,
|
|
204
|
+
authorization_type: Authentication::AuthorizationType::V1HMAC,
|
|
205
|
+
connect_timeout: connect_timeout, socket_timeout: socket_timeout,
|
|
206
|
+
max_connections: max_connections, proxy_configuration: proxy_configuration,
|
|
207
|
+
integrator: integrator, shopping_cart_extension: shopping_cart_extension)
|
|
208
|
+
create_client_from_configuration(configuration, metadata_provider: metadata_provider, connection: connection,
|
|
209
|
+
authenticator: authenticator, marshaller: marshaller, &)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Creates and returns an {OnlinePayments::SDK::Client} from environment variables, using the V1HMAC authorization type.
|
|
213
|
+
# See {OnlinePayments::SDK::CommunicatorConfiguration.from_env} for the variables that are read.
|
|
214
|
+
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
|
215
|
+
#
|
|
216
|
+
# @example Providing a code block
|
|
217
|
+
# Factory.create_client_from_env do |client|
|
|
218
|
+
# # use client as needed
|
|
219
|
+
# end
|
|
220
|
+
# # client is closed here
|
|
221
|
+
#
|
|
222
|
+
# @param max_connections [Integer, nil] the number of connections with the Online Payments platform that are kept alive in the
|
|
223
|
+
# connection pool.
|
|
224
|
+
# @param proxy_configuration [OnlinePayments::SDK::ProxyConfiguration, nil] the proxy to use.
|
|
225
|
+
# @param shopping_cart_extension [OnlinePayments::SDK::Domain::ShoppingCartExtension, nil] shopping cart-related metadata.
|
|
226
|
+
# @param metadata_provider [OnlinePayments::SDK::Communication::MetadataProvider, nil] stores the metadata for the communicating client.
|
|
227
|
+
# @param connection [OnlinePayments::SDK::Communication::Connection, nil] connection that can be used to communicate with the
|
|
228
|
+
# Online Payments platform.
|
|
229
|
+
# @param authenticator [OnlinePayments::SDK::Authentication::Authenticator, nil] authenticator that can authenticate messages sent to
|
|
230
|
+
# the Online Payments platform.
|
|
231
|
+
# @param marshaller [OnlinePayments::SDK::JSON::Marshaller, nil] marshaller that can marshal and unmarshal objects to and from JSON.
|
|
232
|
+
# @return [OnlinePayments::SDK::Client] The created client
|
|
233
|
+
# @raise [ArgumentError] if an environment variable is missing or has an invalid value
|
|
234
|
+
def self.create_client_from_env(max_connections: nil, proxy_configuration: nil, shopping_cart_extension: nil,
|
|
235
|
+
metadata_provider: nil, connection: nil, authenticator: nil, marshaller: nil, &)
|
|
236
|
+
configuration = CommunicatorConfiguration.from_env
|
|
237
|
+
validate_timeouts(configuration.connect_timeout, configuration.socket_timeout)
|
|
238
|
+
configuration.max_connections = max_connections if max_connections
|
|
239
|
+
configuration.proxy_configuration = proxy_configuration if proxy_configuration
|
|
240
|
+
configuration.shopping_cart_extension = shopping_cart_extension if shopping_cart_extension
|
|
241
|
+
create_client_from_configuration(configuration, metadata_provider: metadata_provider, connection: connection,
|
|
242
|
+
authenticator: authenticator, marshaller: marshaller, &)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def self.validate_timeouts(connect_timeout, socket_timeout)
|
|
246
|
+
raise ArgumentError, 'connect_timeout must be positive' unless connect_timeout.is_a?(Numeric) && connect_timeout.positive?
|
|
247
|
+
raise ArgumentError, 'socket_timeout must be positive' unless socket_timeout.is_a?(Numeric) && socket_timeout.positive?
|
|
248
|
+
end
|
|
249
|
+
private_class_method :validate_timeouts
|
|
171
250
|
|
|
172
251
|
# @param configuration [OnlinePayments::SDK::CommunicatorConfiguration]
|
|
173
252
|
def self.get_authenticator(configuration)
|
|
174
|
-
if configuration.authorization_type == Authentication::AuthorizationType::V1HMAC
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
raise RuntimeError.new("Unknown authorizationType #{configuration.authorization_type}")
|
|
253
|
+
return Authentication::V1HmacAuthenticator.new(configuration) if configuration.authorization_type == Authentication::AuthorizationType::V1HMAC
|
|
254
|
+
|
|
255
|
+
raise "Unknown authorizationType #{configuration.authorization_type}"
|
|
178
256
|
end
|
|
257
|
+
private_class_method :get_authenticator
|
|
179
258
|
end
|
|
180
259
|
end
|
|
181
260
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'json'
|
|
2
4
|
require 'singleton'
|
|
3
5
|
require 'onlinepayments/sdk/json/marshaller'
|
|
@@ -13,17 +15,17 @@ module OnlinePayments
|
|
|
13
15
|
# Marshals the _request_object_ to a JSON string using request_object#to_h
|
|
14
16
|
def marshal(request_object)
|
|
15
17
|
return 'null' if request_object.nil?
|
|
18
|
+
|
|
16
19
|
::JSON.pretty_generate(request_object.to_h)
|
|
17
20
|
end
|
|
18
21
|
|
|
19
22
|
# Unmarshals a JSON string into an object of type _klass_ using klass.new_from_hash
|
|
20
23
|
def unmarshal(json_string, klass)
|
|
21
24
|
return nil if json_string.nil? || json_string.empty?
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end
|
|
25
|
+
|
|
26
|
+
raise NotImplementedError unless klass.respond_to?(:new_from_hash)
|
|
27
|
+
|
|
28
|
+
klass.new_from_hash(::JSON.load(json_string)) # rubocop:disable Security/JSONLoad
|
|
27
29
|
rescue ::JSON::ParserError => e
|
|
28
30
|
raise MarshallerSyntaxException, e.message
|
|
29
31
|
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OnlinePayments
|
|
2
4
|
module SDK
|
|
3
5
|
module JSON
|
|
4
6
|
# Class responsible for marshalling and unmarshalling objects to and from JSON
|
|
5
7
|
class Marshaller
|
|
6
|
-
|
|
7
8
|
# Marshals _request_object_ to JSON format by calling #to_h on it.
|
|
8
9
|
#
|
|
9
10
|
# @param request_object [OnlinePayments::SDK::Domain::DataObject] the object to format
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OnlinePayments
|
|
2
4
|
module SDK
|
|
3
5
|
module Logging
|
|
4
6
|
# Base logger class used in this SDK. This class is an interface and cannot be instantiated.
|
|
5
7
|
class CommunicatorLogger
|
|
6
|
-
|
|
7
8
|
# Interface, no instantiation
|
|
8
9
|
# @see OnlinePayments::SDK::Logging::StdoutCommunicatorLogger
|
|
9
10
|
# @see OnlinePayments::SDK::Logging::RubyCommunicatorLogger
|
|
10
11
|
def initialize
|
|
11
|
-
raise NotImplementedError
|
|
12
|
+
raise NotImplementedError, "#{self.class.name} is not implemented."
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
# Logs a message with or without exception
|
|
@@ -16,7 +17,7 @@ module OnlinePayments
|
|
|
16
17
|
# @param message [String] the message to log
|
|
17
18
|
# @param thrown [Exception, nil] the exception to log, or nil to log no exception
|
|
18
19
|
def log(message, thrown = nil)
|
|
19
|
-
raise NotImplementedError
|
|
20
|
+
raise NotImplementedError, "#{self.class.name}#log() is not implemented."
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
end
|
|
@@ -1,89 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'onlinepayments/sdk/logging/obfuscation/body_obfuscator'
|
|
2
4
|
require 'onlinepayments/sdk/logging/obfuscation/header_obfuscator'
|
|
3
5
|
|
|
4
6
|
module OnlinePayments
|
|
5
7
|
module SDK
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
module Logging
|
|
9
|
+
# Abstract class used to construct a message describing a request or response.
|
|
10
|
+
#
|
|
11
|
+
# @attr_reader [String] request_id An identifier assigned to the request and response
|
|
12
|
+
# @attr_reader [String] headers Request or response headers in string form
|
|
13
|
+
# @attr_reader [String] body Request or response body as a string
|
|
14
|
+
# @attr_reader [String] content_type Content type of the body, generally 'application/json' or 'text/html'
|
|
15
|
+
# @attr_reader [OnlinePayments::SDK::Logging::Obfuscation::BodyObfuscator] body_obfuscator
|
|
16
|
+
# @attr_reader [OnlinePayments::SDK::Logging::Obfuscation::HeaderObfuscator] header_obfuscator
|
|
17
|
+
class LogMessageBuilder
|
|
18
|
+
attr_reader :request_id, :headers, :body, :content_type, :body_obfuscator, :header_obfuscator
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
# Create a new LogMessageBuilder
|
|
21
|
+
def initialize(request_id,
|
|
22
|
+
body_obfuscator = Obfuscation::BodyObfuscator.default_obfuscator,
|
|
23
|
+
header_obfuscator = Obfuscation::HeaderObfuscator.default_obfuscator)
|
|
24
|
+
raise ArgumentError if request_id.nil? || request_id.empty?
|
|
25
|
+
raise ArgumentError if body_obfuscator.nil?
|
|
26
|
+
raise ArgumentError if header_obfuscator.nil?
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
raise ArgumentError if body_obfuscator.nil?
|
|
30
|
-
raise ArgumentError if header_obfuscator.nil?
|
|
31
|
-
@request_id = request_id
|
|
32
|
-
@headers = ''
|
|
33
|
-
@body_obfuscator = body_obfuscator
|
|
34
|
-
@header_obfuscator = header_obfuscator
|
|
35
|
-
end
|
|
28
|
+
@request_id = request_id
|
|
29
|
+
@headers = ''
|
|
30
|
+
@body_obfuscator = body_obfuscator
|
|
31
|
+
@header_obfuscator = header_obfuscator
|
|
32
|
+
end
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
# Adds a single header to the #headers string
|
|
35
|
+
def add_headers(name, value)
|
|
36
|
+
@headers += ', ' unless @headers.empty?
|
|
37
|
+
@headers += "#{name}=\""
|
|
38
|
+
@headers += @header_obfuscator.obfuscate_header(name, value) unless value.nil?
|
|
39
|
+
@headers += '"'
|
|
40
|
+
end
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
# Sets the body of this message to the parameter body.
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
# @param body [String] the message body
|
|
45
|
+
# @param content_type [String] the content type of the body
|
|
46
|
+
def set_body(body, content_type)
|
|
47
|
+
@body = if binary?(content_type)
|
|
48
|
+
'<binary content>'
|
|
49
|
+
else
|
|
50
|
+
@body_obfuscator.obfuscate_body(body)
|
|
51
|
+
end
|
|
52
|
+
@content_type = content_type
|
|
53
|
+
end
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
# Constructs and returns the log message as a string.
|
|
56
|
+
# @return [String]
|
|
57
|
+
def message
|
|
58
|
+
raise NotImplementedError, "#{self.class.name}#message() is not implemented."
|
|
59
|
+
end
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
end
|
|
61
|
+
# @deprecated Use {#message} instead.
|
|
62
|
+
# @return [String]
|
|
63
|
+
def get_message # rubocop:disable Naming/AccessorMethodName
|
|
64
|
+
message
|
|
65
|
+
end
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
def to_s
|
|
68
|
+
if instance_of?(LogMessageBuilder)
|
|
69
|
+
super.to_s
|
|
70
|
+
else
|
|
71
|
+
message
|
|
75
72
|
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
protected
|
|
76
|
+
|
|
77
|
+
# Returns an empty string if the parameter is nil, and returns the parameter itself otherwise
|
|
78
|
+
def empty_if_null(value)
|
|
79
|
+
value.nil? ? '' : value
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
76
83
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
end
|
|
84
|
+
# Returns whether or not the content type is binary
|
|
85
|
+
def binary?(content_type)
|
|
86
|
+
if content_type.nil?
|
|
87
|
+
false
|
|
88
|
+
else
|
|
89
|
+
content_type = content_type.downcase
|
|
90
|
+
!(content_type.start_with?('text/') || content_type.include?('json') || content_type.include?('xml'))
|
|
85
91
|
end
|
|
86
92
|
end
|
|
87
93
|
end
|
|
94
|
+
end
|
|
88
95
|
end
|
|
89
96
|
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OnlinePayments
|
|
2
4
|
module SDK
|
|
3
5
|
module Logging
|
|
4
6
|
# Abstract mixin module that allows loggers to be registered to an object.
|
|
5
7
|
module LoggingCapable
|
|
6
|
-
|
|
7
8
|
def enable_logging(communicator_logger)
|
|
8
9
|
raise NotImplementedError
|
|
9
10
|
end
|