bcgov / nr-site-bc-registries

Apache License 2.0
1 stars 0 forks source link

Generate the pdf/email before payment #95

Closed mgtennant closed 1 year ago

mgtennant commented 1 year ago

Changed the service to throw an error if cdogs fails to generate the pdf or html. This error is caught by the controller which in turn is caught by the frontend which will let the user know that there was an error and that they were not charged.

In order to properly handle throwing errors to the frontend, the way the controller handles returning values needed to be changed to use the response object to directly.

The flow is now:

  1. User requests to generate email/document
  2. Nest generates the document, throwing an error if it gets one
  3. If there are no errors, continue to the payment API
  4. If the payment is successful, send the email or return the document.
github-actions[bot] commented 1 year ago

Frontend coverage report

Coverage after merging double-generate into main will be
0.94%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   app.controller.ts0%0%0%0%1, 11, 110–111, 113, 113, 113, 113, 113, 115, 115, 118, 118, 118, 12, 139–140, 142, 142, 142, 142, 142, 144, 144, 147, 147, 147, 168–169, 171, 171, 171, 171, 171, 173, 173, 176, 176, 176, 18–19, 197–198, 2, 200, 200, 200, 200, 200, 202, 202, 205, 205, 205, 21, 21, 21, 21, 21, 21, 21, 226–227, 229, 229, 229, 229, 229, 231, 231, 234, 234, 234, 253–254, 254, 254, 26, 26, 29, 29, 29, 3, 5, 52–53, 55, 55, 55, 55, 55, 57, 57, 6, 60, 60, 60, 7–8, 81–82, 84, 84, 84, 84, 84, 86, 86, 89, 89, 89
   app.module.ts0%100%100%0%1, 10–12, 2–3, 31, 4–9
   app.service.ts0%0%0%0%1, 12–14, 14, 14–15, 15, 15–17, 2, 25, 3, 30, 34–36, 41, 5
   main.ts0%100%0%0%1, 11, 13–17, 20, 28, 3, 30, 32–33, 35, 4–8
src/account
   account.filter.ts0%0%0%0%1, 10, 10, 10–13, 2, 5, 7–9
   account.guard.ts0%0%0%0%1, 11, 5, 7–8, 8, 8–9
   account.module.ts0%100%100%0%1, 11, 2–4
src/authentication
   authentication.controller.ts0%0%0%0%1, 11, 15–16, 16–17, 20, 20, 20–21, 23, 3–4, 9
   authentication.filter.ts0%0%0%0%1, 11–12, 15, 15, 15–19, 19, 19–21, 21, 21–27, 27–31, 31, 31–37, 4, 9
   authentication.guard.ts0%0%0%0%1, 10, 100, 13–14, 14, 14–16, 16, 16–17, 19, 19, 19–20, 20, 20, 22, 22, 22, 22, 22–23, 3, 31, 31, 31, 31–32, 36, 38, 38, 38, 38, 38, 40, 40, 40–41, 46–48, 48, 48, 5, 50–51, 53, 55, 63, 65–66, 73–74, 74, 74–76, 76, 76, 78–79, 81, 83, 9, 91, 94–95, 99
   authentication.module.ts0%100%100%0%1, 15, 2, 4–7
   authentication.service.ts0%0%0%0%1, 102–103, 106, 108–109, 11, 110, 121–123, 125–129, 131, 137–142, 144, 147, 150, 150, 150, 153–157, 157, 157, 161–162, 165, 167–169, 175–176, 178, 181, 181–183, 185, 185, 185–187, 187, 187–188, 190, 199, 2, 202–203, 205, 205, 205–206, 206, 206–208, 211, 214, 217–218, 220, 220, 220–221, 223, 225, 23, 234–235, 237, 237, 239, 239, 239, 239, 24, 240, 244, 248–249, 25, 250–253, 255, 26, 261, 264, 267, 267, 267, 27, 270–274, 274, 274, 278–279, 28, 282, 284–286, 29, 3, 30, 35, 4, 46, 48, 5, 51, 51, 51, 54–58, 58, 58, 62–63, 66, 68–70, 75, 8, 86, 88, 91, 91, 91, 94–98, 98, 98
src/authentication/dto
   code.dto.ts0%100%100%0%1
src/bc-registry
   bc-registry.controller.ts0%0%0%0%1, 100, 100, 100–101, 105, 105, 105–106, 111, 113–114, 114, 114, 114, 114, 114–117, 119, 125, 132, 135–136, 138–140, 142, 142, 142–143, 146–147, 149, 149, 149–150, 154, 154, 154–155, 16, 160–161, 163, 163, 163, 163, 163, 163–165, 168–169, 17, 171–172, 178, 18, 182, 190, 197, 20–21, 26–27, 32, 38, 41–42, 44–46, 48, 48, 48–50, 52, 52, 52–53, 57, 57, 57–58, 63, 65, 65, 65, 65,
github-actions[bot] commented 1 year ago

Backend coverage report

Coverage after merging double-generate into main will be
25.15%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   app.controller.ts0%100%0%0%1, 10, 2, 5–6, 9
   app.module.ts0%0%100%0%1, 10–19, 2, 20–27, 29, 3, 30–32, 32, 32–33, 35, 4, 43, 43, 45, 45–46, 46, 5–7, 75, 8
   app.service.ts0%100%0%0%1, 13, 2, 5–6, 8
   main.ts0%0%0%0%1, 15–16, 18, 18, 18–19, 2, 20–21, 23, 3–4, 7–8
src/actions
   actions.controller.ts0%100%0%0%1, 12–14, 18–19, 2, 23–24, 3–4, 8–9
   actions.module.ts0%100%100%0%1, 13, 2–5
   actions.service.ts0%100%0%0%1, 12, 16–18, 2, 22, 26, 3, 30–31, 35–37, 41–44, 46, 48, 53–55, 57, 6, 9
src/actions/dto
   action.dto.ts0%100%100%0%1
   create-action.dto.ts0%100%100%0%1–2, 4
   update-action.dto.ts0%100%100%0%1, 3
src/actions/entities
   action.entity.ts0%100%0%0%1, 10, 13, 4, 6, 8
src/cron
   cron.module.ts0%100%100%0%1, 10–19, 2, 20–29, 3, 30–35, 4–7, 78, 8–9
   cron.service.ts0%0%0%0%1, 10, 100–102, 104–107, 109, 11, 112–113, 12, 120–129, 13, 130–135, 137, 14–15, 155, 159, 16, 161, 165–167, 17, 175, 177–179, 18, 180–189, 19, 190–192, 196–199, 2, 20, 200–203, 205, 207, 21, 212–219, 22, 221, 223, 228–229, 23, 230–235, 237, 239, 24, 244–249, 25, 250–251, 253, 255, 26, 260–267, 269, 27, 271, 276–279, 28, 280–283, 285, 287, 29, 292–299, 3, 30, 301, 303, 308–309, 31, 310–315, 317, 319, 32, 324–329, 33, 330–331, 333, 335, 34, 340–347, 349, 35, 351, 356–359, 36, 360–363, 365, 367, 37, 372–379, 38, 381, 383, 388–389, 39, 390–395, 397, 399, 4, 40, 404–409, 41, 410–411, 413, 415, 42, 420–427, 429, 431, 436–439, 44, 440–443, 445, 447, 452, 454, 462–465, 47, 475–478, 49, 5, 50–59, 6, 60–65, 70–71, 71, 71–72, 74, 76–77, 77, 77, 77, 77–79, 8, 80, 80, 82–84, 84–86, 9, 92, 94, 96–98, 98, 98–99
src/sites
   sites.controller.ts0%100%0%0%1, 10–11, 14–15, 19, 2, 20, 24–25, 29, 3, 30, 34–35, 39, 4, 40, 5–6
   sites.module.ts0%100%100%0%1, 13, 2–5
   sites.service.ts0%100%0%0%1, 10, 13, 17–19, 2, 23, 27, 3, 31–32, 36–39, 4, 41, 43, 48–50, 52
src/sites/dto
   create-site.dto.ts0%100%100%0%1–2, 4
   site.dto.ts0%100%100%0%1, 103, 109, 115, 121, 127, 13, 133, 139, 145, 151, 157, 163, 169, 175, 181, 187, 19, 193, 199, 205, 211, 217, 223, 229, 235, 241, 247, 25, 253, 259, 265, 3, 31, 37, 43, 49, 55, 61, 67, 7, 73, 79, 85, 91, 97
   update-site.dto.ts0%100%100%0%1, 3
src/sites/entities
   site.entity.ts0%100%0%0%1, 101, 11, 14, 16, 18, 2, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 5, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98
src/sraecass
   sraecass.controller.ts0%100%0%0%1, 10, 13–14, 18–19, 2, 23–24, 28–29, 3, 33–34, 38–39, 4–5, 9
   sraecass.module.ts0%100%100%0%1, 13, 2–5
   sraecass.service.ts0%100%0%0%1, 10, 13, 17–19, 2, 23, 27, 3, 31–32, 36–39, 4, 41, 43, 48–50, 52
src/sraecass/dto
   create-sraecass.dto.ts0%100%100%0%1–2, 4
   sraecass.dto.ts0%100%100%0%1
   update-sraecass.dto.ts0%100%100%0%1, 3
src/sraecass/entities
   sraecass.entity.ts0%100%0%0%11, 13, 15, 17,