{
  "version": 3,
  "sources": ["src/app/core/services/myqq/myqq.errors.ts", "src/app/core/services/myqq-stripe/myqq-stripe.service.ts"],
  "sourcesContent": ["export const errors = {\n  myqqApi: {\n    errBadUrl: \"Bad URL\",\n    errBadRequest: \"Bad Request\",\n    errGetOrder: \"Failed to fetch order\",\n    errGetProfile: \"Failed to fetch profile\",\n    errCreateProfile: \"Failed to create profile\",\n    errGetPaymentMethods: \"Failed to fetch payment methods\",\n    errGetItemPricing: \"Failed to fetch item pricing\",\n    errGetStore: \"Failed to fetch store\",\n    errGetRegions: \"Failed to fetch regions\",\n    errGetCoupon: \"Failed to fetch coupon\",\n    errGetSubscription: \"Failed to fetch subscription information\",\n    errInvalidOrder: \"Invalid order request\",\n    errInvalidCoupon: \"Invalid coupon\",\n    errInvalidLicensePlate: \"Invalid License Plate\",\n    errInvalidVin: \"Invalid Vin\",\n    errInvalidInvoiceId: \"Invalid invoice id\",\n    errPayInvoice: \"Failed to pay invoice\",\n    errProfileNoMembership: \"Membership not found\",\n    errProfileUpdate: \"Failed to update profile\",\n    errAccountNoMembership: \"Account not found on membership\",\n    errAccountNoStripeCustomer: \"Subscription information not found\",\n    errAccountNoHomeStore: \"Home store not found on account\",\n    errAccountExists: \"Account already exists\",\n    errAccountCreate: \"Failed to create account\",\n    errAccountLink: \"Failed to link account\",\n    errAccountAlreadyLinked: \"Account already linked to a different account\",\n    errAccountOwnership: \"Account not owned by user\",\n    errVehicleAlreadyOnAccount: \"Vehicle already on account\",\n    errAccountUpdate: \"Failed to update person\",\n    errAccountNotFound: \"Account not found\",\n    errVehicleCreate: \"Failed to create vehicle\",\n    errVehicleLimit: \"Vehicle limit reached on account\",\n    errVehicleOwnership: \"Vehicle not owned by user\",\n    errVehicleUpdate: \"Failed to update vehicle\",\n    errVehicleGet: \"Failed to fetch vehicle\",\n    errVehicleRemove: \"Failed to remove vehicle(s) from account\",\n    errVehicleMembershipStatus: \"Failed to get vehicle membership status\",\n    errGetMembership: \"Failed to get membership information\",\n    errGetAccountInfo: \"Failed to get account information\",\n    errRequireLicenseOrVin: \"License or VIN required for vehicle\",\n    errEvoxError: \"Upstream evox service error\",\n    errEmailOnMembership: \"Email is associated with an active membership\",\n  },\n};\n", "import { Injectable } from \"@angular/core\";\nimport { Store } from \"@ngrx/store\";\n\nimport { Stripe } from \"src/app/shared/modules/stripe\";\nimport {\n  PaymentMethodData,\n  PaymentMethodResult,\n} from \"src/app/shared/modules/stripe/stripe-definitions/payment-method\";\nimport { log, LogLevels } from \"src/app/core/ngrx/logger\";\nimport { notNil } from \"@qqcw/qqsystem-util\";\n\n/**\n * Create a fake action pending log from payment method data\n */\nconst logPending = (data: PaymentMethodData) =>\n  log({\n    message: `STRIPE/CREATE_PAYMENT_METHOD/PENDING`,\n    data: { type: data.type },\n    level: LogLevels.INFO,\n  });\n\n/**\n * Create a fake action success/failure log from payment method data\n */\nconst logResult = (result: PaymentMethodResult) =>\n  notNil(result.error)\n    ? log({\n        message: `STRIPE/CREATE_PAYMENT_METHOD/FAILURE`,\n        data: result,\n        level: LogLevels.WARNING,\n      })\n    : log({\n        message: `STRIPE/CREATE_PAYMENT_METHOD/SUCCESS`,\n        data: result,\n        level: LogLevels.INFO,\n      });\n\n/**\n * This service wraps the Stripe service with some basic logging so we\n * have a better view of what stripe requests are responding with.\n */\n@Injectable()\nexport class MyqqStripeService {\n  /**\n   * Wraps the Stripe createPaymentMethod with some logging. Additionally,\n   * it will catch any thrown errors and cast them to PaymentMethodResult,\n   * which means this method should never throw.\n   */\n  createPaymentMethod(data: PaymentMethodData) {\n    this.store.dispatch(logPending(data));\n    return this.stripe\n      .createPaymentMethod(data)\n      .catch((error): PaymentMethodResult => ({ error }))\n      .then((result) => {\n        this.store.dispatch(logResult(result));\n        return result;\n      });\n  }\n\n  constructor(readonly stripe: Stripe, readonly store: Store<any>) {}\n}\n"],
  "mappings": "yHAAO,IAAMA,EAAS,CACpBC,QAAS,CACPC,UAAW,UACXC,cAAe,cACfC,YAAa,wBACbC,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EAAiB,CAA1C,KAAAE,OAAAA,EAAyB,KAAAF,MAAAA,CAAoB,yCAjBvDF,GAAiBQ,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAjBV,EAAiBW,QAAjBX,EAAiBY,SAAA,CAAA,EAAxB,IAAOZ,EAAPa,SAAOb,CAAiB,GAAA",
  "names": ["errors", "myqqApi", "errBadUrl", "errBadRequest", "errGetOrder", "errGetProfile", "errCreateProfile", "errGetPaymentMethods", "errGetItemPricing", "errGetStore", "errGetRegions", "errGetCoupon", "errGetSubscription", "errInvalidOrder", "errInvalidCoupon", "errInvalidLicensePlate", "errInvalidVin", "errInvalidInvoiceId", "errPayInvoice", "errProfileNoMembership", "errProfileUpdate", "errAccountNoMembership", "errAccountNoStripeCustomer", "errAccountNoHomeStore", "errAccountExists", "errAccountCreate", "errAccountLink", "errAccountAlreadyLinked", "errAccountOwnership", "errVehicleAlreadyOnAccount", "errAccountUpdate", "errAccountNotFound", "errVehicleCreate", "errVehicleLimit", "errVehicleOwnership", "errVehicleUpdate", "errVehicleGet", "errVehicleRemove", "errVehicleMembershipStatus", "errGetMembership", "errGetAccountInfo", "errRequireLicenseOrVin", "errEvoxError", "errEmailOnMembership", "logPending", "data", "log", "message", "type", "level", "LogLevels", "INFO", "logResult", "result", "notNil", "error", "WARNING", "MyqqStripeService", "createPaymentMethod", "store", "dispatch", "stripe", "catch", "then", "constructor", "\u0275\u0275inject", "Stripe", "Store", "factory", "\u0275fac", "_MyqqStripeService"]
}