import {
  afterEach,
  describe,
  globalExpect,
  init_dist,
  it
} from "../../chunk-GCCHFONX.mjs";
import {
  Blindpay,
  init_client
} from "../../chunk-ES7RXEM7.mjs";
import "../../chunk-GEDDLCJY.mjs";
import "../../chunk-LK3JPQ6I.mjs";
import "../../chunk-CNNEROQ7.mjs";
import "../../chunk-GNDAATIJ.mjs";
import "../../chunk-VKN2AMCW.mjs";
import "../../chunk-LUDGZPXY.mjs";
import "../../chunk-3CZJEDS5.mjs";
import "../../chunk-UCAW3RTZ.mjs";
import "../../chunk-M6IYYMRW.mjs";
import "../../chunk-HKFAJXJG.mjs";
import "../../chunk-QVOSGLUO.mjs";
import "../../chunk-2DAKB5XK.mjs";
import "../../chunk-QHMIK7U3.mjs";
import "../../chunk-LLWEHHKB.mjs";
import {
  __async,
  __commonJS
} from "../../chunk-OBKEW4AQ.mjs";

// src/resources/payins/payins-quotes.test.ts
var require_payins_quotes_test = __commonJS({
  "src/resources/payins/payins-quotes.test.ts"(exports) {
    init_dist();
    init_client();
    describe("Payin quotes", () => {
      afterEach(() => fetchMock.resetMocks());
      const blindpay = new Blindpay("test-key");
      describe("Create payin quote", () => {
        it("should create a payin quote", () => __async(null, null, function* () {
          const mockedPayinQuote = {
            id: "qu_000000000000",
            expires_at: 1712958191,
            commercial_quotation: 495,
            blindpay_quotation: 505,
            receiver_amount: 1010,
            sender_amount: 5240,
            partner_fee_amount: 150,
            flat_fee: 50
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedPayinQuote), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.payins.quotes.create({
            instanceId: "in_000000000000",
            blockchain_wallet_id: "bw_000000000000",
            currency_type: "sender",
            cover_fees: true,
            request_amount: 1e3,
            payment_method: "pix",
            token: "USDC",
            partner_fee_id: "pf_000000000000",
            payer_rules: {
              pix_allowed_tax_ids: ["149.476.037-68"]
            }
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedPayinQuote);
        }));
      });
      describe("Get FX rate", () => {
        it("should get the FX rate", () => __async(null, null, function* () {
          const mockedFxRate = {
            commercial_quotation: 495,
            blindpay_quotation: 505,
            result_amount: 1,
            instance_flat_fee: 50,
            instance_percentage_fee: 0
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedFxRate), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.payins.quotes.getFxRate({
            instanceId: "in_000000000000",
            currency_type: "sender",
            from: "USD",
            to: "BRL",
            request_amount: 1e3
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedFxRate);
        }));
      });
    });
  }
});
export default require_payins_quotes_test();
