Skip to content

Commit aaf2fee

Browse files
authored
Merge pull request #47 from Foxy/bugfix/rumour-and-typedefs
fix: rumour and typedefs
2 parents 50e2c17 + 8763e5c commit aaf2fee

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

src/backend/Graph/coupon.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Attributes } from './attributes';
12
import type { CouponCodes } from './coupon_codes';
23
import type { CouponItemCategories } from './coupon_item_categories';
34
import type { GenerateCodes } from './generate_codes';
@@ -12,6 +13,8 @@ export interface Coupon extends Graph {
1213
'self': Coupon;
1314
/** Store this coupon belongs to. */
1415
'fx:store': Store;
16+
/** Attributes linked to this coupon. */
17+
'fx:attributes': Attributes;
1518
/** Codes linked to this coupon. */
1619
'fx:coupon_codes': CouponCodes;
1720
/** POST here to generate random coupon codes. */
@@ -57,6 +60,12 @@ export interface Coupon extends Graph {
5760
customer_attribute_restrictions: string;
5861
/** Auto-apply coupons only. This coupon will be automatically applied when a subscription includes a product with one of the codes in the list. Wildcards are allowed just like in product code restrictions. Example: `code_1,code_2,sku_*,abc`. */
5962
customer_subscription_restrictions: string;
63+
/** This restricts the usage of a coupon code based on an item's `item_option` key and value. Valid input is a json object with the keys matching the `item_option.name`, and the value an array of comma-separated matching or partially matching strings, using `*` as a wild card at the beginning, end, or middle of the string. So `{"author": ["Agatha*", "*brown"]}` will match the item where item option "author" is "Agatha Christie" or "Dan Brown". It would not match an item with no "author" option, or with an "author" of "John Doe". Optional. 6000 characters or less. */
64+
item_option_restrictions: null | Record<string, string[]>;
65+
/** Enables sharing coupon codes between coupons. */
66+
shared_codes_allowed: boolean;
67+
/** This param is using for coupon calculation amount for tax inclusive mode. Optional. [0..1]. */
68+
inclusive_tax_rate: number;
6069
/** The date this resource was created. */
6170
date_created: string | null;
6271
/** The date this resource was last modified. */

src/backend/Graph/customer_portal_settings.d.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,9 @@ export interface CustomerPortalSettings extends Graph {
7676
date_created: string | null;
7777
/** The date this resource was last modified. */
7878
date_modified: string | null;
79-
} & (
80-
| {
81-
/** Shared secret key. */
82-
jwtSharedSecret: string;
83-
}
84-
| {
85-
/** Private key for JWT signing. */
86-
jwtPrivateKey: string;
87-
}
88-
);
79+
/** Shared secret key. */
80+
jwtSharedSecret: string;
81+
/** Private key for JWT signing, read-only. */
82+
jwtPrivateKey?: string;
83+
};
8984
}

src/backend/Graph/gift_card.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Attributes } from './attributes';
12
import type { GenerateCodes } from './generate_codes';
23
import type { GiftCardCodes } from './gift_card_codes';
34
import type { GiftCardItemCategories } from './gift_card_item_categories';
@@ -12,6 +13,8 @@ export interface GiftCard extends Graph {
1213
'self': GiftCard;
1314
/** Store this gift card is assigned to. */
1415
'fx:store': Store;
16+
/** Attributes linked to this gift card. */
17+
'fx:attributes': Attributes;
1518
/** POST here to generate random gift card codes. */
1619
'fx:generate_codes': GenerateCodes;
1720
/** Collection of codes for this gift card. */

src/backend/Graph/gift_card_code.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface GiftCardCode extends Graph {
3030
end_date: string | null;
3131
/** Current balance on the gift card. Decimal. Required. */
3232
current_balance: number;
33+
/** PATCH-only: use this field to link this gift card code to a customer. */
34+
customer_id?: number | string;
3335
/** The date this resource was created. Readonly. */
3436
date_created: string | null;
3537
/** The date this resource was last modified. Readonly. */

src/core/Rumour/Rumour.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class Rumour {
126126
if (!Rumour.__isResource(value) || Rumour.__isCollection(value)) return patch;
127127

128128
const props = traverse(value).map(function () {
129-
if (this.key?.startsWith('_')) this.delete(true);
129+
if (this.key === '_embedded') return this.delete(true);
130130
});
131131

132132
patch.set(value._links.self.href, props);

0 commit comments

Comments
 (0)