Repository navigation
feat: add Smart Transfers (preauthorizations, payments, balance and data consent) - #113
Merged
Merged
Conversation
…ata consent)
Add the /smart-transfers endpoints to PluggyApiService:
- POST /smart-transfers/preauthorizations (with optional linkedJourney)
- GET /smart-transfers/preauthorizations (paginated) and /{id}
- GET /smart-transfers/preauthorizations/{id}/balance (balance and overdraft)
- DELETE /smart-transfers/preauthorizations/{id}/data-consent
- GET /smart-transfers/preauthorizations/{id}/payments (paginated, from/to)
- POST /smart-transfers/payments and GET /smart-transfers/payments/{id}
The preauthorization exposes dataConsent (status, rejectionReason,
updatedAt), null when the balance permission was not requested.
EncryptedParametersInterceptor now encrypts only POST/PATCH /items bodies
that carry parameters. Before, it also encrypted the payer's parameters on
Smart Transfer preauthorizations, which the API expects as plain JSON, and
threw a NullPointerException on item requests without parameters (MFA).
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.
What
Smart Transfers, the SDK's first payments surface. It covers all 7
/smart-transferspaths of the API spec.1. Preauthorizations
createSmartTransferPreauthorization(CreateSmartTransferPreauthorizationRequest):connectorId,parameters,recipientIds, and the optionalcallbackUrls,clientPreauthorizationId,configurationandlinkedJourney.linkedJourney: truealso asks the user, in the same approval, for permission to read the source account balance.getSmartTransferPreauthorizations(...), paginated, andgetSmartTransferPreauthorization(id).SmartTransferPreauthorization.dataConsent:status(AWAITING_AUTHORISATION,AUTHORISED,REJECTED),rejectionReasonandupdatedAt. It is null when the permission was not requested.2. Source account balance and data consent
getSmartTransferPreauthorizationBalance(id)→GET /smart-transfers/preauthorizations/{id}/balance. Returnsbalanceandoverdraft(contracted,used,available), in BRL.overdraftis null when the institution does not share it.cancelSmartTransferPreauthorizationDataConsent(id)→DELETE /smart-transfers/preauthorizations/{id}/data-consent. Cancels only the permission and returns the preauthorization, which stays active.3. Payments
createSmartTransferPayment(CreateSmartTransferPaymentRequest),getSmartTransferPayment(id), andgetSmartTransferPreauthorizationPayments(id, ...), paginated withfrom/to.Important
EncryptedParametersInterceptorfix. WithrsaPublicKey(...)set, the interceptor encrypted theparametersfield of any POST/PATCH body. That would have sent the Smart Transfer preauthorization'sparametersencrypted, while the API only decrypts them on/items. It also threw aNullPointerExceptionon item requests withoutparameters, such as MFA. It now encrypts only POST/PATCH/itemsbodies that carryparameters.Types follow the rest of the SDK: amounts are
Double, dates areDate, and statuses are enums.rejectionReasonanderrorDetail.codestayString, since new values can appear.Release
pom.xmlgoes to 1.16.0, a minor bump for afeat. Merging tagsv1.16.0and cuts the GitHub Release. Publishing to GitHub Packages is still manual:gh workflow run maven-publish.yml -f tag_version=v1.16.0.CLAUDE.mdnow says the bump belongs in the PR that ships the change.Tests
SmartTransfersTest(20, MockWebServer):dataConsentpresent and null;overdraftpresent and null;linkedJourneyserialized only when set.EncryptedParametersInterceptorTest(3): Smart Transferparameterssent as plain JSON, MFA withoutparameters, items still encrypted. They fail against the old condition.mvn -B package: 62/62.