extend models to fit linkpay additions on payment links - UOD-3819 - #759
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the v0 Payment Links model/types to include additional Linkpay-related fields and introduces a new test covering paymentLinks.getById.
Changes:
- Extended
PaymentLinkDtoandPaymentLinkQuerywith additional fields (e.g.solutionType,multiUse,expiresAt,alias,orderCount,deleted, etc.). - Changed
PaymentLinks.getByIdto return a new “detail envelope” type instead of a singlePaymentLinkDto. - Added a new Jest test for fetching a payment link by id (success + non-200 failure case).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/payment_links/get-by-id.test.ts | Adds coverage for paymentLinks.getById success and error handling. |
| src/v0/payment_links.ts | Extends payment-link DTO/query types and modifies getById return typing/shape. |
Suppressed comments (2)
src/v0/payment_links.ts:332
getByIdnow returns the raw API envelope ({ msg, count, results }) which is a breaking change from the previousPromise<PaymentLinkDto>signature and is inconsistent with other v0 “get one” handlers that return the first result asdata(e.g.src/v0/payment_options.ts:137-150). A safer approach is to keep returning a singlePaymentLinkDtoand extract it fromresponse.data.results[0].
This issue also appears on line 339 of the same file.
async getById (id: string): Promise<PaymentLinkDetailResponse> {
try {
const base = this.uriHelper.generateBaseUri()
const uri = `${base}/${id}`
const response = await this.http.getClient().get(uri)
src/v0/payment_links.ts:341
- The catch block re-wraps
PaymentLinksGetByIdFailedinstances, which can drop useful context like the originalstatus(thrown above) and changes the stack. Several other handlers rethrow the original error when it’s already the right type (e.g.src/v0/integration_partners.ts:111-114).
} catch (error: any) {
throw new PaymentLinksGetByIdFailed(error.message, { error })
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/v0/payment_links.ts:334
getByIdcurrently returns the raw API envelope ({ msg, count, results }) asPaymentLinkDetailResponse. This is inconsistent with the rest of this handler (which typically unwrapsresults[0]for single-entity endpoints) and causes the new test to mock an envelope but assert a singlePaymentLinkDto. Consider returning the first result (and falling back toresponse.datafor backward compatibility) and keep the method return type asPaymentLinkDto.
async getById (id: string): Promise<PaymentLinkDetailResponse> {
try {
const base = this.uriHelper.generateBaseUri()
const uri = `${base}/${id}`
const response = await this.http.getClient().get(uri)
test/payment_links/get-by-id.test.ts:42
- The test name says it "returns the extended detail envelope", but the assertion expects a single payment-link object. Either the name or the assertion should be updated so the test intent matches what is being validated.
it('returns the extended detail envelope', async () => {
src/v0/payment_links.ts:16
PaymentLinkStatuspreviously included values like'open'/'closed'. Removing them is a breaking type change for SDK consumers (even if the backend no longer emits them). If backward compatibility is desired, keep the previous literals and add the new ones.
declare type PaymentLinkStatus = 'sent' | 'paid' | 'expired' | 'authorized' | 'cancelled' | 'refunded' | 'failed'
btech222
approved these changes
Aug 18, 2026
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.