Advanced 25 min read

Review and Refactor

By the end of this lesson, you'll be able to:

  • Review the complete payment feature across every layer built this module
  • Confirm every design decision from Lesson 1 was actually satisfied
  • Apply the full course checklist to a genuinely high-stakes feature

Prerequisites: "Monitor Transactions"

The complete feature, layer by layer

OrderTriggerHandler (thin, enqueues only)
ProcessPaymentJob (Queueable, retry-aware, updates Order__c)
PaymentGatewayService (the actual callout, typed PaymentResult)

Three classes, each with one job — the exact same shape as Module 26, Module 30, and Module 35's projects, now applied to genuinely the highest-stakes data this course has worked with.

Checking against Lesson 1's original design

  • No synchronous callout in the trigger? Yes — the trigger only enqueues (Lesson 3).
  • Three outcomes handled distinctly? Yes — success, decline, error each get their own status and logic (Lessons 2-4).
  • Declines never retried? Yes, explicitly excluded from the retry branch (Lesson 4).
  • Errors retried with a limit? Yes, capped at 3 attempts (Lesson 4).
  • Raw card data never touches Salesforce? Yes — payment tokens only, throughout (Lesson 5).
  • Every path tested, including the retry boundary? Yes (Lesson 6).
  • Stuck transactions monitorable? Yes (Lesson 7).

What this project represents in the course

This closes out Part XVII by combining genuinely everything the course has built toward: triggers (24), bulkification (25), security (28), custom exceptions (22), testing (31), callouts (36), and asynchronous Apex (38) — all in service of one real, high-stakes feature. Only three modules remain before the course's final capstone, and they cover DevOps practices, architecture patterns, and platform-scale concepts that this project's structure has already been quietly preparing for.

Exercise

As a comment, name which single design decision from Lesson 1 you think mattered most to getting right, and why.

Show hint

Consider the consequences of getting each one wrong.

APEX

Review and Refactor Quiz

1. What does this project module combine from across the entire course?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

The closing lesson reviews the entire payment gateway feature — trigger, Queueable job, service, security, tests, and monitoring — against everything this course has built toward.