-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add
/thirpartyRequests/verifications
resource support (#83)
* chore: test cleanup * feat(iterface): add `/thirdpartyRequests/verifications` resource * chore: refactor statemachine into it's own dir in domain, so we don't overload the term 'model' * feat: implement state machine for verifyTransaction * feat: hook up handler with state machine * chore: refactor statemachine tests * chore: refactor statemachine tests * chore: test cleanup * feat: add 202 check test to handler * feat: copy boilerplate tests for fsm * feat: copy boilerplate tests for fsm * feat: first pass at model tests * feat: tests for verifyTransaction model * fix: appease code coverage gods * fix(vulns): run npm audit, fix and ignore unfixable and unused * fix(bdd): lower function coverage of bdd tests... they aren't a priority atm
- Loading branch information
Showing
28 changed files
with
1,954 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/***** | ||
License | ||
-------------- | ||
Copyright © 2020 Mojaloop Foundation | ||
The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") | ||
and you may not use these files except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed | ||
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
Contributors | ||
-------------- | ||
This is the official list of the Mojaloop project contributors for this file. | ||
Names of the original copyright holders (individuals or organizations) | ||
should be listed with a '*' in the first column. People who have | ||
contributed from an organization can be listed under the organization | ||
that actually holds the copyright for their contributions (see the | ||
Gates Foundation organization for an example). Those individuals should have | ||
their names indented and be marked with a '-'. Email address can be added | ||
optionally within square brackets <email>. | ||
* Gates Foundation | ||
- Name Surname <name.surname@gatesfoundation.com> | ||
- Lewis Daly <lewisd@crosslaketech.com> | ||
-------------- | ||
******/ | ||
import { | ||
ControlledStateMachine, | ||
PersistentModelConfig, StateData | ||
} from './persistent.model' | ||
import { Method } from 'javascript-state-machine' | ||
import { ThirdpartyRequests, MojaloopRequests } from '@mojaloop/sdk-standard-components' | ||
import { | ||
thirdparty as tpAPI | ||
} from '@mojaloop/api-snippets' | ||
import { PubSub } from '~/shared/pub-sub' | ||
import { ThirdpartyRequestsVerificationsPostRequest } from '~/server/handlers/thirdpartyRequestsVerifications' | ||
|
||
export interface VerifyTransactionStateMachine extends ControlledStateMachine { | ||
retreiveConsent: Method | ||
onRetreiveConsent: Method | ||
verifyTransaction: Method | ||
onVerifyTransaction: Method | ||
sendCallbackToDFSP: Method | ||
onSendCallbackToDFSP: Method | ||
} | ||
|
||
export interface VerifyTransactionModelConfig extends PersistentModelConfig { | ||
subscriber: PubSub | ||
thirdpartyRequests: ThirdpartyRequests | ||
mojaloopRequests: MojaloopRequests | ||
requestProcessingTimeoutSeconds: number | ||
authServiceParticipantFSPId: string | ||
} | ||
|
||
export interface VerifyTransactionData extends StateData { | ||
// the DFSP requesting the verification of the transaction | ||
participantDFSPId: string | ||
|
||
// initial POST /thirdpartyRequests/verifications request | ||
verificationRequest: ThirdpartyRequestsVerificationsPostRequest | ||
|
||
errorInformation?: tpAPI.Schemas.ErrorInformation | ||
} |
Oops, something went wrong.