Sha256: 9f2f48c6a2087ced30bbac2eac66c5cd45ed466d95ad96b0c8832801c4ae24f4

Contents?: true

Size: 1.12 KB

Versions: 36

Compression:

Stored size: 1.12 KB

Contents

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

  include AuthorizeNet::API

  def get_subscription_status(subscriptionId = '4792732')
    config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
    transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
    #subscription = Subscription.new(config['api_login_id'], config['api_subscription_key'], :gateway => :sandbox)
  
    request = ARBGetSubscriptionStatusRequest.new
    request.refId = '2238251168'
    request.subscriptionId = subscriptionId
  
    response = transaction.get_subscription_status(request)
  
    if response != nil
      if response.messages.resultCode == MessageTypeEnum::Ok
        puts "Successfully got subscription status."
        puts "  Status: #{response.status}"
    
      else
        puts response.messages.messages[0].code
        puts response.messages.messages[0].text
        raise "Failed to get a subscriptions status"
      end
    end
    
    return response
  end

if __FILE__ == $0
  get_subscription_status()
end

Version data entries

36 entries across 36 versions & 1 rubygems

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