Class: NMIGateway::Recurring

Inherits:
Api
  • Object
show all
Defined in:
lib/nmi_gateway/recurring.rb

Constant Summary

Constants inherited from Api

Api::QUERY_URL, Api::TRANSACTION_URL

Instance Attribute Summary

Attributes inherited from Api

#query, #security_key

Instance Method Summary collapse

Methods inherited from Api

#get, #initialize, #post

Constructor Details

This class inherits a constructor from NMIGateway::Api

Instance Method Details

#add_custom_subscription(options = {}) ⇒ Object

NMIGateway::Recurring.new.add_custom_subscription plan_amount: 1.99, month_frequency: 1, day_of_month: 1, customer_vault_id: 664625840



25
26
27
28
29
30
31
32
# File 'lib/nmi_gateway/recurring.rb', line 25

def add_custom_subscription(options = {})
  query = set_query(options)
  query[:recurring] = 'add_subscription'
  query[:type] = 'recurring'
  query[:plan_payments] ||= '0'
  require_fields(:plan_payments, :plan_amount)
  post query
end

#add_subscription_to_plan(options = {}) ⇒ Object

NMIGateway::Recurring.new.add_subscription_to_plan plan_id: “test-1”, customer_vault_id: 664625840



16
17
18
19
20
21
22
# File 'lib/nmi_gateway/recurring.rb', line 16

def add_subscription_to_plan(options = {})
  query = set_query(options)
  query[:recurring] = 'add_subscription'
  query[:type] = 'recurring'
  require_fields(:plan_id)
  post query
end

#create_plan(options = {}) ⇒ Object

NMIGateway::Recurring.new.create_plan plan_amount: 1.99, plan_name: “Test 1.99”, plan_id: “test-1”, month_frequency: 1, day_of_month: 1



5
6
7
8
9
10
11
12
# File 'lib/nmi_gateway/recurring.rb', line 5

def create_plan(options = {})
  query = set_query(options)
  query[:recurring] = 'add_plan'
  query[:type] = 'recurring'
  query[:plan_payments] ||= '0'
  require_fields(:plan_amount, :plan_name, :plan_id)
  post query
end

#delete_subscription(options = {}) ⇒ Object

NMIGateway::Recurring.new.delete_subscription subscription_id: “3261766445”



44
45
46
47
48
49
50
# File 'lib/nmi_gateway/recurring.rb', line 44

def delete_subscription(options = {})
  query = set_query(options)
  query[:recurring] = 'delete_subscription'
  query[:type] = 'recurring'
  require_fields(:subscription_id)
  post query
end

#update_subscription(options = {}) ⇒ Object

NMIGateway::Recurring.new.update_subscription subscription_id: “3261766445”, first_name: “John”, last_name: “Doe”



35
36
37
38
39
40
41
# File 'lib/nmi_gateway/recurring.rb', line 35

def update_subscription(options = {})
  query = set_query(options)
  query[:recurring] = 'update_subscription'
  query[:type] = 'recurring'
  require_fields(:subscription_id)
  post query
end