Repository navigation
Expand file tree
/
Copy pathvat_payment_deadlines_flow.rb
More file actions
65 lines (57 loc) · 1.74 KB
/
Copy pathvat_payment_deadlines_flow.rb
File metadata and controls
65 lines (57 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class VatPaymentDeadlinesFlow < SmartAnswer::Flow
def define
content_id "dfa9a5c3-d52e-479c-8505-855f475dc338"
name "vat-payment-deadlines"
status :published
date_question :when_does_your_vat_accounting_period_end? do
default_day { -1 }
on_response do
self.calculator = SmartAnswer::Calculators::VatPaymentDeadlines.new
end
validate :error_message do |response|
response == response.end_of_month
end
next_node do |response|
calculator.period_end_date = response
question :how_do_you_want_to_pay?
end
end
radio :how_do_you_want_to_pay? do
option "direct-debit"
option "online-telephone-banking"
option "online-debit-credit-card"
option "bacs-direct-credit"
option "bank-giro"
option "chaps"
option "cheque"
on_response do |response|
calculator.payment_method = response
end
next_node do |response|
case response
when "direct-debit"
outcome :result_direct_debit
when "online-telephone-banking"
outcome :result_online_telephone_banking
when "online-debit-credit-card"
outcome :result_online_debit_credit_card
when "bacs-direct-credit"
outcome :result_bacs_direct_credit
when "bank-giro"
outcome :result_bank_giro
when "chaps"
outcome :result_chaps
when "cheque"
outcome :result_cheque
end
end
end
outcome :result_direct_debit
outcome :result_online_telephone_banking
outcome :result_online_debit_credit_card
outcome :result_bacs_direct_credit
outcome :result_bank_giro
outcome :result_chaps
outcome :result_cheque
end
end