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

[Central-Ledger] GET /transfers callback is wrong for expired transfers #3078

Closed
2 tasks
sri-miriyala opened this issue Jan 9, 2023 · 2 comments
Closed
2 tasks
Assignees
Labels
bug Something isn't working or it has wrong behavior on a Mojaloop Core service oss-core This is an issue - story or epic related to a feature on a Mojaloop core service or related to it

Comments

@sri-miriyala
Copy link

sri-miriyala commented Jan 9, 2023

Summary:
When a transfer expires in Switch, the error callback is sent to the Payer. Subsequently when a GET /transfers/{ID} call is made on that transfer the expected call back is PUT /transfers/{ID}. However PUT /transfers/{ID}/error is being returned.

Severity:
Medium

Priority:
Medium

Expected Behavior

  1. The callback for GET /transfers/{ID} for this use-case should be PUT /transfers/{ID} with the status as ABORTED in the body.

Steps to Reproduce

  1. Send a POST /transfers request and simulate the transfer so that the payee does not send any response callback.
  2. Switch expires the transfer and sends error callback to payer.
  3. Make a GET /transfers/{ID} on the expired transfer
  4. Observe that error callback is being made instead of normal callback

Specifications

  • Component (if known): central ledger
  • Version: 14.1.0
  • Platform:
  • Subsystem:
  • Type of testing:
  • Bug found/raised by: Sridevi Miriyala

Tasks for the fix:

  • Updated GET transfers handler
  • Update GP tests

Notes:

  • Severity when opened:
  • Priority when opened:
@sri-miriyala sri-miriyala added the bug Something isn't working or it has wrong behavior on a Mojaloop Core service label Jan 9, 2023
@elnyry-sam-k elnyry-sam-k added oss-core This is an issue - story or epic related to a feature on a Mojaloop core service or related to it to-be-refined This story is ready to be groomed labels Jan 9, 2023
@elnyry-sam-k
Copy link
Member

Hey team! Please add your planning poker estimate with Zenhub @PaulGregoryBaker @mdebarros @vijayg10

@elnyry-sam-k elnyry-sam-k removed the to-be-refined This story is ready to be groomed label Jan 23, 2023
@mdebarros
Copy link
Member

mdebarros commented Jan 25, 2023

Test use-cases to re-produce issues

Happy Path

Get Operation results as follows:

  {
    "method" : "PUT",
    "path" : "/payerfsp/transfers/c61e8e56-a8a2-4dd4-9ff0-7c6f45fc9982",
    "headers" : {
      "Content-Type" : [ "application/vnd.interoperability.transfers+json;version=1.1" ],
      "date" : [ "Wed, 25 Jan 2023 12:54:46 GMT" ],
      "user-agent" : [ "PostmanRuntime/7.30.0" ],
      "cache-control" : [ "no-cache" ],
      "postman-token" : [ "b1e0c5c1-a441-40dc-84ce-9e0d4ef6d634" ],
      "accept-encoding" : [ "gzip, deflate, br" ],
      "connection" : [ "keep-alive" ],
      "fspiop-http-method" : [ "PUT" ],
      "fspiop-uri" : [ "/transfers/c61e8e56-a8a2-4dd4-9ff0-7c6f45fc9982" ],
      "fspiop-source" : [ "switch" ],
      "fspiop-destination" : [ "payerfsp" ],
      "traceparent" : [ "00-a349adc1d3b2297924d609e1eb4ba380-378d1e34615d9a80-00" ],
      "tracestate" : [ "acmevendor=eyJzcGFuSWQiOiIzNzhkMWUzNDYxNWQ5YTgwIn0=" ],
      "Content-Length" : [ "136" ],
      "Host" : [ "mockserver:1080" ]
    },
    "keepAlive" : true,
    "secure" : false,
    "body" : {
      "type" : "STRING",
      "string" : "{\"completedTimestamp\":\"2023-01-25T12:54:26.000Z\",\"transferState\":\"COMMITTED\",\"fulfilment\":\"UNlJ98hZTY_dsw0cAqw4i_UN3v4utt7CZFB4yfLbVFA\"}",
      "contentType" : "application/vnd.interoperability.transfers+json; version=1.1"
    }
  }

Payer sends POST with invalid condition, Payee responds with valid fulfilment, Fulfil handler fails condition-fulfilment validation

Get Operation results as follows:

{
    "method" : "PUT",
    "path" : "/payerfsp/transfers/8b848d0a-9761-4b26-b975-2dcf8a7e53ff",
    "headers" : {
      "Content-Type" : [ "application/vnd.interoperability.transfers+json;version=1.1" ],
      "date" : [ "Wed, 25 Jan 2023 12:58:02 GMT" ],
      "user-agent" : [ "PostmanRuntime/7.30.0" ],
      "cache-control" : [ "no-cache" ],
      "postman-token" : [ "1ee4439b-6a1b-4ce4-8d2b-091b8c70fa1e" ],
      "accept-encoding" : [ "gzip, deflate, br" ],
      "connection" : [ "keep-alive" ],
      "fspiop-http-method" : [ "PUT" ],
      "fspiop-uri" : [ "/transfers/8b848d0a-9761-4b26-b975-2dcf8a7e53ff" ],
      "fspiop-source" : [ "switch" ],
      "fspiop-destination" : [ "payerfsp" ],
      "traceparent" : [ "00-be86828d261fbe6e854926fbc79f4938-3bedb952bca38770-00" ],
      "tracestate" : [ "acmevendor=eyJzcGFuSWQiOiIzYmVkYjk1MmJjYTM4NzcwIn0=" ],
      "Content-Length" : [ "244" ],
      "Host" : [ "mockserver:1080" ]
    },
    "keepAlive" : true,
    "secure" : false,
    "body" : {
      "type" : "STRING",
      "string" : "{\"completedTimestamp\":\"2023-01-25T12:57:57.000Z\",\"transferState\":\"ABORTED\",\"fulfilment\":\"UNlJ98hZTY_dsw0cAqw4i_UN3v4utt7CZFB4yfLbVFA\",\"extensionList\":{\"extension\":[{\"key\":\"cause\",\"value\":\"3100: Generic validation error - invalid fulfilment\"}]}}",
      "contentType" : "application/vnd.interoperability.transfers+json; version=1.1"
    }
  }
  ```

## Payer sends POST with valid condition, Payee responds with invalid fulfilment

Get Operation results as follows:

```json
  {
    "method" : "PUT",
    "path" : "/payerfsp/transfers/5cc18a72-df39-4a65-b4c2-4cd56da72f69",
    "headers" : {
      "Content-Type" : [ "application/vnd.interoperability.transfers+json;version=1.1" ],
      "date" : [ "Wed, 25 Jan 2023 12:55:32 GMT" ],
      "user-agent" : [ "PostmanRuntime/7.30.0" ],
      "cache-control" : [ "no-cache" ],
      "postman-token" : [ "aa027590-1fa6-43a2-ada4-9835e477944f" ],
      "accept-encoding" : [ "gzip, deflate, br" ],
      "connection" : [ "keep-alive" ],
      "fspiop-http-method" : [ "PUT" ],
      "fspiop-uri" : [ "/transfers/5cc18a72-df39-4a65-b4c2-4cd56da72f69" ],
      "fspiop-source" : [ "switch" ],
      "fspiop-destination" : [ "payerfsp" ],
      "traceparent" : [ "00-d220e3389c79fd25079e9df21b3be3bc-c72c1972a9ead927-00" ],
      "tracestate" : [ "acmevendor=eyJzcGFuSWQiOiJjNzJjMTk3MmE5ZWFkOTI3In0=" ],
      "Content-Length" : [ "244" ],
      "Host" : [ "mockserver:1080" ]
    },
    "keepAlive" : true,
    "secure" : false,
    "body" : {
      "type" : "STRING",
      "string" : "{\"completedTimestamp\":\"2023-01-25T12:55:25.000Z\",\"transferState\":\"ABORTED\",\"fulfilment\":\"XNlJ98hZTY_dsw0cAqw4i_UN3v4utt7CZFB4yfLbVFX\",\"extensionList\":{\"extension\":[{\"key\":\"cause\",\"value\":\"3100: Generic validation error - invalid fulfilment\"}]}}",
      "contentType" : "application/vnd.interoperability.transfers+json; version=1.1"
    }
  }

Payer sends POST with valid condition, Payee responds with PUT ERROR Callback with invalid fulfilment

Get Operation results as follows:

  {
    "method" : "PUT",
    "path" : "/payerfsp/transfers/bf3d2466-6958-40eb-959d-ec124fc0509b",
    "headers" : {
      "Content-Type" : [ "application/vnd.interoperability.transfers+json;version=1.1" ],
      "date" : [ "Wed, 25 Jan 2023 12:51:19 GMT" ],
      "user-agent" : [ "PostmanRuntime/7.30.0" ],
      "cache-control" : [ "no-cache" ],
      "postman-token" : [ "b990fd00-feba-4e99-b254-18851e3eb468" ],
      "accept-encoding" : [ "gzip, deflate, br" ],
      "connection" : [ "keep-alive" ],
      "fspiop-http-method" : [ "PUT" ],
      "fspiop-uri" : [ "/transfers/bf3d2466-6958-40eb-959d-ec124fc0509b" ],
      "fspiop-source" : [ "switch" ],
      "fspiop-destination" : [ "payerfsp" ],
      "traceparent" : [ "00-98d79191d56b35e756152365d2170a06-81a174d45a383f96-00" ],
      "tracestate" : [ "acmevendor=eyJzcGFuSWQiOiI4MWExNzRkNDVhMzgzZjk2In0=" ],
      "Content-Length" : [ "171" ],
      "Host" : [ "mockserver:1080" ]
    },
    "keepAlive" : true,
    "secure" : false,
    "body" : {
      "type" : "STRING",
      "string" : "{\"completedTimestamp\":\"2023-01-25T12:50:56.000Z\",\"transferState\":\"ABORTED\",\"extensionList\":{\"extension\":[{\"key\":\"cause\",\"value\":\"3106: Condition can not be validated.\"}]}}",
      "contentType" : "application/vnd.interoperability.transfers+json; version=1.1"
    }
  }

Payer sends POST with valid condition, Switch responds with timeout ERROR Callback

Get Operation results as follows:

{
    "method" : "PUT",
    "path" : "/payerfsp/transfers/ac9f557d-6b2d-4920-b2c6-b68be48d70c7/error",
    "headers" : {
      "Content-Type" : [ "application/vnd.interoperability.transfers+json;version=1.1" ],
      "date" : [ "Wed, 25 Jan 2023 12:59:25 GMT" ],
      "user-agent" : [ "PostmanRuntime/7.30.0" ],
      "cache-control" : [ "no-cache" ],
      "postman-token" : [ "1f2bfbde-76d6-4b75-8f9b-49643ba448f1" ],
      "accept-encoding" : [ "gzip, deflate, br" ],
      "connection" : [ "keep-alive" ],
      "fspiop-http-method" : [ "PUT" ],
      "fspiop-uri" : [ "/transfers/ac9f557d-6b2d-4920-b2c6-b68be48d70c7/error" ],
      "fspiop-source" : [ "switch" ],
      "fspiop-destination" : [ "payerfsp" ],
      "traceparent" : [ "00-1b1d34474272bac774cbfc6a55084a51-ac369c910e105bad-00" ],
      "tracestate" : [ "acmevendor=eyJzcGFuSWQiOiJhYzM2OWM5MTBlMTA1YmFkIn0=" ],
      "Content-Length" : [ "79" ],
      "Host" : [ "mockserver:1080" ]
    },
    "keepAlive" : true,
    "secure" : false,
    "body" : {
      "type" : "STRING",
      "string" : "{\"errorInformation\":{\"errorCode\":\"3303\",\"errorDescription\":\"Transfer expired\"}}",
      "contentType" : "application/vnd.interoperability.transfers+json; version=1.1"
    }
  }

mdebarros added a commit to mojaloop/central-ledger that referenced this issue Jan 25, 2023
…ansfers

feat(mojaloop/#3078): get /transfers callback is wrong for expired transfers - mojaloop/project#3078
- removed incorrect logic from get-handler which would throw an exception when the transfer-state was TransferInternalState.EXPIRED_RESERVED
- updated unit tests to reflect this change
mdebarros added a commit to mojaloop/testing-toolkit-test-cases that referenced this issue Jan 26, 2023
…ansfers

feat(mojaloop/#3078): get /transfers callback is wrong for expired transfers - mojaloop/project#3078
- updated transfer negative scenarios in the GP test collection to conform to FSPIOP Spec and code changes to the Central-Ledger
mdebarros added a commit to mojaloop/testing-toolkit-test-cases that referenced this issue Jan 27, 2023
feat(mojaloop/#3078): get /transfers callback is wrong for expired transfers - mojaloop/project#3078
- updated transfer negative scenarios in the GP test collection to conform to FSPIOP Spec and code changes to the Central-Ledger
mdebarros added a commit to mojaloop/central-ledger that referenced this issue Jan 27, 2023
feat(mojaloop/#3078): get /transfers callback is wrong for expired transfers - mojaloop/project#3078
- removed incorrect logic from get-handler which would throw an exception when the transfer-state was TransferInternalState.EXPIRED_RESERVED
- updated unit tests to reflect this change

chore: enhancements for local functional and dev environment setups
- updated main readme with instructions on how to run functional tests using the ml-core-test-harness
- added docker compose for local dev with updated instructions on main readme
- added postman script to use against populateData scripts under test/util folder

chore: enhancements for local functional and dev environment setups
- updated main readme with instructions on how to run functional tests using the ml-core-test-harness
- added docker compose for local dev with updated instructions on main readme

chore: updated dependencies and audits with approrpriate commets
@mdebarros mdebarros changed the title GET /transfers callback is wrong for expired transfers [Central-Ledger] GET /transfers callback is wrong for expired transfers Feb 3, 2023
kleyow pushed a commit to mojaloop/testing-toolkit-test-cases that referenced this issue Feb 3, 2023
* Added assertions for tests

* added negative test case

* feat(mojaloop/#3078): get /transfers callback is wrong for transf (#109)

feat(mojaloop/#3078): get /transfers callback is wrong for expired transfers - mojaloop/project#3078
- updated transfer negative scenarios in the GP test collection to conform to FSPIOP Spec and code changes to the Central-Ledger

* Updated TC2 with correct TTK references

* Added checks for default accounts

* Added test case for regular transfer

* Updated type for MAS3 TC

---------

Co-authored-by: Miguel de Barros <miguel@debarros.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or it has wrong behavior on a Mojaloop Core service oss-core This is an issue - story or epic related to a feature on a Mojaloop core service or related to it
Projects
None yet
Development

No branches or pull requests

4 participants