Module: SecureNet
- Defined in:
- lib/securenet.rb
Class Method Summary collapse
-
.authorize(data) ⇒ Object
Transaction Processing.
- .capture(data) ⇒ Object
- .charge(data) ⇒ Object
- .closeBatch ⇒ Object
-
.createCustomer(data) ⇒ Object
Vault.
- .createCustomerPaymentMethod(data) ⇒ Object
-
.createInstallmentPlan(data) ⇒ Object
Installment Plans.
- .createRecurringPlan(data) ⇒ Object
- .createVariablePlan(data) ⇒ Object
-
.credit(data) ⇒ Object
Credits.
- .deleteCustomerPaymentMethod(data) ⇒ Object
- .deletePlan(data) ⇒ Object
- .getBatch(batchid) ⇒ Object
-
.getCurrentBatch ⇒ Object
Batch Routines.
- .getCustomer(data) ⇒ Object
- .getCustomerPaymentMethod(data) ⇒ Object
- .getPlan(data) ⇒ Object
- .getTransaction(data) ⇒ Object
-
.getTransactions(data) ⇒ Object
Transactions.
- .init(id, key, url = "https://gwapi.demo.securenet.com/api") ⇒ Object
-
.refund(data) ⇒ Object
Refunds and Voids.
- .updateCustomer(data) ⇒ Object
- .updateTransaction(data) ⇒ Object
- .void(data) ⇒ Object
Class Method Details
.authorize(data) ⇒ Object
Transaction Processing
33 34 35 |
# File 'lib/securenet.rb', line 33 def self.(data) return @util.post("/Payments/Authorize", data) end |
.capture(data) ⇒ Object
37 38 39 |
# File 'lib/securenet.rb', line 37 def self.capture(data) return @util.post("/Payments/Capture", data) end |
.charge(data) ⇒ Object
41 42 43 |
# File 'lib/securenet.rb', line 41 def self.charge(data) return @util.post("/Payments/Charge", data) end |
.closeBatch ⇒ Object
25 26 27 |
# File 'lib/securenet.rb', line 25 def self.closeBatch return @util.post("/batches/Close", nil) end |
.createCustomer(data) ⇒ Object
Vault
49 50 51 |
# File 'lib/securenet.rb', line 49 def self.createCustomer(data) return @util.post("/Customers", data) end |
.createCustomerPaymentMethod(data) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/securenet.rb', line 73 def self.createCustomerPaymentMethod(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end return @util.post("/Customers/#{customerId}", data) end |
.createInstallmentPlan(data) ⇒ Object
Installment Plans
104 105 106 107 108 109 |
# File 'lib/securenet.rb', line 104 def self.createInstallmentPlan(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end return @util.post("/Customers/#{customerId}/PaymentSchedules/Installment", data) end |
.createRecurringPlan(data) ⇒ Object
118 119 120 121 122 123 |
# File 'lib/securenet.rb', line 118 def self.createRecurringPlan(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end return @util.post("/Customers/#{customerId}/PaymentSchedules/Recurring", data) end |
.createVariablePlan(data) ⇒ Object
111 112 113 114 115 116 |
# File 'lib/securenet.rb', line 111 def self.createVariablePlan(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end return @util.post("/Customers/#{customerId}/PaymentSchedules/Variable", data) end |
.credit(data) ⇒ Object
Credits
149 150 151 |
# File 'lib/securenet.rb', line 149 def self.credit(data) return @util.post("/Payments/Credit", data) end |
.deleteCustomerPaymentMethod(data) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/securenet.rb', line 90 def self.deleteCustomerPaymentMethod(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end if ! data.has_key?("paymentMethodId".to_sym) return @util.error("paymentMethodId is required") end return @util.delete("/Customers/#{data[:customerId]}/PaymentMethod/#{data[:paymentMethodId]}", data) end |
.deletePlan(data) ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'lib/securenet.rb', line 135 def self.deletePlan(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end if ! data.has_key?("planId".to_sym) return @util.error("planId is required") end return @util.delete("/Customers/#{data[:customerId]}/PaymentSchedules/#{data[:planId]}", data) end |
.getBatch(batchid) ⇒ Object
21 22 23 |
# File 'lib/securenet.rb', line 21 def self.getBatch(batchid) return @util.get("/batches/#{batchid}", nil) end |
.getCurrentBatch ⇒ Object
Batch Routines
17 18 19 |
# File 'lib/securenet.rb', line 17 def self.getCurrentBatch return @util.get("/batches/Current", nil) end |
.getCustomer(data) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/securenet.rb', line 53 def self.getCustomer(data) if data.class == Hash if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end customerId = data[:customerId] else customerId = data end return @util.get("/Customers/#{customerId}", nil) end |
.getCustomerPaymentMethod(data) ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/securenet.rb', line 80 def self.getCustomerPaymentMethod(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end if ! data.has_key?("paymentMethodId".to_sym) return @util.error("paymentMethodId is required") end return @util.get("/Customers/#{data[:customerId]}/PaymentMethod/#{data[:paymentMethodId]}", data) end |
.getPlan(data) ⇒ Object
125 126 127 128 129 130 131 132 133 |
# File 'lib/securenet.rb', line 125 def self.getPlan(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end if ! data.has_key?("planId".to_sym) return @util.error("planId is required") end return @util.get("/Customers/#{data[:customerId]}/PaymentSchedules/#{data[:planId]}", data) end |
.getTransaction(data) ⇒ Object
185 186 187 188 189 190 191 192 193 194 |
# File 'lib/securenet.rb', line 185 def self.getTransaction(data) if data.class == Hash if ! data.has_key?("transactionId".to_sym) return @util.error("transactionId is required") end return @util.get("/Transactions/#{data[:transactionId]}", nil) else return @util.get("/Transactions/#{data}", nil) end end |
.getTransactions(data) ⇒ Object
Transactions
177 178 179 180 181 182 183 |
# File 'lib/securenet.rb', line 177 def self.getTransactions(data) if data.class == Hash return @util.post("/Transactions/Search", data) else return @util.get("/Transactions/#{data}", nil) end end |
.init(id, key, url = "https://gwapi.demo.securenet.com/api") ⇒ Object
9 10 11 |
# File 'lib/securenet.rb', line 9 def self.init(id, key, url = "https://gwapi.demo.securenet.com/api") @util = SecurenetUtil.new(id, key, url) end |
.refund(data) ⇒ Object
Refunds and Voids
157 158 159 160 161 162 163 |
# File 'lib/securenet.rb', line 157 def self.refund(data) if data.class == Hash return @util.post("/Payments/Refund", data) else return @util.post("/Payments/Refund", { :transactionId => data }) end end |
.updateCustomer(data) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/securenet.rb', line 65 def self.updateCustomer(data) if ! data.has_key?("customerId".to_sym) return @util.error("customerId is required") end return @util.put("/Customers/#{data[:customerId]}", data) end |
.updateTransaction(data) ⇒ Object
196 197 198 199 200 201 |
# File 'lib/securenet.rb', line 196 def self.updateTransaction(data) if ! data.has_key?("referenceTransactionId".to_sym) return @util.error("referenceTransactionId is required") end return @util.put("/Transactions/#{data[:referenceTransactionId]}", data) end |
.void(data) ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/securenet.rb', line 165 def self.void(data) if data.class == Hash return @util.post("/Payments/Void", data) else return @util.post("/Payments/Void", { :transactionId => data }) end end |