@basedone/core 0.2.1 → 0.2.3
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/dist/{chunk-MVFO4WRF.mjs → chunk-SKX4VGEN.mjs} +573 -1
- package/dist/ecommerce.d.mts +1220 -7
- package/dist/ecommerce.d.ts +1220 -7
- package/dist/ecommerce.js +573 -1
- package/dist/ecommerce.mjs +1 -1
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +580 -1
- package/dist/index.mjs +8 -2
- package/lib/ecommerce/QUICK_REFERENCE.md +26 -0
- package/lib/ecommerce/README.md +26 -0
- package/lib/ecommerce/client/base.ts +7 -1
- package/lib/ecommerce/client/customer.ts +190 -0
- package/lib/ecommerce/client/merchant.ts +783 -0
- package/lib/ecommerce/types/entities.ts +94 -0
- package/lib/ecommerce/types/enums.ts +5 -1
- package/lib/ecommerce/types/requests.ts +122 -0
- package/lib/ecommerce/types/responses.ts +244 -0
- package/lib/utils/formatter.ts +1 -1
- package/lib/utils/time.ts +24 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BannerType, BaseEcommerceClient, CustomerEcommerceClient, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, InventoryAuditAction, MerchantEcommerceClient, MerchantStatus, OrderStatus, PaymentMethod, PaymentStatus, ProductSortBy, ReturnStatus, ReviewSortBy, ReviewStatus, ShipmentStatus, SortOrder, TaxBehavior, TaxReportPeriodType, TaxReportStatus, TaxType, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './chunk-
|
|
1
|
+
export { BannerType, BaseEcommerceClient, CustomerEcommerceClient, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, InventoryAuditAction, MerchantEcommerceClient, MerchantStatus, OrderStatus, PaymentMethod, PaymentStatus, ProductSortBy, ReturnStatus, ReviewSortBy, ReviewStatus, ShipmentStatus, SortOrder, TaxBehavior, TaxReportPeriodType, TaxReportStatus, TaxType, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './chunk-SKX4VGEN.mjs';
|
|
2
2
|
export { AssetIdUtils, InstrumentClient } from './chunk-VBC6EQ7Q.mjs';
|
|
3
3
|
import { __glob } from './chunk-4UEJOM6W.mjs';
|
|
4
4
|
import Decimal, { Decimal as Decimal$1 } from 'decimal.js';
|
|
@@ -1297,6 +1297,12 @@ function getLatestCompletedWeek(currentTimestamp, offset = 0, weekStartsOn = 4 /
|
|
|
1297
1297
|
const weekNumber = Math.round(msSinceWeek1 / WEEK_IN_MS) + 1;
|
|
1298
1298
|
return { weekNumber, startDate, endDate };
|
|
1299
1299
|
}
|
|
1300
|
+
function getWeekInfoFromNumber(weekNumber, weekStartsOn = 4 /* Thursday */) {
|
|
1301
|
+
const week1StartDate = new Date(process.env.WEEK1_START_DATE || "2025-12-04T00:00:00Z");
|
|
1302
|
+
const startDate = new Date(week1StartDate.getTime() + (weekNumber - 1) * WEEK_IN_MS);
|
|
1303
|
+
const endDate = new Date(startDate.getTime() + WEEK_IN_MS);
|
|
1304
|
+
return { weekNumber, startDate, endDate };
|
|
1305
|
+
}
|
|
1300
1306
|
|
|
1301
1307
|
// lib/hip3/market-info.ts
|
|
1302
1308
|
async function getAllPerpsMeta(infoClient) {
|
|
@@ -1305,4 +1311,4 @@ async function getAllPerpsMeta(infoClient) {
|
|
|
1305
1311
|
});
|
|
1306
1312
|
}
|
|
1307
1313
|
|
|
1308
|
-
export { CloidClientCode, CloidClientCodeNameById, DayOfWeek, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, USDC_SPOT_TOKEN, UserDexAbstractionTypes, WidgetType, WidgetTypeById, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
|
|
1314
|
+
export { CloidClientCode, CloidClientCodeNameById, DayOfWeek, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, USDC_SPOT_TOKEN, UserDexAbstractionTypes, WidgetType, WidgetTypeById, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWeekInfoFromNumber, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
|
|
@@ -57,6 +57,16 @@ await client.createReview("prod_123", {
|
|
|
57
57
|
comment: "Love it!",
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
// Shop Following
|
|
61
|
+
const followStatus = await client.isFollowingMerchant("merchant_123");
|
|
62
|
+
await client.followMerchant("merchant_123");
|
|
63
|
+
await client.unfollowMerchant("merchant_123");
|
|
64
|
+
const following = await client.getFollowedMerchants({ limit: 20 });
|
|
65
|
+
|
|
66
|
+
// Merchant Profile & Products (public)
|
|
67
|
+
const merchant = await client.getMerchantProfile("merchant_123");
|
|
68
|
+
const products = await client.getMerchantProducts("merchant_123", { sortBy: "popular" });
|
|
69
|
+
|
|
60
70
|
// Calculate discounts
|
|
61
71
|
const discounts = await client.calculateCartDiscounts({
|
|
62
72
|
items: [{ productId: "prod_123", quantity: 2 }],
|
|
@@ -67,6 +77,17 @@ const tax = await client.calculateTax({
|
|
|
67
77
|
items: [{ productId: "prod_123", quantity: 2 }],
|
|
68
78
|
shippingAddress: { country: "US", region: "NY" },
|
|
69
79
|
});
|
|
80
|
+
|
|
81
|
+
// Get merchant storefront profile
|
|
82
|
+
const merchant = await client.getMerchantProfile("merchant_123");
|
|
83
|
+
console.log(merchant.merchant.name, merchant.merchant.productCount);
|
|
84
|
+
|
|
85
|
+
// List merchant products with search/sort
|
|
86
|
+
const merchantProducts = await client.getMerchantProducts("merchant_123", {
|
|
87
|
+
search: "laptop",
|
|
88
|
+
sortBy: "popular",
|
|
89
|
+
limit: 20,
|
|
90
|
+
});
|
|
70
91
|
```
|
|
71
92
|
|
|
72
93
|
## Merchant Client
|
|
@@ -200,6 +221,11 @@ import type {
|
|
|
200
221
|
PaymentMethod,
|
|
201
222
|
CreateOrderRequest,
|
|
202
223
|
ListProductsParams,
|
|
224
|
+
// Merchant storefront types
|
|
225
|
+
PublicMerchantProfile,
|
|
226
|
+
PublicMerchantProfileResponse,
|
|
227
|
+
MerchantProductsResponse,
|
|
228
|
+
ListMerchantProductsParams,
|
|
203
229
|
} from "@basedone/core/ecommerce";
|
|
204
230
|
```
|
|
205
231
|
|
package/lib/ecommerce/README.md
CHANGED
|
@@ -68,6 +68,17 @@ if (order.escrow) {
|
|
|
68
68
|
// After depositing, confirm the transaction
|
|
69
69
|
await client.confirmEscrowDeposit(order.orders[0].id);
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
// Browse a merchant's storefront
|
|
73
|
+
const merchantProfile = await client.getMerchantProfile("merchant_123");
|
|
74
|
+
console.log(`${merchantProfile.merchant.name} - ${merchantProfile.merchant.productCount} products`);
|
|
75
|
+
|
|
76
|
+
// Get merchant products with search and sort
|
|
77
|
+
const merchantProducts = await client.getMerchantProducts("merchant_123", {
|
|
78
|
+
search: "laptop",
|
|
79
|
+
sortBy: "popular", // popular, latest, top_sales, price_asc, price_desc, rating
|
|
80
|
+
limit: 20,
|
|
81
|
+
});
|
|
71
82
|
```
|
|
72
83
|
|
|
73
84
|
### Merchant Client
|
|
@@ -142,6 +153,16 @@ await client.updateOrderStatus("ord_123", {
|
|
|
142
153
|
- `getActiveBanners(params?)` - Get active promotional banners
|
|
143
154
|
- `trackBanner(bannerId, request)` - Track banner impression/click
|
|
144
155
|
|
|
156
|
+
#### Merchant Storefront (Public)
|
|
157
|
+
- `getMerchantProfile(merchantId)` - Get public merchant profile
|
|
158
|
+
- `getMerchantProducts(merchantId, params?)` - Get merchant's products with filtering
|
|
159
|
+
|
|
160
|
+
#### Shop Following
|
|
161
|
+
- `isFollowingMerchant(merchantId)` - Check if following a merchant
|
|
162
|
+
- `followMerchant(merchantId)` - Follow a merchant
|
|
163
|
+
- `unfollowMerchant(merchantId)` - Unfollow a merchant
|
|
164
|
+
- `getFollowedMerchants(params?)` - Get list of followed merchants
|
|
165
|
+
|
|
145
166
|
### Merchant APIs
|
|
146
167
|
|
|
147
168
|
#### Profile
|
|
@@ -319,6 +340,11 @@ import type {
|
|
|
319
340
|
PaymentMethod,
|
|
320
341
|
CreateOrderRequest,
|
|
321
342
|
ListProductsParams,
|
|
343
|
+
// Merchant storefront types
|
|
344
|
+
PublicMerchantProfile,
|
|
345
|
+
PublicMerchantProfileResponse,
|
|
346
|
+
MerchantProductsResponse,
|
|
347
|
+
ListMerchantProductsParams,
|
|
322
348
|
// ... and many more
|
|
323
349
|
} from "@basedone/core/ecommerce";
|
|
324
350
|
```
|
|
@@ -33,6 +33,9 @@ export interface EcommerceClientConfig {
|
|
|
33
33
|
|
|
34
34
|
/** Enable automatic retry on retryable errors */
|
|
35
35
|
enableRetry?: boolean;
|
|
36
|
+
|
|
37
|
+
/** Whether to send cookies with requests */
|
|
38
|
+
withCredentials?: boolean;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -55,9 +58,10 @@ export interface EcommerceClientConfig {
|
|
|
55
58
|
*/
|
|
56
59
|
export class BaseEcommerceClient {
|
|
57
60
|
private axiosInstance: AxiosInstance;
|
|
58
|
-
private config: Required<Omit<EcommerceClientConfig, "authToken" | "headers">> & {
|
|
61
|
+
private config: Required<Omit<EcommerceClientConfig, "authToken" | "headers" | "withCredentials">> & {
|
|
59
62
|
authToken?: string;
|
|
60
63
|
headers?: Record<string, string>;
|
|
64
|
+
withCredentials?: boolean;
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
constructor(config: EcommerceClientConfig) {
|
|
@@ -69,11 +73,13 @@ export class BaseEcommerceClient {
|
|
|
69
73
|
retryBaseDelay: config.retryBaseDelay || 1000,
|
|
70
74
|
headers: config.headers,
|
|
71
75
|
enableRetry: config.enableRetry !== false,
|
|
76
|
+
withCredentials: config.withCredentials || false,
|
|
72
77
|
};
|
|
73
78
|
|
|
74
79
|
this.axiosInstance = axios.create({
|
|
75
80
|
baseURL: this.config.baseURL,
|
|
76
81
|
timeout: this.config.timeout,
|
|
82
|
+
withCredentials: this.config.withCredentials,
|
|
77
83
|
headers: {
|
|
78
84
|
"Content-Type": "application/json",
|
|
79
85
|
...this.config.headers,
|
|
@@ -22,6 +22,9 @@ import type {
|
|
|
22
22
|
TrackBannerRequest,
|
|
23
23
|
SendMessageRequest,
|
|
24
24
|
ListActiveFlashSalesParams,
|
|
25
|
+
ListMerchantProductsParams,
|
|
26
|
+
ListFollowingParams,
|
|
27
|
+
CalculateShippingRequest,
|
|
25
28
|
|
|
26
29
|
// Response types
|
|
27
30
|
ListProductsResponse,
|
|
@@ -45,6 +48,13 @@ import type {
|
|
|
45
48
|
MessageStatsResponse,
|
|
46
49
|
MessageResponse,
|
|
47
50
|
ActiveFlashSalesResponse,
|
|
51
|
+
GetPaymentMethodsResponse,
|
|
52
|
+
PublicMerchantProfileResponse,
|
|
53
|
+
MerchantProductsResponse,
|
|
54
|
+
FollowStatusResponse,
|
|
55
|
+
FollowActionResponse,
|
|
56
|
+
ListFollowingResponse,
|
|
57
|
+
CalculateShippingResponse,
|
|
48
58
|
} from "../types";
|
|
49
59
|
|
|
50
60
|
/**
|
|
@@ -481,6 +491,36 @@ export class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
481
491
|
async calculateTax(request: CalculateTaxRequest): Promise<CalculateTaxResponse> {
|
|
482
492
|
return this.post("/api/marketplace/tax/calculate", request);
|
|
483
493
|
}
|
|
494
|
+
|
|
495
|
+
// ============================================================================
|
|
496
|
+
// Shipping Calculation API
|
|
497
|
+
// ============================================================================
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Calculate shipping options for cart items
|
|
501
|
+
*
|
|
502
|
+
* @param request - Cart items, merchant, and destination
|
|
503
|
+
* @returns Available shipping options with costs
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* const result = await client.calculateShippingOptions({
|
|
508
|
+
* merchantId: "merchant_123",
|
|
509
|
+
* cartItems: [
|
|
510
|
+
* { productId: "prod_123", quantity: 2 }
|
|
511
|
+
* ],
|
|
512
|
+
* destinationCountry: "US",
|
|
513
|
+
* orderSubtotal: 99.99
|
|
514
|
+
* });
|
|
515
|
+
*
|
|
516
|
+
* result.shippingOptions.forEach(opt => {
|
|
517
|
+
* console.log(opt.name, opt.cost, opt.estimatedDelivery);
|
|
518
|
+
* });
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
async calculateShippingOptions(request: CalculateShippingRequest): Promise<CalculateShippingResponse> {
|
|
522
|
+
return this.post("/api/marketplace/shipping/calculate", request);
|
|
523
|
+
}
|
|
484
524
|
|
|
485
525
|
// ============================================================================
|
|
486
526
|
// Banners API
|
|
@@ -635,5 +675,155 @@ export class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
635
675
|
const queryString = params ? buildQueryString(params) : "";
|
|
636
676
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
637
677
|
}
|
|
678
|
+
|
|
679
|
+
// ============================================================================
|
|
680
|
+
// Merchant Storefront API
|
|
681
|
+
// ============================================================================
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Get public merchant profile
|
|
685
|
+
*
|
|
686
|
+
* Fetches public information about a merchant for the storefront page.
|
|
687
|
+
*
|
|
688
|
+
* @param merchantId - Merchant ID
|
|
689
|
+
* @returns Public merchant profile with stats
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
694
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
async getMerchantProfile(merchantId: string): Promise<PublicMerchantProfileResponse> {
|
|
698
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* List merchant products
|
|
703
|
+
*
|
|
704
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
705
|
+
*
|
|
706
|
+
* @param merchantId - Merchant ID
|
|
707
|
+
* @param params - Query parameters for filtering and pagination
|
|
708
|
+
* @returns Paginated list of products
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
713
|
+
* search: "laptop",
|
|
714
|
+
* sortBy: "popular",
|
|
715
|
+
* limit: 20,
|
|
716
|
+
* });
|
|
717
|
+
*
|
|
718
|
+
* result.items.forEach(product => {
|
|
719
|
+
* console.log(product.title, product.priceUSDC);
|
|
720
|
+
* });
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
async getMerchantProducts(
|
|
724
|
+
merchantId: string,
|
|
725
|
+
params?: ListMerchantProductsParams
|
|
726
|
+
): Promise<MerchantProductsResponse> {
|
|
727
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
728
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// ============================================================================
|
|
732
|
+
// Shop Following API
|
|
733
|
+
// ============================================================================
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Check if following a merchant
|
|
737
|
+
*
|
|
738
|
+
* @param merchantId - Merchant ID
|
|
739
|
+
* @returns Follow status with follow date if applicable
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
744
|
+
* if (status.isFollowing) {
|
|
745
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
746
|
+
* }
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
async isFollowingMerchant(merchantId: string): Promise<FollowStatusResponse> {
|
|
750
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Follow a merchant
|
|
755
|
+
*
|
|
756
|
+
* @param merchantId - Merchant ID to follow
|
|
757
|
+
* @returns Follow action result
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```typescript
|
|
761
|
+
* const result = await client.followMerchant("merchant_123");
|
|
762
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
async followMerchant(merchantId: string): Promise<FollowActionResponse> {
|
|
766
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Unfollow a merchant
|
|
771
|
+
*
|
|
772
|
+
* @param merchantId - Merchant ID to unfollow
|
|
773
|
+
* @returns Unfollow action result
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```typescript
|
|
777
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
778
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
|
+
async unfollowMerchant(merchantId: string): Promise<FollowActionResponse> {
|
|
782
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Get list of followed merchants
|
|
787
|
+
*
|
|
788
|
+
* @param params - Query parameters for pagination and sorting
|
|
789
|
+
* @returns Paginated list of followed merchants with their info
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* ```typescript
|
|
793
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
794
|
+
* result.items.forEach(item => {
|
|
795
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
796
|
+
* });
|
|
797
|
+
* ```
|
|
798
|
+
*/
|
|
799
|
+
async getFollowedMerchants(params?: ListFollowingParams): Promise<ListFollowingResponse> {
|
|
800
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
801
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// ============================================================================
|
|
805
|
+
// Payment Methods
|
|
806
|
+
// ============================================================================
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Get available payment methods
|
|
810
|
+
*
|
|
811
|
+
* Returns the list of enabled payment methods that can be used during checkout.
|
|
812
|
+
*
|
|
813
|
+
* @returns List of available payment methods with display info
|
|
814
|
+
*
|
|
815
|
+
* @example
|
|
816
|
+
* ```typescript
|
|
817
|
+
* const result = await client.getPaymentMethods();
|
|
818
|
+
* if (result.paymentsEnabled) {
|
|
819
|
+
* result.methods.forEach(method => {
|
|
820
|
+
* console.log(`${method.name}: ${method.description}`);
|
|
821
|
+
* });
|
|
822
|
+
* }
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
async getPaymentMethods(): Promise<GetPaymentMethodsResponse> {
|
|
826
|
+
return this.get("/api/marketplace/payments/methods");
|
|
827
|
+
}
|
|
638
828
|
}
|
|
639
829
|
|