-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDS-5553] (and 5542) Request a connection invitation for a permitee (#…
…2743) * [MDS-5553] (and 5542) Request a connection invitation for a permitee (#2732) * better help text. * API serves current_permittee_guid * untested action creator * permitee column, invitation request made successfully on modal load * show invitation url on the screen actionCreator is being called over and over again. * sync common folders * convert action creator to typescript * only show button if mine is major mine * add get vc invtitations endpoint, permit must be open\ * fixes * typescript updates by Tara! * skeleton loading by Tara * add feature flag * api now returns connection status with current_permitee * pass state up to form * pass connectionState and remove logging * don't show button if active * remove not working button * don't allow null, replace with string * common folder diff * feature flag and remove unused import Signed-off-by: Jason Syrotuck <[email protected]> --------- Signed-off-by: Jason Syrotuck <[email protected]> * make tests more likely to pass- Henry's changes --------- Signed-off-by: Jason Syrotuck <[email protected]> Co-authored-by: Jason Syrotuck <[email protected]>
- Loading branch information
Showing
35 changed files
with
609 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./verifiableCredentialInvitation.interface"; |
4 changes: 4 additions & 0 deletions
4
...s/common/src/interfaces/verifiableCredentials/verifiableCredentialInvitation.interface.ts
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,4 @@ | ||
export interface IVCInvitation { | ||
invitation: any[]; | ||
invitation_url: string; | ||
} |
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
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
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
10 changes: 10 additions & 0 deletions
10
services/core-api/app/api/verifiable_credentials/response_models.py
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,10 @@ | ||
from flask_restplus import fields | ||
from app.extensions import api | ||
|
||
PARTY_VERIFIABLE_CREDENTIAL_CONNECTION = api.model( | ||
'PartyVerifiableCredentialConnection', { | ||
'invitation_id': fields.String, | ||
'party_guid': fields.String, | ||
'connection_id': fields.String, | ||
'connection_state': fields.String, | ||
}) |
61 changes: 61 additions & 0 deletions
61
services/core-web/common/actionCreators/verifiableCredentialActionCreator.ts
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,61 @@ | ||
import { ENVIRONMENT } from "@mds/common"; | ||
import { request, success, error } from "../actions/genericActions"; | ||
import * as reducerTypes from "../constants/reducerTypes"; | ||
import * as verfiableCredentialActions from "../actions/verfiableCredentialActions"; | ||
import { createRequestHeader } from "../utils/RequestHeaders"; | ||
import { showLoading, hideLoading } from "react-redux-loading-bar"; | ||
import CustomAxios from "../customAxios"; | ||
import { AppThunk } from "@/store/appThunk.type"; | ||
import { IVCInvitation } from "@mds/common"; | ||
import { AxiosResponse } from "axios"; | ||
|
||
export const createVCWalletInvitation = ( | ||
partyGuid: string | ||
): AppThunk<Promise<AxiosResponse<IVCInvitation>>> => ( | ||
dispatch | ||
): Promise<AxiosResponse<IVCInvitation>> => { | ||
dispatch(showLoading("modal")); | ||
dispatch(request(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
return CustomAxios() | ||
.post( | ||
`${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${partyGuid}`, | ||
null, | ||
createRequestHeader() | ||
) | ||
.then((response) => { | ||
dispatch(success(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); | ||
dispatch(hideLoading("modal")); | ||
return response; | ||
}) | ||
.catch((err) => { | ||
dispatch(error(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(hideLoading("modal")); | ||
throw new Error(err); | ||
}); | ||
}; | ||
|
||
export const fetchVCWalletInvitations = ( | ||
partyGuid: string | ||
): AppThunk<Promise<AxiosResponse<IVCInvitation>>> => ( | ||
dispatch | ||
): Promise<AxiosResponse<IVCInvitation>> => { | ||
dispatch(showLoading("modal")); | ||
dispatch(request(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
return CustomAxios() | ||
.get( | ||
`${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${partyGuid}`, | ||
createRequestHeader() | ||
) | ||
.then((response) => { | ||
dispatch(success(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); | ||
dispatch(hideLoading("modal")); | ||
return response; | ||
}) | ||
.catch((err) => { | ||
dispatch(error(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
dispatch(hideLoading("modal")); | ||
throw new Error(err); | ||
}); | ||
}; |
6 changes: 6 additions & 0 deletions
6
services/core-web/common/actions/verfiableCredentialActions.js
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,6 @@ | ||
import * as ActionTypes from "../constants/actionTypes"; | ||
|
||
export const storeVCConnectionInvitation = (payload) => ({ | ||
type: ActionTypes.STORE_VC_WALLET_CONNECTION_INVITATION, | ||
payload, | ||
}); |
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
32 changes: 32 additions & 0 deletions
32
services/core-web/common/reducers/verifiableCredentialReducer.js
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,32 @@ | ||
import * as actionTypes from "../constants/actionTypes"; | ||
import { VERIFIABLE_CREDENTIALS } from "../constants/reducerTypes"; | ||
|
||
/** | ||
* @file verifiableCredentialReducer.js | ||
* all data associated with verificable credential records. | ||
*/ | ||
|
||
const initialState = { | ||
vcWalletConnectionInvitation: {}, | ||
}; | ||
|
||
const verifiableCredentialReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case actionTypes.STORE_VC_WALLET_CONNECTION_INVITATION: | ||
return { | ||
...state, | ||
vcWalletConnectionInvitation: action.payload, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
const verifiableCredentialReducerObject = { | ||
[VERIFIABLE_CREDENTIALS]: verifiableCredentialReducer, | ||
}; | ||
|
||
export const getVCWalletConnectionInvitation = (state) => | ||
state[VERIFIABLE_CREDENTIALS].vcWalletConnectionInvitation; | ||
|
||
export default verifiableCredentialReducerObject; |
3 changes: 3 additions & 0 deletions
3
services/core-web/common/selectors/verifiableCredentialSelectors.js
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,3 @@ | ||
import * as verifiableCredentialReducer from "../reducers/verifiableCredentialReducer"; | ||
|
||
export const { getVCWalletConnectionInvitation } = verifiableCredentialReducer; |
61 changes: 61 additions & 0 deletions
61
services/minespace-web/common/actionCreators/verifiableCredentialActionCreator.ts
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,61 @@ | ||
import { ENVIRONMENT } from "@mds/common"; | ||
import { request, success, error } from "../actions/genericActions"; | ||
import * as reducerTypes from "../constants/reducerTypes"; | ||
import * as verfiableCredentialActions from "../actions/verfiableCredentialActions"; | ||
import { createRequestHeader } from "../utils/RequestHeaders"; | ||
import { showLoading, hideLoading } from "react-redux-loading-bar"; | ||
import CustomAxios from "../customAxios"; | ||
import { AppThunk } from "@/store/appThunk.type"; | ||
import { IVCInvitation } from "@mds/common"; | ||
import { AxiosResponse } from "axios"; | ||
|
||
export const createVCWalletInvitation = ( | ||
partyGuid: string | ||
): AppThunk<Promise<AxiosResponse<IVCInvitation>>> => ( | ||
dispatch | ||
): Promise<AxiosResponse<IVCInvitation>> => { | ||
dispatch(showLoading("modal")); | ||
dispatch(request(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
return CustomAxios() | ||
.post( | ||
`${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${partyGuid}`, | ||
null, | ||
createRequestHeader() | ||
) | ||
.then((response) => { | ||
dispatch(success(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); | ||
dispatch(hideLoading("modal")); | ||
return response; | ||
}) | ||
.catch((err) => { | ||
dispatch(error(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(hideLoading("modal")); | ||
throw new Error(err); | ||
}); | ||
}; | ||
|
||
export const fetchVCWalletInvitations = ( | ||
partyGuid: string | ||
): AppThunk<Promise<AxiosResponse<IVCInvitation>>> => ( | ||
dispatch | ||
): Promise<AxiosResponse<IVCInvitation>> => { | ||
dispatch(showLoading("modal")); | ||
dispatch(request(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
return CustomAxios() | ||
.get( | ||
`${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${partyGuid}`, | ||
createRequestHeader() | ||
) | ||
.then((response) => { | ||
dispatch(success(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); | ||
dispatch(hideLoading("modal")); | ||
return response; | ||
}) | ||
.catch((err) => { | ||
dispatch(error(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); | ||
dispatch(hideLoading("modal")); | ||
throw new Error(err); | ||
}); | ||
}; |
6 changes: 6 additions & 0 deletions
6
services/minespace-web/common/actions/verfiableCredentialActions.js
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,6 @@ | ||
import * as ActionTypes from "../constants/actionTypes"; | ||
|
||
export const storeVCConnectionInvitation = (payload) => ({ | ||
type: ActionTypes.STORE_VC_WALLET_CONNECTION_INVITATION, | ||
payload, | ||
}); |
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
Oops, something went wrong.