예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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
예제 #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)
예제 #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)
예제 #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')
예제 #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")
예제 #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')
예제 #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")
예제 #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