Skip to content
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

Settle Window and Adjust Positions - Transfer Abort #535

Closed
26 tasks done
elnyry-sam-k opened this issue Nov 22, 2018 · 2 comments
Closed
26 tasks done

Settle Window and Adjust Positions - Transfer Abort #535

elnyry-sam-k opened this issue Nov 22, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@elnyry-sam-k
Copy link
Member

elnyry-sam-k commented Nov 22, 2018

Goal:
As a Hub Operator
I want to manage Settlements while updating positions independent of the Settlement bank
so that even while the Settlement process is in progress, the FSPs can operate against their settled Positions; this relies on the Scheme Rules to provide consistency

Tasks:

  • Create new diagram 6.2.6. Abort Settlement (abortSettlementById) with ref. to 6.3.4. [@ggrg]
  • Add diagram 6.3.4. Settlement Transfer Abort [@ggrg]
  • Present for DA review and apply DA recommendations [@ggrg]
  • Add RECEIVED_FULFIL transferState entry prior to COMMITTED [@ggrg]
  • Create new endpoint PUT /settlements/{ID} and implement abortSettlementById (6.2.6.) [@ggrg]
  • Implement Abort Settlement Transfer Abort method, reverting positions when needed (6.3.4.) [@ggrg]
  • Added reason and changedDate to settlement.getById [@ggrg]
  • Fixed bug when creating new settlement with ABORTED windows [@ggrg]
  • Add REJECTED transferStateChange entry prior to ABORTED [@ggrg]
  • Test settlements may be created with windows in ABORTED state [@ggrg]
  • Improved: settlement getById now also returns settlement level information as reason, createdDate, changedDate [@ggrg]
  • Improved: settlementEventTrigger error placeholders were updated with descriptive errorInformation and also return settlement level info for reason, createdDate and changedDate [@ggrg]
  • Technical Debt: as Swagger 2.0 does not support anyOf, all accepted payload attributes are optional and further validated programatically. For more information see the comment below (definitions.SettlementUpdatebySettlementIdPayload). [@ggrg]
  • Update sequence diagrams to match implementation [@ggrg]
  • Fix broken unit tests [@ggrg]
  • Update demo scripts to cover abort operation [@ggrg]
  • Write new unit tests and provide full coverage, if possible [@ggrg]

Pull Requests:

Acceptance Criteria:

  • Abort: PUT /settlements/{ID}
    • Settlement set to ABORTED
    • All Transfers from POSITION account to MLNS account are set to ABORTED state.
    • If aborted from PS_TRANSFERS_RESERVED, DR Positions for POSITION and MLNS are reverted back

Implementation notes:

  • Create a follow-up story for Reconciliation
  • In new approach, the risk of unavailable funds is managed after settlement whereas in the earlier approach (not preserved), the risk is managed during the Settlement process
  • PUT /settlements/{ID} - (ABORTED as result of the request, when allowed)

Dependencies:

  • none

Accountability:

@ggrg
Copy link
Member

ggrg commented Dec 18, 2018

"definitions": {
    "SettlementUpdatebySettlementIdPayload": {
        "type": "object",
        "properties": {
            "state": {
                "type": "string",
                "enum": [
                    "ABORTED"
                ]
            },
            "reason": {
                "type": "string"
            },
            "externalReference": {
                "type": "string"
            },
            "participants": {
                "type": "array",
                "items": {
                    "$ref": "#/definitions/SettlementUpdateBySettlementIDOuterPayload"
                }
            }
        }
    },

@ggrg
Copy link
Member

ggrg commented Dec 18, 2018

Test coverage report after unit tests fix:

=============================== Coverage summary ===============================
Statements   : 91.85% ( 913/994 )
Branches     : 90.3% ( 326/361 )
Functions    : 91.34% ( 116/127 )
Lines        : 91.8% ( 884/963 )
================================================================================

1..446
# tests 446
# pass  446

# ok

Coverage check:

ERROR: Coverage for statements (50%) does not meet per-file (src/models/index.js)  threshold (90%)
ERROR: Coverage for statements (84.22%) does not meet per-file (src/models/settlement/facade.js)  threshold (90%)
ERROR: Coverage for branches (84.53%) does not meet per-file (src/models/settlement/facade.js)  threshold (90%)
ERROR: Coverage for lines (84.11%) does not meet per-file (src/models/settlement/facade.js)  threshold (90%)
ERROR: Coverage for functions (83.33%) does not meet per-file (src/models/settlement/facade.js)  threshold (90%)
ERROR: Coverage for statements (86.21%) does not meet per-file (src/handlers/settlements/{id}.js)  threshold (90%)
ERROR: Coverage for branches (61.11%) does not meet per-file (src/handlers/settlements/{id}.js)  threshold (90%)
ERROR: Coverage for lines (86.21%) does not meet per-file (src/handlers/settlements/{id}.js)  threshold (90%)

@ggrg ggrg closed this as completed Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants