Skip to content

Commit

Permalink
feat(payment): PAYPAL-2476 added TS interface for updateOrder method …
Browse files Browse the repository at this point in the history
…in PPCP request sender (#2033)
  • Loading branch information
bc-dronov authored Jul 10, 2023
1 parent d084acf commit 10c2e8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
PayPalOrderData,
PayPalOrderStatusData,
PayPalUpdateOrderRequestBody,
PayPalUpdateOrderResponse,
} from './paypal-commerce-types';

export default class PayPalCommerceRequestSender {
Expand All @@ -33,8 +34,9 @@ export default class PayPalCommerceRequestSender {
return res.body;
}

// TODO: add response type interface Promise<something> in another task
async updateOrder(requestBody: PayPalUpdateOrderRequestBody) {
async updateOrder(
requestBody: PayPalUpdateOrderRequestBody,
): Promise<PayPalUpdateOrderResponse> {
const url = `/api/storefront/initialization/paypalcommerce`;
const body = requestBody;
const headers = {
Expand All @@ -43,7 +45,7 @@ export default class PayPalCommerceRequestSender {
...SDK_VERSION_HEADERS,
};

const res = await this.requestSender.put(url, { headers, body });
const res = await this.requestSender.put<PayPalUpdateOrderResponse>(url, { headers, body });

return res.body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ export interface PayPalUpdateOrderRequestBody {
selectedShippingOption?: ShippingOption;
}

export interface PayPalUpdateOrderResponse {
statusCode: number;
}

export interface PayPalCreateOrderRequestBody extends HostedInstrument, VaultedInstrument {
cartId: string;
}
Expand Down

0 comments on commit 10c2e8f

Please sign in to comment.