fix(eims): sign the /v1/verify request body

This commit is contained in:
Hagernesh
2026-09-01 03:41:28 +00:00
parent dd9f597e01
commit fe3d398757
4 changed files with 202 additions and 32 deletions

View File

@@ -214,10 +214,13 @@ export class EimsInvoiceRegistrationService {
* compared — the supplied collection's own fixture uses different example values on each side,
* so equality there would assert a property of the mock rather than of the gateway.
*
* Bearer-authenticated but unsigned, via `postBearer` — see that method for why.
* Signed, via `postSigned`. The supplied collection shows a raw `{"irn":"…"}` body, but the live
* gateway rejects that with `GATEWAY ERROR code=4001` naming `request`, `signature` and
* `certificate` as null — verified against `core.mor.gov.et` on 2026-09-01. The signed envelope
* clears that validation. The collection's unsigned example is wrong for this endpoint.
*/
private async queryVerify(irn: string): Promise<EimsVerifyResponse> {
const response = await this.client.postBearer<EimsVerifyRequest, EimsVerifyResponse>(
const response = await this.client.postSigned<EimsVerifyRequest, EimsVerifyResponse>(
"/v1/verify",
{ irn },
);