Class: Killbill::Securenet::PaymentPlugin

Inherits:
Plugin::ActiveMerchant::PaymentPlugin
  • Object
show all
Defined in:
lib/securenet/api.rb

Instance Method Summary collapse

Constructor Details

#initializePaymentPlugin

Returns a new instance of PaymentPlugin.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/securenet/api.rb', line 5

def initialize
  gateway_builder = Proc.new do |config|
    ::ActiveMerchant::Billing::SecureNetGateway.new :login => config[:login], :password => config[:password]
  end

  super(gateway_builder,
        :securenet,
        ::Killbill::Securenet::SecurenetPaymentMethod,
        ::Killbill::Securenet::SecurenetTransaction,
        ::Killbill::Securenet::SecurenetResponse)
end

Instance Method Details

#add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, properties, context) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/securenet/api.rb', line 101

def add_payment_method(, kb_payment_method_id, payment_method_props, set_default, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(, kb_payment_method_id, payment_method_props, set_default, properties, context)
end

#authorize_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/securenet/api.rb', line 25

def authorize_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
end

#build_form_descriptor(kb_account_id, descriptor_fields, properties, context) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/securenet/api.rb', line 149

def build_form_descriptor(, descriptor_fields, properties, context)
  # Pass extra parameters for the gateway here
  options = {}
  properties = merge_properties(properties, options)

  # Add your custom static hidden tags here
  options = {
      #:token => config[:securenet][:token]
  }
  descriptor_fields = merge_properties(descriptor_fields, options)

  super(, descriptor_fields, properties, context)
end

#capture_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/securenet/api.rb', line 35

def capture_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
end

#credit_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/securenet/api.rb', line 65

def credit_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
end

#delete_payment_method(kb_account_id, kb_payment_method_id, properties, context) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/securenet/api.rb', line 109

def delete_payment_method(, kb_payment_method_id, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(, kb_payment_method_id, properties, context)
end

#get_payment_info(kb_account_id, kb_payment_id, properties, context) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/securenet/api.rb', line 85

def get_payment_info(, kb_payment_id, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(, kb_payment_id, properties, context)
end

#get_payment_method_detail(kb_account_id, kb_payment_method_id, properties, context) ⇒ Object



117
118
119
120
121
122
123
# File 'lib/securenet/api.rb', line 117

def get_payment_method_detail(, kb_payment_method_id, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(, kb_payment_method_id, properties, context)
end

#get_payment_methods(kb_account_id, refresh_from_gateway, properties, context) ⇒ Object



129
130
131
132
133
134
135
# File 'lib/securenet/api.rb', line 129

def get_payment_methods(, refresh_from_gateway, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(, refresh_from_gateway, properties, context)
end

#on_event(event) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/securenet/api.rb', line 17

def on_event(event)
  # Require to deal with per tenant configuration invalidation
  super(event)
  #
  # Custom event logic could be added below...
  #
end

#process_notification(notification, properties, context) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/securenet/api.rb', line 163

def process_notification(notification, properties, context)
  # Pass extra parameters for the gateway here
  options = {}
  properties = merge_properties(properties, options)

  super(notification, properties, context) do |gw_notification, service|
    # Retrieve the payment
    # gw_notification.kb_payment_id =
    #
    # Set the response body
    # gw_notification.entity =
  end
end

#purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/securenet/api.rb', line 45

def purchase_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
end

#refund_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/securenet/api.rb', line 75

def refund_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
end

#reset_payment_methods(kb_account_id, payment_methods, properties, context) ⇒ Object



145
146
147
# File 'lib/securenet/api.rb', line 145

def reset_payment_methods(, payment_methods, properties, context)
  super
end

#search_payment_methods(search_key, offset, limit, properties, context) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/securenet/api.rb', line 137

def search_payment_methods(search_key, offset, limit, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(search_key, offset, limit, properties, context)
end

#search_payments(search_key, offset, limit, properties, context) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/securenet/api.rb', line 93

def search_payments(search_key, offset, limit, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  properties = merge_properties(properties, options)
  super(search_key, offset, limit, properties, context)
end

#set_default_payment_method(kb_account_id, kb_payment_method_id, properties, context) ⇒ Object



125
126
127
# File 'lib/securenet/api.rb', line 125

def set_default_payment_method(, kb_payment_method_id, properties, context)
  # TODO
end

#void_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, properties, context) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/securenet/api.rb', line 55

def void_payment(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, properties, context)
  # Pass extra parameters for the gateway here
  options = {}

  default_options(options, kb_payment_transaction_id)

  properties = merge_properties(properties, options)
  super(, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, properties, context)
end