Doing Cookbooks

website·Indexed 30 days ago

https://doing-cookbooks.s3-website.fr-par.scw.cloud

A collection of technical guides and blueprints covering Stripe integration (tax configuration, webhooks, and catalog synchronization), PrestaShop development (theming, modules, and hooks), and e-reporting standards including PDF/A-3 and Factur-X via TCPDF.

Tokens
47.8K
Snippets
133
Records
273
Agent score
50%

What's inside Doing Cookbooks

  1. Overview of the Stripe Integration Cookbook

    This cookbook provides a reproducible method for implementing a complete Stripe integration, focusing on maintaining a clean architecture. It is divided into two primary phases:

    1. Stripe Configuration: Setting up the account, products, taxes, subscriptions, and webhooks to ensure the environment is production-ready.
    2. Integration Blueprints: Technology-agnostic technical specifications covering data models, services, APIs, webhook processing, and business rules required for a robust integration.
  2. Configure Xcode Cloud post-clone script for Flutter

    To prepare the Flutter environment in Xcode Cloud, create a ci_post_clone.sh script located in ios/ci_scripts/. This script must handle Flutter installation based on the machine architecture (arm64 vs x86_64), disable telemetry, run flutter pub get, manually generate Generated.xcconfig if missing (to ensure pod install works), and execute pod install.

    Critical constraints:

    • Do not use sudo (it fails silently in Xcode Cloud).
    • Do not use --repo-update with pod install due to SSL expiration issues with the CocoaPods Source CDN.
    • Avoid activating flutterfire_cli without Firebase to prevent 15-minute timeouts.
    • Use uname -m to detect architecture for the correct Flutter SDK download URL.
    #!/bin/sh
    set -e
    
    FLUTTER_VERSION="3.38.5"
    FLUTTER_DIR="$HOME/flutter"
    REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
    
    echo "==> Installation de Flutter $FLUTTER_VERSION"
    
    ARCH=$(uname -m)
    if [ "$ARCH" = "arm64" ]; then
      FLUTTER_URL="https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_${FLUTTER_VERSION}-stable.zip"
    else
      FLUTTER_URL="https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_${FLUTTER_VERSION}-stable.zip"
    fi
    
    curl -fsSL -o /tmp/flutter.zip "$FLUTTER_URL"
    unzip -q /tmp/flutter.zip -d "$HOME"
    rm /tmp/flutter.zip
    
    export PATH="$FLUTTER_DIR/bin:$PATH"
    
    flutter config --no-analytics --suppress-analytics 2>/dev/null || true
    
    cd "$REPO_ROOT"
    flutter pub get
    
    mkdir -p ios/Flutter
    if [ ! -f "ios/Flutter/Generated.xcconfig" ]; then
      cat > ios/Flutter/Generated.xcconfig << XCCONFIG
    FLUTTER_ROOT=${FLUTTER_DIR}
    FLUTTER_APPLICATION_PATH=${REPO_ROOT}
    COCOAPODS_PARALLEL_CODE_SIGN=true
    FLUTTER_TARGET=lib/main.dart
    FLUTTER_BUILD_DIR=build
    FLUTTER_BUILD_MODE=release
    DART_DEFINES=
    DART_OBFUSCATION=false
    TRACK_WIDGET_CREATION=false
    TREE_SHAKE_ICONS=false
    PACKAGE_CONFIG=.dart_tool/package_config.json
    XCCONFIG
    fi
    
    cd "$REPO_ROOT/ios"
    pod install
  3. Prerequisites for Flutter CI/CD Pipelines

    To implement manual Bitbucket pipelines for deploying a Flutter app to Google Play Store and TestFlight, the following requirements must be met:

    • Bitbucket Repository: Pipelines must be enabled.
    • Flutter App: Configured with flavors (e.g., preprod, prod) using flutter_flavorizr.
    • Google Play Console: Account with the app already created.
    • Apple Developer Program: Access to App Store Connect and Xcode Cloud.
    • Tooling: Fastlane (installed via gem install in pipeline) and Ruby (included in the CI Docker image).
  4. Generate Factur-X compliant electronic invoices with Symfony

    This guide provides an overview of generating electronic invoices that comply with the Factur-X standard using the Symfony framework. The process includes the generation of XML data, PDF/A-3 documents, and the necessary validation and testing procedures to ensure compliance.
  5. Integrate Yodeck as a real-time display layer via REST API

    Yodeck provides a REST API that allows business applications to act as the 'brain' (controlling which client, screen, and content to display and when) while Yodeck acts as the 'execution arm' (handling the actual display on physical screens). This integration removes the need for manual content uploads or playlist modifications via the Yodeck web interface.

    Key capabilities available via the API include:

    • Automating the delivery of content (images, videos, web pages, dashboards, documents).
    • Assigning content to specific screens or groups of screens.
    • Advanced hourly and daily scheduling.
    • Multi-site and multi-client management.
    • Monitoring screen status (uptime, last seen, and deployed content).
  6. PrestaShop Docker environment architecture

    A robust PrestaShop development environment is built using a docker-compose.yml file that orchestrates the following components:

    • Runtime: PHP, MySQL, and a web server (Apache or Nginx).
    • Persistence: Dedicated volumes for PrestaShop source code and the MySQL database.
    • Purpose: This setup ensures a reproducible, isolated, and portable environment suitable for local development, staging, and production.
  7. Understand PrestaShop module architecture and selection

    PrestaShop modules are the core building blocks of the platform. To effectively extend PrestaShop, developers should understand the system's history, its architectural design, and the different families of modules available. This knowledge helps in making the strategic decision between purchasing an existing module from the marketplace or developing a custom solution from scratch.
  8. Understand the relationship between Stripe Products and Prices

    In Stripe, a Product represents the commercial offering (e.g., a Premium subscription, a Pro license, or a service) and defines what is being sold, independent of its cost. The cost is defined by one or more Prices.

    Key constraints:

    • A single Product can be associated with multiple Prices (e.g., monthly, annual, or promotional rates).
    • A single Price can only be associated with one Product.
  9. Implement forced app update mechanism in Flutter

    To implement a forced update mechanism, the Flutter app must send its current version to the backend via a custom header (X-App-Version). If the backend determines the version is too old, it returns an HTTP 426 Upgrade Required response. The app intercepts this status and displays a blocking dialog directing the user to the App Store or Google Play Store.
  10. Evaluate PrestaShop module compatibility and versioning

    PrestaShop module architecture has evolved significantly across versions. Modules developed for older versions (e.g., PS 1.6) are generally incompatible with newer versions (e.g., PS 9) without a complete rewrite.

    Key architectural shifts include:

    • PS 1.4: Introduction of hooks.
    • PS 1.7: Introduction of Symfony and Webpack; modules can inherit Symfony architecture.
    • PS 8: Support for PHP 8.1+ and modernized Symfony services.
    • PS 9: Transition to a quasi full-Symfony architecture using autowiring and Doctrine; modern modules act as Symfony bundles.
  11. Architectural principles for Stripe integration

    When integrating Stripe, adhere to these core architectural constraints to ensure security and data integrity:

    • Source of Truth: The local application is the source of truth for users, plans, functional rights, and business rules. Stripe is the source of truth for payments, external subscriptions, invoices, and refunds.
    • Entitlements: Access rights must never be determined by real-time API calls to Stripe; they must be stored in a local entitlement entity.
    • Idempotency: All Stripe events must be processed idempotently.
    • Environment Isolation: Test and production Stripe environments must remain strictly separate.
    • Security: Secret keys must never be exposed to the frontend, mobile apps, or Git repositories.