Esempio n. 1
0
 def update_record_in_receipt(self, date, qty):
     if len(self.receipt) == 0:
         raise custom_error.InputError('no item to update')
     else:
         all_date = [x['date'] for x in self.receipt]
         if date in all_date:
             for item in self.receipt:
                 if item['date'] == date:
                     item['qty'] = qty
         else:
             raise custom_error.InputError(
                 'can not find matching date to update')
Esempio n. 2
0
 def delete_post_address(self, address: str):
     if self.post_address is not None:
         self.post_address = None
         logging.info('post_address is deleted')
     else:
         raise custom_error.InputError(
             'address is not exist for delete, please add address first')
Esempio n. 3
0
 def add_payment_schedule(self, payment_schedule_option: str):
     if payment_schedule_option is not None:
         if payment_schedule_option == 'Monthy_Pay':
             self.payment_method = pay_schedule.Monthy_Pay(1)
         elif payment_schedule_option == 'Weekly_Pay':
             self.payment_method = pay_schedule.Weekly_Pay(1)
         elif payment_schedule_option == 'Biweekly_Pay':
             self.payment_method = pay_schedule.Biweekly_Pay(1)
         else:
             return 'payment_schedule_option is not exist'
     else:
         raise custom_error.InputError(
             'payment_schedule already exist, you could use update_payment_schedule'
         )
Esempio n. 4
0
 def add_payment_method(self, payment_method_option: str):
     if payment_method_option is not None:
         if payment_method_option == 'Payment_to_Post':
             self.payment_method = payment_method.Payment_to_Post(1)
         elif payment_method_option == 'Payment_in_Company':
             self.payment_method = payment_method.Payment_in_Company(1)
         elif payment_method_option == 'Payment_to_PerosnalAccount':
             self.payment_method = payment_method.Payment_to_PerosnalAccount(
                 1)
         else:
             return 'payment_method_option is not exist'
     else:
         raise custom_error.InputError(
             'payment_method already exist, you could use update_payment_method'
         )
Esempio n. 5
0
 def update_post_address(self, address: str):
     if self.post_address is not None:
         self.post_address = address
     else:
         raise custom_error.InputError(
             'address is not exist for update, please add address first')
Esempio n. 6
0
 def add_post_address(self, address: str):
     if self.post_address is not None:
         raise custom_error.InputError(
             'address already exist, you could use update_post_address')
     else:
         self.post_address = address
Esempio n. 7
0
 def get_payment_schedule(self):
     if self.payment_schedule is not None:
         return self.payment_schedule
     else:
         raise custom_error.InputError('no payment_schedule, system error')