class Adyen::API::RecurringService

This is the class that maps actions to Adyen’s Recurring SOAP service.

It’s encouraged to use the shortcut methods on the {API} module, which abstracts away the difference between this service and the {PaymentService}. Henceforth, for extensive documentation you should look at the {API} documentation.

The most important difference is that you instantiate a {RecurringService} with the parameters that are needed for the call that you will eventually make.

@example

recurring = Adyen::API::RecurringService.new(:shopper => { :reference => user.id })
response = recurring.disable
response.success? # => true

Constants

CARD_PARTIAL

@private

DISABLE_LAYOUT

@private

ELV_ATTRS
ELV_PARTIAL

@private

ENDPOINT_URI

The Adyen Recurring SOAP service endpoint uri.

LIST_LAYOUT

@private

RECURRING_DETAIL_PARTIAL

@private

STORE_TOKEN_LAYOUT

Public Instance Methods

disable() click to toggle source

@see API.disable_recurring_contract

   # File lib/adyen/api/recurring_service.rb
30 def disable
31   call_webservice_action('disable', disable_request_body, DisableResponse)
32 end
list() click to toggle source

@see API.list_recurring_details

   # File lib/adyen/api/recurring_service.rb
25 def list
26   call_webservice_action('listRecurringDetails', list_request_body, ListResponse)
27 end
store_token() click to toggle source

@see API.store_recurring_token

   # File lib/adyen/api/recurring_service.rb
35 def store_token
36   call_webservice_action('storeToken', store_token_request_body, StoreTokenResponse)
37 end

Private Instance Methods

card_partial() click to toggle source

The card's CVC isn't needed when tokenising details, so insert `nil'.

   # File lib/adyen/api/recurring_service.rb
42 def card_partial
43   validate_parameters!(:card => [:holder_name, :number, :expiry_year, :expiry_month])
44   card  = @params[:card].values_at(:holder_name, :number, :cvc, :expiry_year)
45   card << @params[:card][:expiry_month].to_i
46   CARD_PARTIAL % card
47 end
disable_request_body() click to toggle source
   # File lib/adyen/api/recurring_service.rb
62 def disable_request_body
63   validate_parameters!(:merchant_account, :shopper => [:reference])
64   if reference = @params[:recurring_detail_reference]
65     reference = RECURRING_DETAIL_PARTIAL % reference
66   end
67   DISABLE_LAYOUT % [@params[:merchant_account], @params[:shopper][:reference], reference || '']
68 end
elv_partial() click to toggle source

The ELV - (Elektronisches Lastschriftverfahren) does not require bank_location, so insert 'nil'.

   # File lib/adyen/api/recurring_service.rb
51 def elv_partial
52   validate_parameters!(:elv => ELV_ATTRS)
53   elv  = @params[:elv].values_at(*ELV_ATTRS)
54   ELV_PARTIAL % elv
55 end
list_request_body() click to toggle source
   # File lib/adyen/api/recurring_service.rb
57 def list_request_body
58   validate_parameters!(:merchant_account, :shopper => [:reference])
59   LIST_LAYOUT % [@params[:merchant_account], @params[:shopper][:reference]]
60 end
store_token_request_body() click to toggle source
   # File lib/adyen/api/recurring_service.rb
70 def store_token_request_body
71   validate_parameters!(:merchant_account, :shopper => [:email, :reference])
72   content = []
73   content << card_partial unless @params[:card].nil?
74   content << elv_partial  unless @params[:elv].nil?    
75   raise ArgumentError, "The required parameter 'card' or 'elv' is missing." if content.empty?    
76   STORE_TOKEN_LAYOUT % [@params[:merchant_account], @params[:shopper][:reference], @params[:shopper][:email], content.join]
77 end