Class: Adyen::SOAP::RecurringService

Inherits:
Base
  • Object
show all
Defined in:
lib/adyen/soap.rb

Overview

SOAP client to interact with the recurring payment service of Adyen. This client implements the submitRecurring call to submit payments for a recurring contract. Moreover, it implements the deactiveRecurring call to cancel a recurring contract.

See the Adyen Recurring manual for more information about this SOAP service

Constant Summary collapse

ENDPOINT_URI =
'https://pal-%s.adyen.com/pal/servlet/soap/Recurring'

Instance Method Summary collapse

Methods inherited from Base

inherited, #on_after_create_http_client, #on_before_dispatch, #on_create_document, #on_response_document

Instance Method Details

#deactivate(args = {}) ⇒ Object

Deactivates a recurring payment contract. Requires the following arguments:

  • :merchent_account The merchant account under which to place

    this payment.
    
  • :recurring_reference The psp_reference of the RECURRING_CONTRACT

    notification that was sent after the initial payment.
    
  • :reference The (merchant) reference for this deactivation.

  • :shopper_reference The refrence of the shopper. This should be

    the same as the reference that was used to create the recurring contract.
    


140
141
142
143
144
145
146
147
148
149
150
# File 'lib/adyen/soap.rb', line 140

def deactivate(args = {})
  invoke_args = Adyen::SOAP.default_arguments.merge(args)
  response = invoke('recurring:deactivateRecurring') do |message|
    message.add('recurring:recurringRequest') do |req|
      req.add('recurring:merchantAccount', invoke_args[:merchant_account])
      req.add('recurring:recurringReference', invoke_args[:recurring_reference])
      req.add('recurring:reference', invoke_args[:reference])
      req.add('recurring:shopperReference', invoke_args[:shopper_reference])
    end
  end
end

#submit(args = {}) ⇒ Object

Submits a recurring payment. Requires the following arguments as hash:

  • :currency The currency code (EUR, GBP, USD, etc)

  • :value The value of the payments in cents

  • :merchent_account The merchant account under which to place

    this payment.
    
  • :recurring_reference The psp_reference of the RECURRING_CONTRACT

    notification that was sent after the initial payment.
    
  • :reference The (merchant) reference for this payment.

  • :shopper_email The email address of the shopper.

  • :shopper_reference The refrence of the shopper. This should be

    the same as the reference that was used to create the recurring contract.
    


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/adyen/soap.rb', line 114

def submit(args = {})
  invoke_args = Adyen::SOAP.default_arguments.merge(args)
  response = invoke('recurring:submitRecurring') do |message|
    message.add('recurring:recurringRequest') do |req|
      req.add('recurring:amount') do |amount|
        amount.add('common:currency', invoke_args[:currency])
        amount.add('common:value', invoke_args[:value])
      end
      req.add('recurring:merchantAccount', invoke_args[:merchant_account])
      req.add('recurring:recurringReference', invoke_args[:recurring_reference])
      req.add('recurring:reference', invoke_args[:reference])
      req.add('recurring:shopperEmail', invoke_args[:shopper_email])
      req.add('recurring:shopperReference', invoke_args[:shopper_reference])
    end
  end
end