Sha256: 1494ceeda0e1c6dfb60348b3c8a415f4247a2c2e731bcf2368f9964ac12d077c

Contents?: true

Size: 1.43 KB

Versions: 36

Compression:

Stored size: 1.43 KB

Contents

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

  include AuthorizeNet::API

  def get_customer_payment_profile(customerProfileId = '40036377', customerPaymentProfileId = '36315992')
    config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")

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

    
    request = GetCustomerPaymentProfileRequest.new
    request.customerProfileId = customerProfileId
    request.customerPaymentProfileId = customerPaymentProfileId

    response = transaction.get_customer_payment_profile(request)


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

      if response.paymentProfile.subscriptionIds != nil && response.paymentProfile.subscriptionIds.subscriptionId != nil
        puts "  List of subscriptions: "
        response.paymentProfile.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.customerPaymentProfileId}."
    end 
    return response
  end
  
if __FILE__ == $0
  get_customer_payment_profile()
end

Version data entries

36 entries across 36 versions & 1 rubygems

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