Skip to content

feat(core): add missing fields to request structs - #67

Open
MargaretKerubo wants to merge 2 commits into
Flying-Tea-Squad:mainfrom
MargaretKerubo:feat/request-fields
Open

MargaretKerubo wants to merge 2 commits into
Flying-Tea-Squad:mainfrom
MargaretKerubo:feat/request-fields

Conversation

@MargaretKerubo

Copy link
Copy Markdown

Summary

This PR adds the missing data fields to the standard request structs in requests.go to match the specifications defined in the plan.md appendix.

Prior to this change, the structs only contained the IdempotencyKey. The new fields (like Amount, TransactionID) provide the necessary data schema to map provider-specific payloads (such as M-Pesa's STK push) to the unified Gateway interface.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation

Related issue

Closes #61

Details

  • PurchaseRequest & AuthorizeRequest: Added Amount, Currency, Phone, Description, CallbackURL, and Metadata fields.
  • CaptureRequest & RefundRequest: Added TransactionID and Amount fields to reference the original transaction and support partial capture/refunds.
  • VoidRequest & StatusRequest: Added TransactionID field.
  • Documentation: Added Godoc comments to all exported structs explaining their specific purpose in the payment lifecycle.

Testing

  • Ran mise run ci locally. Verified that the code compiles, golangci-lint passes without warnings, and all existing tests pass (go test ./...).

Checklist

  • Tests added or updated
  • Documentation updated
  • go test ./... passes
  • Breaking changes documented

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.

Add missing fields to PurchaseRequest (and align other request types) per plan.md's appendix

1 participant