2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-25 16:15:39 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
2018-03-25 17:30:42 +00:00
|
|
|
class DirectDebitDetailsController < ApplicationController
|
|
|
|
# POST /sepa
|
|
|
|
# This endpoint is used for saving direct debit account details
|
|
|
|
# when SEPA payment is selected in the donation widget. Actual charge is
|
|
|
|
# happening offline, after donations are exported to an external CRM.
|
|
|
|
def create
|
|
|
|
render(
|
2019-07-30 21:29:24 +00:00
|
|
|
JsonResp.new(params) do |_data|
|
2018-03-25 17:30:42 +00:00
|
|
|
requires(:supporter_id).as_int
|
|
|
|
requires(:sepa_params).nested do
|
|
|
|
requires(:iban, :name, :bic).as_string
|
|
|
|
end
|
2019-07-30 21:29:24 +00:00
|
|
|
end.when_valid do |_data|
|
2018-03-25 17:30:42 +00:00
|
|
|
InsertDirectDebitDetail.execute(params)
|
|
|
|
end
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|