-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cancellation as claim note through VRO's svc-bgs-api #2315
Changes from all commits
0c1acc8
0928318
ce9ac2f
ac9195e
8633bcf
9789ad1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
workflow_call: | ||
|
||
env: | ||
COMPOSE_PROFILES: 'bip' | ||
COMPOSE_PROFILES: 'bip,bgs' | ||
VRO_DEV_SECRETS_FOLDER: "${{ github.workspace }}/.cache/abd-vro-dev-secrets" | ||
|
||
jobs: | ||
|
@@ -62,18 +62,6 @@ jobs: | |
# Quit after 60 seconds | ||
retries: 30 | ||
|
||
# Temporary step added to avoid condition where bipApiExchange is not yet created. | ||
- name: 'Create bipApiExchange exchange' | ||
uses: indiesdev/[email protected] | ||
with: | ||
url: 'http://localhost:15672/api/exchanges/%2f/bipApiExchange' | ||
method: 'PUT' | ||
basic-auth-token: '${{env.RABBITMQ_BASIC_AUTH}}' | ||
body: '{"type":"direct", "durable":true, "auto_delete":true}' | ||
accept: 201, 204 | ||
retries: 3 | ||
log-response: true | ||
|
||
- name: "Run Employee Experience Integration Tests" | ||
run: | | ||
./gradlew :domain-ee:ee-ep-merge-app:integrationTest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,20 @@ class ClientName(str, Enum): | |
PUT_TSOJ = "putTemporaryStationOfJurisdictionClient" | ||
CREATE_CLAIM_CONTENTIONS = "createClaimContentionsClient" | ||
CANCEL_CLAIM = "cancelClaimClient" | ||
BGS_ADD_CLAIM_NOTE = "addClaimNoteClient" | ||
|
||
|
||
EXCHANGE = "bipApiExchange" | ||
BIP_EXCHANGE = "bipApiExchange" | ||
BGS_EXCHANGE = "bgs-api" | ||
|
||
EXCHANGES = { | ||
ClientName.GET_CLAIM: os.environ.get("BIP_API_EXCHANGE") or BIP_EXCHANGE, | ||
ClientName.GET_CLAIM_CONTENTIONS: os.environ.get("BIP_API_EXCHANGE") or BIP_EXCHANGE, | ||
ClientName.PUT_TSOJ: os.environ.get("BIP_API_EXCHANGE") or BIP_EXCHANGE, | ||
ClientName.CREATE_CLAIM_CONTENTIONS: os.environ.get("BIP_API_EXCHANGE") or BIP_EXCHANGE, | ||
ClientName.CANCEL_CLAIM: os.environ.get("BIP_API_EXCHANGE") or BIP_EXCHANGE, | ||
ClientName.BGS_ADD_CLAIM_NOTE: os.environ.get("BGS_API_EXCHANGE") or BGS_EXCHANGE, | ||
} | ||
|
||
QUEUES = { | ||
ClientName.GET_CLAIM: | ||
|
@@ -39,6 +50,8 @@ class ClientName(str, Enum): | |
os.environ.get("CREATE_CLAIM_CONTENTIONS_REQUEST") or "createClaimContentionsQueue", | ||
ClientName.CANCEL_CLAIM: | ||
os.environ.get("CANCEL_CLAIM_REQUEST") or "cancelClaimQueue", | ||
ClientName.BGS_ADD_CLAIM_NOTE: | ||
os.environ.get("ADD_CLAIM_NOTE_REQUEST") or "add-note", | ||
} | ||
|
||
REPLY_QUEUES = { | ||
|
@@ -52,4 +65,6 @@ class ClientName(str, Enum): | |
os.environ.get("CREATE_CLAIM_CONTENTIONS_RESPONSE") or "createClaimContentionsResponseQueue", | ||
ClientName.CANCEL_CLAIM: | ||
os.environ.get("CANCEL_CLAIM_RESPONSE") or "cancelClaimResponseQueue", | ||
ClientName.BGS_ADD_CLAIM_NOTE: | ||
os.environ.get("ADD_CLAIM_NOTE_RESPONSE") or "add-note-response", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it too late to switch these to camel-case? 😅 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pydantic import ConfigDict | ||
from pydantic.alias_generators import to_camel | ||
|
||
from .request import GeneralRequest | ||
from .response import GeneralResponse | ||
|
||
|
||
class Request(GeneralRequest): | ||
model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel) | ||
|
||
vbms_claim_id: int | ||
claim_notes: list[str] | ||
|
||
|
||
class Response(GeneralResponse): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,15 @@ | |
import logging | ||
from typing import Type | ||
|
||
from fastapi.encoders import jsonable_encoder | ||
from hoppy.exception import ResponseException | ||
from model import cancel_claim, create_contentions, get_claim, get_contentions | ||
from model import ( | ||
add_claim_note, | ||
cancel_claim, | ||
create_contentions, | ||
get_claim, | ||
get_contentions, | ||
) | ||
from model import update_temp_station_of_jurisdiction as tsoj | ||
from model.merge_job import JobState, MergeJob | ||
from model.request import GeneralRequest | ||
|
@@ -30,6 +37,7 @@ class EpMergeMachine(StateMachine): | |
running_merge_contentions = State(value=JobState.RUNNING_MERGE_CONTENTIONS) | ||
running_move_contentions_to_pending_claim = State(value=JobState.RUNNING_MOVE_CONTENTIONS_TO_PENDING_CLAIM) | ||
running_cancel_ep400_claim = State(value=JobState.RUNNING_CANCEL_EP400_CLAIM) | ||
running_add_claim_note_to_ep400 = State(value=JobState.RUNNING_ADD_CLAIM_NOTE_TO_EP400) | ||
completed_success = State(final=True, value=JobState.COMPLETED_SUCCESS) | ||
completed_error = State(final=True, value=JobState.COMPLETED_ERROR) | ||
|
||
|
@@ -48,8 +56,10 @@ class EpMergeMachine(StateMachine): | |
| running_merge_contentions.to(completed_error, cond="has_error") | ||
| running_move_contentions_to_pending_claim.to(running_cancel_ep400_claim, unless="has_error") | ||
| running_move_contentions_to_pending_claim.to(completed_error, cond="has_error") | ||
| running_cancel_ep400_claim.to(completed_success, unless="has_error") | ||
| running_cancel_ep400_claim.to(running_add_claim_note_to_ep400, unless="has_error") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the plan was to add a claim note when merging failed, not on success? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. The plan is to add a claim note as part of the happy path. See #2161. The claim note is being added after the claim is cancelled that way the cancellation reason for the claim will show in VBMS. 👍 |
||
| running_cancel_ep400_claim.to(completed_error, cond="has_error") | ||
| running_add_claim_note_to_ep400.to(completed_success, unless="has_error") | ||
| running_add_claim_note_to_ep400.to(completed_error, cond="has_error") | ||
) | ||
|
||
def __init__(self, merge_job: MergeJob): | ||
|
@@ -138,6 +148,16 @@ def on_cancel_ep400_claim(self): | |
response_type=cancel_claim.Response) | ||
self.process() | ||
|
||
@running_add_claim_note_to_ep400.enter | ||
def on_add_claim_note_to_ep400(self): | ||
request = add_claim_note.Request(vbms_claim_id=self.job.ep400_claim_id, | ||
claim_notes=[self.cancellation_reason]) | ||
self.make_request( | ||
request=request, | ||
hoppy_client=HOPPY.get_client(ClientName.BGS_ADD_CLAIM_NOTE), | ||
response_type=add_claim_note.Response) | ||
self.process() | ||
|
||
@completed_success.enter | ||
@completed_error.enter | ||
def on_completed(self, state): | ||
|
@@ -180,5 +200,5 @@ def log_error(self, error): | |
f"pending_claim_id={self.job.pending_claim_id} " | ||
f"ep400_claim_id={self.job.ep400_claim_id} " | ||
f"state={self.job.state} " | ||
f"error=\'{error}\'") | ||
self.job.error(self.job.state, error) | ||
f"error=\"{jsonable_encoder(error)}\"") | ||
self.job.error(error if isinstance(error, list) else [error]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer necessary as the integration tests declare the bipApiExchange