wabe 0.5.10 → 0.5.12

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
@@ -1132,6 +1132,8 @@ export type CreatePaymentOptions = {
1132
1132
  cancelUrl: string;
1133
1133
  automaticTax?: boolean;
1134
1134
  recurringInterval?: "month" | "year";
1135
+ createInvoice?: boolean;
1136
+ allowPromotionCode?: boolean;
1135
1137
  };
1136
1138
  export type InitWebhookOptions = {
1137
1139
  webhookUrl: string;
@@ -1173,7 +1175,51 @@ export type InitWebhookOutput = {
1173
1175
  webhookId: string;
1174
1176
  endpointSecret: string;
1175
1177
  };
1178
+ export type CreateCouponOptions = {
1179
+ amountOff?: number;
1180
+ currency?: Currency$1;
1181
+ duration?: "forever" | "once" | "repeating";
1182
+ durationInMonths?: number;
1183
+ name?: string;
1184
+ percentOff?: number;
1185
+ maxRedemptions?: number;
1186
+ };
1187
+ export type CreatePromotionCodeOptions = {
1188
+ couponId: string;
1189
+ code?: string;
1190
+ active?: boolean;
1191
+ maxRedemptions?: number;
1192
+ };
1193
+ export type DeleteCouponOptions = {
1194
+ id: string;
1195
+ };
1196
+ export type UpdatePromotionCodeOptions = {
1197
+ id: string;
1198
+ active: boolean;
1199
+ };
1176
1200
  export interface PaymentAdapter {
1201
+ /**
1202
+ * Delete a coupon
1203
+ * @param options DeleteCouponOptions
1204
+ */
1205
+ deleteCoupon: (options: DeleteCouponOptions) => Promise<void>;
1206
+ /**
1207
+ * Create a coupon
1208
+ * @param options CreateCouponOptions
1209
+ * @returns id The coupon id
1210
+ */
1211
+ createCoupon: (options: CreateCouponOptions) => Promise<string>;
1212
+ /**
1213
+ * Disable a promotion code
1214
+ * @param options DeletePromotionCodeOptions
1215
+ */
1216
+ updatePromotionCode: (options: UpdatePromotionCodeOptions) => Promise<void>;
1217
+ /**
1218
+ * Create a promotion code from a coupon
1219
+ * @param options CreatePromotionCodeOptions
1220
+ * @returns code The promotion code
1221
+ */
1222
+ createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<string>;
1177
1223
  /**
1178
1224
  * Get a customer by id
1179
1225
  * @param id The customer id
@@ -1233,6 +1279,10 @@ declare class PaymentController implements PaymentAdapter {
1233
1279
  private adapter;
1234
1280
  private config;
1235
1281
  constructor(paymentConfig: PaymentConfig);
1282
+ deleteCoupon(options: DeleteCouponOptions): Promise<void>;
1283
+ updatePromotionCode(options: UpdatePromotionCodeOptions): Promise<void>;
1284
+ createCoupon(options: CreateCouponOptions): Promise<string>;
1285
+ createPromotionCode(options: CreatePromotionCodeOptions): Promise<string>;
1236
1286
  getCustomerById(options: GetCustomerByIdOptions): Promise<{
1237
1287
  email: string | null;
1238
1288
  }>;
@@ -1375,6 +1425,10 @@ export declare class PaymentDevAdapter implements PaymentAdapter {
1375
1425
  getCustomerById(): Promise<{
1376
1426
  email: string;
1377
1427
  }>;
1428
+ deleteCoupon(): Promise<void>;
1429
+ updatePromotionCode(): Promise<void>;
1430
+ createCoupon(): Promise<string>;
1431
+ createPromotionCode(): Promise<string>;
1378
1432
  validateWebhook(): Promise<{
1379
1433
  isValid: boolean;
1380
1434
  payload: {};
package/dist/index.js CHANGED
@@ -61414,6 +61414,16 @@ class PaymentDevAdapter {
61414
61414
  email: "customer@test.com"
61415
61415
  };
61416
61416
  }
61417
+ async deleteCoupon() {
61418
+ }
61419
+ async updatePromotionCode() {
61420
+ }
61421
+ async createCoupon() {
61422
+ return "";
61423
+ }
61424
+ async createPromotionCode() {
61425
+ return "";
61426
+ }
61417
61427
  async validateWebhook() {
61418
61428
  return { isValid: true, payload: {}, type: "" };
61419
61429
  }
@@ -75661,6 +75671,18 @@ class PaymentController {
75661
75671
  this.adapter = paymentConfig.adapter;
75662
75672
  this.config = paymentConfig;
75663
75673
  }
75674
+ deleteCoupon(options) {
75675
+ return this.adapter.deleteCoupon(options);
75676
+ }
75677
+ updatePromotionCode(options) {
75678
+ return this.adapter.updatePromotionCode(options);
75679
+ }
75680
+ createCoupon(options) {
75681
+ return this.adapter.createCoupon(options);
75682
+ }
75683
+ createPromotionCode(options) {
75684
+ return this.adapter.createPromotionCode(options);
75685
+ }
75664
75686
  getCustomerById(options) {
75665
75687
  return this.adapter.getCustomerById(options);
75666
75688
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wabe",
3
- "version": "0.5.10",
3
+ "version": "0.5.12",
4
4
  "description": "Your backend in minutes not days",
5
5
  "homepage": "https://wabe.dev",
6
6
  "author": {