Sha256: e0e632a8953ad7dd1aed845a358afed4fdfe43c144e80ed37a682a59f31ef1ea

Contents?: true

Size: 1.36 KB

Versions: 36

Compression:

Stored size: 1.36 KB

Contents

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

  include AuthorizeNet::API

  def get_customer_shipping_address(customerProfileId = '40036377', customerAddressId = '37808097')
    config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")

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

    
    request = GetCustomerShippingAddressRequest.new
    request.customerProfileId = customerProfileId
    request.customerAddressId = customerAddressId

    response = transaction.get_customer_shipping_profile(request)


    if response.messages.resultCode == MessageTypeEnum::Ok
      puts "Successfully retrieved a shipping address with profile ID #{request.customerAddressId} and whose customer ID is #{request.customerProfileId}."

      if response.subscriptionIds != nil && response.subscriptionIds.subscriptionId != nil
        puts "  List of subscriptions: "
        response.subscriptionIds.subscriptionId.each do |subscriptionId|
          puts "    #{subscriptionId}"
        end
      end

    else
      puts response.messages.messages[0].text
      raise "Failed to get payment profile information with ID #{request.customerProfileId}"
    end
    return response
  end
  
if __FILE__ == $0
  get_customer_shipping_address()
end

Version data entries

36 entries across 36 versions & 1 rubygems

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