@mitumba/sdk 1.27.0 → 1.28.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/dist/index.d.ts CHANGED
@@ -404,6 +404,136 @@ interface OrderHistoryParams {
404
404
  page?: number;
405
405
  }
406
406
 
407
+ type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
408
+ type BaleType = 'original' | 'sorted';
409
+ interface WholesaleStore {
410
+ id: string;
411
+ name: string;
412
+ slug: string;
413
+ tagline: string | null;
414
+ description: string | null;
415
+ logo_url: string | null;
416
+ origins: string[];
417
+ verified: boolean;
418
+ }
419
+ interface WholesaleDepot {
420
+ id: string;
421
+ name: string;
422
+ address: string | null;
423
+ city_id: string | null;
424
+ is_primary: boolean;
425
+ }
426
+ interface Bale {
427
+ id: string;
428
+ store_id: string;
429
+ seller_id: string;
430
+ title: string;
431
+ category: string;
432
+ grade: BaleGrade;
433
+ bale_type: BaleType;
434
+ weight_kg: number;
435
+ origin: string | null;
436
+ est_pieces: number | null;
437
+ price_kes: number;
438
+ moq: number;
439
+ mix: string | null;
440
+ description: string | null;
441
+ city_id: string | null;
442
+ status: 'draft' | 'active' | 'sold_out';
443
+ created_at: string;
444
+ }
445
+ interface BaleDetail extends Bale {
446
+ images: string[];
447
+ store: {
448
+ name: string;
449
+ slug: string;
450
+ verified: boolean;
451
+ sti: number | null;
452
+ };
453
+ }
454
+ interface CreateBaleInput {
455
+ title: string;
456
+ category: string;
457
+ grade: BaleGrade;
458
+ bale_type?: BaleType;
459
+ weight_kg: number;
460
+ origin?: string;
461
+ est_pieces?: number;
462
+ price_kes: number;
463
+ moq?: number;
464
+ mix?: string;
465
+ description?: string;
466
+ city_id?: string;
467
+ status?: 'draft' | 'active' | 'sold_out';
468
+ }
469
+ interface WholesaleFeedParams {
470
+ q?: string;
471
+ category?: string;
472
+ grade?: BaleGrade;
473
+ origin?: string;
474
+ city_id?: string;
475
+ limit?: number;
476
+ offset?: number;
477
+ }
478
+ interface BaleFeedItem extends Bale {
479
+ image_url: string | null;
480
+ store: {
481
+ name: string;
482
+ slug: string;
483
+ verified: boolean;
484
+ sti: number | null;
485
+ };
486
+ }
487
+ interface SaveWholesaleStoreInput {
488
+ name: string;
489
+ tagline?: string;
490
+ description?: string;
491
+ logo_url?: string;
492
+ origins?: string[];
493
+ }
494
+ interface AddDepotInput {
495
+ name: string;
496
+ address?: string;
497
+ city_id?: string;
498
+ is_primary?: boolean;
499
+ }
500
+ declare const BALE_ORDER_STATUSES: readonly ["pending_payment", "paid", "confirmed", "in_transit", "delivered", "completed", "cancelled"];
501
+ type BaleOrderStatus = typeof BALE_ORDER_STATUSES[number];
502
+ type BaleFulfillment = 'pickup' | 'courier';
503
+ interface BaleOrder {
504
+ id: string;
505
+ bale_id: string;
506
+ buyer_id: string;
507
+ seller_id: string;
508
+ store_id: string;
509
+ title: string;
510
+ grade: string;
511
+ origin: string | null;
512
+ image_url: string | null;
513
+ qty: number;
514
+ unit_kes: number;
515
+ total_kes: number;
516
+ fulfillment: BaleFulfillment;
517
+ freight_kes: number | null;
518
+ status: BaleOrderStatus;
519
+ city_id: string | null;
520
+ buyer_name: string | null;
521
+ store_name: string | null;
522
+ created_at: string;
523
+ }
524
+ interface BaleOrderEvent {
525
+ actor: string;
526
+ old_status: string | null;
527
+ new_status: string;
528
+ note: string | null;
529
+ created_at: string;
530
+ }
531
+ interface CreateBaleOrderInput {
532
+ bale_id: string;
533
+ qty?: number;
534
+ fulfillment: BaleFulfillment;
535
+ }
536
+
407
537
  interface StkPushInput {
408
538
  order_id: string;
409
539
  phone: string;
@@ -429,6 +559,42 @@ interface PaymentStatusResponse {
429
559
  status: PaymentStatus;
430
560
  total: number;
431
561
  }
562
+ type PaymentProvider = 'daraja' | 'intasend' | 'paystack' | 'airtel';
563
+ type PaymentAttemptStatus = 'initiated' | 'funded' | 'failed' | 'refunded' | 'cancelled';
564
+ type CheckoutStatus = 'pending' | 'paid' | 'failed' | 'cancelled' | 'refunded';
565
+ type CheckoutOrder = {
566
+ type: 'retail';
567
+ status: OrderStatus;
568
+ } | {
569
+ type: 'bale';
570
+ status: BaleOrderStatus;
571
+ };
572
+ interface CheckoutStatusResponse {
573
+ version: 1;
574
+ order_id: string;
575
+ order: CheckoutOrder;
576
+ checkout_status: CheckoutStatus;
577
+ terminal: boolean;
578
+ retryable: boolean;
579
+ amount: {
580
+ currency: 'KES';
581
+ minor_units: number;
582
+ };
583
+ latest_attempt: {
584
+ id: string;
585
+ sequence: number;
586
+ provider: PaymentProvider;
587
+ status: PaymentAttemptStatus;
588
+ terminal: boolean;
589
+ created_at: string;
590
+ updated_at: string;
591
+ } | null;
592
+ attempt_count: number;
593
+ order_updated_at: string;
594
+ status_updated_at: string;
595
+ server_time: string;
596
+ poll_after_ms: number;
597
+ }
432
598
 
433
599
  interface VAZIOutfitItem {
434
600
  id: string;
@@ -1040,134 +1206,6 @@ interface DisputeListParams {
1040
1206
  page?: number;
1041
1207
  }
1042
1208
 
1043
- type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
1044
- type BaleType = 'original' | 'sorted';
1045
- interface WholesaleStore {
1046
- id: string;
1047
- name: string;
1048
- slug: string;
1049
- tagline: string | null;
1050
- description: string | null;
1051
- logo_url: string | null;
1052
- origins: string[];
1053
- verified: boolean;
1054
- }
1055
- interface WholesaleDepot {
1056
- id: string;
1057
- name: string;
1058
- address: string | null;
1059
- city_id: string | null;
1060
- is_primary: boolean;
1061
- }
1062
- interface Bale {
1063
- id: string;
1064
- store_id: string;
1065
- seller_id: string;
1066
- title: string;
1067
- category: string;
1068
- grade: BaleGrade;
1069
- bale_type: BaleType;
1070
- weight_kg: number;
1071
- origin: string | null;
1072
- est_pieces: number | null;
1073
- price_kes: number;
1074
- moq: number;
1075
- mix: string | null;
1076
- description: string | null;
1077
- city_id: string | null;
1078
- status: 'draft' | 'active' | 'sold_out';
1079
- created_at: string;
1080
- }
1081
- interface BaleDetail extends Bale {
1082
- images: string[];
1083
- store: {
1084
- name: string;
1085
- slug: string;
1086
- verified: boolean;
1087
- sti: number | null;
1088
- };
1089
- }
1090
- interface CreateBaleInput {
1091
- title: string;
1092
- category: string;
1093
- grade: BaleGrade;
1094
- bale_type?: BaleType;
1095
- weight_kg: number;
1096
- origin?: string;
1097
- est_pieces?: number;
1098
- price_kes: number;
1099
- moq?: number;
1100
- mix?: string;
1101
- description?: string;
1102
- city_id?: string;
1103
- status?: 'draft' | 'active' | 'sold_out';
1104
- }
1105
- interface WholesaleFeedParams {
1106
- q?: string;
1107
- category?: string;
1108
- grade?: BaleGrade;
1109
- origin?: string;
1110
- city_id?: string;
1111
- limit?: number;
1112
- offset?: number;
1113
- }
1114
- interface BaleFeedItem extends Bale {
1115
- image_url: string | null;
1116
- store: {
1117
- name: string;
1118
- slug: string;
1119
- verified: boolean;
1120
- sti: number | null;
1121
- };
1122
- }
1123
- interface SaveWholesaleStoreInput {
1124
- name: string;
1125
- tagline?: string;
1126
- description?: string;
1127
- logo_url?: string;
1128
- origins?: string[];
1129
- }
1130
- interface AddDepotInput {
1131
- name: string;
1132
- address?: string;
1133
- city_id?: string;
1134
- is_primary?: boolean;
1135
- }
1136
- declare const BALE_ORDER_STATUSES: readonly ["pending_payment", "paid", "confirmed", "in_transit", "delivered", "completed", "cancelled"];
1137
- type BaleOrderStatus = typeof BALE_ORDER_STATUSES[number];
1138
- type BaleFulfillment = 'pickup' | 'courier';
1139
- interface BaleOrder {
1140
- id: string;
1141
- bale_id: string;
1142
- buyer_id: string;
1143
- seller_id: string;
1144
- store_id: string;
1145
- title: string;
1146
- grade: string;
1147
- origin: string | null;
1148
- image_url: string | null;
1149
- qty: number;
1150
- unit_kes: number;
1151
- total_kes: number;
1152
- fulfillment: BaleFulfillment;
1153
- freight_kes: number | null;
1154
- status: BaleOrderStatus;
1155
- city_id: string | null;
1156
- created_at: string;
1157
- }
1158
- interface BaleOrderEvent {
1159
- actor: string;
1160
- old_status: string | null;
1161
- new_status: string;
1162
- note: string | null;
1163
- created_at: string;
1164
- }
1165
- interface CreateBaleOrderInput {
1166
- bale_id: string;
1167
- qty?: number;
1168
- fulfillment: BaleFulfillment;
1169
- }
1170
-
1171
1209
  interface MitumbaClientConfig {
1172
1210
  baseUrl: string;
1173
1211
  debug?: boolean;
@@ -1602,8 +1640,15 @@ declare class PayModule {
1602
1640
  initPaystack(input: PaystackInput, options?: RequestOptions): Promise<PaystackInitResponse>;
1603
1641
  /**
1604
1642
  * Poll for the current status of a payment by its order ID.
1643
+ *
1644
+ * @deprecated Use {@link getCheckoutStatus} for the typed checkout lifecycle.
1645
+ * This method retains its legacy route and response for compatibility.
1605
1646
  */
1606
1647
  getStatus(orderId: string, options?: RequestOptions): Promise<PaymentStatusResponse>;
1648
+ /**
1649
+ * Get the buyer-visible checkout lifecycle for a retail or bale order.
1650
+ */
1651
+ getCheckoutStatus(orderId: string, options?: RequestOptions): Promise<CheckoutStatusResponse>;
1607
1652
  }
1608
1653
 
1609
1654
  declare class VaziModule {
@@ -2397,4 +2442,4 @@ declare class MitumbaClient {
2397
2442
  isAuthenticated(): Promise<boolean>;
2398
2443
  }
2399
2444
 
2400
- export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };
2445
+ export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutOrder, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };
package/dist/index.js CHANGED
@@ -727,10 +727,19 @@ var PayModule = class {
727
727
  }
728
728
  /**
729
729
  * Poll for the current status of a payment by its order ID.
730
+ *
731
+ * @deprecated Use {@link getCheckoutStatus} for the typed checkout lifecycle.
732
+ * This method retains its legacy route and response for compatibility.
730
733
  */
731
734
  async getStatus(orderId, options) {
732
735
  return this.client.get(`/pay/status/${orderId}`, void 0, options);
733
736
  }
737
+ /**
738
+ * Get the buyer-visible checkout lifecycle for a retail or bale order.
739
+ */
740
+ async getCheckoutStatus(orderId, options) {
741
+ return this.client.get(`/pay/checkout-status/${orderId}`, void 0, options);
742
+ }
734
743
  };
735
744
 
736
745
  // src/modules/vazi.ts