@misiki/gocommerce-connector 0.31.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/{index-sPZh8NN4.d.cts → index-BAmkQfij.d.cts} +42 -4
- package/dist/{index-sPZh8NN4.d.ts → index-BAmkQfij.d.ts} +42 -4
- package/dist/index.cjs +90 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +90 -34
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +90 -33
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +90 -34
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, w as CheckoutService, z as CollectionService, D as Company, E as CompanyOrder, F as ContactService, G as CountryService, H as CouponService, J as Credit, K as CurrencyService, O as CustomizerEditor, P as CustomizerFile, R as CustomizerSavedDesign, S as CustomizerService, V as DealService, W as DemoRequestService, X as EngineRequest, Y as EnquiryService, a0 as FaqService, a1 as FeedbackService, a2 as FooterSettings, a5 as GalleryService, a7 as GoogleReview, a8 as GoogleReviewService, a9 as GoogleReviews, ab as HeaderSettings, ac as HomeLayout, ad as HomeLayoutSection, ae as HomeService, ag as InitService, ah as Invitation, ai as LayoutCollection, aj as LayoutPage, ak as LayoutService, al as Lead, an as MeilisearchService, ao as Member, ar as MenuService, au as NewsletterService, az as OrderService, aA as PageLayout, aB as PageService, aD as PaymentMethodService, aF as PluginService, aF as PluginsService, aG as PopularSearchService, aH as PopularityService, aM as ProductService, aN as ProfileService, aO as Quote, aP as REDIRECT_GATEWAYS, aQ as ReelsService, aR as RegionService, aS as RejectedLine, aV as ReviewService, aY as SearchService, aZ as SettingService, aZ as SettingsService, a$ as SiteChrome, b0 as SiteFooter, b1 as SiteHeader, b2 as SocialLink, b3 as StateService, b4 as StoreClosed, b5 as StorePass, b8 as StoreService, b9 as StoreUnlock, bb as StorefrontMenu, be as ThemeSettings, bf as ThemeSettingsResult, bg as UploadService, bh as UserService, bk as VariantService, bl as VarniCustomDesignService, bm as VarniCustomProductService, bo as VendorService, bp as WarrantyService, bq as WhatsappConsent, br as WhatsappConsentOffer, bs as WhatsappService, bv as WishlistService, bw as addressService, bx as authService, by as autocompleteService, bz as b2bService, bA as bannerService, bB as blogService, bC as cartService, bD as
|
|
1
|
+
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, w as CheckoutService, z as CollectionService, D as Company, E as CompanyOrder, F as ContactService, G as CountryService, H as CouponService, J as Credit, K as CurrencyService, O as CustomizerEditor, P as CustomizerFile, R as CustomizerSavedDesign, S as CustomizerService, V as DealService, W as DemoRequestService, X as EngineRequest, Y as EnquiryService, a0 as FaqService, a1 as FeedbackService, a2 as FooterSettings, a5 as GalleryService, a7 as GoogleReview, a8 as GoogleReviewService, a9 as GoogleReviews, ab as HeaderSettings, ac as HomeLayout, ad as HomeLayoutSection, ae as HomeService, ag as InitService, ah as Invitation, ai as LayoutCollection, aj as LayoutPage, ak as LayoutService, al as Lead, an as MeilisearchService, ao as Member, ar as MenuService, au as NewsletterService, az as OrderService, aA as PageLayout, aB as PageService, aD as PaymentMethodService, aF as PluginService, aF as PluginsService, aG as PopularSearchService, aH as PopularityService, aM as ProductService, aN as ProfileService, aO as Quote, aP as REDIRECT_GATEWAYS, aQ as ReelsService, aR as RegionService, aS as RejectedLine, aV as ReviewService, aY as SearchService, aZ as SettingService, aZ as SettingsService, a$ as SiteChrome, b0 as SiteFooter, b1 as SiteHeader, b2 as SocialLink, b3 as StateService, b4 as StoreClosed, b5 as StorePass, b8 as StoreService, b9 as StoreUnlock, bb as StorefrontMenu, be as ThemeSettings, bf as ThemeSettingsResult, bg as UploadService, bh as UserService, bk as VariantService, bl as VarniCustomDesignService, bm as VarniCustomProductService, bo as VendorService, bp as WarrantyService, bq as WhatsappConsent, br as WhatsappConsentOffer, bs as WhatsappService, bv as WishlistService, bw as addressService, bx as authService, by as autocompleteService, bz as b2bService, bA as bannerService, bB as blogService, bC as cartService, bD as cashfreeIsTest, bE as categoryService, bF as chatService, bG as checkoutService, bH as collectionService, bI as contactService, bJ as countryService, bK as couponService, bM as currencyService, bN as customizerService, bO as dealService, bP as demoRequestService, bR as emptyPage, bS as enquiryService, bT as faqService, bU as feedbackService, bY as galleryService, bZ as googleReviewService, b_ as homeService, b$ as initService, c0 as layoutService, c1 as mediaUrl, c2 as meilisearchService, c3 as menuService, c5 as newsletterService, c6 as orderService, c7 as ownDomain, c8 as pageService, c9 as paymentMethodService, ca as pluginService, cb as pluginsService, cc as popularSearchService, cd as popularityService, cg as productService, ci as profileService, cj as qs, ck as reelsService, cl as regionService, cm as reviewService, cn as searchService, co as setRequestHost, cp as settingService, cq as settingsService, cr as stateService, cs as staticStore, ct as storeForHost, cu as storeService, cJ as toPage, cM as toStorefrontFacets, cQ as uploadService, cR as userService, cS as variantService, cT as varniCustomDesignService, cU as varniCustomProductService, cV as vendorService, cW as warrantyService, cX as whatsappService, cY as wishlistService } from '../index-BAmkQfij.cjs';
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, w as CheckoutService, z as CollectionService, D as Company, E as CompanyOrder, F as ContactService, G as CountryService, H as CouponService, J as Credit, K as CurrencyService, O as CustomizerEditor, P as CustomizerFile, R as CustomizerSavedDesign, S as CustomizerService, V as DealService, W as DemoRequestService, X as EngineRequest, Y as EnquiryService, a0 as FaqService, a1 as FeedbackService, a2 as FooterSettings, a5 as GalleryService, a7 as GoogleReview, a8 as GoogleReviewService, a9 as GoogleReviews, ab as HeaderSettings, ac as HomeLayout, ad as HomeLayoutSection, ae as HomeService, ag as InitService, ah as Invitation, ai as LayoutCollection, aj as LayoutPage, ak as LayoutService, al as Lead, an as MeilisearchService, ao as Member, ar as MenuService, au as NewsletterService, az as OrderService, aA as PageLayout, aB as PageService, aD as PaymentMethodService, aF as PluginService, aF as PluginsService, aG as PopularSearchService, aH as PopularityService, aM as ProductService, aN as ProfileService, aO as Quote, aP as REDIRECT_GATEWAYS, aQ as ReelsService, aR as RegionService, aS as RejectedLine, aV as ReviewService, aY as SearchService, aZ as SettingService, aZ as SettingsService, a$ as SiteChrome, b0 as SiteFooter, b1 as SiteHeader, b2 as SocialLink, b3 as StateService, b4 as StoreClosed, b5 as StorePass, b8 as StoreService, b9 as StoreUnlock, bb as StorefrontMenu, be as ThemeSettings, bf as ThemeSettingsResult, bg as UploadService, bh as UserService, bk as VariantService, bl as VarniCustomDesignService, bm as VarniCustomProductService, bo as VendorService, bp as WarrantyService, bq as WhatsappConsent, br as WhatsappConsentOffer, bs as WhatsappService, bv as WishlistService, bw as addressService, bx as authService, by as autocompleteService, bz as b2bService, bA as bannerService, bB as blogService, bC as cartService, bD as
|
|
1
|
+
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, w as CheckoutService, z as CollectionService, D as Company, E as CompanyOrder, F as ContactService, G as CountryService, H as CouponService, J as Credit, K as CurrencyService, O as CustomizerEditor, P as CustomizerFile, R as CustomizerSavedDesign, S as CustomizerService, V as DealService, W as DemoRequestService, X as EngineRequest, Y as EnquiryService, a0 as FaqService, a1 as FeedbackService, a2 as FooterSettings, a5 as GalleryService, a7 as GoogleReview, a8 as GoogleReviewService, a9 as GoogleReviews, ab as HeaderSettings, ac as HomeLayout, ad as HomeLayoutSection, ae as HomeService, ag as InitService, ah as Invitation, ai as LayoutCollection, aj as LayoutPage, ak as LayoutService, al as Lead, an as MeilisearchService, ao as Member, ar as MenuService, au as NewsletterService, az as OrderService, aA as PageLayout, aB as PageService, aD as PaymentMethodService, aF as PluginService, aF as PluginsService, aG as PopularSearchService, aH as PopularityService, aM as ProductService, aN as ProfileService, aO as Quote, aP as REDIRECT_GATEWAYS, aQ as ReelsService, aR as RegionService, aS as RejectedLine, aV as ReviewService, aY as SearchService, aZ as SettingService, aZ as SettingsService, a$ as SiteChrome, b0 as SiteFooter, b1 as SiteHeader, b2 as SocialLink, b3 as StateService, b4 as StoreClosed, b5 as StorePass, b8 as StoreService, b9 as StoreUnlock, bb as StorefrontMenu, be as ThemeSettings, bf as ThemeSettingsResult, bg as UploadService, bh as UserService, bk as VariantService, bl as VarniCustomDesignService, bm as VarniCustomProductService, bo as VendorService, bp as WarrantyService, bq as WhatsappConsent, br as WhatsappConsentOffer, bs as WhatsappService, bv as WishlistService, bw as addressService, bx as authService, by as autocompleteService, bz as b2bService, bA as bannerService, bB as blogService, bC as cartService, bD as cashfreeIsTest, bE as categoryService, bF as chatService, bG as checkoutService, bH as collectionService, bI as contactService, bJ as countryService, bK as couponService, bM as currencyService, bN as customizerService, bO as dealService, bP as demoRequestService, bR as emptyPage, bS as enquiryService, bT as faqService, bU as feedbackService, bY as galleryService, bZ as googleReviewService, b_ as homeService, b$ as initService, c0 as layoutService, c1 as mediaUrl, c2 as meilisearchService, c3 as menuService, c5 as newsletterService, c6 as orderService, c7 as ownDomain, c8 as pageService, c9 as paymentMethodService, ca as pluginService, cb as pluginsService, cc as popularSearchService, cd as popularityService, cg as productService, ci as profileService, cj as qs, ck as reelsService, cl as regionService, cm as reviewService, cn as searchService, co as setRequestHost, cp as settingService, cq as settingsService, cr as stateService, cs as staticStore, ct as storeForHost, cu as storeService, cJ as toPage, cM as toStorefrontFacets, cQ as uploadService, cR as userService, cS as variantService, cT as varniCustomDesignService, cU as varniCustomProductService, cV as vendorService, cW as warrantyService, cX as whatsappService, cY as wishlistService } from '../index-BAmkQfij.js';
|
package/dist/services/index.js
CHANGED
|
@@ -2194,9 +2194,9 @@ var CheckoutService = class extends BaseService {
|
|
|
2194
2194
|
}
|
|
2195
2195
|
// The family's other gateway flows. GoCommerce's Stripe is a Payment
|
|
2196
2196
|
// Element (a client secret, not a hosted page) — `checkout('stripe')` returns
|
|
2197
|
-
// that secret for a storefront that mounts the element.
|
|
2198
|
-
//
|
|
2199
|
-
//
|
|
2197
|
+
// that secret for a storefront that mounts the element. PhonePe and Affirm are
|
|
2198
|
+
// not engine gateways at all. paymentMethodService never offers these codes,
|
|
2199
|
+
// so they are reached only by a storefront that hard-codes one.
|
|
2200
2200
|
async checkoutStripe() {
|
|
2201
2201
|
throw unsupported(
|
|
2202
2202
|
"checkoutStripe",
|
|
@@ -2219,7 +2219,7 @@ var CheckoutService = class extends BaseService {
|
|
|
2219
2219
|
const gateway = await this.redirectGateway();
|
|
2220
2220
|
if (!gateway) throw unsupported("checkoutPaypal", "this store has no hosted-page payment gateway switched on");
|
|
2221
2221
|
const id2 = cartId || storedCartId() || "";
|
|
2222
|
-
const back = origin ?
|
|
2222
|
+
const back = origin ? successUrl(origin, id2) : void 0;
|
|
2223
2223
|
const result = await this.place(gateway, id2, back ? { return_url: back } : {});
|
|
2224
2224
|
const url = result.payment.client_data?.url;
|
|
2225
2225
|
if (!url) throw new GoCommerceError("The payment page did not open. Please try again.", 502);
|
|
@@ -2235,11 +2235,40 @@ var CheckoutService = class extends BaseService {
|
|
|
2235
2235
|
} = {}) {
|
|
2236
2236
|
return { order_no: order_no ?? null, status: "processing" };
|
|
2237
2237
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2238
|
+
/**
|
|
2239
|
+
* Cashfree's JavaScript checkout. The engine has already created the Cashfree
|
|
2240
|
+
* order; this hands the storefront the session its modal opens. `order_no` is
|
|
2241
|
+
* the store's number, which the storefront prefers over `order_id`, Cashfree's.
|
|
2242
|
+
*
|
|
2243
|
+
* The return URL is for the one case the modal cannot open, an in-app browser,
|
|
2244
|
+
* when Cashfree sends the shopper back to it instead. Only https is sent: every
|
|
2245
|
+
* Cashfree example is, and a plain-http dev origin should not risk the order.
|
|
2246
|
+
*/
|
|
2247
|
+
async checkoutCashfree({ cartId, origin } = {}) {
|
|
2248
|
+
const { id: id2, extras, address } = await this.storedCheckout(cartId);
|
|
2249
|
+
if (!extras.phone && !address.phone) throw new GoCommerceError("Add a phone number to pay with Cashfree.", 400);
|
|
2250
|
+
const result = await this.place("cashfree", id2, origin?.startsWith("https:") ? { return_url: successUrl(origin, id2) } : {});
|
|
2251
|
+
const data = result.payment.client_data ?? {};
|
|
2252
|
+
if (result.payment.kind !== "client_action" || !data.payment_session_id) {
|
|
2253
|
+
throw new GoCommerceError("The payment page did not open. Please try again.", 502);
|
|
2254
|
+
}
|
|
2255
|
+
cashfreeEnvironment = data.environment;
|
|
2256
|
+
return {
|
|
2257
|
+
order_no: result.order.number,
|
|
2258
|
+
payment_session_id: data.payment_session_id,
|
|
2259
|
+
order_id: data.order_id,
|
|
2260
|
+
environment: data.environment
|
|
2261
|
+
};
|
|
2240
2262
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2263
|
+
/**
|
|
2264
|
+
* Nothing to capture: the signed webhook tells the engine the order is paid.
|
|
2265
|
+
* The storefront calls this on the server, after Cashfree's modal resolves
|
|
2266
|
+
* with any outcome, so it can neither claim the payment nor, without the
|
|
2267
|
+
* browser's order token, check it. Answering sends the shopper to the success
|
|
2268
|
+
* page; throwing would call a payment that may have gone through failed.
|
|
2269
|
+
*/
|
|
2270
|
+
async captureCashfreePayment({ order_no } = {}) {
|
|
2271
|
+
return { order_no: order_no ?? null, status: "processing" };
|
|
2243
2272
|
}
|
|
2244
2273
|
async checkoutPhonepe() {
|
|
2245
2274
|
throw unsupported("checkoutPhonepe", "the engine has no PhonePe gateway");
|
|
@@ -2305,7 +2334,7 @@ var CheckoutService = class extends BaseService {
|
|
|
2305
2334
|
}
|
|
2306
2335
|
/**
|
|
2307
2336
|
* What checkout would charge for the cart now, by the storefront's method
|
|
2308
|
-
* code (`COD`, `RAZORPAY`, `PAYPAL`) or none yet (D185). Null until the
|
|
2337
|
+
* code (`COD`, `RAZORPAY`, `CASHFREE`, `PAYPAL`) or none yet (D185). Null until the
|
|
2309
2338
|
* address step has stored an address, and null from an engine before D185.
|
|
2310
2339
|
*
|
|
2311
2340
|
* A refusal is checkout's own: the same GoCommerceError, with the same
|
|
@@ -2313,7 +2342,7 @@ var CheckoutService = class extends BaseService {
|
|
|
2313
2342
|
*/
|
|
2314
2343
|
async getQuote({ cartId, method = "" } = {}) {
|
|
2315
2344
|
const id2 = cartId || storedCartId();
|
|
2316
|
-
if (!id2 || !cartExtras(id2).shippingAddress) return null;
|
|
2345
|
+
if (!id2 || !cartExtras(id2).shippingAddress || cartExtras(id2).attempt?.placed) return null;
|
|
2317
2346
|
const { extras, email, address } = await this.storedCheckout(id2);
|
|
2318
2347
|
const code = method.toLowerCase() === "paypal" ? await this.redirectGateway() : method.toLowerCase();
|
|
2319
2348
|
try {
|
|
@@ -2374,6 +2403,11 @@ var CheckoutService = class extends BaseService {
|
|
|
2374
2403
|
* key resumes that order, and without one the shopper is stuck. A changed
|
|
2375
2404
|
* request — a different address, a different method — gets a new key, since
|
|
2376
2405
|
* the engine refuses a key replayed with a different body.
|
|
2406
|
+
*
|
|
2407
|
+
* A gateway's modal keeps the key after the order is placed, along with exactly
|
|
2408
|
+
* what placed it. The cart is converted by then, so a shopper who closes the
|
|
2409
|
+
* window can pay again only under this key, and the engine then reopens the same
|
|
2410
|
+
* gateway order rather than risk a second charge on a new one (D232).
|
|
2377
2411
|
*/
|
|
2378
2412
|
async place(code, cartId, extra = {}) {
|
|
2379
2413
|
const { id: id2, extras, email, address, currency } = await this.storedCheckout(cartId);
|
|
@@ -2390,23 +2424,27 @@ var CheckoutService = class extends BaseService {
|
|
|
2390
2424
|
const serialised = JSON.stringify(body);
|
|
2391
2425
|
const retry = extras.attempt?.body === `${code}:${serialised}`;
|
|
2392
2426
|
const key = retry ? extras.attempt.key : newKey();
|
|
2427
|
+
const placed = retry ? extras.attempt?.placed : void 0;
|
|
2393
2428
|
const meta = retry ? extras.attempt?.meta : metaBrowser();
|
|
2394
2429
|
const attribution = retry ? extras.attempt?.attribution : landingAttribution();
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2430
|
+
if (!placed) {
|
|
2431
|
+
saveCartExtras(id2, {
|
|
2432
|
+
attempt: { key, body: `${code}:${serialised}`, ...meta ? { meta } : {}, ...attribution ? { attribution } : {} }
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2398
2435
|
const metadata = {
|
|
2399
2436
|
...extra.metadata,
|
|
2400
2437
|
...meta ? { meta_capi: meta } : {},
|
|
2401
2438
|
...attribution ? { attribution } : {}
|
|
2402
2439
|
};
|
|
2403
2440
|
const expected = this.expected.get(id2);
|
|
2441
|
+
const sent = placed ?? {
|
|
2442
|
+
...Object.keys(metadata).length ? { ...body, metadata } : body,
|
|
2443
|
+
...expected ? { quoted_total_minor: toMinor(expected.total, currency) } : {}
|
|
2444
|
+
};
|
|
2404
2445
|
const result = await this.data(`/api/checkout/${encodeURIComponent(code)}`, {
|
|
2405
2446
|
method: "POST",
|
|
2406
|
-
body:
|
|
2407
|
-
...Object.keys(metadata).length ? { ...body, metadata } : body,
|
|
2408
|
-
...expected ? { quoted_total_minor: toMinor(expected.total, currency) } : {}
|
|
2409
|
-
},
|
|
2447
|
+
body: sent,
|
|
2410
2448
|
headers: { "Idempotency-Key": key }
|
|
2411
2449
|
}).catch((err) => {
|
|
2412
2450
|
if (keyAlreadyUsed(err)) {
|
|
@@ -2433,11 +2471,18 @@ var CheckoutService = class extends BaseService {
|
|
|
2433
2471
|
}).catch(() => void 0);
|
|
2434
2472
|
}
|
|
2435
2473
|
}
|
|
2436
|
-
|
|
2474
|
+
const reopenable = result.payment.kind === "client_action";
|
|
2475
|
+
saveCartExtras(id2, { attempt: reopenable ? { key, body: `${code}:${serialised}`, placed: sent } : null });
|
|
2476
|
+
if (reopenable && result.order.payment_status === "paid") {
|
|
2477
|
+
throw new GoCommerceError(`Order ${result.order.number} is already paid, so there is nothing more to pay.`, 409, "already_paid");
|
|
2478
|
+
}
|
|
2437
2479
|
return result;
|
|
2438
2480
|
}
|
|
2439
2481
|
};
|
|
2440
2482
|
var REDIRECT_GATEWAYS = /* @__PURE__ */ new Set(["paypal", "adyen", "paddle", "lemonsqueezy", "creem", "hyperswitch", "revenuecat"]);
|
|
2483
|
+
var cashfreeEnvironment;
|
|
2484
|
+
var cashfreeIsTest = () => cashfreeEnvironment === "sandbox";
|
|
2485
|
+
var successUrl = (origin, cartId) => `${origin.replace(/\/+$/, "")}/checkout/success?cart_id=${encodeURIComponent(cartId)}`;
|
|
2441
2486
|
var unsupported = (method, why) => new NotSupportedError("CheckoutService", method, why);
|
|
2442
2487
|
function keyAlreadyUsed(err) {
|
|
2443
2488
|
return err instanceof GoCommerceError && err.status === 400 && err.message.includes("Idempotency-Key was already used");
|
|
@@ -2464,7 +2509,8 @@ var checkoutService = new CheckoutService();
|
|
|
2464
2509
|
// src/services/payment-method-service.ts
|
|
2465
2510
|
var DRIVABLE = {
|
|
2466
2511
|
cod: { code: "COD", img: "/payment/cod.svg" },
|
|
2467
|
-
razorpay: { code: "RAZORPAY" }
|
|
2512
|
+
razorpay: { code: "RAZORPAY" },
|
|
2513
|
+
cashfree: { code: "CASHFREE", img: "/payment/card.svg" }
|
|
2468
2514
|
};
|
|
2469
2515
|
var reported2 = /* @__PURE__ */ new Set();
|
|
2470
2516
|
var PaymentMethodService = class extends BaseService {
|
|
@@ -2473,7 +2519,12 @@ var PaymentMethodService = class extends BaseService {
|
|
|
2473
2519
|
const options = await this.facts.checkoutOptions();
|
|
2474
2520
|
const methods = options.methods ?? [];
|
|
2475
2521
|
const redirect = methods.find((m) => REDIRECT_GATEWAYS.has(m.code))?.code;
|
|
2476
|
-
const drive = (code) =>
|
|
2522
|
+
const drive = (code) => {
|
|
2523
|
+
if (code === "cashfree" && options.currency !== "INR") return void 0;
|
|
2524
|
+
if (DRIVABLE[code]) return DRIVABLE[code];
|
|
2525
|
+
if (code === redirect) return { code: "PAYPAL", img: "/payment/card.svg" };
|
|
2526
|
+
return REDIRECT_GATEWAYS.has(code) ? { code: code.toUpperCase(), img: "/payment/card.svg" } : void 0;
|
|
2527
|
+
};
|
|
2477
2528
|
const data = methods.filter((m) => {
|
|
2478
2529
|
if (drive(m.code)) return true;
|
|
2479
2530
|
if (!reported2.has(m.code)) {
|
|
@@ -2483,19 +2534,24 @@ var PaymentMethodService = class extends BaseService {
|
|
|
2483
2534
|
);
|
|
2484
2535
|
}
|
|
2485
2536
|
return false;
|
|
2486
|
-
}).map((m, i) =>
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2537
|
+
}).map((m, i) => {
|
|
2538
|
+
const method = {
|
|
2539
|
+
id: m.code,
|
|
2540
|
+
code: drive(m.code).code,
|
|
2541
|
+
engineCode: m.code,
|
|
2542
|
+
name: m.name,
|
|
2543
|
+
title: m.name,
|
|
2544
|
+
description: "",
|
|
2545
|
+
img: drive(m.code).img ?? null,
|
|
2546
|
+
fee: toMajor(m.fee),
|
|
2547
|
+
rank: i,
|
|
2548
|
+
active: true,
|
|
2549
|
+
isActive: true
|
|
2550
|
+
};
|
|
2551
|
+
if (REDIRECT_GATEWAYS.has(m.code) && m.code !== redirect) Object.assign(method, { redirects: true });
|
|
2552
|
+
if (m.code === "cashfree") Object.defineProperty(method, "isTest", { get: cashfreeIsTest, enumerable: true });
|
|
2553
|
+
return method;
|
|
2554
|
+
});
|
|
2499
2555
|
return { data, count: data.length, pageSize: data.length, noOfPage: 1, page: 1 };
|
|
2500
2556
|
}
|
|
2501
2557
|
};
|
|
@@ -4259,6 +4315,6 @@ function attemptKey(request) {
|
|
|
4259
4315
|
}
|
|
4260
4316
|
var b2bService = new B2bService();
|
|
4261
4317
|
|
|
4262
|
-
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, CustomizerService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WhatsappService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, customizerService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, googleReviewService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, whatsappService, wishlistService };
|
|
4318
|
+
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, CustomizerService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WhatsappService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, cashfreeIsTest, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, customizerService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, googleReviewService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, whatsappService, wishlistService };
|
|
4263
4319
|
//# sourceMappingURL=index.js.map
|
|
4264
4320
|
//# sourceMappingURL=index.js.map
|