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

Export xlsx FSP auth code (MTCN) #4527

Merged
merged 45 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
57ded17
install new pkgs
pavlo-mk Dec 17, 2024
d5c0f56
imports
pavlo-mk Dec 17, 2024
c3198b5
update initdemo & add property
pavlo-mk Dec 18, 2024
1b500c1
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Dec 18, 2024
4597662
upd mutations
pavlo-mk Dec 20, 2024
efceb49
conflicts
pavlo-mk Dec 23, 2024
9def2e5
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Dec 29, 2024
6c3169c
export file with auth code
pavlo-mk Dec 30, 2024
7f95ab6
add workbook encryption & migrations
pavlo-mk Dec 30, 2024
bdbba32
add sent_email_with_passwords
pavlo-mk Dec 31, 2024
b359b14
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Dec 31, 2024
dcda274
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Dec 31, 2024
3f3abe8
add celery task unit test
pavlo-mk Jan 2, 2025
ee82254
fix normal per fsp export
pavlo-mk Jan 2, 2025
0f261c0
fe lint
pavlo-mk Jan 2, 2025
6bc3c85
ut fixes
pavlo-mk Jan 3, 2025
440ddb1
more ut fixes :star:
pavlo-mk Jan 3, 2025
1aad96a
refresh_from_db more fields after export mutation
pavlo-mk Jan 3, 2025
f217742
add more unit tests
pavlo-mk Jan 3, 2025
c634318
upd first last reg time test data
pavlo-mk Jan 3, 2025
549bfdd
conflicts
pavlo-mk Jan 9, 2025
6dd8f82
clean up
pavlo-mk Jan 9, 2025
478f04b
add changes for export xlsx
Jan 10, 2025
7ac01ea
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Jan 13, 2025
8c69ec7
fixes
Jan 14, 2025
d5a9c8b
upd fixtures
pavlo-mk Jan 13, 2025
739724c
merge develop & conflicts
pavlo-mk Jan 15, 2025
0644622
upd fixtures PP
pavlo-mk Jan 15, 2025
c70e3a2
add PP.fsp_communication_channel
pavlo-mk Jan 15, 2025
1620b7b
can_export_xlsx & can_download_xlsx & can_send_xlsx_password
pavlo-mk Jan 15, 2025
c8d5800
fix
pavlo-mk Jan 15, 2025
5553c82
permissions simplify
Jan 15, 2025
b96590d
upd perm check for export/download/send pass
pavlo-mk Jan 15, 2025
effee76
fix mutation args
pavlo-mk Jan 15, 2025
03d0669
fix export
Jan 15, 2025
ff6268e
disable button when exporting in progress
Jan 15, 2025
ef91733
conflicts
pavlo-mk Jan 16, 2025
0a63854
uv lock
pavlo-mk Jan 16, 2025
5c18220
u tests
pavlo-mk Jan 16, 2025
788b30c
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Jan 16, 2025
335cfda
Merge branch 'develop' into export_xlsx_fsp_auth_code
pavlo-mk Jan 16, 2025
bebbd20
flake
pavlo-mk Jan 16, 2025
b740a27
conflicts
pavlo-mk Jan 16, 2025
66c4738
review & more tests
pavlo-mk Jan 16, 2025
6049749
more tests
pavlo-mk Jan 16, 2025
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
1 change: 1 addition & 0 deletions development_tools/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- "8080:8000"
volumes:
- ../src:/app/src
- ../tests:/app/tests
- backend-data:/data
- ../pyproject.toml:/app/pyproject.toml
- ../uv.lock:/packages/uv.lock
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ dependencies = [
"elastic-transport==8.13.0",
"flower>=2.0.1",
"factory-boy<4,>=3",
"django-fernet-fields>=0.6",
"msoffcrypto-tool>=5.4.2",
"pyzipper>=0.3.6",
]
requires-python = "==3.12.*"
readme = "README.md"
Expand Down
12 changes: 9 additions & 3 deletions src/frontend/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum Action {
REJECT
FINISH
SEND_TO_PAYMENT_GATEWAY
SEND_XLSX_PASSWORD
}

input ActionPaymentPlanInput {
Expand Down Expand Up @@ -2324,8 +2325,8 @@ type Mutations {
excludeHouseholds(excludedHouseholdsIds: [String]!, exclusionReason: String, paymentPlanId: ID!): ExcludeHouseholdsMutation
setSteficonRuleOnPaymentPlanPaymentList(paymentPlanId: ID!, steficonRuleId: ID!, version: BigInt): SetSteficonRuleOnPaymentPlanPaymentListMutation
copyTargetingCriteria(name: String!, paymentPlanId: ID!, programCycleId: ID!): CopyTargetingCriteriaMutation
exportXlsxPaymentPlanPaymentList(paymentPlanId: ID!): ExportXLSXPaymentPlanPaymentListMutation
exportXlsxPaymentPlanPaymentListPerFsp(paymentPlanId: ID!): ExportXLSXPaymentPlanPaymentListPerFSPMutation
exportXlsxPaymentPlanPaymentList(fspXlsxTemplateId: ID, paymentPlanId: ID!): ExportXLSXPaymentPlanPaymentListMutation
exportXlsxPaymentPlanPaymentListPerFsp(fspXlsxTemplateId: ID, paymentPlanId: ID!): ExportXLSXPaymentPlanPaymentListPerFSPMutation
importXlsxPaymentPlanPaymentList(file: Upload!, paymentPlanId: ID!): ImportXLSXPaymentPlanPaymentListMutation
importXlsxPaymentPlanPaymentListPerFsp(file: Upload!, paymentPlanId: ID!): ImportXLSXPaymentPlanPaymentListPerFSPMutation
exportPdfPaymentPlanSummary(paymentPlanId: ID!): ExportPDFPaymentPlanSummaryMutation
Expand Down Expand Up @@ -2660,6 +2661,11 @@ type PaymentPlanNode implements Node {
supportingDocuments: [PaymentPlanSupportingDocumentNode]
program: ProgramNode
totalHouseholdsCountWithValidPhoneNo: Int
canCreateXlsxWithFspAuthCode: Boolean
fspCommunicationChannel: String
canExportXlsx: Boolean
canDownloadXlsx: Boolean
canSendXlsxPassword: Boolean
}

type PaymentPlanNodeConnection {
Expand Down Expand Up @@ -3122,7 +3128,7 @@ type Query {
allPayments(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, paymentPlanId: String!, programId: String, orderBy: String): PaymentNodeConnection
allPaymentRecordsAndPayments(businessArea: String!, program: String, household: ID, orderBy: String, first: Int, last: Int, before: String, after: String): PaginatedPaymentRecordsAndPaymentsNode
financialServiceProviderXlsxTemplate(id: ID!): FinancialServiceProviderXlsxTemplateNode
allFinancialServiceProviderXlsxTemplates(offset: Int, before: String, after: String, first: Int, last: Int, name: String, createdBy: ID, orderBy: String): FinancialServiceProviderXlsxTemplateNodeConnection
allFinancialServiceProviderXlsxTemplates(offset: Int, before: String, after: String, first: Int, last: Int, financialServiceProviders: [ID], name: String, createdBy: ID, orderBy: String): FinancialServiceProviderXlsxTemplateNodeConnection
financialServiceProvider(id: ID!): FinancialServiceProviderNode
allFinancialServiceProviders(offset: Int, before: String, after: String, first: Int, last: Int, createdBy: ID, name: String, visionVendorNumber: String, deliveryMechanisms: [String], distributionLimit: Float, communicationChannel: String, xlsxTemplates: [ID], orderBy: String): FinancialServiceProviderNodeConnection
paymentRecordVerification(id: ID!): PaymentVerificationNode
Expand Down
79 changes: 76 additions & 3 deletions src/frontend/src/__generated__/graphql.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { gql } from '@apollo/client';

export const ExportXlsxPPListPerFsp = gql`
mutation ExportXlsxPPListPerFsp($paymentPlanId: ID!) {
exportXlsxPaymentPlanPaymentListPerFsp(paymentPlanId: $paymentPlanId) {
mutation ExportXlsxPPListPerFsp($paymentPlanId: ID!, $fspXlsxTemplateId: ID) {
exportXlsxPaymentPlanPaymentListPerFsp(
paymentPlanId: $paymentPlanId
fspXlsxTemplateId: $fspXlsxTemplateId
) {
paymentPlan {
id
status
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { gql } from '@apollo/client';

export const ALL_FSP_XLSX_TEMPLATES = gql`
query AllFinancialServiceProviderXlsxTemplates {
allFinancialServiceProviderXlsxTemplates {
edges {
node {
id
name
}
}
}
}
`;
5 changes: 5 additions & 0 deletions src/frontend/src/apollo/queries/paymentmodule/PaymentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const PAYMENT_PLAN_QUERY = gql`
bankReconciliationSuccess
bankReconciliationError
exchangeRate
fspCommunicationChannel
canExportXlsx
canDownloadXlsx
canSendXlsxPassword
programCycle {
id
title
Expand Down Expand Up @@ -150,6 +154,7 @@ export const PAYMENT_PLAN_QUERY = gql`
}
hasPaymentListExportFile
hasFspDeliveryMechanismXlsxTemplate
canCreateXlsxWithFspAuthCode
importedFileDate
importedFileName
totalEntitledQuantityUsd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ export function FollowUpPaymentPlanDetailsHeader({
PERMISSIONS.PM_ACCEPTANCE_PROCESS_FINANCIAL_REVIEW,
permissions,
);
const canDownloadXlsx = hasPermissions(
PERMISSIONS.PM_DOWNLOAD_XLSX_FOR_FSP,
permissions,
);
const canExportXlsx = hasPermissions(
PERMISSIONS.PM_EXPORT_XLSX_FOR_FSP,
permissions,
);

const canSendToPaymentGateway =
hasPermissions(PERMISSIONS.PM_SEND_TO_PAYMENT_GATEWAY, permissions) &&
paymentPlan.canSendToPaymentGateway;
Expand Down Expand Up @@ -143,27 +136,15 @@ export function FollowUpPaymentPlanDetailsHeader({
);
break;
case 'ACCEPTED':
case 'FINISHED':
buttons = (
<AcceptedPaymentPlanHeaderButtons
canDownloadXlsx={canDownloadXlsx}
canExportXlsx={canExportXlsx}
canSendToPaymentGateway={canSendToPaymentGateway}
paymentPlan={paymentPlan}
canSplit={canSplit}
/>
);
break;
case 'FINISHED': // TODO: may create another one for that explicitly but good for now
buttons = (
<AcceptedPaymentPlanHeaderButtons
canDownloadXlsx={canDownloadXlsx}
canExportXlsx={canExportXlsx}
canSendToPaymentGateway={false}
paymentPlan={paymentPlan}
canSplit={false}
/>
);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ describe('components/paymentmodule/PaymentPlanDetails/PaymentPlanDetailsHeader/H
mocks={fakeExportXlsxPpListPerFspMutation}
>
<AcceptedPaymentPlanHeaderButtons
canDownloadXlsx={false}
canExportXlsx={false}
canSendToPaymentGateway={false}
canSplit={false}
paymentPlan={fakeApolloPaymentPlan}
Expand All @@ -26,24 +24,4 @@ describe('components/paymentmodule/PaymentPlanDetails/PaymentPlanDetailsHeader/H

expect(container).toMatchSnapshot();
});

it('should render not disabled buttons', async () => {
const { container } = render(
<MockedProvider
addTypename={false}
mocks={fakeExportXlsxPpListPerFspMutation}
>
<AcceptedPaymentPlanHeaderButtons
canDownloadXlsx
canExportXlsx
canSendToPaymentGateway
canSplit
paymentPlan={fakeApolloPaymentPlan}
/>
</MockedProvider>,
);
await act(() => wait(0)); // wait for response

expect(container).toMatchSnapshot();
});
});
Loading
Loading