merchi_sdk_ts 0.0.1
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/.babelrc +13 -0
- package/.eslintrc.cjs +43 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/jest.config.js +17 -0
- package/package.json +44 -0
- package/src/constants/auto_assign_production_on_actions.ts +6 -0
- package/src/constants/call_to_actions.test.ts +5 -0
- package/src/constants/call_to_actions.ts +14 -0
- package/src/constants/discount_types.test.ts +5 -0
- package/src/constants/discount_types.ts +3 -0
- package/src/constants/domain_types.test.ts +5 -0
- package/src/constants/domain_types.ts +12 -0
- package/src/constants/errors.ts +32 -0
- package/src/constants/event_types.test.ts +5 -0
- package/src/constants/event_types.ts +5 -0
- package/src/constants/field_types.test.ts +5 -0
- package/src/constants/field_types.ts +13 -0
- package/src/constants/input_types.test.ts +5 -0
- package/src/constants/input_types.ts +13 -0
- package/src/constants/inventory_status.test.ts +5 -0
- package/src/constants/inventory_statuses.ts +6 -0
- package/src/constants/invoice_types.test.ts +5 -0
- package/src/constants/invoice_types.ts +5 -0
- package/src/constants/item_types.test.ts +5 -0
- package/src/constants/item_types.ts +5 -0
- package/src/constants/job/drafting_status.test.ts +5 -0
- package/src/constants/job/drafting_status.ts +7 -0
- package/src/constants/job/payment_status.test.ts +5 -0
- package/src/constants/job/payment_status.ts +7 -0
- package/src/constants/job/production_status.test.ts +5 -0
- package/src/constants/job/production_status.ts +12 -0
- package/src/constants/job/shipment_status.test.ts +5 -0
- package/src/constants/job/shipment_status.ts +11 -0
- package/src/constants/job/supply_chain_request_status.test.ts +5 -0
- package/src/constants/job/supply_chain_request_status.ts +6 -0
- package/src/constants/job_priorities.test.ts +5 -0
- package/src/constants/job_priorities.ts +6 -0
- package/src/constants/job_status.test.ts +5 -0
- package/src/constants/job_status.ts +49 -0
- package/src/constants/job_types.test.ts +5 -0
- package/src/constants/job_types.ts +15 -0
- package/src/constants/notification_sections.test.ts +5 -0
- package/src/constants/notification_sections.ts +13 -0
- package/src/constants/notification_types.test.ts +5 -0
- package/src/constants/notification_types.ts +97 -0
- package/src/constants/notification_urgencies.test.ts +5 -0
- package/src/constants/notification_urgencies.ts +7 -0
- package/src/constants/payment_types.test.ts +5 -0
- package/src/constants/payment_types.ts +10 -0
- package/src/constants/platform.test.ts +15 -0
- package/src/constants/platform.ts +6 -0
- package/src/constants/product_types.test.ts +6 -0
- package/src/constants/product_types.ts +25 -0
- package/src/constants/rights.test.ts +5 -0
- package/src/constants/rights.ts +5 -0
- package/src/constants/robots_meta_directives.test.ts +5 -0
- package/src/constants/robots_meta_directives.ts +11 -0
- package/src/constants/roles.test.ts +5 -0
- package/src/constants/roles.ts +38 -0
- package/src/constants/shipment_companies.test.ts +5 -0
- package/src/constants/shipment_companies.ts +18 -0
- package/src/constants/shipment_services.test.ts +5 -0
- package/src/constants/shipment_services.ts +3 -0
- package/src/constants/system_roles.test.ts +5 -0
- package/src/constants/system_roles.ts +3 -0
- package/src/constants/theme_foundations.test.ts +5 -0
- package/src/constants/theme_foundations.ts +6 -0
- package/src/constants/theme_status.test.ts +5 -0
- package/src/constants/theme_status.ts +5 -0
- package/src/constants/user_types.test.ts +5 -0
- package/src/constants/user_types.ts +17 -0
- package/src/constants/white_label_accessibilities.test.ts +5 -0
- package/src/constants/white_label_accessibilities.ts +6 -0
- package/src/cookie.test.ts +11 -0
- package/src/cookie.ts +16 -0
- package/src/entities/address.test.ts +7 -0
- package/src/entities/address.ts +65 -0
- package/src/entities/assignment.test.ts +39 -0
- package/src/entities/assignment.ts +92 -0
- package/src/entities/automatic_payment_relationship.test.ts +8 -0
- package/src/entities/automatic_payment_relationship.ts +26 -0
- package/src/entities/backup.test.ts +7 -0
- package/src/entities/backup.ts +14 -0
- package/src/entities/bank.test.ts +7 -0
- package/src/entities/bank.ts +45 -0
- package/src/entities/cart.test.ts +50 -0
- package/src/entities/cart.ts +89 -0
- package/src/entities/cart_item.test.ts +33 -0
- package/src/entities/cart_item.ts +77 -0
- package/src/entities/cart_shipment_group.ts +21 -0
- package/src/entities/cart_shipment_quote.ts +33 -0
- package/src/entities/category.test.ts +57 -0
- package/src/entities/category.ts +37 -0
- package/src/entities/company.test.ts +7 -0
- package/src/entities/company.ts +275 -0
- package/src/entities/company_invitation.test.ts +7 -0
- package/src/entities/company_invitation.ts +33 -0
- package/src/entities/component.test.ts +14 -0
- package/src/entities/component.ts +92 -0
- package/src/entities/component_tag.test.ts +7 -0
- package/src/entities/component_tag.ts +17 -0
- package/src/entities/component_version.test.ts +7 -0
- package/src/entities/component_version.ts +30 -0
- package/src/entities/country_tax.test.ts +13 -0
- package/src/entities/country_tax.ts +46 -0
- package/src/entities/discount.test.ts +18 -0
- package/src/entities/discount.ts +34 -0
- package/src/entities/discount_group.test.ts +7 -0
- package/src/entities/discount_group.ts +28 -0
- package/src/entities/domain.test.ts +79 -0
- package/src/entities/domain.ts +246 -0
- package/src/entities/domain_invitation.test.ts +7 -0
- package/src/entities/domain_invitation.ts +36 -0
- package/src/entities/domain_tag.test.ts +7 -0
- package/src/entities/domain_tag.ts +42 -0
- package/src/entities/draft.test.ts +43 -0
- package/src/entities/draft.ts +88 -0
- package/src/entities/draft_comment.test.ts +7 -0
- package/src/entities/draft_comment.ts +54 -0
- package/src/entities/draft_template.test.ts +7 -0
- package/src/entities/draft_template.ts +40 -0
- package/src/entities/email_address.test.ts +7 -0
- package/src/entities/email_address.ts +24 -0
- package/src/entities/email_counter.test.ts +7 -0
- package/src/entities/email_counter.ts +20 -0
- package/src/entities/enrolled_domain.test.ts +7 -0
- package/src/entities/enrolled_domain.ts +40 -0
- package/src/entities/exchange_rate.test.ts +7 -0
- package/src/entities/exchange_rate.ts +22 -0
- package/src/entities/file.test.ts +43 -0
- package/src/entities/file.ts +172 -0
- package/src/entities/internal_tag.test.ts +7 -0
- package/src/entities/internal_tag.ts +51 -0
- package/src/entities/inventory.test.ts +28 -0
- package/src/entities/inventory.ts +56 -0
- package/src/entities/inventory_unit_variation.test.ts +7 -0
- package/src/entities/inventory_unit_variation.ts +29 -0
- package/src/entities/invoice.test.ts +43 -0
- package/src/entities/invoice.ts +179 -0
- package/src/entities/item.test.ts +19 -0
- package/src/entities/item.ts +44 -0
- package/src/entities/job.test.ts +95 -0
- package/src/entities/job.ts +349 -0
- package/src/entities/job_comment.test.ts +7 -0
- package/src/entities/job_comment.ts +50 -0
- package/src/entities/matching_inventory.ts +29 -0
- package/src/entities/menu.test.ts +7 -0
- package/src/entities/menu.ts +30 -0
- package/src/entities/menu_item.test.ts +7 -0
- package/src/entities/menu_item.ts +29 -0
- package/src/entities/notification.test.ts +7 -0
- package/src/entities/notification.ts +99 -0
- package/src/entities/page.test.ts +7 -0
- package/src/entities/page.ts +32 -0
- package/src/entities/payment.test.ts +19 -0
- package/src/entities/payment.ts +65 -0
- package/src/entities/payment_device.test.ts +7 -0
- package/src/entities/payment_device.ts +30 -0
- package/src/entities/phone_number.test.ts +7 -0
- package/src/entities/phone_number.ts +36 -0
- package/src/entities/product.test.ts +750 -0
- package/src/entities/product.ts +427 -0
- package/src/entities/production_comment.test.ts +7 -0
- package/src/entities/production_comment.ts +50 -0
- package/src/entities/quote.test.ts +98 -0
- package/src/entities/quote.ts +140 -0
- package/src/entities/quote_item.test.ts +50 -0
- package/src/entities/quote_item.ts +71 -0
- package/src/entities/seo_domain_page.test.ts +7 -0
- package/src/entities/seo_domain_page.ts +33 -0
- package/src/entities/session.test.ts +7 -0
- package/src/entities/session.ts +28 -0
- package/src/entities/shipment.test.ts +24 -0
- package/src/entities/shipment.ts +185 -0
- package/src/entities/shipment_item.test.ts +7 -0
- package/src/entities/shipment_item.ts +15 -0
- package/src/entities/shipment_item_fulfillment.test.ts +8 -0
- package/src/entities/shipment_item_fulfillment.ts +15 -0
- package/src/entities/shipment_method.test.ts +7 -0
- package/src/entities/shipment_method.ts +61 -0
- package/src/entities/shipment_method_variation.test.ts +7 -0
- package/src/entities/shipment_method_variation.ts +39 -0
- package/src/entities/short_url.test.ts +7 -0
- package/src/entities/short_url.ts +36 -0
- package/src/entities/subscription_plan.test.ts +7 -0
- package/src/entities/subscription_plan.ts +73 -0
- package/src/entities/supply_domain.test.ts +7 -0
- package/src/entities/supply_domain.ts +27 -0
- package/src/entities/system_role.test.ts +7 -0
- package/src/entities/system_role.ts +17 -0
- package/src/entities/theme.test.ts +38 -0
- package/src/entities/theme.ts +267 -0
- package/src/entities/theme_css_setting.test.ts +7 -0
- package/src/entities/theme_css_setting.ts +23 -0
- package/src/entities/user.test.ts +154 -0
- package/src/entities/user.ts +394 -0
- package/src/entities/user_company.test.ts +7 -0
- package/src/entities/user_company.ts +27 -0
- package/src/entities/variation.test.ts +7 -0
- package/src/entities/variation.ts +61 -0
- package/src/entities/variation_field.test.ts +76 -0
- package/src/entities/variation_field.ts +169 -0
- package/src/entities/variation_fields_option.test.ts +46 -0
- package/src/entities/variation_fields_option.ts +95 -0
- package/src/entities/variation_option.test.ts +7 -0
- package/src/entities/variation_option.ts +52 -0
- package/src/entities/variations_group.test.ts +7 -0
- package/src/entities/variations_group.ts +41 -0
- package/src/entity.ts +1002 -0
- package/src/merchi.test.ts +25 -0
- package/src/merchi.ts +379 -0
- package/src/request.test.ts +43 -0
- package/src/request.ts +124 -0
- package/src/test_util.ts +18 -0
- package/src/toasts.test.ts +38 -0
- package/src/toasts.ts +34 -0
- package/src/util/float.ts +12 -0
- package/src/util/query_string.test.ts +7 -0
- package/src/util/query_string.ts +11 -0
- package/src/util/validation.test.ts +16 -0
- package/src/util/validation.ts +2 -0
- package/src/uuid.test.ts +15 -0
- package/src/uuid.ts +8 -0
- package/tsconfig.json +23 -0
- package/webpack.config.cjs +27 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Invoice } from './invoice';
|
|
3
|
+
import { User } from './user';
|
|
4
|
+
import { AutomaticPaymentRelationship } from './automatic_payment_relationship';
|
|
5
|
+
import { RequestOptions } from '../request';
|
|
6
|
+
|
|
7
|
+
export class Payment extends Entity {
|
|
8
|
+
protected static resourceName = 'payments';
|
|
9
|
+
protected static singularName = 'payment';
|
|
10
|
+
protected static pluralName = 'payments';
|
|
11
|
+
|
|
12
|
+
@Payment.property({ type: Date })
|
|
13
|
+
public archived?: Date | null;
|
|
14
|
+
|
|
15
|
+
@Payment.property()
|
|
16
|
+
public id?: number;
|
|
17
|
+
|
|
18
|
+
@Payment.property()
|
|
19
|
+
public payDate?: Date;
|
|
20
|
+
|
|
21
|
+
@Payment.property()
|
|
22
|
+
public paymentType?: number;
|
|
23
|
+
|
|
24
|
+
@Payment.property()
|
|
25
|
+
public note?: string;
|
|
26
|
+
|
|
27
|
+
@Payment.property()
|
|
28
|
+
public amount?: number;
|
|
29
|
+
|
|
30
|
+
@Payment.property()
|
|
31
|
+
public autoRefundable?: boolean;
|
|
32
|
+
|
|
33
|
+
@Payment.property({ type: Date })
|
|
34
|
+
public refunded?: Date | null;
|
|
35
|
+
|
|
36
|
+
@Payment.property()
|
|
37
|
+
public sendSms?: boolean;
|
|
38
|
+
|
|
39
|
+
@Payment.property()
|
|
40
|
+
public sendEmail?: boolean;
|
|
41
|
+
|
|
42
|
+
@Payment.property({ type: Invoice })
|
|
43
|
+
public invoice?: Invoice | null;
|
|
44
|
+
|
|
45
|
+
@Payment.property({ type: User })
|
|
46
|
+
public paymentRecorder?: User | null;
|
|
47
|
+
|
|
48
|
+
@Payment.property({ type: User })
|
|
49
|
+
public refundIssuer?: User | null;
|
|
50
|
+
|
|
51
|
+
@Payment.property({ type: AutomaticPaymentRelationship })
|
|
52
|
+
public chargedByPaymentRelationship?: AutomaticPaymentRelationship | null;
|
|
53
|
+
|
|
54
|
+
public refund = () => {
|
|
55
|
+
const resource = `/payments/${this.id}/refund/`;
|
|
56
|
+
const fetchOptions: RequestOptions = { method: 'POST' };
|
|
57
|
+
|
|
58
|
+
return this.merchi
|
|
59
|
+
.authenticatedFetch(resource, fetchOptions)
|
|
60
|
+
.then((data: any) => {
|
|
61
|
+
this.fromJson(data);
|
|
62
|
+
return this;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Company } from './company';
|
|
3
|
+
|
|
4
|
+
export class PaymentDevice extends Entity {
|
|
5
|
+
protected static resourceName = 'payment_devices';
|
|
6
|
+
protected static singularName = 'paymentDevice';
|
|
7
|
+
protected static pluralName = 'paymentDevices';
|
|
8
|
+
|
|
9
|
+
@PaymentDevice.property({type: Date})
|
|
10
|
+
public archived?: Date | null;
|
|
11
|
+
|
|
12
|
+
@PaymentDevice.property()
|
|
13
|
+
public id?: number;
|
|
14
|
+
|
|
15
|
+
@PaymentDevice.property({type: String})
|
|
16
|
+
public code?: string;
|
|
17
|
+
|
|
18
|
+
@PaymentDevice.property({type: String})
|
|
19
|
+
public deviceId?: string;
|
|
20
|
+
|
|
21
|
+
@PaymentDevice.property({type: String})
|
|
22
|
+
public squareId?: string;
|
|
23
|
+
|
|
24
|
+
@PaymentDevice.property({type: String})
|
|
25
|
+
public deviceData?: string;
|
|
26
|
+
|
|
27
|
+
@PaymentDevice.property({type: Company})
|
|
28
|
+
public company?: Company | null;
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Company } from './company';
|
|
2
|
+
import { Entity } from '../entity';
|
|
3
|
+
import { User } from './user';
|
|
4
|
+
|
|
5
|
+
export class PhoneNumber extends Entity {
|
|
6
|
+
protected static resourceName = 'phone_numbers';
|
|
7
|
+
protected static singularName = 'phoneNumber';
|
|
8
|
+
protected static pluralName = 'phoneNumbers';
|
|
9
|
+
|
|
10
|
+
@PhoneNumber.property({type: Date})
|
|
11
|
+
public archived?: Date | null;
|
|
12
|
+
|
|
13
|
+
@PhoneNumber.property()
|
|
14
|
+
public id?: number;
|
|
15
|
+
|
|
16
|
+
@PhoneNumber.property()
|
|
17
|
+
public number?: string;
|
|
18
|
+
|
|
19
|
+
@PhoneNumber.property()
|
|
20
|
+
public code?: string;
|
|
21
|
+
|
|
22
|
+
@PhoneNumber.property({arrayType: 'User'})
|
|
23
|
+
public users?: User[];
|
|
24
|
+
|
|
25
|
+
@PhoneNumber.property({arrayType: 'Company'})
|
|
26
|
+
public companies?: Company[];
|
|
27
|
+
|
|
28
|
+
@PhoneNumber.property({arrayType: 'Company'})
|
|
29
|
+
public paymentCompanies?: Company[];
|
|
30
|
+
|
|
31
|
+
@PhoneNumber.property({embeddedByDefault: false})
|
|
32
|
+
public localFormatNumber?: string;
|
|
33
|
+
|
|
34
|
+
@PhoneNumber.property({embeddedByDefault: false})
|
|
35
|
+
public internationalFormatNumber?: string;
|
|
36
|
+
}
|