Sha256: c100448d37b7a95d412ce481f5b3649dc82c289aabac360488284b6f82846fd7

Contents?: true

Size: 1.28 KB

Versions: 36

Compression:

Stored size: 1.28 KB

Contents

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

include AuthorizeNet::API

def validate_customer_payment_profile(customerProfileId = '36152115', customerPaymentProfileId = '32689262')
	config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")

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

	request = ValidateCustomerPaymentProfileRequest.new

	#Edit this part to select a specific customer
	request.customerProfileId = customerProfileId
	request.customerPaymentProfileId = customerPaymentProfileId
	request.validationMode = ValidationModeEnum::TestMode

	response = transaction.validate_customer_payment_profile(request)

	if response.messages.resultCode == MessageTypeEnum::Ok
	  puts "Successfully validated customer with customer profile ID #{request.customerProfileId}"
	  puts "Direct Response: #{response.directResponse} "
	else
	    puts response.messages.messages[0].code
	    puts response.messages.messages[0].text
	    raise "Failed to validate customer with customer profile ID #{request.customerProfileId} and payment profile ID #{customerPaymentProfileId}"
	end

	return response

end

if __FILE__ == $0
  validate_customer_payment_profile()
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
authorizenetsample-1.0.4 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.0.3 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.0.2 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.0.1 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.0.0 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.0 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.9 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.8 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.7 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.6 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.5 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.4 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.3 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.2 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-0.1 lib/CustomerProfiles/validate-customer-payment-profile.rb
authorizenetsample-1.9.5 lib/CustomerProfiles/validate-customer-payment-profile.rb