def test_get_many_payments(self): self.assertEqual(True, isinstance(Payment.get(id=1), dict)) self.payment1.save() self.payment2.save() self.assertEqual(True, isinstance(Payment.get_all()[0], Payment)) self.assertEqual(True, isinstance(Payment.get_all()[1], Payment)) self.assertEqual(2, len(Payment.get_all()))
def create(self, validated_data): """Crear pago de especialista.""" match = validated_data.pop('match') instance = Payment(**validated_data) instance.save() match.status = 5 if 'test' not in sys.argv: client_id = match.client_id specialist_id = match.specialist_id qset_client = Client.objects.filter(pk=client_id) qset_spec = Specialist.objects.filter(pk=specialist_id) dict_pending = NotificationClientSerializer(qset_client).data dict_pending_sp = NotificationSpecialistSerializer(qset_spec).data badge_count = dict_pending["queries_pending"] + dict_pending[ "match_pending"] badge_count_sp = dict_pending_sp[ "queries_pending"] + dict_pending_sp["match_pending"] disp_name = display_specialist_name(match) disp_name_to_specialist = display_client_name(match.client) data_notif_push = { "title": disp_name, "body": match.subject, "sub_text": "", "ticker": trans("successful hiring"), "badge": badge_count, "icon": match.category.image, "type": Params.TYPE_NOTIF["match_success"], "queries_pending": dict_pending["queries_pending"], "match_pending": dict_pending["match_pending"], "match_id": match.id } data_specialist = { "title": disp_name_to_specialist, "body": match.subject, "sub_text": "", "ticker": trans("successful hiring"), "badge": badge_count_sp, "icon": match.category.image, "type": Params.TYPE_NOTIF["match_success"], "queries_pending": dict_pending_sp["queries_pending"], "match_pending": dict_pending_sp["match_pending"], "match_id": match.id } # envio de notificacion push Notification.fcm_send_data(user_id=client_id, data=data_notif_push) Notification.fcm_send_data(user_id=specialist_id, data=data_specialist) match.save() sellercontact = match.client.sellercontact_set.get() sellercontact.type_contact = 3 sellercontact.save() sale = match.sale_detail.sale sale.status = 3 sale.save() return instance
def add_payment(request): payment = Payment( date=request.GET['date'], pay_out=request.GET['pay_out'], pay_in=request.GET['pay_in'], ) payment.save() return HttpResponse("OK")
def handle(self, *args, **options): if len(Company.objects.all()) < 5: company_names = [ "charity", "grocery", "assignment", "industry", "negotiation", "mud", "performance", "committee", "patience", "meaning", "student", "teaching", "message", "agency", "county", "inspector", "president", "fortune", "instruction", "television", "estate", "inflation", "refrigerator", "examination", "organization", "death", "teacher", "warning", "idea", "psychology", "establishment", "mode", "session", "politics", "analysis", "transportation", "difference", "variation", "version", "information", "addition", "dinner", "homework", "protection", "property", "writing", "hotel", "possession", "problem" ] company_titles = ["LLC", "Inc", "Co", "Corp", "Ltd"] names = [ "Jacob", "Michael", "Matthew", "Joshua", "Christopher", "Nicholas", "Andrew", "Joseph", "Daniel", "Tyler", "William", "Brandon", "Ryan", "John", "Zachary", "David", "Anthony", "James", "Justin", "Alexander", "Jonathan", "Christian", "Austin", "Dylan", "Ethan", "Benjamin", "Noah", "Samuel", "Robert", "Nathan", "Cameron", "Kevin", "Thomas", "Jose", "Hunter", "Jordan", "Kyle", "Caleb", "Jason", "Logan", "Aaron", "Eric", "Brian", "Gabriel", "Adam", "Jack", "Isaiah", "Juan", "Luis", "Connor" ] last_names = [ "Smith", "Johnson", "Williams", "Brown", "Jones", "Miller", "Davis", "Garcia", "Rodriguez", "Wilson", "Martinez", "Anderson", "Taylor", "Thomas", "Hernandez", "Moore", "Martin", "Jackson", "Thompson", "White", "Lopez", "Lee", "Gonzalez", "Harris", "Clark", "Lewis", "Robinson", "Walker", "Perez", "Hall", "Young", "Allen", "Sanchez", "Wright", "King", "Scott", "Green", "Baker", "Adams", "Nelson", "Hill", "Ramirez", "Campbell", "Mitchell", "Roberts", "Carter", "Phillips", "Evans", "Turner", "Torres" ] for index, company in enumerate(company_names): print("*****Creating users for : " + company + " - " + str(index) + " of " + str(len(company_names)) + "*****") company = Company.create(company.capitalize() + " " + random.choice(company_titles)) for name in range(1, random.randrange(1, 20)): fullname = names[name] + " " + random.choice( last_names) + " " + str(random.randrange(1, 9999)) user = PerpayUser.objects.create_user(username=fullname, email=fullname + "@gmail.com", password="******", company=company.id) for i in range(1, random.randrange(1, 20)): Payment.create(random.randrange(1, 5000), user) else: self.stdout.write(self.style.SUCCESS('Skipped Database fill'))
def validate(self, data: dict) -> dict: payment = Payment(**data) try: payment.validate() except ValueError as e: raise serializers.ValidationError({"error": e}) return data
def test_update_payment(self): self.payment1.save() payment1 = Payment.get(id=1) payment1.update({'balance': 1000.0, 'required': 5000.0}) payment1 = Payment.get(id=1) self.assertEqual(1000.0, payment1.balance) self.assertEqual(5000.0, payment1.required) self.assertTrue(isinstance( payment1.update({'random': 'bad field'}), dict))
def setUp(self): """ Set up test application. """ self.app = create_app('testing') self.client = self.app.test_client() self.client.headers = {'Authorization': getenv('TEST_TOKEN')} self.app_context = self.app.app_context() self.app_context.push() db.drop_all() db.create_all() self.board1 = Board() self.board2 = Board() self.conversation1 = Conversation() self.conversation2 = Conversation() self.deposit1 = Deposit() self.deposit2 = Deposit() self.estate1 = Estate(address="Random Address 1") self.estate2 = Estate(address="Random Address 2") self.estate3 = Estate() self.headers = {'Authorization': getenv('TEST_TOKEN')} self.message1 = Message(sender=1, content='Random Content') self.message2 = Message(sender=2, content='Random Content') self.message3 = Message() self.payment1 = Payment() self.payment2 = Payment() self.role1 = Role(title='basic') self.role2 = Role(title='admin') self.role3 = Role(title='super_admin') self.role4 = Role() self.unit1 = Unit(name="Random Unit 1") self.unit2 = Unit(name="Random Unit 2") self.unit3 = Unit() self.user1 = User(name="First1 Middle1 Last1", phone_number="000 12 3456781", email="*****@*****.**", password=digest('ABC123!@#')) self.user2 = User(name="First2 Middle2 Last2", phone_number="000 12 3456782", email="*****@*****.**", password=digest('ABC123!@#')) self.user3 = User() self.user_new_data1 = {'phone_number': "000 12 3456783"} self.user_new_data2 = {'bad_field': "random"} self.wallet1 = Wallet() self.wallet2 = Wallet() self.user1_dict = { "name": "First1 Middle1 Last1", "phone_number": "000 12 3456781", "email": "*****@*****.**", "password": "******" } self.conversation3_dict = {"participants": [1, 2]} self.message4_dict = {"content": "New Message."} self.board3_dict = {'members': [1, 2]}
def import_payments(request): if request.method == 'POST': Employee.objects.all().delete() req_body = request.FILES['file'].read() payments_dict = simplexml.loads(req_body)['payments'] for p in payments_dict: payment_tosave = Payment(method=p['method'], raw_salary=p['raw_salary'], tax_rate=p['tax_rate']) payment_tosave.save() return HttpResponse(status=200) return HttpResponse(status=400)
def test_add_and_remove_payments_from_wallet(self): self.wallet1.save() self.payment1.save() self.payment2.save() wallet1 = Wallet.get(id=1) self.assertEqual(0, len(wallet1.payments)) wallet1.insert('payments', [Payment.get(id=1), Payment.get(id=2)]) wallet1 = Wallet.get(id=1) self.assertEqual(True, isinstance(wallet1.payments[0], Payment)) self.assertEqual(True, isinstance(wallet1.payments[1], Payment)) self.assertEqual(2, len(wallet1.payments)) wallet1.remove('payments', id=1) self.assertEqual(1, len(wallet1.payments))
def create_payment_intent(request): stripe.api_key = settings.STRIPE_KEY value = request.POST.get("value", None) if not value: return Response({'error': 'Value must exist.'}, status=status.HTTP_200_OK) value = int(value) * 100 if value < 1: return Response({'error': 'Value must be greater than or equal to 1.'}, status=status.HTTP_200_OK) uuid = request.POST.get("user", None) if not uuid: return Response({'error': 'ID must exist.'}, status=status.HTTP_200_OK) profile = Profile.objects.filter(uuid=uuid) if not profile: return Response({'error': 'This profile doesn\'t exist.'}, status=status.HTTP_200_OK) profile = profile.first() payment = Payment() payment.entertainer = profile payment.save() session = stripe.checkout.Session.create( payment_method_types=['card'], line_items=[{ 'name': 'Donation to ' + profile.entertainer_name, 'amount': value, 'currency': 'aud', 'quantity': 1, 'description': 'Thank you for your donation to ' + profile.entertainer_name, 'images': [ "{0}{1}{2}".format(settings.BASE_API_URL, settings.MEDIA_URL, profile.logo) ], }], payment_intent_data={ 'application_fee_amount': int(0.02 * value), 'transfer_data': { 'destination': profile.stripe_id, }, }, success_url=settings.BASE_URL + 'confirmation/' + str(payment.uuid), cancel_url=settings.BASE_URL + 'tip-user/' + str(profile.uuid), ) payment.stripe_id = session.payment_intent payment.save() return Response({'client_secret': session}, status=status.HTTP_200_OK)
def _req_body_to_payment(request): request_body_fields = request.body.decode('utf-8') payment_fields = json.loads(request_body_fields) payment = Payment(method=payment_fields['method'].encode('utf-8'), raw_salary=payment_fields['raw_salary'], tax_rate=payment_fields['tax_rate']) return payment
def handle(self, *args, **options): # company = Company.objects.get_or_create("AdminCompany") if len(Company.objects.all()) ==0: company = Company.create("AdminCompany") user=get_user_model() user = PerpayUser.objects.create_superuser(username="******",email="*****@*****.**",password="******",company=company.id) for i in range(1,random.randrange(1,10)): Payment.create(random.randrange(1,5000),user) self.stdout.write(self.style.SUCCESS('Successfully created Admin user and Company')) else: self.stdout.write(self.style.SUCCESS('Skipped initial setup'))
def test_add_and_remove_deposit_estate_unit_wallet(self): self.deposit1.save() self.deposit2.save() self.estate1.save() self.unit1.save() self.wallet1.save() self.payment1.save() payment1 = Payment.get(id=1) payment1.estate = Estate.get(id=1) payment1.unit = Unit.get(id=1) payment1.wallet = Wallet.get(id=1) payment1.insert('deposits', [Deposit.get(id=1), Deposit.get(id=2)]) self.assertEqual(True, isinstance(payment1.estate, Estate)) self.assertEqual(True, isinstance(payment1.unit, Unit)) self.assertEqual(True, isinstance(payment1.wallet, Wallet)) self.assertEqual(True, isinstance(payment1.deposits[0], Deposit)) self.assertEqual(True, isinstance(payment1.deposits[1], Deposit)) self.assertEqual(2, len(payment1.deposits)) payment1.remove('estate') payment1.remove('unit') payment1.remove('wallet') self.assertEqual(None, payment1.estate) self.assertEqual(None, payment1.unit) self.assertEqual(None, payment1.wallet) payment1.remove('deposits', id=1) self.assertEqual(1, len(payment1.deposits))
def create(self, validated_data): payment = Payment.create_payment( cart_order=validated_data['cart_order'], amount=validated_data['amount'], currency=validated_data['currency'] if validated_data.get('currency') else 'INR', status=validated_data['status'] if validated_data.get('status') else 'created') return payment
def test_add_and_remove_payment_to_deposit(self): self.deposit1.save() self.payment1.save() deposit1 = Deposit.get(id=1) self.assertEqual(None, deposit1.payment) deposit1.insert('payment', Payment.get(id=1)) self.assertEqual(True, isinstance(deposit1.payment, Payment)) deposit1.remove('payment') self.assertEqual(None, deposit1.payment)
def test_add_and_remove_payment_from_unit(self): self.unit1.save() self.payment1.save() unit1 = Unit.get(id=1) self.assertEqual(None, unit1.payment) payment1 = Payment.get(id=1) unit1.insert('payment', payment1) unit1 = Unit.get(id=1) self.assertEqual(True, isinstance(unit1.payment, Payment)) unit1.remove('payment') self.assertEqual(None, unit1.payment)
def test_add_and_remove_payment_to_estate(self): self.estate1.save() self.payment1.save() estate1 = Estate.get(id=1) self.assertEqual(None, estate1.payment) payment1 = Payment.get(id=1) estate1.insert('payment', payment1) estate1 = Estate.get(id=1) self.assertEqual(True, isinstance(estate1.payment, Payment)) estate1.remove('payment') self.assertEqual(None, estate1.payment)
def add_new_payment(self): try: payment = Payment(note=self.data['note'], amount=self.data['amount'], payer=self.data['payer'], payee=self.data['payee']) db.session.add(payment) db.session.commit() except Exception as err: print(err) raise err return '', 200
def import_payments(request): if request.method == 'POST': req_body = request.FILES['file'].read() payments_dict = simplexml.loads(req_body)['payments'] payments = [ Payment(0, p['method'], p['raw_salary'], p['tax_rate']) for p in payments_dict ] with connect() as conn: dbpayments = Payments(conn) dbpayments.importall(payments) return HttpResponse(status=200) return HttpResponse(status=400)
def payment(request): if request.method == 'POST': body = json.loads(request.body) payment = Payment.create(**body) responese = {'status': 200, 'payment': payment.serialize()} return JsonResponse(responese, status=200) response = { 'status': 400, 'message': 'Invalid request method', } return JsonResponse(response, status=400)
def order_payment(request): token = request.headers.get('token') token = Token.objects.filter(token=token) if token.exists(): if request.method == 'POST': try: info = loads(request.body.decode('utf-8')) user = token[0].user o_id = info['orderId'] trans_id = info['transactionId'] trans_time = info['transactionTime'] st = info['status'] amount = info['amount'] payment = Payment(user=user, order_id=o_id, trans_id=trans_id, status=st, amount=amount, trans_time=trans_time) payment.save() if st == 'FAILED': return my_response(False, 'transaction failed', payment.to_json()) else: o = Order.objects.filter(order_id=o_id) o.update(completed=True) o = o.first() notif_to_admin( orderId=o_id, title='order payment', message='user paid for his order with trackId: ' + str(o.track_id)) return my_response(True, 'success', payment.to_json()) except Exception as e: return my_response( False, 'error in payment order, check body send, ' + str(e), {}) elif request.method == 'GET': if token[0].is_admin: pays = Payment.objects.all() else: pays = Payment.objects.filter(user=token[0].user) _list = [] for p in pays: _list.append(p.to_json()) return my_response(True, 'success', _list) else: return my_response(False, 'invalid method', {}) else: return my_response(False, 'token not exist', {})
def create(self, validated_data): """Metodo para confirmar pago.""" fee = validated_data["monthly_fee"] # cambio el estatus de la cuota a pago # 2 PAID fee.status = 2 fee.save() qsetdetail = SaleDetail.objects.filter(sale=fee.sale) # devolver plan name, validity_months, y query quantity de los productos adquiridos # mostrarlos en la data data = {'qset': qsetdetail} # envio codigo pin por correo y aviso en push notification if fee.sale.status == 1: body = "Revisa tu correo, te enviamos tu codigo PIN" if qsetdetail.count() > 1: body = "Revisa tu correo, te enviamos tus codigos PIN" mail = BasicEmailAmazon( subject="Confirmación de pago. Productos comprados", to=fee.sale.client.username, template='email/pin_code') if 'test' not in sys.argv: mail.sendmail(args=data) qset_client = Client.objects.filter(pk=fee.sale.client_id) dict_pending = NotificationClientSerializer(qset_client).data badge_count = dict_pending["queries_pending"] + dict_pending[ "match_pending"] data_notif_push = { "title": "Se ha validado tu pago", "body": body, "sub_text": "", "ticker": "", "badge": badge_count, "icon": 'http://linkup-lb-09-916728193.us-east-1.elb.amazonaws.com/static/dashboard/dist/img/logo_grande.png', "type": Params.TYPE_NOTIF["PIN"], "queries_pending": dict_pending["queries_pending"], "match_pending": dict_pending["match_pending"] } # envio de notificacion push Notification.fcm_send_data(user_id=fee.sale.client_id, data=data_notif_push) # buscar contacto efectivo para acualitzar estado a efectivo cliente # filtar por el correo del id del cliente SellerContact.objects.filter( email_exact=fee.sale.client.username).update(type_contact=3) # compruebo si no hay mas cuotas pendientes por pagar if MonthlyFee.objects.filter(sale=fee.sale, status=1).exists(): # cambio el estatus de la ventas # 2 Progreso Sale.objects.filter(pk=fee.sale_id).update(status=2) else: # 3 pagada Sale.objects.filter(pk=fee.sale_id).update(status=3) for detail in qsetdetail: qacd = QueryPlansAcquired.objects.get(sale_detail=detail, queryplansclient__owner=True) qpclient = qacd.queryplansclient_set.get() # debo chequear si es por cuotas o no if fee.sale.is_fee: new_queries = qacd.query_plans.query_quantity / qacd.query_plans.validity_months # libero el numero de consultas que corresponde qacd.available_queries += new_queries # actualizo cuantas consultas faltan por pagar qacd.queries_to_pay -= new_queries else: # libero el numero de consultas que corresponde qacd.available_queries = qacd.query_plans.query_quantity # actualizo cuantas consultas faltan por pagar qacd.queries_to_pay = 0 if fee.sale.status == 1: qacd.status = 3 qacd.save() # actualizo a pyrebase si es el elegido if 'test' not in sys.argv: if qpclient.is_chosen: pyrebase.chosen_plan( fee.sale.client.id, {"available_queries": qacd.available_queries}) # cambio el codigo del usuario user = User.objects.get(pk=fee.sale.client_id) if fee.sale.client.type_client == 'b': user.code = Params.CODE_PREFIX["client"] + user.ruc else: user.code = Params.CODE_PREFIX["client"] + user.document_number user.save() validated_data["status"] = 2 instance = Payment(**validated_data) instance.save() return instance
def seed_test_data(): """ Seed data to be used for testing. """ db.drop_all() db.create_all() payment_1 = Payment() payment_2 = Payment() payment_3 = Payment() payment_4 = Payment() payment_1.insert('deposits', [Deposit( amount=1000.0), Deposit(amount=500.0)]) payment_2.insert('deposits', [Deposit( amount=1000.0), Deposit(amount=500.0)]) payment_3.insert('deposits', [Deposit(amount=1000.0)]) payment_4.insert('deposits', [Deposit(amount=1000.0)]) wallet_1 = Wallet() wallet_2 = Wallet() wallet_3 = Wallet() wallet_4 = Wallet() wallet_1.insert('payments', [payment_1, payment_2]) wallet_2.insert('payments', [payment_3]) wallet_3.insert('payments', [payment_4]) estate1 = Estate(address='Casterly Rock') estate2 = Estate(address='Dorne') estate3 = Estate(address='Dragonstone') estate2.insert('payment', wallet_2.payments[0]) estate3.insert('payment', wallet_3.payments[0]) unit1 = Unit(name='No. 1') unit2 = Unit(name='No. 2') unit3 = Unit(name='No. 1') unit4 = Unit(name='No. 2') unit5 = Unit(name='No. 3') unit1.insert('payment', wallet_1.payments[0]) unit2.insert('payment', wallet_1.payments[1]) estate1.insert('estate_units', [unit1, unit2]) estate2.insert('estate_units', [unit3]) estate3.insert('estate_units', [unit4, unit5]) board1 = Board() board2 = Board() board1.insert('estates_owned', [estate1, estate2]) board2.insert('estates_owned', [estate3]) board1.insert('units_owned', [unit5]) user0 = User( name="Test User", phone_number="000 00 0000000", email="*****@*****.**", password=digest('ABC123!@#1')) user1 = User( name="Jaime Lannister", phone_number="000 12 3456781", email="*****@*****.**", password=digest('ABC123!@#1')) user2 = User( name="Oberyn Martell", phone_number="000 12 3456782", email="*****@*****.**", password=digest('ABC123!@#2')) user3 = User( name="Daenerys Targaryen", phone_number="000 12 3456783", email="*****@*****.**", password=digest('ABC123!@#3')) conversation1 = Conversation() conversation2 = Conversation() message1 = Message(sender=user1.name, content='Content 1') message2 = Message(sender=user2.name, content='Content 2') message3 = Message(sender=user3.name, content='Content 3') conversation1.insert('messages', [message1, message2]) conversation2.insert('messages', [message3]) user0.insert('boards', [board1]) user1.insert('boards', [board1]) user2.insert('boards', [board1]) user3.insert('boards', [board2]) user1.insert('units', [unit1, unit2]) user2.insert('units', [unit3]) user3.insert('units', [unit4]) user0.insert('wallet', wallet_4) user1.insert('wallet', wallet_1) user2.insert('wallet', wallet_2) user3.insert('wallet', wallet_3) user1.insert('conversations', [conversation1, conversation2]) user2.insert('conversations', [conversation1, conversation2]) user3.insert('conversations', [conversation1]) role1 = Role(title='admin') role2 = Role(title='basic') role3 = Role(title='super_admin') role3.insert('users', [user0, user1]) role2.insert('users', [user0, user1, user2, user3]) role1.insert('users', [user0, user3]) role1.save() role2.save() role3.save() print('\nTest Data Seeded.\n')
def _map_payment(payment_db_data): return Payment(*payment_db_data)
def test_get_payment(self): self.assertEqual(True, isinstance(Payment.get(id=1), dict)) self.payment1.save() self.assertEqual(True, isinstance(Payment.get(id=1), Payment))
def test_payment_exists(self): self.assertFalse(Payment.check_exists(id=1)) self.payment1.save() self.assertTrue(Payment.check_exists(id=1))
def test_delete_payment(self): self.payment1.save() self.assertTrue(Payment.check_exists(id=1)) payment1 = Payment.get(id=1) self.assertTrue(payment1.delete()) self.assertFalse(Payment.check_exists(id=1))
def create(self, validated_data): """Crear pago de especialista.""" match = validated_data.pop('match') # import pdb; pdb.set_trace() match = Match.objects.get(pk=match.id) instance = Payment(**validated_data) instance.save() match.specialist_payment = instance client = match.client # se verifica si ya fue cliente el usuario que solicito el match # si ya lo fue pasa a status 5 directo sino pasa a 4. pendiente de pago is_client = Sale.objects.filter(saledetail__is_billable=True, client=client, status__range=(2, 3)).exists() if is_client: match.status = 5 disp_name_to_client = display_specialist_name(match) ticker_client = trans("successful hiring") disp_name_to_specialist = display_client_name(client) ticker_specialist = trans("successful hiring") else: match.status = 4 disp_name_to_client = "Sube el recibo de tu pago" ticker_client = "Realiza tu pago, procederemos con tu solicitud" ticker_specialist = "Espera por el pago del cliente" disp_name_to_specialist = "Se autorizo pago" sale = Sale.objects.create(place="BCP", total_amount=match.price, reference_number=increment_reference(), description='pago de match', client=match.client, status=1) sale_detail = SaleDetail.objects.create( price=match.price, description="Contratacion de especialista", discount=float(0), pin_code='XXXXXX', is_billable=True, product_type_id=2, sale=sale) if 'test' not in sys.argv: client_id = match.client_id specialist_id = match.specialist_id qset_client = Client.objects.filter(pk=client_id) qset_spec = Specialist.objects.filter(pk=specialist_id) dict_pending_cl = NotificationClientSerializer(qset_client).data dict_pending_sp = NotificationSpecialistSerializer(qset_spec).data badge_count = dict_pending_cl["queries_pending"] + dict_pending_cl[ "match_pending"] badge_count_sp = dict_pending_sp[ "queries_pending"] + dict_pending_sp["match_pending"] data_client = { "title": disp_name_to_client, "body": match.subject, "sub_text": "", "ticker": ticker_client, "badge": badge_count, "icon": match.category.image, "type": Params.TYPE_NOTIF["match_success"], "queries_pending": dict_pending_cl["queries_pending"], "match_pending": dict_pending_cl["match_pending"], "match_id": match.id } data_specialist = { "title": disp_name_to_specialist, "body": match.subject, "sub_text": "", "ticker": ticker_specialist, "badge": badge_count_sp, "icon": match.category.image, "type": Params.TYPE_NOTIF["match_success"], "queries_pending": dict_pending_sp["queries_pending"], "match_pending": dict_pending_sp["match_pending"], "match_id": match.id } # envio de notificacion push Notification.fcm_send_data(user_id=client_id, data=data_client) Notification.fcm_send_data(user_id=specialist_id, data=data_specialist) match.save() return instance