class IngramMicro::ReturnAuthorization

Constants

TRANSMISSION_FILENAME

Attributes

credit_card_information[RW]
customer[RW]
detail[RW]
order_header[RW]
purchase_order_information[RW]
shipment_information[RW]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method IngramMicro::Transmission::new
# File lib/ingram_micro/transmissions/return_authorization.rb, line 7
def initialize(options={})
  super
  @transaction_name = 'return-authorization'
  @customer = options[:customer]
  @shipment_information = options[:shipment_information]
  @credit_card_information = options[:credit_card_information]
  @order_header = options[:order_header]
  @detail = options[:detail]
  @purchase_order_information = options[:purchase_order_information]
end

Public Instance Methods

add_message_header(builder) click to toggle source
# File lib/ingram_micro/transmissions/return_authorization.rb, line 27
def add_message_header(builder)
  message_header = IngramMicro::MessageHeaderPW.new({
    partner_name: IngramMicro.configuration.partner_name,
    transaction_name: transaction_name})
  builder.send('message-header') do
    message_header.build(builder)
  end
  message_header.valid?
end
add_return_authorization_submission(builder) click to toggle source
# File lib/ingram_micro/transmissions/return_authorization.rb, line 37
def add_return_authorization_submission(builder)
  ra_options = {
    customer: customer,
    shipment_information: shipment_information,
    credit_card_information: credit_card_information,
    order_header: order_header,
    detail: detail,
    purchase_order_information: purchase_order_information
  }
  ras = IngramMicro::ReturnAuthorizationSubmission.new(ra_options)
  builder.send('return-authorization-submission') do
    ras.build(builder)
  end
  ras.valid?
end
xml_builder() click to toggle source
# File lib/ingram_micro/transmissions/return_authorization.rb, line 18
def xml_builder
  @builder ||= Nokogiri::XML::Builder.new do |builder|
    builder.send('message') do
      add_message_header(builder)
      add_return_authorization_submission(builder)
    end
  end
end