Skip to content

Fix/rsk 46 fix risk assessment models - #20

Merged
AliJohari05 merged 5 commits into
mainfrom
fix/RSK-46-fix-risk-assessment-models
Nov 8, 2026
Merged

AliJohari05 merged 5 commits into
mainfrom
fix/RSK-46-fix-risk-assessment-models

Conversation

@MParsa-ES

Copy link
Copy Markdown
Owner

Jira Issue & User Story

  • Jira Ticket: RSK-46
  • User Story: US-01A

Summary of Changes

  • Internal/External Routing: Added transfer_type discriminator to the RiskAssessment model and RiskAssessmentRequestSerializer.

  • Conditional Destinations: Enforced strict validation rules requiring destination_account_id (and null IBAN) for INTERNAL transfers, and destination_iban (and null account ID) for EXTERNAL transfers.

  • Unified Rule Target: Created a destination_target model property to seamlessly feed the correct identifier string to the upcoming Rule Engine and Blocklist evaluators without conditional clutter.

  • Contract Alignment: Updated openapi/s4_rsk.yaml and drf-spectacular annotations to perfectly match the S3-PAY contract (including RFC 9457 Problem mappings and JWT Bearer auth).

  • Testing: Added a comprehensive Test Matrix, 2 end-to-end integration tests (verifying PostgreSQL CheckConstraints and full API lifecycle), and configured Bruno API collections using the new payment_service JWT authorization.

LabBank Technical Standards Checklist

  • GEN-01 / GEN-02: Endpoint is under /api/v1/ and documented with OpenAPI (drf-spectacular).
  • GEN-03: Money fields use 64-bit integer (BigIntegerField) in IRR (no float/double).
  • GEN-04: Public identifiers use UUIDv7 (uuid6.uuid7).
  • GEN-05: Timestamps are stored/returned in UTC; daily boundaries use Asia/Tehran.
  • GEN-06: Errors return RFC 9457 application/problem+json format.
  • GEN-07 / GEN-08: Mutating POST endpoints support Idempotency-Key and propagate X-Correlation-ID.
  • Tests: Unit and integration tests (pytest) added and passing.

- Add transfer_type discriminator to RiskAssessment model and serializer.
- Support conditional destination_account_id and destination_iban fields.
- Add destination_target property to unify blocklist/rule engine lookups.
- Update API tests to align with the finalized S3-PAY JWT contract.
@AliJohari05
AliJohari05 merged commit 08828bf into main Nov 8, 2026
1 check passed
@AliJohari05
AliJohari05 deleted the fix/RSK-46-fix-risk-assessment-models branch November 8, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants