Skip to content

Commit

Permalink
feat: Add method to delete payment link
Browse files Browse the repository at this point in the history
  • Loading branch information
peoray committed Jan 29, 2024
1 parent 0c726fc commit d4bdf9e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ export class HTTPCore {
* @param {AxiosRequestConfig} [config] - The Axios request configuration.
* @returns {Promise<T>} - The response data.
*/
public async delete<T>(url: string, config?: AxiosRequestConfig): Promise<T> {
public async delete<T>(
url: string,
// data?: any,
config?: AxiosRequestConfig
): Promise<T> {
return this.handleRequest<T>(this.request.delete(url, config))
}
}
8 changes: 8 additions & 0 deletions src/services/payment-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
IPaymentLinkResponse,
IGetPaymentLinksResponse,
IEditPaymentLinkRequest,
IDeletePaymentLinksResponse,
IDeletePaymentLinksRequest,
} from '../types'

/**
Expand Down Expand Up @@ -41,4 +43,10 @@ export class PaymentLinks extends HTTPCore {
): Promise<IPaymentLinkResponse> {
return this.put<IPaymentLinkResponse>(`/paymentlinks/${linkId}`, data)
}

public async deletePaymentLink(
data: IDeletePaymentLinksRequest
): Promise<IDeletePaymentLinksResponse> {
return this.delete<IDeletePaymentLinksResponse>(`/paymentlinks`, { data })
}
}
9 changes: 9 additions & 0 deletions src/types/payment-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ export interface IEditPaymentLinkRequest {
name: string
description: string
}

export interface IDeletePaymentLinksRequest {
ids: string[]
}

export interface IDeletePaymentLinksResponse {
success: boolean
message: string
}

0 comments on commit d4bdf9e

Please sign in to comment.