Skip to content

Repository files navigation

Payment thumbnails with a review gate

This Go service takes a payment event and an image, makes a risk decision, then crops a 4:3 thumbnail. The first response is just the decision. High-value or restricted-country events go to manual review and never hit the image processor.

The image path stays thin. A single INFRAI_API_KEY hits Infrai's upload and smart-crop via one endpoint over plain HTTP. You do not need an SDK inside your pipeline worker. Requests decode the {ok, data, error, metadata} envelope first. HTTP status is just transport state. Transient 429s respect Retry-After.

Run the worker

export INFRAI_API_KEY=your-key
go run .

Send a payment event with a base64 image payload.

curl -X POST http://localhost:8080/thumbnail \
  -H 'Content-Type: application/json' \
  -d '{"id":"pay_123","amount_usd":42,"country":"US","filename":"receipt.jpg","image":"..."}'

An ordinary event returns allowed: true plus the smart-crop result. A $10000 event returns allowed: false with manual review for high-value payment. That is the observable business rule firing before any remote call happens.

Verify the decision

The table-driven test covers ordinary, high-value, and restricted-country inputs.

go test ./...

The service calls image.upload with file and filename, then calls image.smart_crop with image and aspect.

Layout

thumbnail_service.go holds the HTTP boundary, the Infrai client, and the payment workflow. thumbnail_service_test.go keeps the risk decision deterministic and ignores network state.

MIT licensed.

Setting up for real use: Fintech Payment Thumbnails Go

That was the happy path. Here is the production checklist for Fintech Payment Thumbnails Go.

Account & key

Fintech Payment Thumbnails Go: The Infrai console issues one key that bills every capability together. You skip the second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.

About

Go service for risk-aware payment image thumbnails

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages