feat: add PHP, .NET, and Java language support to Lego system builder#3
Open
theCreedo wants to merge 12 commits into
Open
feat: add PHP, .NET, and Java language support to Lego system builder#3theCreedo wants to merge 12 commits into
theCreedo wants to merge 12 commits into
Conversation
…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.
slogsdon
requested changes
Jun 24, 2026
| var token = body.TryGetProperty("token", out var t) ? t.GetString() ?? "" : ""; | ||
| var amount = body.TryGetProperty("amount", out var a) ? decimal.Parse(a.GetString() ?? "29.99", System.Globalization.CultureInfo.InvariantCulture) : 29.99m; | ||
| var currency = body.TryGetProperty("currency", out var c) ? c.GetString() ?? "USD" : "USD"; | ||
| var result = await Payments.Authorize(token, amount, currency); |
Contributor
There was a problem hiding this comment.
In node, the import happens in this file. Would be good to follow the same pattern. Let's each file stand alone as a code example with the necessary context to have it compile and "run"
| ], | ||
| php: [ | ||
| ' composer install', | ||
| ' ./run.sh # branded checkout on http://localhost:3000', |
Contributor
There was a problem hiding this comment.
This is the only one that uses the run script. We should make the call to either use it across all languages or none of them.
| ' ./vendor/bin/phpunit tests/ # smoke tests (skip without credentials)', | ||
| ], | ||
| dotnet: [ | ||
| ' dotnet run # branded checkout on http://localhost:3000', |
Contributor
There was a problem hiding this comment.
just the run command here. Should include dotnet install and dotnet test to match the others.
| ' dotnet run # branded checkout on http://localhost:3000', | ||
| ], | ||
| java: [ | ||
| ' mvn integration-test # builds + starts embedded Tomcat on http://localhost:3000', |
Contributor
There was a problem hiding this comment.
Same here. should include the other commands.
| $response = curl_exec($ch); | ||
| $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
| $curlError = curl_error($ch); | ||
| curl_close($ch); |
Contributor
There was a problem hiding this comment.
These should use the SDK to generate the access token similar to the Node version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.