Esempio n. 1
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        #send notification: consider using ngrok to call an offline API or try twilio later on
        Sync.objects.create(method='register', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com',
                     'register')  # ack sync table if successful

        #remeber to send the password to the phone no. of the user. Once the email is set, the user can make choices.
        data = {
            'message':
            'Dear customer, thanks for signing up. Your password is: {}. Have the best re-charging experience ever!'
            .format(self.reset_password),
            'phone':
            obj.username
        }
        task_sms(data)
Esempio n. 2
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        #send notification: consider using ngrok to call an offline API or try twilio later on
        Sync.objects.create(method='register', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'register')   # ack sync table if successful

        #remeber to send the password to the phone no. of the user. Once the email is set, the user can make choices.
        data = {
            'message': 'Dear customer, thanks for signing up. Your password is: {}. Have the best re-charging experience ever!'.format(self.reset_password),
            'phone': obj.username
        }
        task_sms(data)
Esempio n. 3
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        #send notification: consider using ngrok to call an offline API
        Sync.objects.create(method='register', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'register')
        data = {
            'message':
            'Dear customer, thanks for signing up. Have the best re-charging experience ever!',
            'phone': obj.username
        }
        task_sms(data)
Esempio n. 4
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        #send notification: consider using ngrok to call an offline API
        Sync.objects.create(method='register', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'register')
        data = {
            'message': 'Dear customer, thanks for signing up. Have the best re-charging experience ever!',
            'phone': obj.username
        }
        task_sms(data)
Esempio n. 5
0
    def post_save(self, obj, created=False):
        Sync.objects.create(method='update_schedule',
                            model_id=obj.id)  # sync into sync db

        task_request(
            obj, 'www.arooko.ngrok.com',
            'update_schedule')  # will do it immediately unless network down
Esempio n. 6
0
    def post_save(self, obj, created=False):
        if self.uplink_user:
            OfflineWalletLog.objects.create(wallet=obj,
                                            user_from=self.uplink_user,
                                            amount=obj.amount,
                                            report='uplink-to-downlink')
        elif self.master_user:
            OfflineWalletLog.objects.create(wallet=obj,
                                            user_from=self.master_user,
                                            amount=obj.amount,
                                            report='master-to-slave')
        else:
            OfflineWalletLog.objects.create(wallet=obj,
                                            amount=obj.amount,
                                            report='self')

        Sync.objects.create(method='update_wallet', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'update_wallet')

        #send this message in the sync after sync
        msg = 'Dear Customer, {} credited your account with {}. Thanks for your patronage!'.format(
            self.kwargs['owner'].get_full_name, obj.amount)
        data = {'message': msg, 'phone': self.kwargs['owner'].username}
        task_sms(data)
Esempio n. 7
0
    def post_save(self, obj, created=False):
        if self.uplink_user:
            OfflineWalletLog.objects.create(wallet=obj, user_from=self.uplink_user, amount=obj.amount, report='uplink-to-downlink')
        elif self.master_user:
            OfflineWalletLog.objects.create(wallet=obj, user_from=self.master_user, amount=obj.amount, report='master-to-slave')
        else:
            OfflineWalletLog.objects.create(wallet=obj, amount=obj.amount, report='self')

        Sync.objects.create(method='update_wallet', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'update_wallet')

        #send this message in the sync after sync
        msg = 'Dear Customer, {} credited your account with {}. Thanks for your patronage!'.format(self.kwargs['owner'].get_full_name, obj.amount)
        data = {'message':msg, 'phone':self.kwargs['owner'].username}
        task_sms(data)
Esempio n. 8
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        Sync.objects.create(method='register', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'register')
Esempio n. 9
0
    def post_save(self, obj, created=True):
        for user in User.objects.all():
            try:
                Wallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                OfflineWallet.objects.create(owner=user)
            except IntegrityError:
                pass
            try:
                Token.objects.create(user=user)
            except IntegrityError:
                pass
            try:
                Schedule.objects.create(user=user)
            except IntegrityError:
                pass

        Sync.objects.create(method="register", model_id=obj.id)

        task_request(obj, "www.arooko.ngrok.com", "register")
Esempio n. 10
0
    def post_save(self, obj, created=False):
        Sync.objects.create(method='update_user', model_id=obj.id)

        task_request(obj, 'www.arooko.ngrok.com', 'update_user')
Esempio n. 11
0
    def post_save(self, obj, created=False):
        Sync.objects.create(method="update_user", model_id=obj.id)

        task_request(obj, "www.arooko.ngrok.com", "update_user")
Esempio n. 12
0
    def post_save(self, obj, created=False):
        Sync.objects.create(method='update_schedule', model_id=obj.id)      # sync into sync db

        task_request(obj, 'www.arooko.ngrok.com', 'update_schedule')    # will do it immediately unless network down