Sha256: 6be852c2cbdb354c3d2b0e72ea78ad91a5abb91adf2b7816bacd9383c7c26a24
Contents?: true
Size: 809 Bytes
Versions: 2
Compression:
Stored size: 809 Bytes
Contents
module HyperPay class PaymentParameterBuilder REQUIRED_PARAMETERS = %w[entityId customer.email customer.mobile customer.givenName customer.surname billing.street1 billing.city billing.state billing.country billing.postcode customParameters[3DS2_enrolled] merchantTransactionId paymentType currency amount].freeze attr_reader :parameters def initialize @parameters = {} end # Implementation of `add` method returns `self` to allow chaining def add(key, value) @parameters[key] = value self # Return self to allow chaining end def validate! missing_params = REQUIRED_PARAMETERS - @parameters.keys unless missing_params.empty? raise ArgumentError, "Missing required parameters: #{missing_params.join(', ')}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
HyperPay-0.1.1 | lib/HyperPay/payment_parameter_builder.rb |
HyperPay-0.1.0 | lib/HyperPay/payment_parameter_builder.rb |