def send_eq_print_fulfilment_message(context, fulfilment_code): requests.get(f'{Config.NOTIFY_STUB_SERVICE}/reset') context.fulfilment_requested_case_id = context.uac_created_events[0][ 'payload']['uac']['caseId'] context.individual_case_id = str(uuid.uuid4()) message = json.dumps({ "event": { "type": "FULFILMENT_REQUESTED", "source": "QUESTIONNAIRE_RUNNER", "channel": "EQ", "dateTime": "2019-07-07T22:37:11.988Z", "transactionId": "d2541acb-230a-4ade-8123-eee2310c9143" }, "payload": { "fulfilmentRequest": { "fulfilmentCode": fulfilment_code, "caseId": context.fulfilment_requested_case_id, "individualCaseId": context.individual_case_id, "contact": { "title": "Ms", "forename": "jo", "surname": "smith", }, } } }) publish_to_pubsub(message, Config.EQ_FULFILMENT_PROJECT_ID, Config.EQ_FULFILMENT_TOPIC_NAME)
def _publish_qm_undelivered_mail(context, questionnaire_id): context.sent_to_gcp = False data = json.dumps({ "transactionId": str(uuid.uuid4()), "dateTime": "2008-08-24T00:00:00", "questionnaireId": questionnaire_id, "unreceipt": False }) publish_to_pubsub(data, Config.QM_UNDELIVERED_PROJECT_ID, Config.QM_UNDELIVERED_TOPIC_NAME) context.sent_to_gcp = True
def _publish_offline_receipt(context, channel='QM', unreceipt=False, tx_id="3d14675d-a25d-4672-a0fe-b960586653e8", questionnaire_id="0"): context.sent_to_gcp = False data = json.dumps({ "dateTime": "2008-08-24T00:00:00", "transactionId": tx_id, "questionnaireId": questionnaire_id, "channel": channel, "unreceipt": unreceipt }) publish_to_pubsub(data, Config.OFFLINE_RECEIPT_TOPIC_PROJECT, Config.OFFLINE_RECEIPT_TOPIC_ID) context.sent_to_gcp = True
def ppo_sends_fulfilment_confirmed(context): context.first_case = get_first_case(context) data = json.dumps({ "transactionId": str(uuid.uuid4()), "dateTime": "2019-08-03T14:30:01", "caseRef": context.first_case['caseRef'], "productCode": "P_OR_H1", "channel": "PPO", "type": "FULFILMENT_CONFIRMED" }) publish_to_pubsub(data, Config.FULFILMENT_CONFIRMED_PROJECT_ID, Config.FULFILMENT_CONFIRMED_TOPIC_ID)
def _publish_ppo_undelivered_mail(context, case_ref): context.sent_to_gcp = False data = json.dumps({ "transactionId": str(uuid.uuid4()), "dateTime": "2019-08-03T14:30:01", "caseRef": case_ref, "productCode": "P_OR_H1", "channel": "PPO", "type": "UNDELIVERED_MAIL_REPORTED", "unreceipt": False }) publish_to_pubsub(data, Config.PPO_UNDELIVERED_PROJECT_ID, Config.PPO_UNDELIVERED_TOPIC_NAME) context.sent_to_gcp = True
def _publish_object_finalize(context, case_id="0", tx_id="3d14675d-a25d-4672-a0fe-b960586653e8", questionnaire_id="0"): context.sent_to_gcp = False data = json.dumps({ "timeCreated": "2008-08-24T00:00:00Z", "metadata": { "case_id": case_id, "tx_id": tx_id, "questionnaire_id": questionnaire_id, } }) publish_to_pubsub(data, Config.RECEIPT_TOPIC_PROJECT, Config.RECEIPT_TOPIC_ID, eventType='OBJECT_FINALIZE', bucketId='eq-bucket', objectId=tx_id) context.sent_to_gcp = True
def qm_sends_fulfilment_confirmed(context): context.first_case = get_first_case(context) uac_created_message = context.uac_created_events[0] data = json.dumps({ "transactionId": str(uuid.uuid4()), "dateTime": "2019-08-03T14:30:01", "questionnaireId": uac_created_message['payload']['uac']['questionnaireId'], "productCode": "P_OR_H1", "channel": "QM", "type": "FULFILMENT_CONFIRMED" }) publish_to_pubsub(data, Config.FULFILMENT_CONFIRMED_PROJECT_ID, Config.FULFILMENT_CONFIRMED_TOPIC_ID)