Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ logs/
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
!.yarn/versions
example.swagger.json
10 changes: 6 additions & 4 deletions src/TapsilatSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
OrderSubmerchant,
APIResponse,
OrderAccountingRequest,
OrderAccountingResponse,
OrderPostAuthRequest,
AddBasketItemRequest,
RemoveBasketItemRequest,
Expand Down Expand Up @@ -356,13 +357,14 @@ export class TapsilatSDK {
* @description Handles accounting operations for a specific order using its reference ID.
*
* @param {OrderAccountingRequest} request - Accounting request details
* @returns {Promise<APIResponse<unknown>>} Promise resolving to the accounting response
* @returns {Promise<OrderAccountingResponse>} Promise resolving to the accounting response
* @throws {TapsilatValidationError} When input validation fails
* @throws {TapsilatError} When API returns an error response
*/
async orderAccounting(
request: OrderAccountingRequest
): Promise<APIResponse<unknown>> {
): Promise<OrderAccountingResponse> {

Comment on lines 392 to +400
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orderAccounting() return type changed from Promise<APIResponse<unknown>> to Promise<OrderAccountingResponse>, which is a breaking change for callers that previously relied on the wrapper shape. If this SDK follows semver, this should be called out in changelog/release notes (or consider returning APIResponse<OrderAccountingResponse> if the intent is to preserve the wrapper).

Copilot uses AI. Check for mistakes.
if (!isNonEmptyString(request.order_reference_id)) {
throw new TapsilatValidationError(
"Order reference ID is required and must be a non-empty string",
Expand All @@ -371,11 +373,11 @@ export class TapsilatSDK {
}

try {
const response = await this.httpClient.post<APIResponse<unknown>>(
const orderAccountingResponse = await this.httpClient.post<OrderAccountingResponse>(
"/order/accounting",
request
);
return handleResponse(response, "Order accounting");
return handleResponse(orderAccountingResponse, "Order accounting");
} catch (error) {
return handleError(error, "order accounting");
}
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/TapsilatSDK.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ describe("TapsilatSDK", () => {

const mockResponse = {
success: true,
data: { success: true },
data: { code: 200, message: "OK" },
};

mockHttpClient.post.mockResolvedValueOnce(mockResponse);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export type {
SubscriptionRedirectResponse,
OrganizationSettings,
OrderAccountingRequest,
OrderAccountingResponse,
OrderPostAuthRequest,
AddBasketItemRequest,
RemoveBasketItemRequest,
Expand Down
48 changes: 46 additions & 2 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export interface Address {
*/
export interface BillingAddress extends Address {
billing_type: "PERSONAL" | "CORPORATE";
citizenship?: string;
neighbourhood?: string;
street1?: string;
street2?: string;
street3?: string;
vat_number?: string;
tax_office?: string;
title?: string;
Expand All @@ -170,12 +175,20 @@ export interface BasketItem {
name?: string;
category1?: string;
category2?: string;
commission_amount?: number;
coupon?: string;
mcc?: string;
item_type?: string;
paid_amount?: number;
payer?: BasketItemPayerDTO;
price?: number;
quantity?: number;
quantity_float?: number;
coupon_discount?: number;
data?: string;
quantity_unit?: string;
sub_merchant_key?: string;
sub_merchant_price?: string;
}

/**
Expand Down Expand Up @@ -337,12 +350,14 @@ export interface Buyer {
id?: string;
name: string;
surname: string;
birth_date?: string;
email: string;
gsm_number?: string;
identity_number?: string;
registration_address?: string;
city?: string;
country?: string;
title?: string;
zip_code?: string;
ip?: string;
registration_date?: string;
Expand All @@ -369,20 +384,30 @@ export interface OrderCreateRequest {
locale: Locale;
three_d_force?: boolean;
currency: Currency;
shipping_address?: Address;
checkout_design?: CheckoutDesignDTO;
shipping_address?: ShippingAddressDTO;
basket_items?: BasketItem[];
billing_address?: BillingAddress;
Comment on lines 390 to 394
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrderCreateRequest.shipping_address changed from Address to ShippingAddressDTO. This is a breaking typing change for SDK consumers and also narrows/remodels the allowed fields (e.g., district/contact_phone no longer allowed, while tracking_code/shipping_date become allowed). If backward compatibility matters, consider using a union (Address | ShippingAddressDTO) or introducing a dedicated request type that matches what the API accepts and deprecating the old shape.

Copilot uses AI. Check for mistakes.
buyer: Buyer;
consents?: OrderConsent[];
conversation_id?: string;
external_reference_id?: string;
order_cards?: OrderCardDTO[];
paid_amount?: number;
partial_payment?: boolean;
payment_mode?: string;
payment_methods?: boolean;
payment_options?: PaymentOption[];
payment_success_url?: string;
payment_failure_url?: string;
payment_terms?: PaymentTermDTO[];
pf_sub_merchant?: OrderPFSubMerchantDTO;
redirect_failure_url?: string;
redirect_success_url?: string;
enabled_installments?: number[];
metadata?: OrderMetadata[];
sub_organization?: SubOrganizationDTO;
submerchants?: SubmerchantDTO[];
}

// ORDER CREATE RESPONSE
Expand Down Expand Up @@ -540,6 +565,7 @@ export interface BasketItemDTO {
data?: string;
id?: string;
item_type?: string;
mcc?: string;
name?: string;
paid_amount?: number;
payer?: BasketItemPayerDTO;
Expand All @@ -566,6 +592,10 @@ export interface BillingAddressDTO {
contact_phone?: string;
country?: string;
district?: string;
neighbourhood?: string;
street1?: string;
street2?: string;
street3?: string;
tax_office?: string;
title?: string;
vat_number?: string;
Expand Down Expand Up @@ -734,15 +764,18 @@ export interface OrderCreateDTO {
enabled_installments?: number[];
external_reference_id?: string;
metadata?: MetadataDTO[];
order_cards?: OrderCardDTO;
order_cards?: OrderCardDTO[];
paid_amount?: number;
partial_payment?: boolean;
payment_failure_url?: string;
payment_mode?: string;
payment_methods?: boolean;
payment_options?: string[];
payment_success_url?: string;
payment_terms?: PaymentTermDTO[];
pf_sub_merchant?: OrderPFSubMerchantDTO;
redirect_failure_url?: string;
redirect_success_url?: string;
shipping_address?: ShippingAddressDTO;
sub_organization?: SubOrganizationDTO;
submerchants?: SubmerchantDTO[];
Expand Down Expand Up @@ -1063,6 +1096,17 @@ export interface OrderAccountingRequest {
order_reference_id: string;
}

/**
* @category Order Management
* @summary Response for order accounting
* @description API response payload returned after order accounting operation
* @interface OrderAccountingResponse
*/
export interface OrderAccountingResponse {
code?: number;
message?: string;
}

/**
* @category Order Management
* @summary Request to add an item to the basket
Expand Down