wabe 0.5.11 → 0.5.13

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
@@ -1190,19 +1190,42 @@ export type CreatePromotionCodeOptions = {
1190
1190
  active?: boolean;
1191
1191
  maxRedemptions?: number;
1192
1192
  };
1193
+ export type DeleteCouponOptions = {
1194
+ id: string;
1195
+ };
1196
+ export type UpdatePromotionCodeOptions = {
1197
+ id: string;
1198
+ active: boolean;
1199
+ };
1193
1200
  export interface PaymentAdapter {
1201
+ /**
1202
+ * Delete a coupon
1203
+ * @param options DeleteCouponOptions
1204
+ */
1205
+ deleteCoupon: (options: DeleteCouponOptions) => Promise<void>;
1194
1206
  /**
1195
1207
  * Create a coupon
1196
1208
  * @param options CreateCouponOptions
1197
1209
  * @returns id The coupon id
1198
1210
  */
1199
- createCoupon: (options: CreateCouponOptions) => Promise<string>;
1211
+ createCoupon: (options: CreateCouponOptions) => Promise<{
1212
+ code: string;
1213
+ id: string;
1214
+ }>;
1215
+ /**
1216
+ * Disable a promotion code
1217
+ * @param options DeletePromotionCodeOptions
1218
+ */
1219
+ updatePromotionCode: (options: UpdatePromotionCodeOptions) => Promise<void>;
1200
1220
  /**
1201
1221
  * Create a promotion code from a coupon
1202
1222
  * @param options CreatePromotionCodeOptions
1203
- * @returns code The promotion code
1223
+ * @returns code, id The promotion code and the stripe id
1204
1224
  */
1205
- createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<string>;
1225
+ createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<{
1226
+ id: string;
1227
+ code: string;
1228
+ }>;
1206
1229
  /**
1207
1230
  * Get a customer by id
1208
1231
  * @param id The customer id
@@ -1262,8 +1285,16 @@ declare class PaymentController implements PaymentAdapter {
1262
1285
  private adapter;
1263
1286
  private config;
1264
1287
  constructor(paymentConfig: PaymentConfig);
1265
- createCoupon(options: CreateCouponOptions): Promise<string>;
1266
- createPromotionCode(options: CreatePromotionCodeOptions): Promise<string>;
1288
+ deleteCoupon(options: DeleteCouponOptions): Promise<void>;
1289
+ updatePromotionCode(options: UpdatePromotionCodeOptions): Promise<void>;
1290
+ createCoupon(options: CreateCouponOptions): Promise<{
1291
+ code: string;
1292
+ id: string;
1293
+ }>;
1294
+ createPromotionCode(options: CreatePromotionCodeOptions): Promise<{
1295
+ id: string;
1296
+ code: string;
1297
+ }>;
1267
1298
  getCustomerById(options: GetCustomerByIdOptions): Promise<{
1268
1299
  email: string | null;
1269
1300
  }>;
@@ -1406,8 +1437,16 @@ export declare class PaymentDevAdapter implements PaymentAdapter {
1406
1437
  getCustomerById(): Promise<{
1407
1438
  email: string;
1408
1439
  }>;
1409
- createCoupon(): Promise<string>;
1410
- createPromotionCode(): Promise<string>;
1440
+ deleteCoupon(): Promise<void>;
1441
+ updatePromotionCode(): Promise<void>;
1442
+ createCoupon(): Promise<{
1443
+ code: string;
1444
+ id: string;
1445
+ }>;
1446
+ createPromotionCode(): Promise<{
1447
+ code: string;
1448
+ id: string;
1449
+ }>;
1411
1450
  validateWebhook(): Promise<{
1412
1451
  isValid: boolean;
1413
1452
  payload: {};
package/dist/index.js CHANGED
@@ -61414,11 +61414,15 @@ class PaymentDevAdapter {
61414
61414
  email: "customer@test.com"
61415
61415
  };
61416
61416
  }
61417
+ async deleteCoupon() {
61418
+ }
61419
+ async updatePromotionCode() {
61420
+ }
61417
61421
  async createCoupon() {
61418
- return "";
61422
+ return { code: "", id: "" };
61419
61423
  }
61420
61424
  async createPromotionCode() {
61421
- return "";
61425
+ return { code: "", id: "" };
61422
61426
  }
61423
61427
  async validateWebhook() {
61424
61428
  return { isValid: true, payload: {}, type: "" };
@@ -75667,6 +75671,12 @@ class PaymentController {
75667
75671
  this.adapter = paymentConfig.adapter;
75668
75672
  this.config = paymentConfig;
75669
75673
  }
75674
+ deleteCoupon(options) {
75675
+ return this.adapter.deleteCoupon(options);
75676
+ }
75677
+ updatePromotionCode(options) {
75678
+ return this.adapter.updatePromotionCode(options);
75679
+ }
75670
75680
  createCoupon(options) {
75671
75681
  return this.adapter.createCoupon(options);
75672
75682
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wabe",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "Your backend in minutes not days",
5
5
  "homepage": "https://wabe.dev",
6
6
  "author": {