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

Feat/licensee select priv purchase #39

Closed
wants to merge 36 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
base data layer done
Dana Stiefel committed Oct 18, 2024

Verified

This commit was signed with the committer’s verified signature.
poyzannur Poyzan
commit ca742e8406a6c10d9f4da1cd29d0626b1b771972
4 changes: 2 additions & 2 deletions webroot/src/network/userApi/data.api.ts
Original file line number Diff line number Diff line change
@@ -194,9 +194,9 @@ export class UserDataApi implements DataApiInterface {
const privilegePurchaseOptions = items.filter((serverItem) => (serverItem.type === 'jurisdiction')).map((serverPurchaseOption) => (PrivilegePurchaseOptionSerializer.fromServer(serverPurchaseOption)));

const compactCommissionFee = items.filter((serverItem) => (serverItem.type === 'compact')).map((serverFeeObject) => ({
compact: serverFeeObject?.compact,
compact: serverFeeObject?.compactName,
feeType: serverFeeObject?.compactCommissionFee?.feeType,
fee: serverFeeObject?.compactCommissionFee.fee
fee: serverFeeObject?.compactCommissionFee?.feeAmount
}))[0];

return { privilegePurchaseOptions, compactCommissionFee };
3 changes: 3 additions & 0 deletions webroot/src/pages/SelectPrivileges/SelectPrivileges.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,9 @@ export default class SelectPrivileges extends Vue {
//
// Lifecycle
//
mounted() {
this.$store.dispatch('user/getPrivilegePurchaseInformationRequest');
}

//
// Computed
1 change: 0 additions & 1 deletion webroot/src/store/compact/compact.state.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

export interface State {
compactMap: object;

}

export const state: State = {
29 changes: 15 additions & 14 deletions webroot/src/store/user/user.actions.ts
Original file line number Diff line number Diff line change
@@ -190,27 +190,28 @@ export default {
},
getPrivilegePurchaseInformationRequest: ({ commit, dispatch }) => {
commit(MutationTypes.GET_PRIVILEGE_PURCHASE_INFORMATION_REQUEST);
return dataApi.getAuthenticatedStaffUser().then((data) => {



return dataApi.getPrivilegePurchaseInformation().then((data) => {
dispatch('getPrivilegePurchaseInformationSuccess', data);

return data;
}).catch((error) => {
dispatch('getPrivilegePurchaseInformationFailure', error);
});
},
getPrivilegePurchaseInformationSuccess: ({ commit, dispatch, state }, data) => {
console.log('serializedData', data);

// const newCompact = new Compact({...state.currentCompact, privilegePurchaseOptions: a, compactCommissionFee: a, compactCommissionFeeType: a});
// commit(MutationTypes.GET_PRIVILEGE_PURCHASE_INFORMATION_SUCCESS, newCompact);
// if (newCompact) {
// dispatch('setCurrentCompact', newCompact);
// }
getPrivilegePurchaseInformationSuccess: ({ dispatch, commit, state }, data) => {
if (data?.compactCommissionFee?.compact === state?.currentCompact?.type) {
const newCompact = new Compact({
...state.currentCompact,
privilegePurchaseOptions: data.privilegePurchaseOptions,
compactCommissionFee: data?.compactCommissionFee?.feeType,
compactCommissionFeeType: data?.compactCommissionFee?.feeType
});

dispatch('setCurrentCompact', newCompact);
commit(MutationTypes.GET_PRIVILEGE_PURCHASE_INFORMATION_SUCCESS, newCompact);
dispatch('setCurrentCompact', newCompact);
} else {
// TODO: make sure error case is all good
dispatch('getPrivilegePurchaseInformationFailure', 'Compact mismatch');
}
},
getPrivilegePurchaseInformationFailure: ({ commit }, error: Error) => {
commit(MutationTypes.GET_PRIVILEGE_PURCHASE_INFORMATION_FAILURE, error);