Sha256: af01910e4a9e052e98c951ace778e60405bc0f9fd1f176bf1619b67a2895e4f0

Contents?: true

Size: 1021 Bytes

Versions: 36

Compression:

Stored size: 1021 Bytes

Contents

require 'rubygems'
require 'yaml'
require 'authorizenet'
require 'securerandom'

  include AuthorizeNet::API

  def create_customer_shipping_address(customerProfileId = '1813343337')
    config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")

    transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)

    
    request = CreateCustomerShippingAddressRequest.new
    
    request.address = CustomerAddressType.new('John','Doe')
    request.customerProfileId = customerProfileId
    response = transaction.create_customer_shipping_profile(request)


    if response.messages.resultCode == MessageTypeEnum::Ok
      puts "Successfully created a customer shipping address with id:  #{response.customerAddressId}."
    else
      puts "Failed to create a new customer shipping address: #{response.messages.messages[0].text}"      
    end
    return response
  end

if __FILE__ == $0
  create_customer_shipping_address()
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
authorizenetsample-1.2.5 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.2.4 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.2.3 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.2.2 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.2.1 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.2.0 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.9 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.8 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.7 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.5 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.4 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.3 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.2 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.1 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.1.0 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.0.9 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.0.8 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.0.7 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.0.6 lib/CustomerProfiles/create-customer-shipping-address.rb
authorizenetsample-1.0.5 lib/CustomerProfiles/create-customer-shipping-address.rb