218 results in 0.34s across 48,708 indexed files
· Save search
Programs
checkout.py — Checkout Service
services/checkout/checkout.py
def create_checkout(customer_id):
cart = get_cart(customer_id)
total = cart.subtotal()
return account_service.charge(customer_id, total)
cart = get_cart(customer_id)
total = cart.subtotal()
return account_service.charge(customer_id, total)
payment.py — Payment Processor
services/payment/payment.py
if balance(account_id) < amount: raise InsufficientFunds
return debit(account_id, amount)
return debit(account_id, amount)
checkout.ts — Checkout API route
services/checkout/checkout.ts
router.post('/checkout', async (req, res) => {
const account = await findAccount(req.body.customerId);
const account = await findAccount(req.body.customerId);
Schemas
schema.sql — Customers & accounts
db/schema.sql
CREATE TABLE customers (
customer_id UUID PRIMARY KEY,
account_number VARCHAR(20) NOT NULL
customer_id UUID PRIMARY KEY,
account_number VARCHAR(20) NOT NULL
orders.sql — Orders table
db/orders.sql
id UUID PRIMARY KEY,
customer_id UUID REFERENCES customers(id)
customer_id UUID REFERENCES customers(id)
Jobs
nightly.yml — Daily account reconciliation
jobs/nightly.yml
schedule: cron('0 2 * * *')
- run: reconcile(accounts)
- run: reconcile(accounts)
reports.yml — Monthly statements
jobs/reports.yml
schedule: cron('0 4 1 * *')
- run: statement_for(customers)
- run: statement_for(customers)
SQL
SELECT from accounts
services/checkout/checkout.py (line 142)
SELECT * FROM accounts
WHERE customer_id = %s
WHERE customer_id = %s