merchi_sdk_ts 1.34.0 → 1.35.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/RELEASING.md +43 -0
- package/dist/entities/cart.js +4 -0
- package/dist/entities/cart.test.js +6 -0
- package/dist/entities/domain.js +3 -0
- package/dist/entities/domain.test.js +8 -0
- package/dist/entities/invoice.js +4 -0
- package/dist/entities/invoice.test.js +6 -0
- package/dist/entities/payment.js +16 -0
- package/dist/entities/payment.test.js +6 -0
- package/dist/entities/product.js +4 -0
- package/package.json +1 -1
- package/src/entities/cart.test.ts +7 -0
- package/src/entities/cart.ts +3 -0
- package/src/entities/domain.test.ts +11 -0
- package/src/entities/domain.ts +19 -0
- package/src/entities/invoice.test.ts +7 -0
- package/src/entities/invoice.ts +3 -0
- package/src/entities/payment.test.ts +8 -0
- package/src/entities/payment.ts +12 -0
- package/src/entities/product.ts +3 -0
- package/coverage/clover.xml +0 -369
- package/coverage/coverage-final.json +0 -8
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/discount.ts.html +0 -136
- package/coverage/lcov-report/estimate.ts.html +0 -1015
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -206
- package/coverage/lcov-report/index.ts.html +0 -106
- package/coverage/lcov-report/inventory.ts.html +0 -352
- package/coverage/lcov-report/matrix.ts.html +0 -736
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/round.ts.html +0 -166
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/constants/auto_assign_production_on_actions.ts.html +0 -103
- package/coverage/lcov-report/src/constants/call_to_actions.ts.html +0 -127
- package/coverage/lcov-report/src/constants/discount_types.ts.html +0 -100
- package/coverage/lcov-report/src/constants/domain_types.ts.html +0 -121
- package/coverage/lcov-report/src/constants/errors.ts.html +0 -181
- package/coverage/lcov-report/src/constants/event_types.ts.html +0 -100
- package/coverage/lcov-report/src/constants/field_types.ts.html +0 -133
- package/coverage/lcov-report/src/constants/index.html +0 -551
- package/coverage/lcov-report/src/constants/index.ts.html +0 -238
- package/coverage/lcov-report/src/constants/input_types.ts.html +0 -124
- package/coverage/lcov-report/src/constants/inventory_statuses.ts.html +0 -103
- package/coverage/lcov-report/src/constants/invoice_types.ts.html +0 -100
- package/coverage/lcov-report/src/constants/item_types.ts.html +0 -100
- package/coverage/lcov-report/src/constants/job/drafting_status.ts.html +0 -106
- package/coverage/lcov-report/src/constants/job/index.html +0 -176
- package/coverage/lcov-report/src/constants/job/payment_status.ts.html +0 -106
- package/coverage/lcov-report/src/constants/job/production_status.ts.html +0 -121
- package/coverage/lcov-report/src/constants/job/shipment_status.ts.html +0 -118
- package/coverage/lcov-report/src/constants/job/supply_chain_request_status.ts.html +0 -103
- package/coverage/lcov-report/src/constants/job_priorities.ts.html +0 -103
- package/coverage/lcov-report/src/constants/job_status.ts.html +0 -232
- package/coverage/lcov-report/src/constants/job_types.ts.html +0 -133
- package/coverage/lcov-report/src/constants/notification_sections.ts.html +0 -124
- package/coverage/lcov-report/src/constants/notification_types.ts.html +0 -376
- package/coverage/lcov-report/src/constants/notification_urgencies.ts.html +0 -106
- package/coverage/lcov-report/src/constants/payment_types.ts.html +0 -115
- package/coverage/lcov-report/src/constants/platform.ts.html +0 -103
- package/coverage/lcov-report/src/constants/product_types.ts.html +0 -163
- package/coverage/lcov-report/src/constants/rights.ts.html +0 -100
- package/coverage/lcov-report/src/constants/robots_meta_directives.ts.html +0 -118
- package/coverage/lcov-report/src/constants/roles.ts.html +0 -199
- package/coverage/lcov-report/src/constants/shipment_companies.ts.html +0 -142
- package/coverage/lcov-report/src/constants/shipment_services.ts.html +0 -94
- package/coverage/lcov-report/src/constants/system_roles.ts.html +0 -94
- package/coverage/lcov-report/src/constants/theme_foundations.ts.html +0 -103
- package/coverage/lcov-report/src/constants/theme_status.ts.html +0 -100
- package/coverage/lcov-report/src/constants/user_types.ts.html +0 -136
- package/coverage/lcov-report/src/constants/white_label_accessibilities.ts.html +0 -103
- package/coverage/lcov-report/src/cookie.ts.html +0 -133
- package/coverage/lcov-report/src/entities/address.ts.html +0 -280
- package/coverage/lcov-report/src/entities/agent_conversation.ts.html +0 -202
- package/coverage/lcov-report/src/entities/agent_skill.ts.html +0 -382
- package/coverage/lcov-report/src/entities/agent_skill_approval.ts.html +0 -163
- package/coverage/lcov-report/src/entities/agent_skill_version.ts.html +0 -277
- package/coverage/lcov-report/src/entities/agent_token_usage.ts.html +0 -349
- package/coverage/lcov-report/src/entities/assignment.ts.html +0 -382
- package/coverage/lcov-report/src/entities/automatic_payment_relationship.ts.html +0 -172
- package/coverage/lcov-report/src/entities/bank.ts.html +0 -220
- package/coverage/lcov-report/src/entities/cart.ts.html +0 -373
- package/coverage/lcov-report/src/entities/cart_item.ts.html +0 -340
- package/coverage/lcov-report/src/entities/cart_shipment_group.ts.html +0 -148
- package/coverage/lcov-report/src/entities/cart_shipment_quote.ts.html +0 -184
- package/coverage/lcov-report/src/entities/category.ts.html +0 -262
- package/coverage/lcov-report/src/entities/company.ts.html +0 -1258
- package/coverage/lcov-report/src/entities/company_invitation.ts.html +0 -184
- package/coverage/lcov-report/src/entities/component.ts.html +0 -361
- package/coverage/lcov-report/src/entities/component_tag.ts.html +0 -136
- package/coverage/lcov-report/src/entities/component_version.ts.html +0 -175
- package/coverage/lcov-report/src/entities/country_tax.ts.html +0 -223
- package/coverage/lcov-report/src/entities/discount.ts.html +0 -214
- package/coverage/lcov-report/src/entities/discount_group.ts.html +0 -214
- package/coverage/lcov-report/src/entities/domain.ts.html +0 -3274
- package/coverage/lcov-report/src/entities/domain_chat_settings.ts.html +0 -331
- package/coverage/lcov-report/src/entities/domain_invitation.ts.html +0 -193
- package/coverage/lcov-report/src/entities/domain_tag.ts.html +0 -211
- package/coverage/lcov-report/src/entities/draft.ts.html +0 -313
- package/coverage/lcov-report/src/entities/draft_comment.ts.html +0 -265
- package/coverage/lcov-report/src/entities/draft_preview.ts.html +0 -196
- package/coverage/lcov-report/src/entities/draft_preview_layer.ts.html +0 -148
- package/coverage/lcov-report/src/entities/draft_template.ts.html +0 -346
- package/coverage/lcov-report/src/entities/email_address.ts.html +0 -157
- package/coverage/lcov-report/src/entities/email_counter.ts.html +0 -145
- package/coverage/lcov-report/src/entities/enrolled_domain.ts.html +0 -205
- package/coverage/lcov-report/src/entities/exchange_rate.ts.html +0 -151
- package/coverage/lcov-report/src/entities/file.ts.html +0 -580
- package/coverage/lcov-report/src/entities/index.html +0 -1271
- package/coverage/lcov-report/src/entities/internal_tag.ts.html +0 -238
- package/coverage/lcov-report/src/entities/inventory.ts.html +0 -274
- package/coverage/lcov-report/src/entities/inventory_group.ts.html +0 -193
- package/coverage/lcov-report/src/entities/inventory_unit_variation.ts.html +0 -172
- package/coverage/lcov-report/src/entities/invoice.ts.html +0 -643
- package/coverage/lcov-report/src/entities/item.ts.html +0 -262
- package/coverage/lcov-report/src/entities/job.ts.html +0 -1270
- package/coverage/lcov-report/src/entities/job_comment.ts.html +0 -235
- package/coverage/lcov-report/src/entities/job_note.ts.html +0 -205
- package/coverage/lcov-report/src/entities/job_operation_log.ts.html +0 -208
- package/coverage/lcov-report/src/entities/matching_inventory.ts.html +0 -172
- package/coverage/lcov-report/src/entities/menu.ts.html +0 -175
- package/coverage/lcov-report/src/entities/menu_item.ts.html +0 -172
- package/coverage/lcov-report/src/entities/notification.ts.html +0 -403
- package/coverage/lcov-report/src/entities/page.ts.html +0 -181
- package/coverage/lcov-report/src/entities/payment.ts.html +0 -280
- package/coverage/lcov-report/src/entities/payment_device.ts.html +0 -175
- package/coverage/lcov-report/src/entities/phone_number.ts.html +0 -193
- package/coverage/lcov-report/src/entities/product.ts.html +0 -1525
- package/coverage/lcov-report/src/entities/product_form.ts.html +0 -238
- package/coverage/lcov-report/src/entities/product_form_version.ts.html +0 -238
- package/coverage/lcov-report/src/entities/product_review.ts.html +0 -748
- package/coverage/lcov-report/src/entities/production_comment.ts.html +0 -235
- package/coverage/lcov-report/src/entities/quote.ts.html +0 -505
- package/coverage/lcov-report/src/entities/quote_item.ts.html +0 -298
- package/coverage/lcov-report/src/entities/reminder.ts.html +0 -307
- package/coverage/lcov-report/src/entities/seo_domain_page.ts.html +0 -184
- package/coverage/lcov-report/src/entities/session.ts.html +0 -169
- package/coverage/lcov-report/src/entities/shipment.ts.html +0 -664
- package/coverage/lcov-report/src/entities/shipment_item.ts.html +0 -130
- package/coverage/lcov-report/src/entities/shipment_item_fulfillment.ts.html +0 -130
- package/coverage/lcov-report/src/entities/shipment_log.ts.html +0 -196
- package/coverage/lcov-report/src/entities/shipment_method.ts.html +0 -268
- package/coverage/lcov-report/src/entities/shipment_method_variation.ts.html +0 -202
- package/coverage/lcov-report/src/entities/short_url.ts.html +0 -193
- package/coverage/lcov-report/src/entities/subscription_plan.ts.html +0 -304
- package/coverage/lcov-report/src/entities/supply_domain.ts.html +0 -166
- package/coverage/lcov-report/src/entities/support_conversation.ts.html +0 -280
- package/coverage/lcov-report/src/entities/support_message.ts.html +0 -175
- package/coverage/lcov-report/src/entities/system_role.ts.html +0 -136
- package/coverage/lcov-report/src/entities/theme.ts.html +0 -331
- package/coverage/lcov-report/src/entities/theme_css_setting.ts.html +0 -154
- package/coverage/lcov-report/src/entities/user.ts.html +0 -1369
- package/coverage/lcov-report/src/entities/user_company.ts.html +0 -166
- package/coverage/lcov-report/src/entities/variation.ts.html +0 -277
- package/coverage/lcov-report/src/entities/variation_field.ts.html +0 -889
- package/coverage/lcov-report/src/entities/variation_fields_option.ts.html +0 -406
- package/coverage/lcov-report/src/entities/variation_option.ts.html +0 -259
- package/coverage/lcov-report/src/entities/variations_group.ts.html +0 -208
- package/coverage/lcov-report/src/entity.ts.html +0 -3367
- package/coverage/lcov-report/src/index.html +0 -221
- package/coverage/lcov-report/src/index.ts.html +0 -652
- package/coverage/lcov-report/src/merchi.ts.html +0 -1420
- package/coverage/lcov-report/src/pricing/discount.ts.html +0 -136
- package/coverage/lcov-report/src/pricing/estimate.ts.html +0 -1015
- package/coverage/lcov-report/src/pricing/index.html +0 -206
- package/coverage/lcov-report/src/pricing/index.ts.html +0 -106
- package/coverage/lcov-report/src/pricing/inventory.ts.html +0 -352
- package/coverage/lcov-report/src/pricing/matrix.ts.html +0 -736
- package/coverage/lcov-report/src/pricing/round.ts.html +0 -166
- package/coverage/lcov-report/src/pricing/visibility.ts.html +0 -418
- package/coverage/lcov-report/src/request.ts.html +0 -673
- package/coverage/lcov-report/src/test_util.ts.html +0 -139
- package/coverage/lcov-report/src/toasts.ts.html +0 -187
- package/coverage/lcov-report/src/util/float.ts.html +0 -121
- package/coverage/lcov-report/src/util/index.html +0 -161
- package/coverage/lcov-report/src/util/index.ts.html +0 -106
- package/coverage/lcov-report/src/util/query_string.ts.html +0 -124
- package/coverage/lcov-report/src/util/validation.ts.html +0 -91
- package/coverage/lcov-report/src/uuid.ts.html +0 -109
- package/coverage/lcov-report/visibility.ts.html +0 -418
- package/coverage/lcov.info +0 -769
- package/dist/constants/theme_foundations.js +0 -7
- package/dist/constants/theme_foundations.test.js +0 -4
- package/dist/entities/backup.js +0 -45
- package/dist/entities/backup.test.js +0 -6
- package/dist/entities/company_invoice_settings.js +0 -80
- package/dist/entities/company_invoice_settings_version.js +0 -64
- package/dist/entities/component.js +0 -141
- package/dist/entities/component.test.js +0 -12
- package/dist/entities/component_tag.js +0 -49
- package/dist/entities/component_tag.test.js +0 -6
- package/dist/entities/component_version.js +0 -65
- package/dist/entities/component_version.test.js +0 -6
- package/dist/entities/invoice_template.js +0 -60
- package/dist/entities/invoice_template_version.js +0 -52
- package/dist/entities/menu.js +0 -65
- package/dist/entities/menu.test.js +0 -6
- package/dist/entities/menu_item.js +0 -65
- package/dist/entities/menu_item.test.js +0 -6
- package/dist/entities/page.js +0 -69
- package/dist/entities/page.test.js +0 -6
- package/dist/entities/seo_domain_page.js +0 -70
- package/dist/entities/seo_domain_page.test.js +0 -6
- package/yarn-error.log +0 -4718
package/RELEASING.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Automatic npm releases
|
|
2
|
+
|
|
3
|
+
Merging to `main` triggers `.github/workflows/publish.yml`. No manually edited version or local `npm publish` is needed after the one-time npm trust setup.
|
|
4
|
+
|
|
5
|
+
## One-time setup
|
|
6
|
+
|
|
7
|
+
In npm package **merchi_sdk_ts** settings, add a GitHub Actions trusted publisher:
|
|
8
|
+
|
|
9
|
+
- Owner: `merchisdk`
|
|
10
|
+
- Repository: `merchi_sdk_ts`
|
|
11
|
+
- Workflow filename: `publish.yml`
|
|
12
|
+
- Environment: leave blank (the job has no GitHub environment)
|
|
13
|
+
- Allow direct publishing (`npm publish`), not stage-only publishing.
|
|
14
|
+
|
|
15
|
+
An npm package owner must authorize this once. There is no `NPM_TOKEN` dependency. Current local npm credentials returned 401, so this trust setup has not been verified or completed by Codex. GitHub branch rules must allow the workflow bot to write the version commit to `main`; the workflow never disables protection or force-pushes.
|
|
16
|
+
|
|
17
|
+
Official setup: https://docs.npmjs.com/trusted-publishers/
|
|
18
|
+
|
|
19
|
+
## Behavior
|
|
20
|
+
|
|
21
|
+
- Builds latest `main` after acquiring a per-repository concurrency slot. Several rapid merges may be included in one release.
|
|
22
|
+
- Uses an explicitly prepared stable version if it is newer than npm latest; otherwise automatically increments the registry's patch version. Major/minor releases remain deliberate changes to package.json.
|
|
23
|
+
- Installs dependencies and builds before publishing. npm install also repairs the historical lockfile/manifest mismatch; the resulting lockfile and version are committed together.
|
|
24
|
+
- Pushes the version commit with `[skip ci]` using `GITHUB_TOKEN`; it does not trigger another push workflow. A concurrent main update rejects the push and prevents publication of that attempt.
|
|
25
|
+
- Publishes through npm OIDC, verifies registry version and git commit, then tags `v<version>`.
|
|
26
|
+
- Re-runs of the already published commit do not bump or republish. If publication failed after the version commit, retries reuse the unpublished version only while it remains newer than latest and unoccupied.
|
|
27
|
+
- The hourly run recovers interrupted releases and packages whose new dependencies were not published yet. A failed build or missing authorization still reports failure; it cannot be solved by inventing credentials or publishing broken code. A manual Actions rerun is optional.
|
|
28
|
+
|
|
29
|
+
Merge/release SDK and invoice before cart and checkout for the initial wallet release. Cart/checkout require invoice 1.3.2 or later; if merged sooner they wait through failed install/retry runs until it exists. Consumers such as Dashboard retain their normal lockfile update/review process; this workflow does not merge or deploy consumers.
|
|
30
|
+
|
|
31
|
+
Validation: local release planner tests and YAML parsing. Package builds and payment regression tests were verified separately. Actual GitHub-to-npm publishing still requires the one-time trusted publisher setup and a merged workflow.
|
|
32
|
+
|
|
33
|
+
## Coexistence with manual publishing
|
|
34
|
+
|
|
35
|
+
Manual npm publishing remains allowed. The planner reads both latest and all occupied versions, skips occupied versions, and recognizes a manually published main commit even when its version differs from package.json. If latest has no gitHead or its commit is not an ancestor of main, automation pauses with a warning; merge the released source into main or investigate the package provenance before continuing. It never assumes unknown manual code is safe to replace.
|
|
36
|
+
|
|
37
|
+
Immediately before publishing, the workflow rechecks latest and version availability. A changed registry or a concurrent same-version manual publication is deferred with a warning, without replacing that version or its Git tag. Network/auth/build failures remain failures; the next scheduled run retries. A successful publish with a lost response is reconciled against the registry gitHead.
|
|
38
|
+
|
|
39
|
+
GitHub concurrency serializes Actions only, not developers' npm commands. npm has no cross-publisher lock or atomic compare-and-set for latest: simultaneous different-version manual and automatic publishes can still race on latest. When doing an exceptional manual release, coordinate to avoid an active publish job (or temporarily disable this workflow and wait for any active job to finish). Prefer the automatic workflow for routine releases. No script force-pushes, unpublishes, or rewrites an existing Git tag. Published version immutability prevents overwriting that version, but does not make latest race-free. First hosted OIDC publication still needs verification after merge.
|
|
40
|
+
|
|
41
|
+
## Release recovery
|
|
42
|
+
|
|
43
|
+
Publication verification queries the exact version with fresh registry reads, retrying up to seven times over 30 seconds without repeating npm publish. Each run also recovers the latest published version's missing Git tag before preparing a new release, including when main has advanced. Recovery requires the registry gitHead to be contained in the checkout history. Existing conflicting tags fail visibly and are never overwritten. Ignored, untracked lockfiles are not staged. Branch rules must still permit the normal version commit push; protection is never changed by this workflow.
|
package/dist/entities/cart.js
CHANGED
|
@@ -76,6 +76,10 @@ var Cart = /** @class */ (function (_super) {
|
|
|
76
76
|
Cart.property(),
|
|
77
77
|
__metadata("design:type", Number)
|
|
78
78
|
], Cart.prototype, "id", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
Cart.property(),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], Cart.prototype, "stripePaymentEngine", void 0);
|
|
79
83
|
__decorate([
|
|
80
84
|
Cart.property(),
|
|
81
85
|
__metadata("design:type", Date)
|
|
@@ -43,3 +43,9 @@ test('pass cookie tokens to query string', function () {
|
|
|
43
43
|
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
44
44
|
return invocation;
|
|
45
45
|
});
|
|
46
|
+
test('preserves server payment engine hint', function () {
|
|
47
|
+
var merchi = new Merchi();
|
|
48
|
+
var entity = new merchi.Cart();
|
|
49
|
+
entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
|
|
50
|
+
expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
|
|
51
|
+
});
|
package/dist/entities/domain.js
CHANGED
|
@@ -202,6 +202,9 @@ var Domain = /** @class */ (function (_super) {
|
|
|
202
202
|
_this.updateStorefrontV2RepositoryFile = function (payload) {
|
|
203
203
|
return _this.storefrontV2Request(_this.storefrontV2DomainResource('repository_file/'), 'POST', payload);
|
|
204
204
|
};
|
|
205
|
+
_this.getStorefrontV2ProductStatus = function (productId) {
|
|
206
|
+
return _this.storefrontV2Request(_this.storefrontV2DomainResource("products/".concat(String(productId), "/status/")), 'GET');
|
|
207
|
+
};
|
|
205
208
|
_this.publishStorefrontV2Product = function (payload) {
|
|
206
209
|
return _this.storefrontV2Request(_this.storefrontV2DomainResource('products/publish/'), 'POST', payload);
|
|
207
210
|
};
|
|
@@ -249,6 +249,14 @@ test('can publish storefront v2 product', function () {
|
|
|
249
249
|
productName: 'Wristband',
|
|
250
250
|
});
|
|
251
251
|
});
|
|
252
|
+
test('can get storefront v2 product status', function () {
|
|
253
|
+
var merchi = new Merchi();
|
|
254
|
+
var domain = new merchi.Domain();
|
|
255
|
+
domain.id = 42;
|
|
256
|
+
var fetch = mockFetch(true, {}, 200);
|
|
257
|
+
domain.getStorefrontV2ProductStatus(88);
|
|
258
|
+
expect(fetch.mock.calls[0][0]).toContain('/domains/42/storefront_v2/products/88/status/');
|
|
259
|
+
});
|
|
252
260
|
test('can get storefront v2 change request by id', function () {
|
|
253
261
|
var merchi = new Merchi();
|
|
254
262
|
var domain = new merchi.Domain();
|
package/dist/entities/invoice.js
CHANGED
|
@@ -47,6 +47,10 @@ var Invoice = /** @class */ (function (_super) {
|
|
|
47
47
|
Invoice.property(),
|
|
48
48
|
__metadata("design:type", Number)
|
|
49
49
|
], Invoice.prototype, "id", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Invoice.property(),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], Invoice.prototype, "stripePaymentEngine", void 0);
|
|
50
54
|
__decorate([
|
|
51
55
|
Invoice.property({ type: Date }),
|
|
52
56
|
__metadata("design:type", Object)
|
|
@@ -37,3 +37,9 @@ test('client and invoice tokens supported by merchi', function () {
|
|
|
37
37
|
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
38
38
|
return invocation;
|
|
39
39
|
});
|
|
40
|
+
test('preserves server payment engine hint', function () {
|
|
41
|
+
var merchi = new Merchi();
|
|
42
|
+
var entity = new merchi.Invoice();
|
|
43
|
+
entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
|
|
44
|
+
expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
|
|
45
|
+
});
|
package/dist/entities/payment.js
CHANGED
|
@@ -61,6 +61,22 @@ var Payment = /** @class */ (function (_super) {
|
|
|
61
61
|
Payment.property(),
|
|
62
62
|
__metadata("design:type", Number)
|
|
63
63
|
], Payment.prototype, "paymentType", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
Payment.property(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], Payment.prototype, "paymentProvider", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Payment.property(),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
Payment.property(),
|
|
74
|
+
__metadata("design:type", Number)
|
|
75
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
Payment.property({ type: String }),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], Payment.prototype, "refundStatus", void 0);
|
|
64
80
|
__decorate([
|
|
65
81
|
Payment.property(),
|
|
66
82
|
__metadata("design:type", String)
|
|
@@ -14,3 +14,9 @@ test('payment refund', function () {
|
|
|
14
14
|
expect(payment.amount).toEqual(10);
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
test('wallet method and partial refund survive API serialization', function () {
|
|
18
|
+
var payment = new (new Merchi()).Payment();
|
|
19
|
+
payment.fromJson({ id: 8, amount: 20, paymentType: 1, paymentProvider: 'stripe',
|
|
20
|
+
paymentMethod: 'wechat_pay', refundedAmount: 5, refundStatus: 'pending' });
|
|
21
|
+
expect(payment.toJson()).toMatchObject({ paymentMethod: 'wechat_pay', refundedAmount: 5, refundStatus: 'pending' });
|
|
22
|
+
});
|
package/dist/entities/product.js
CHANGED
|
@@ -194,6 +194,10 @@ var Product = /** @class */ (function (_super) {
|
|
|
194
194
|
Product.property({ type: Date }),
|
|
195
195
|
__metadata("design:type", Date)
|
|
196
196
|
], Product.prototype, "updated", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
Product.property({ type: Date }),
|
|
199
|
+
__metadata("design:type", Object)
|
|
200
|
+
], Product.prototype, "storefrontLastDeployed", void 0);
|
|
197
201
|
__decorate([
|
|
198
202
|
Product.property({ type: 'User' }),
|
|
199
203
|
__metadata("design:type", Object)
|
package/package.json
CHANGED
|
@@ -48,3 +48,10 @@ test('pass cookie tokens to query string', () => {
|
|
|
48
48
|
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
49
49
|
return invocation;
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
test('preserves server payment engine hint', () => {
|
|
53
|
+
const merchi = new Merchi();
|
|
54
|
+
const entity = new merchi.Cart();
|
|
55
|
+
entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
|
|
56
|
+
expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
|
|
57
|
+
});
|
package/src/entities/cart.ts
CHANGED
|
@@ -276,6 +276,17 @@ test('can publish storefront v2 product', () => {
|
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
+
test('can get storefront v2 product status', () => {
|
|
280
|
+
const merchi = new Merchi();
|
|
281
|
+
const domain = new merchi.Domain();
|
|
282
|
+
domain.id = 42;
|
|
283
|
+
const fetch = mockFetch(true, {}, 200);
|
|
284
|
+
domain.getStorefrontV2ProductStatus(88);
|
|
285
|
+
expect(fetch.mock.calls[0][0]).toContain(
|
|
286
|
+
'/domains/42/storefront_v2/products/88/status/'
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
|
|
279
290
|
test('can get storefront v2 change request by id', () => {
|
|
280
291
|
const merchi = new Merchi();
|
|
281
292
|
const domain = new merchi.Domain();
|
package/src/entities/domain.ts
CHANGED
|
@@ -290,6 +290,8 @@ export interface StorefrontV2RollbackResult {
|
|
|
290
290
|
export interface StorefrontV2ProductPublishResult {
|
|
291
291
|
action: 'deploy' | 'recache' | string;
|
|
292
292
|
productName?: string | null;
|
|
293
|
+
productId?: number | null;
|
|
294
|
+
lastDeployed?: number | null;
|
|
293
295
|
status?: string;
|
|
294
296
|
productUrl?: string;
|
|
295
297
|
deploymentId?: string;
|
|
@@ -299,6 +301,13 @@ export interface StorefrontV2ProductPublishResult {
|
|
|
299
301
|
httpStatus?: number;
|
|
300
302
|
}
|
|
301
303
|
|
|
304
|
+
export interface StorefrontV2ProductStatus {
|
|
305
|
+
activated: boolean;
|
|
306
|
+
outOfSync?: boolean;
|
|
307
|
+
lastUpdated?: number | null;
|
|
308
|
+
lastDeployed?: number | null;
|
|
309
|
+
}
|
|
310
|
+
|
|
302
311
|
export interface StorefrontV2CategoryPublishResult {
|
|
303
312
|
action: 'deploy' | 'recache' | string;
|
|
304
313
|
categoryName?: string | null;
|
|
@@ -314,6 +323,7 @@ export interface StorefrontV2CategoryPublishResult {
|
|
|
314
323
|
export interface StorefrontV2ProductPublishPayload {
|
|
315
324
|
productName?: string;
|
|
316
325
|
productUrl?: string;
|
|
326
|
+
productId?: number;
|
|
317
327
|
branchName?: string;
|
|
318
328
|
}
|
|
319
329
|
|
|
@@ -1029,6 +1039,15 @@ export class Domain extends Entity {
|
|
|
1029
1039
|
) as Promise<{repositoryFileUpdate: StorefrontV2RepositoryFileUpdate}>;
|
|
1030
1040
|
};
|
|
1031
1041
|
|
|
1042
|
+
public getStorefrontV2ProductStatus = (
|
|
1043
|
+
productId: number
|
|
1044
|
+
): Promise<{storefrontProductStatus: StorefrontV2ProductStatus}> => {
|
|
1045
|
+
return this.storefrontV2Request(
|
|
1046
|
+
this.storefrontV2DomainResource(`products/${String(productId)}/status/`),
|
|
1047
|
+
'GET'
|
|
1048
|
+
) as Promise<{storefrontProductStatus: StorefrontV2ProductStatus}>;
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1032
1051
|
public publishStorefrontV2Product = (
|
|
1033
1052
|
payload?: StorefrontV2ProductPublishPayload
|
|
1034
1053
|
): Promise<{productPublish: StorefrontV2ProductPublishResult}> => {
|
|
@@ -41,3 +41,10 @@ test('client and invoice tokens supported by merchi', () => {
|
|
|
41
41
|
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
42
42
|
return invocation;
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
test('preserves server payment engine hint', () => {
|
|
46
|
+
const merchi = new Merchi();
|
|
47
|
+
const entity = new merchi.Invoice();
|
|
48
|
+
entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
|
|
49
|
+
expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
|
|
50
|
+
});
|
package/src/entities/invoice.ts
CHANGED
|
@@ -17,3 +17,11 @@ test('payment refund', () => {
|
|
|
17
17
|
expect(payment.amount).toEqual(10);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
test('wallet method and partial refund survive API serialization', () => {
|
|
23
|
+
const payment = new (new Merchi()).Payment();
|
|
24
|
+
payment.fromJson({ id: 8, amount: 20, paymentType: 1, paymentProvider: 'stripe',
|
|
25
|
+
paymentMethod: 'wechat_pay', refundedAmount: 5, refundStatus: 'pending' });
|
|
26
|
+
expect(payment.toJson()).toMatchObject({ paymentMethod: 'wechat_pay', refundedAmount: 5, refundStatus: 'pending' });
|
|
27
|
+
});
|
package/src/entities/payment.ts
CHANGED
|
@@ -21,6 +21,18 @@ export class Payment extends Entity {
|
|
|
21
21
|
@Payment.property()
|
|
22
22
|
public paymentType?: number;
|
|
23
23
|
|
|
24
|
+
@Payment.property()
|
|
25
|
+
public paymentProvider?: string;
|
|
26
|
+
|
|
27
|
+
@Payment.property()
|
|
28
|
+
public paymentMethod?: string;
|
|
29
|
+
|
|
30
|
+
@Payment.property()
|
|
31
|
+
public refundedAmount?: number;
|
|
32
|
+
|
|
33
|
+
@Payment.property({ type: String })
|
|
34
|
+
public refundStatus?: string | null;
|
|
35
|
+
|
|
24
36
|
@Payment.property()
|
|
25
37
|
public note?: string;
|
|
26
38
|
|
package/src/entities/product.ts
CHANGED
|
@@ -44,6 +44,9 @@ export class Product extends Entity {
|
|
|
44
44
|
@Product.property({type: Date})
|
|
45
45
|
public updated?: Date;
|
|
46
46
|
|
|
47
|
+
@Product.property({type: Date})
|
|
48
|
+
public storefrontLastDeployed?: Date | null;
|
|
49
|
+
|
|
47
50
|
@Product.property({type: 'User'})
|
|
48
51
|
public createdBy?: User | null;
|
|
49
52
|
|