Skip to content

feat: add PHP, .NET, and Java language support to Lego system builder#3

Open
theCreedo wants to merge 22 commits into
mainfrom
feature/multi-language-scaffold
Open

feat: add PHP, .NET, and Java language support to Lego system builder#3
theCreedo wants to merge 22 commits into
mainfrom
feature/multi-language-scaffold

Conversation

@theCreedo

Copy link
Copy Markdown

No description provided.

theCreedo added 12 commits June 18, 2026 12:55
…arsing

- Remove Node-only guard; supported languages are now node and php
- Add resolveForLanguage() helper: flat arrays/maps treated as node-only
  shorthand; language-keyed objects select by spec.language
- Add .php and .sh to textExtensions so PHP scaffold files get slot-rendered
- router.php: static file serving from public/ + route dispatch to index.php
  modeled on dispute-management/php/router.php
- index.php: generated entry point with {{ SLOT }} markers mirroring index.js
- core/config.php: GpApiConfig setup from env, ServicesContainer registration
  modeled on dispute-management/php/sdk-config.php
- core/error-handler.php: sendError() normalizes SDK exceptions to JSON
- composer.json: globalpayments/php-sdk ^13.4, vlucas/phpdotenv ^5.5, phpunit ^11
- run.sh: composer install + php -S built-in server
- README.md: gold-standard per-language format with {{ SLOT }} markers
- tests/ProjectTest.php: PHPUnit smoke test, skips without credentials
- public/: shared branded assets copied from scaffold/node/public/
- token-helper.php: generateAccessToken() via direct cURL + SHA-512
  (per AGENTS.md from online-card-payments — not PHP SDK method)
- studs/fragments/token-helper-route.php: GET /api/access-token handler
- bricks/payments.php: charge(), authorize(), capture() using PHP SDK
  CreditCardData->charge()->withCurrency()->execute()
- bricks/fragments/charge-route.php: POST /api/charge handler
- bricks/fragments/authorize-route.php: POST /api/authorize handler
- bricks/fragments/capture-route.php: POST /api/capture/:id handler
- All manifests updated with language-keyed files/inserts (node + php)
- builder: skip core/ vendoring for PHP (baked into scaffold); apply
  resolveForLanguage to test_fragments; language-aware next-steps output
- specs/simple-checkout-php.yaml: first PHP spec (tiles: hosted-fields, bricks: charge)
- Verified: two builds produce byte-identical output
ASP.NET Core Minimal API shell (net9.0) with named slot markers,
ServicesContainer baseplate config, and static-file serving from public/.
Jakarta EE Servlet dispatching on method+URI (mirrors PHP routing pattern),
embedded Tomcat 10.x via Cargo Maven plugin, mvn integration-test to build
and start in one step.
Direct REST call to /ucp/accesstoken with SHA-512(nonce+appKey) secret,
scoped to PMT_POST_Create_Single permission. Returns { accessToken, environment }.
Stateless Payments class wrapping CreditCardData SDK calls. Amount parsed
from string to handle JSON string values from the frontend.
Adds files/inserts entries for dotnet and java to token-helper, charge,
authorize, capture, and hosted-fields manifests.
Adds dotnet/java to SUPPORTED_LANGUAGES, nextSteps, and textExtensions.
Java component files are vendored to src/main/java/com/globalpayments/sample/
instead of components/ to satisfy Maven package structure requirements.
simple-checkout and delayed-capture variants for both languages.
All four generate and build verified clean.
Drops "Node vertical slice" title, adds language support matrix,
updates layout section and quick start for all 4 languages,
marks Phase 1-2 complete in roadmap.
Comment thread bricks/fragments/authorize-route.cs
Comment thread builder/build-project.js Outdated
Comment thread builder/build-project.js
Comment thread builder/build-project.js
Comment thread studs/token-helper.php Outdated
theCreedo added 10 commits July 8, 2026 13:30
… files

Replace the single payments.* file (containing all three methods) with
per-operation charge/authorize/capture files across all four languages,
so each generated project includes only the operations it needs.
…k imports

Each route fragment now requires its own per-operation module instead of
the shared payments file. C# fragments include a requires comment listing
the using directives needed to make the fragment self-contained.
Each language now calls the SDK's token generation method directly,
matching the pattern already used in the Node implementation.
Conditionally render the authorization code result row so capture
responses (which don't include an auth code) don't show a blank value.
Drop ./run.sh from PHP next steps in favor of the direct php -S command.
Add dotnet restore and dotnet test for .NET. Add mvn dependency:resolve
and mvn test for Java so all languages show consistent install/run/test steps.
…age suffix

Rename simple-checkout.yaml and delayed-capture.yaml to include the -node
suffix, matching the PHP, .NET, and Java spec naming convention. Rename
golden/simple-checkout to golden/simple-checkout-node and update the
snapshot harness to match.
Add quick start commands for all four languages under the delayed-capture
section. Replace ./run.sh with the direct php -S command for PHP to match
the builder output and keep all languages consistent.
@theCreedo theCreedo requested a review from slogsdon July 8, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants