import { Component, Element, Event, Listen, Method, Prop, State, Watch, h, Build, } from "@stencil/core";
export class Epay {
  constructor() {
    this.slideIndex = [
      "summary",
      "payment",
      "card",
      "check",
      "confirmation",
      "success",
    ];
    this.userPrefersDark = window &&
      window.matchMedia &&
      window.matchMedia("(prefers-color-scheme: dark)").matches
      ? true
      : false;
    /**
     * The amount of money owed
     */
    this.owed = 0;
    /**
     * The total amount of money billed
     */
    this.total = 0;
    /**
     * The list of payments
     */
    this.payments = [];
    this.customer = {};
    this.users = [];
    this.paymentMethod = "card";
    this.disableFetch = false;
    this.isSlidesHidding = false;
    this.isBackShowing = false;
    this.isHeaderHidden = false;
    this.loading = false;
  }
  async onSuccess(event) {
    var _a, _b, _c, _d;
    if (event.detail.endpoint === "findJob") {
      this.job = (_b = (_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.job;
      this.customer = ((_c = this.job) === null || _c === void 0 ? void 0 : _c.customer) || {};
      this.email = ((_d = this.job.customer) === null || _d === void 0 ? void 0 : _d.email) || null;
      this.owed = this.job.amountOwed || 0;
      this.total = this.job.amountBilled || 0;
      this.amount = this.owed;
      setTimeout(async () => {
        await this.sliderEl.updateAutoHeight();
      }, 1000);
    }
    else if (event.detail.endpoint === "addPayment") {
      this.fetchData();
      this.reset();
    }
  }
  async onSubmit() {
    if (this.paymentMethod === "check") {
      await this.payWithCheck();
    }
    else {
      await this.payWithCard();
    }
  }
  onReset() {
    this.goBack();
  }
  onCheckScan(event) {
    if (!event || !event.detail || !event.detail.front) {
      return false;
    }
    this.checkFront = event.detail.front;
    this.checkBack = event.detail.back;
  }
  onInput(event) {
    var _a;
    if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.name) === "amount") {
      this.amount = event.target.value ? parseFloat(event.target.value) : null;
    }
    else if (event.target.name === "email") {
      this.email = event.target.value;
    }
    else if (event.target.name === "paymentMethod") {
      this.paymentMethod = event.target.value;
    }
    else if (event.target.name === "paymentType") {
      this.paymentType = event.target.value;
    }
  }
  onFtToggle(event) {
    var _a;
    if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.name) === "projected") {
      console.log(event);
    }
  }
  async onSubmitCard(_event) {
    await this.goToConfirmation(event);
  }
  async goToConfirmation(event) {
    this.paymentPayload = event && event.detail ? event.detail : null;
    this.isHeaderHidden = true;
    await this.sliderEl.slideTo(4);
    this.paymentEvent = event;
  }
  async approve() {
    if (this.paymentMethod === "check") {
      try {
        await this.confirmPayment(this.errorCode === 2006
          ? {
            ignore_check_amount_mismatch: true,
          }
          : {});
        this.submitPayment(this.paymentMethod, this.paymentEvent);
      }
      catch (error) {
        console.log("Error taking check payment", error);
      }
    }
    else {
      this.submitPayment(this.paymentMethod, this.paymentEvent);
    }
  }
  submitPayment(type, event) {
    let data = {};
    if (type === "card") {
      data = {
        token: event.detail.token.id,
        amount: this.amount,
        email: this.email,
      };
    }
    else if (type === "check") {
      data = {
        transactionId: event.id ? event.id : null,
        checkNumber: event.check_number ? event.check_number : null,
        amount: this.amount,
        email: this.email,
      };
    }
    else if (type === "manual") {
      data = {
        amount: this.amount,
        email: this.email,
      };
    }
    this.fireenjinSubmit.emit({
      endpoint: "addPayment",
      data: {
        ...data,
        jobId: this.jobId,
        userId: this.userId,
        type,
      },
    });
  }
  onCardError() {
    setTimeout(() => {
      this.updateSlides();
    }, 1000);
  }
  async onSlideChange(event) {
    console.log(event);
    if (!this.sliderEl)
      return;
    await this.setSlide(this.sliderEl.querySelectorAll("ion-slide")[await this.sliderEl.getActiveIndex()].id);
  }
  onCheckError(event) {
    if (!event ||
      !event.detail ||
      !event.detail.error ||
      !event.detail.error.errors ||
      !event.detail.error.errors[0]) {
      return false;
    }
    if (event.detail.error.errors[0].error_code === 2006) {
      this.errorCode = 2006;
      this.error = `The amount you typed doesn't match what the scanner saw (${this.formatUSD(event.detail.error.errors[0].error_data.read_amount)}). Are you sure you wish to proceed?`;
    }
    else {
      this.error = event.detail.error.errors[0].error_message;
    }
    setTimeout(() => {
      this.updateSlides();
    }, 2000);
  }
  async onSubmitCheck(event) {
    this.goToConfirmation(event);
  }
  /**
   * Update the ion-slides height
   */
  async updateSlides() {
    this.sliderEl.updateAutoHeight();
    return this.sliderEl.update();
  }
  async success() {
    await this.sliderEl.slideTo(5);
    this.isBackShowing = false;
    this.checkmarkEl.animating = true;
    setTimeout(async () => {
      await this.reset();
    }, 5000);
  }
  async reset() {
    this.error = null;
    this.paymentPayload = null;
    this.sliderEl.slideTo(0);
    this.amount = 0;
    this.isBackShowing = false;
    this.isHeaderHidden = false;
    this.paymentMethod = null;
    this.paymentEvent = null;
    this.setSubText();
    await this.sliderEl.update();
  }
  /**
   * Confirm a check payment
   */
  async confirmPayment(options = {}) {
    return this.payCheckEl.confirmPayment(options);
  }
  onOwedChange() {
    this.setSubText();
  }
  onTotalChange() {
    this.setSubText();
  }
  componentDidLoad() {
    if (!(Build === null || Build === void 0 ? void 0 : Build.isBrowser))
      return;
    this.setSubText();
    if (this.showSlide) {
      this.setSlide(this.showSlide);
    }
    if (!this.disableFetch) {
      this.fetchData();
    }
  }
  async fetchData() {
    if (this.jobId) {
      this.fireenjinFetch.emit({
        endpoint: "findJob",
        params: {
          id: this.jobId,
          withPayments: true,
          withEfiles: false,
          withUsers: false,
          withSites: false,
          withPayModel: false,
          withPhotos: false,
          withPayables: false,
          withReadings: false,
        },
      });
    }
  }
  async setSlide(name) {
    if (["confirmation", "card", "check", "success"].indexOf(name) >= 0) {
      this.isBackShowing = true;
    }
    else if (name === "confirmation" || name === "success") {
      this.isHeaderHidden = true;
      if (name === "success") {
        await this.success();
      }
    }
    else if (name === "payments") {
      this.isBackShowing = false;
    }
  }
  formatUSD(amount) {
    const formatter = new Intl.NumberFormat("en-US", {
      style: "currency",
      currency: "USD",
    });
    return formatter.format(amount);
  }
  setSubText() {
    this.amount = parseFloat(this.owed) || 0;
    this.subText = `${this.calculatePercentPaid()}% paid of ${this.formatUSD(parseFloat(this.total) || 0)} bill`;
  }
  calculatePercentPaid() {
    const decimal = Math.round((this.owed / this.total) * 100);
    const percent = 100 - decimal;
    return typeof percent === "number" && percent !== Infinity && percent > 0
      ? percent
      : 0;
  }
  async takePayment() {
    if (this.isBackShowing)
      return;
    this.isBackShowing = true;
    this.sliderEl.slideNext();
  }
  payWithCard() {
    if (!this.amount ||
      this.amount <= 0 ||
      !this.email ||
      this.email.indexOf("@") === -1) {
      alert("Billee email address and amount being paid are required!");
      return false;
    }
    this.paymentMethod = "card";
    this.subText = `Paying ${this.formatUSD(this.amount)} by card...`;
    this.sliderEl.slideTo(2);
  }
  payWithCheck() {
    if (!this.amount ||
      this.amount <= 0 ||
      !this.email ||
      this.email.indexOf("@") === -1) {
      alert("Billee email address and amount being paid are required!");
      return false;
    }
    this.paymentMethod = "check";
    this.subText = `Paying ${this.formatUSD(this.amount)} by check...`;
    this.sliderEl.slideTo(3);
  }
  payManually() {
    if (!this.amount ||
      this.amount <= 5 ||
      !this.email ||
      this.email.indexOf("@") === -1) {
      alert("Billee email address and amount greater than $5.00 being paid are required!");
      return false;
    }
    this.paymentMethod = "manual";
    this.goToConfirmation(null);
  }
  async goBack() {
    this.loading = false;
    this.error = null;
    const currentSlideIndex = await this.sliderEl.getActiveIndex();
    if (currentSlideIndex === 4) {
      if (this.paymentMethod === "card") {
        await this.sliderEl.slideTo(2);
      }
      else if (this.paymentMethod === "check") {
        await this.sliderEl.slideTo(3);
      }
      else if (this.paymentMethod === "manual") {
        await this.sliderEl.slideTo(1);
      }
    }
    else {
      this.paymentMethod === "check"
        ? await this.sliderEl.slideTo(1)
        : await this.sliderEl.slidePrev();
    }
    this.paymentMethod = null;
    if (currentSlideIndex === 0) {
      this.reset();
    }
    this.isHeaderHidden = false;
  }
  capitalize(s) {
    if (typeof s !== "string")
      return "";
    return s.charAt(0).toUpperCase() + s.slice(1);
  }
  getPaymentTypeCofirmation() {
    if (this.paymentMethod === "card") {
      return `<h4>${this.capitalize(this.paymentPayload &&
        this.paymentPayload.token &&
        this.paymentPayload.token.card &&
        this.paymentPayload.token.card
        ? this.paymentPayload.token.card.brand
        : "")} ${this.paymentPayload &&
        this.paymentPayload.token &&
        this.paymentPayload.token.card &&
        this.paymentPayload.token.card
        ? this.paymentPayload.token.card.funding
        : ""} ending in ${this.paymentPayload &&
        this.paymentPayload.token &&
        this.paymentPayload.token.card &&
        this.paymentPayload.token.card
        ? this.paymentPayload.token.card.last4
        : ""}</h4>`;
    }
    else if (this.paymentMethod === "check") {
      return `<ion-grid><ion-row><ion-col size="6"><img src="${this.checkFront}" style="border-radius: 20px; width:100%; display: block; max-width: 300px;" /></ion-col><ion-col size="6"><img src="${this.checkBack}" style="border-radius: 20px; width:100%; display: block; max-width: 300px;" /></ion-col></ion-row></ion-grid>`;
    }
    else if (this.paymentMethod === "manual") {
      return "<h4>This should be avoided!</h4>";
    }
  }
  getPaymentText(payment) {
    let paymentText = "";
    const paidOn = new Date(payment.createdAt).toLocaleString().split(",")[0];
    if (payment.type === "manual") {
      paymentText = `${this.formatUSD(payment.amount)} manually on ${paidOn}`;
    }
    else if (payment.type === "card") {
      paymentText = `${this.formatUSD(payment.amount)} on ${payment.brand ? payment.brand : ""} card ending in ${payment.ending_in ? payment.ending_in : ""} on ${paidOn}`;
    }
    else if (payment.type === "check") {
      paymentText = `${this.formatUSD(payment.amount)} by check ${payment.check_number ? payment.check_number : ""} on ${paidOn}`;
    }
    return paymentText;
  }
  render() {
    var _a, _b, _c, _d;
    return (h("ion-card", null,
      h("div", { class: {
          owed: true,
          hidden: this.isHeaderHidden,
        } },
        h("span", null,
          this.formatUSD(this.owed),
          h("small", null, " owed")),
        h("p", null, this.subText)),
      h("ion-slides", { ref: (el) => (this.sliderEl = el), options: {
          autoHeight: true,
          allowTouchMove: false,
          simulateTouch: false,
          autoplay: false,
        }, class: { "hide-slides": this.isSlidesHidding } },
        h("ion-slide", { id: "payments" },
          h("ion-grid", null,
            h("ion-row", null,
              h("ion-col", null,
                h("div", { class: "past" },
                  h("h2", null, "Past Payments"),
                  ((_b = (_a = this === null || this === void 0 ? void 0 : this.job) === null || _a === void 0 ? void 0 : _a.payments) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (this.job.payments.map((payment) => {
                    var _a, _b;
                    return (h("ion-item", { lines: "none" },
                      h("ion-label", { class: "ion-text-wrap" },
                        h("h4", null,
                          ((_a = payment.user) === null || _a === void 0 ? void 0 : _a.firstName)
                            ? payment.user.firstName
                            : "",
                          " ",
                          ((_b = payment.user) === null || _b === void 0 ? void 0 : _b.lastName)
                            ? payment.user.lastName
                            : ""),
                        h("p", { style: {
                            color: payment.type === "manual"
                              ? "var(--ion-color-danger)"
                              : "var(--ion-color-success)",
                          } }, this.getPaymentText(payment)))));
                  })) : (h("floodteam-fallback", { icon: "logo-usd", message: "No payments received yet..." }))),
                h("ion-button", { onClick: () => this.takePayment() }, "Pay Now"))))),
        h("ion-slide", { id: "details" },
          h("fireenjin-form", { id: "invoice", name: "invoice", class: "ion-padding", resetButton: "Back", resetButtonColor: "medium", submitButton: "Next", disableReset: true, disableLoader: true },
            h("fireenjin-input-amount", { name: "amount", labelPosition: "stacked", label: "Amount on Invoice", value: this.amount }),
            h("fireenjin-input", { name: "email", labelPosition: "stacked", type: "email", label: "Invoice Email", value: this.email }),
            h("fireenjin-select", { lines: "full", labelPosition: "stacked", name: "paymentType", label: "Payment Type", value: null, options: [
                { label: "Self", value: null },
                { label: "Insurance", value: "insurance" },
                { label: "Code Blue", value: "codeblue" },
              ] }),
            h("fireenjin-select", { lines: "full", labelPosition: "stacked", name: "paymentMethod", label: "Payment Method", value: "card", options: [
                { label: "Check", value: "check" },
                { label: "Card", value: "card" },
                { label: "ACH", value: "ach" },
              ] }),
            h("fireenjin-toggle", { lines: "full", name: "send", value: true, label: "Send Invoice", color: "secondary" }))),
        h("ion-slide", { id: "card" },
          h("floodteam-pay-card", { stripeKey: this.stripeKey, stripeStyle: {
              base: {
                color: this.userPrefersDark ? "#FFFFFF" : "#000000",
                iconSize: "30px",
                iconColor: "#999999",
                lineHeight: "20px",
                fontFamily: '"Work Sans", sans-serif',
                fontSmoothing: "antialiased",
                fontSize: "18px",
                "::placeholder": {
                  color: "#999999",
                  iconColor: "#999999",
                  fontWeight: "normal",
                },
              },
              invalid: {
                color: "#ee6274",
                iconColor: "#ee6274",
              },
            } })),
        h("ion-slide", { id: "check" },
          h("floodteam-pay-check", { loading: this.loading, ref: (el) => (this.payCheckEl = el), apiKey: this.dadeKey, url: this.dadeUrl, amount: this.amount })),
        h("ion-slide", { id: "confirmation" },
          h("ion-grid", null,
            h("ion-row", null,
              h("ion-col", null,
                h("p", { class: "confirm-title" }, "Confirm Payment of"),
                h("h1", null, this.formatUSD(this.amount)),
                this.error && h("floodteam-error", { message: this.error }),
                h("ion-list", null,
                  h("ion-item", null,
                    h("ion-icon", { slot: "start", name: "person" }),
                    h("div", null,
                      h("p", null, "From"),
                      h("h4", null,
                        ((_c = this.customer) === null || _c === void 0 ? void 0 : _c.firstName)
                          ? this.customer.firstName
                          : "Customer",
                        " ",
                        ((_d = this.customer) === null || _d === void 0 ? void 0 : _d.lastName)
                          ? this.customer.lastName
                          : "Name"))),
                  h("ion-item", null,
                    h("ion-icon", { slot: "start", name: "mail" }),
                    h("div", null,
                      h("p", null, "Send receipt to"),
                      h("h4", null, this.email ? this.email : "Customer Email"))),
                  h("ion-item", null,
                    h("ion-icon", { slot: "start", name: "logo-usd" }),
                    h("div", null,
                      h("p", null, this.paymentMethod === "manual"
                        ? `Paying manually`
                        : `Paying with ${this.capitalize(this.paymentMethod)}`),
                      h("div", { innerHTML: this.getPaymentTypeCofirmation() }))),
                  h("ion-grid", null,
                    h("ion-row", { class: "ion-align-items-center" },
                      h("ion-col", { size: "12", class: "ion-align-self-end" },
                        h("ion-button", { onClick: () => this.approve() }, "Approve & Finish"))))))))),
        h("ion-slide", { id: "success" },
          h("ion-grid", null,
            h("ion-row", null,
              h("ion-col", null,
                h("floodteam-checkmark", { ref: (el) => (this.checkmarkEl = el) }),
                h("p", null, "You're good to go!"))))))));
  }
  static get is() { return "floodteam-epay"; }
  static get originalStyleUrls() { return {
    "$": ["epay.css"]
  }; }
  static get styleUrls() { return {
    "$": ["epay.css"]
  }; }
  static get properties() { return {
    "error": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The error message to display"
      },
      "attribute": "error",
      "reflect": false
    },
    "owed": {
      "type": "any",
      "mutable": true,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The amount of money owed"
      },
      "attribute": "owed",
      "reflect": false,
      "defaultValue": "0"
    },
    "total": {
      "type": "any",
      "mutable": true,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The total amount of money billed"
      },
      "attribute": "total",
      "reflect": false,
      "defaultValue": "0"
    },
    "showSlide": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "| \"report\"\n    | \"details\"\n    | \"payments\"\n    | \"card\"\n    | \"check\"\n    | \"confirmation\"",
        "resolved": "\"card\" | \"check\" | \"confirmation\" | \"details\" | \"payments\" | \"report\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The slide to show when loading the component"
      },
      "attribute": "show-slide",
      "reflect": false
    },
    "payments": {
      "type": "unknown",
      "mutable": true,
      "complexType": {
        "original": "{\n    timestamp: string;\n    brand: string;\n    last4: number;\n    amount: number;\n  }[]",
        "resolved": "{ timestamp: string; brand: string; last4: number; amount: number; }[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "The list of payments"
      },
      "defaultValue": "[]"
    },
    "stripeKey": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "stripe-key",
      "reflect": false
    },
    "customer": {
      "type": "any",
      "mutable": true,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "customer",
      "reflect": false,
      "defaultValue": "{}"
    },
    "jobId": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "job-id",
      "reflect": false
    },
    "userId": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "user-id",
      "reflect": false
    },
    "dadeKey": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "dade-key",
      "reflect": false
    },
    "dadeUrl": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "dade-url",
      "reflect": false
    },
    "users": {
      "type": "unknown",
      "mutable": true,
      "complexType": {
        "original": "any[]",
        "resolved": "any[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "defaultValue": "[]"
    },
    "paymentId": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "payment-id",
      "reflect": false
    },
    "paymentMethod": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "\"card\" | \"check\" | \"manual\" | \"ach\"",
        "resolved": "\"ach\" | \"card\" | \"check\" | \"manual\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "payment-method",
      "reflect": false,
      "defaultValue": "\"card\""
    },
    "paymentType": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "\"insurance\" | \"codeblue\"",
        "resolved": "\"codeblue\" | \"insurance\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "payment-type",
      "reflect": false
    },
    "disableFetch": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "disable-fetch",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get states() { return {
    "amount": {},
    "isSlidesHidding": {},
    "isBackShowing": {},
    "isHeaderHidden": {},
    "email": {},
    "subText": {},
    "paymentPayload": {},
    "checkFront": {},
    "checkBack": {},
    "paymentEvent": {},
    "loading": {},
    "errorCode": {},
    "job": {}
  }; }
  static get events() { return [{
      "method": "ftEpayShowCommisions",
      "name": "ftEpayShowCommisions",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }, {
      "method": "fireenjinFetch",
      "name": "fireenjinFetch",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }, {
      "method": "fireenjinSubmit",
      "name": "fireenjinSubmit",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }]; }
  static get methods() { return {
    "updateSlides": {
      "complexType": {
        "signature": "() => Promise<void>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<void>"
      },
      "docs": {
        "text": "Update the ion-slides height",
        "tags": []
      }
    },
    "success": {
      "complexType": {
        "signature": "() => Promise<void>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<void>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    },
    "reset": {
      "complexType": {
        "signature": "() => Promise<void>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<void>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    },
    "confirmPayment": {
      "complexType": {
        "signature": "(options?: any) => Promise<any>",
        "parameters": [{
            "tags": [],
            "text": ""
          }],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<any>"
      },
      "docs": {
        "text": "Confirm a check payment",
        "tags": []
      }
    },
    "takePayment": {
      "complexType": {
        "signature": "() => Promise<void>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<void>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    }
  }; }
  static get elementRef() { return "epayEl"; }
  static get watchers() { return [{
      "propName": "owed",
      "methodName": "onOwedChange"
    }, {
      "propName": "total",
      "methodName": "onTotalChange"
    }]; }
  static get listeners() { return [{
      "name": "fireenjinSuccess",
      "method": "onSuccess",
      "target": "body",
      "capture": false,
      "passive": false
    }, {
      "name": "fireenjinSubmit",
      "method": "onSubmit",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "fireenjinReset",
      "method": "onReset",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftCancel",
      "method": "onReset",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftCheckScan",
      "method": "onCheckScan",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ionInput",
      "method": "onInput",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ionChange",
      "method": "onInput",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftToggle",
      "method": "onFtToggle",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftSubmitCard",
      "method": "onSubmitCard",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftCardError",
      "method": "onCardError",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ionSlideDidChange",
      "method": "onSlideChange",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftCheckError",
      "method": "onCheckError",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "ftSubmitCheck",
      "method": "onSubmitCheck",
      "target": undefined,
      "capture": false,
      "passive": false
    }]; }
}
//# sourceMappingURL=epay.js.map