Skip to content

Commit

Permalink
Merge 8de32ce into cfe35a0
Browse files Browse the repository at this point in the history
  • Loading branch information
acsauk authored Jan 16, 2025
2 parents cfe35a0 + 8de32ce commit ca0a905
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 455 deletions.
4 changes: 3 additions & 1 deletion cmd/event-received/sirius_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ func handleFeeApproved(
donor.Tasks.PayForLpa = task.PaymentStateApproved
}

donor.ReducedFeeApprovedAt = now()

if err := putDonor(ctx, donor, now, client); err != nil {
return fmt.Errorf("failed to update LPA task status: %w", err)
return fmt.Errorf("failed to update donor provided details: %w", err)
}

return nil
Expand Down
6 changes: 5 additions & 1 deletion cmd/event-received/sirius_event_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func TestHandleFeeApproved(t *testing.T) {
})

updatedDonorProvided := completedDonorProvided
updatedDonorProvided.ReducedFeeApprovedAt = testNow
updatedDonorProvided.UpdateHash()
updatedDonorProvided.UpdatedAt = testNow

Expand Down Expand Up @@ -244,6 +245,7 @@ func TestHandleFeeApprovedWhenNotPaid(t *testing.T) {
})

updatedDonorProvided := completedDonorProvided
updatedDonorProvided.ReducedFeeApprovedAt = testNow
updatedDonorProvided.UpdateHash()
updatedDonorProvided.UpdatedAt = testNow

Expand Down Expand Up @@ -310,6 +312,7 @@ func TestHandleFeeApprovedWhenNotSigned(t *testing.T) {
})

updatedDonorProvided := donorProvided
updatedDonorProvided.ReducedFeeApprovedAt = testNow
updatedDonorProvided.Tasks.PayForLpa = task.PaymentStateCompleted
updatedDonorProvided.UpdateHash()
updatedDonorProvided.UpdatedAt = testNow
Expand Down Expand Up @@ -497,6 +500,7 @@ func TestHandleFeeApprovedWhenApprovedTypeDiffers(t *testing.T) {
})

updatedDonorProvided := *donorProvided
updatedDonorProvided.ReducedFeeApprovedAt = testNow
updatedDonorProvided.Tasks.PayForLpa = tc.updatedTaskState
updatedDonorProvided.FeeType = tc.approvedFeeType
updatedDonorProvided.UpdateHash()
Expand Down Expand Up @@ -538,7 +542,7 @@ func TestHandleFeeApprovedWhenDynamoClientPutError(t *testing.T) {
Return(expectedError)

err := handleFeeApproved(ctx, client, event, nil, nil, nil, appcontext.Data{}, testNowFn)
assert.Equal(t, fmt.Errorf("failed to update LPA task status: %w", expectedError), err)
assert.Equal(t, fmt.Errorf("failed to update donor provided details: %w", expectedError), err)
}

func TestHandleFeeApprovedWhenShareCodeSenderError(t *testing.T) {
Expand Down
16 changes: 16 additions & 0 deletions cypress/e2e/donor/progress.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,21 @@ describe('Progress', () => {
cy.contains('Simone Sutherland has confirmed your identity').should('not.exist');
cy.contains('You do not need to take any action.').should('not.exist');
});

it("when reduced fee approved and payment task complete", () => {
cy.visit('/fixtures?redirect=/progress&progress=payForTheLpa&feeType=NoFee');

cy.checkA11yApp();
cy.contains('Success: 1 notification from OPG');

cy.contains('We have approved your LPA fee request');
cy.contains('Your LPA is now paid.');

cy.reload()

cy.contains('Success: 1 notification from OPG').should('not.exist');
cy.contains('We have approved your LPA fee request').should('not.exist');
cy.contains('Your LPA is now paid.').should('not.exist');
})
});
});
Loading

0 comments on commit ca0a905

Please sign in to comment.