/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */

import type { CancelablePromise } from "../core/CancelablePromise";
import { OpenAPI } from "../core/OpenAPI";
import { request as __request } from "../core/request";
export class OrderCallbackService {
  /**
   * Handle card payment callback
   * @param orderTransactionId
   * @param requestBody
   * @returns any
   * @throws ApiError
   */
  public static orderCallbackControllerHandleCardPaymentCallback(
    orderTransactionId: string,
    requestBody: {
      orderId?: string;
      uniqueId?: string;
      isPaid?: boolean;
      providerResponse?: {
        amount?: number;
        billing?: {
          address?: {
            city?: string;
            country?: string;
            postcodeZip?: string;
            stateProvince?: string;
            street?: string;
          };
        };
        customer?: {
          email?: string;
          firstName?: string;
          lastName?: string;
          mobilePhone?: string;
        };
      };
    },
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/order-webhooks/card",
      query: {
        orderTransactionId: orderTransactionId,
      },
      body: requestBody,
      mediaType: "application/json",
    });
  }
  /**
   * @param requestBody
   * @returns any
   * @throws ApiError
   */
  public static orderCallbackControllerCheckOrderStatus(requestBody: {
    orderId?: string;
  }): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/order-webhooks/check-status",
      body: requestBody,
      mediaType: "application/json",
    });
  }

  /**
   * NOWPayments IPN (server-to-server). Requires valid x-nowpayments-sig.
   * @param xNowpaymentsSig HMAC-SHA512 hex of sorted JSON body
   */
  public static orderCallbackControllerHandleNowpaymentsIpn(
    requestBody: Record<string, unknown>,
    xNowpaymentsSig: string,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/order-webhooks/nowpayments",
      body: requestBody,
      mediaType: "application/json",
      headers: {
        "x-nowpayments-sig": xNowpaymentsSig,
      },
    });
  }
}
