class GpWebpay::Ws::Services::ProcessCardOnFilePayment

Constants

OPERATION_NAME
REQUEST_NAME
RESPONSE_ENTITY_NAME
RESPONSE_NAME
SERVICE_EXCEPTION

Public Class Methods

new(attributes, merchant_number: :default) click to toggle source
Calls superclass method GpWebpay::Ws::BaseSignedRequest::new
# File lib/gp_webpay/ws/services/process_card_on_file_payment.rb, line 19
def initialize(attributes, merchant_number: :default)
  config = GpWebpay.config[merchant_number] || GpWebpay.config.default
  merged_attributes = {
    return_url: GpWebpay::Engine.routes.url_helpers.gp_webpay_orders_url({ merchant_number: config.merchant_number })
  }.merge(attributes)
  super(merged_attributes, merchant_number: merchant_number)
end

Public Instance Methods

rescue_from_soap(exception) click to toggle source
# File lib/gp_webpay/ws/services/process_card_on_file_payment.rb, line 27
def rescue_from_soap(exception)
  response = WsResponse.from_fault_error(exception.to_hash, self.class::SERVICE_EXCEPTION, config.merchant_number)

  if response.valid? && response.params[:authentication_link].present?
    raise GpWebpayConfirmationRequired.new('GP Webpay requires authentication', response.params[:authentication_link])
  end

  response
end