Method: ActiveMerchant::Billing::TrustCommerceGateway#recurring
- Defined in:
- lib/active_merchant/billing/gateways/trust_commerce.rb
#recurring(money, creditcard, options = {}) ⇒ Object
recurring() a TrustCommerce account that is activated for Citadel, TrustCommerce’s hosted customer billing info database.
Recurring billing uses the same TC action as a plain-vanilla ‘store’, but we have a separate method for clarity. It can be called like store, with the addition of a required ‘periodicity’ parameter:
The parameter :periodicity should be specified as either :bimonthly, :monthly, :biweekly, :weekly, :yearly or :daily
gateway.recurring(tendollar, creditcard, :periodicity => :weekly)
You can optionally specify how long you want payments to continue using ‘payments’
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/active_merchant/billing/gateways/trust_commerce.rb', line 268 def recurring(money, creditcard, = {}) ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE requires!(, i[periodicity bimonthly monthly biweekly weekly yearly daily]) cycle = case [:periodicity] when :monthly '1m' when :bimonthly '2m' when :weekly '1w' when :biweekly '2w' when :yearly '1y' when :daily '1d' end parameters = { amount: amount(money), cycle:, verify: [:verify] || 'y', billingid: [:billingid] || nil, payments: [:payments] || nil } add_creditcard(parameters, creditcard) commit('store', parameters) end |