module MandarinPay::ConformityParams

Constants

PARAMS_CONFORMITY

Public Instance Methods

conformity_params(extra_params) click to toggle source
# File lib/mandarin_pay/conformity_params.rb, line 22
def conformity_params(extra_params)
  Hash[default_params.merge(extra_params.deep_symbolize_keys).map do |key, value|
    if key == :price
      [PARAMS_CONFORMITY[key], format("%.2f", value)]
    else
      [PARAMS_CONFORMITY[key], value]
    end
  end.compact]
end
default_params() click to toggle source
# File lib/mandarin_pay/conformity_params.rb, line 32
def default_params
  default = Hash[PARAMS_CONFORMITY.map do |internal_name, _external_name|
    [internal_name, send(internal_name)]
  end].compact
  initial_options.merge(default)
end
initial_options() click to toggle source
# File lib/mandarin_pay/conformity_params.rb, line 39
def initial_options
  {
    merchant_id: MandarinPay.merchant_id,
    price: @price,
    order_id: @order_id
  }
end