from otree.api import * doc = """ Ending Page and Info Request for Payment """ class C(BaseConstants): NAME_IN_URL = 'f_ending' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): payment_method_1 = models.StringField( label='Which payment method do you prefer the most?', choices=[ ['OVO', 'OVO'], ['GoPay', 'GoPay'], ['DANA', 'DANA'], ['Bank Transfer', 'Bank Transfer'], ], widget=widgets.RadioSelect ) payment_method_2 = models.StringField( label='What is your second preferred payment method?
' '(We will use this method if there is an issue with your first choice)', choices=[ ['OVO', 'OVO'], ['GoPay', 'GoPay'], ['DANA', 'DANA'], ['Bank Transfer', 'Bank Transfer'], ], widget=widgets.RadioSelect ) ewallet_number = models.StringField( label='Phone number linked to your e-wallet account
' '(Optional)', blank=True ) bank_name = models.StringField( label='Your bank name
' '(Optional)', blank=True ) bank_acc_num = models.StringField( label='Your bank account number
' '(Optional)', blank=True ) email_address = models.StringField( label='Your email address' '(Optional)', blank=True ) payment_info_consent = models.BooleanField( label='We ask for your contact and payment information on the next page.
' '(Optional)', choices=[ [True, 'I understand the purpose of this request and agree to provide the information.'], [False, 'I do not agree to provide this information.'], ], blank=True, ) time_preference = models.StringField( label='If we offer part of your payment (Rp10,000 out of your fixed Rp40,000 participation payment) ' 'to be paid in advance (within 24 hours after this session ends), which of the following options would you choose?
' '(Rp30,000 of the fixed payment and any bonus payments will be paid approximately one month from now.', choices=[ ['1', ''], ], widget=widgets.RadioSelect, ) time_preference_1 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp11,000 next month'] ], widget=widgets.RadioSelect ) time_preference_2 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp12,000 next month'] ], widget=widgets.RadioSelect ) time_preference_3 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp13,000 next month'] ], widget=widgets.RadioSelect ) time_preference_4 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp14,000 next month'] ], widget=widgets.RadioSelect ) time_preference_5 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp15,000 next month'] ], widget=widgets.RadioSelect ) time_preference_6 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp16,000 next month'] ], widget=widgets.RadioSelect ) time_preference_7 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp17,000 next month'] ], widget=widgets.RadioSelect ) time_preference_8 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp18,000 next month'] ], widget=widgets.RadioSelect ) time_preference_9 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp19,000 next month'] ], widget=widgets.RadioSelect ) time_preference_10 = models.StringField( label='Which of the following options would you choose?
', choices=[ ['1', 'Receive Rp10,000 today (within 24 hours)'], ['2', 'Receive Rp20,000 next month'] ], widget=widgets.RadioSelect ) # Consent consent_failed = models.BooleanField(initial=False) # PAGES class Time_Preference(Page): form_model = 'player' form_fields = [ 'time_preference_1', 'time_preference_2', 'time_preference_3', 'time_preference_4', 'time_preference_5', 'time_preference_6', 'time_preference_7', 'time_preference_8', 'time_preference_9', 'time_preference_10', ] class Ending_Page(Page): pass class Payment_Info_Consent(Page): form_model = 'player' form_fields = ['payment_info_consent'] def before_next_page(player: Player, timeout_happened): if not player.payment_info_consent: player.consent_failed = True class Payment_Info(Page): form_model = 'player' form_fields = [ 'payment_method_1', 'payment_method_2', 'ewallet_number', 'bank_name', 'bank_acc_num', 'email_address' ] @staticmethod def is_displayed(player: Player): return player.consent_failed is False class Contact_Page(Page): pass page_sequence = [ Ending_Page, Time_Preference, Payment_Info_Consent, Payment_Info, Contact_Page ]