Skip to content

refactor: enhance type safety and add OrderAccountingResponse interface#13

Open
TarikSogukpinar wants to merge 9 commits into
mainfrom
refactor/missing-types
Open

refactor: enhance type safety and add OrderAccountingResponse interface#13
TarikSogukpinar wants to merge 9 commits into
mainfrom
refactor/missing-types

Conversation

@TarikSogukpinar
Copy link
Copy Markdown
Contributor

No description provided.

@TarikSogukpinar TarikSogukpinar self-assigned this Apr 8, 2026
Copilot AI review requested due to automatic review settings April 8, 2026 18:17
@TarikSogukpinar TarikSogukpinar added the enhancement New feature or request label Apr 8, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors and tightens TypeScript typings around order creation/accounting, introducing an explicit OrderAccountingResponse type and expanding several existing request/DTO interfaces to better reflect the API payloads.

Changes:

  • Add OrderAccountingResponse interface and export it from the public entrypoint.
  • Update TapsilatSDK.orderAccounting() to return a typed OrderAccountingResponse (and adjust the unit test mock accordingly).
  • Expand multiple order-related types (e.g., OrderCreateRequest, BasketItem, BillingAddress, Buyer, and related DTOs) with additional optional fields.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types/index.ts Expands order-related request/DTO shapes and adds OrderAccountingResponse.
src/TapsilatSDK.ts Updates orderAccounting() typing to return OrderAccountingResponse.
src/index.ts Re-exports OrderAccountingResponse from the package entrypoint.
src/__tests__/TapsilatSDK.test.ts Updates the mocked accounting response payload to match the new response type.
.gitignore Adds example.swagger.json to ignored files (but currently with a trailing-space issue).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/types/index.ts
Comment on lines 386 to 390
currency: Currency;
shipping_address?: Address;
checkout_design?: CheckoutDesignDTO;
shipping_address?: ShippingAddressDTO;
basket_items?: BasketItem[];
billing_address?: BillingAddress;
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.
Comment thread src/TapsilatSDK.ts
Comment on lines 359 to +367
* @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> {

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants