Week 4 (scoped): BooksRun live price/stock check + daily FTP sync stub
Adds a live per-ISBN BooksRun API check to the checkout-time price recheck (Order\PriceRecheck) so a booksrun-sourced offer is verified fresh, not trusted from a potentially day-stale local cache -- fails closed on any problem (API error, no stock), matching Appendix B's "stale supplier cost must never be trusted as final." Live values are written back to the same offer_id row so SupplierOrderJob's later fulfillment-time read sees them too. Also wires a real daily Action Scheduler job (scheduling/dedup/batch-write infrastructure) for BooksRun's FTP inventory feed, but leaves the actual connect+parse step (Import\BooksRunOfferSync::connect_and_parse_feed()) as a deliberate stub -- no FTP access or sample feed exists yet, and guessing at a file format would silently write wrong data once real access arrives. The stub fails loud on the manual CLI trigger, quiet on the scheduled job (no point alarming on an expected, known state). Ingram, BooksRun AutoBuy, production email, and tax/legal/monitoring are explicitly out of scope for this pass -- narrowed by user request. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D2gmgaDVXcRGCwLfdXQajD
This commit is contained in:
1 parent
4079bfceac
commit
a733ba4bfd
11 files changed
+578
-4
No files matched your search
+10
-1
@@ -75,12 +75,21 @@ printf '%s' "$HELCIM_API_TOKEN_VALUE" > "$SECRETS_DIR/helcim_api_token"
|
||||
if [[ -z "$HELCIM_API_TOKEN_VALUE" ]]; then
|
||||
echo " (HELCIM_API_TOKEN not set in ${ENV_FILE} — Helcim gateway will install but stay unconfigured)"
|
||||
fi
|
||||
# Same pattern again — optional, written unconditionally.
|
||||
# Integration\BooksRunAdapter::is_configured() is false until a real key
|
||||
# lands in BOOKSRUN_API_KEY. BOOKSRUN_FTP_PASSWORD is a placeholder: no
|
||||
# FTP access exists yet either (Import\BooksRunOfferSync is a stub), but
|
||||
# the secret-file path is wired up now so nothing changes here once it does.
|
||||
BOOKSRUN_API_KEY_VALUE="$(env_get "$ENV_FILE" BOOKSRUN_API_KEY)"
|
||||
printf '%s' "$BOOKSRUN_API_KEY_VALUE" > "$SECRETS_DIR/booksrun_api_key"
|
||||
BOOKSRUN_FTP_PASSWORD_VALUE="$(env_get "$ENV_FILE" BOOKSRUN_FTP_PASSWORD)"
|
||||
printf '%s' "$BOOKSRUN_FTP_PASSWORD_VALUE" > "$SECRETS_DIR/booksrun_ftp_password"
|
||||
# 644, not 600: the db/wordpress/cron containers read this as their own
|
||||
# (non-host-matching) container UID, e.g. www-data — chmod 600 made it
|
||||
# unreadable to them. The containing directory (700, above) is what
|
||||
# actually keeps other host users out; these just need to be world-readable
|
||||
# within that already-restricted directory.
|
||||
chmod 644 "$SECRETS_DIR/db_password" "$SECRETS_DIR/db_root_password" "$SECRETS_DIR/hardcover_api_token" "$SECRETS_DIR/helcim_api_token"
|
||||
chmod 644 "$SECRETS_DIR/db_password" "$SECRETS_DIR/db_root_password" "$SECRETS_DIR/hardcover_api_token" "$SECRETS_DIR/helcim_api_token" "$SECRETS_DIR/booksrun_api_key" "$SECRETS_DIR/booksrun_ftp_password"
|
||||
|
||||
echo "==> building and starting ${ENVIRONMENT}"
|
||||
$COMPOSE up -d --build
|
||||
|
||||
Reference in new issue
Block a user