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.
Files changed (207) hide show
  1. package/RELEASING.md +43 -0
  2. package/dist/entities/cart.js +4 -0
  3. package/dist/entities/cart.test.js +6 -0
  4. package/dist/entities/domain.js +3 -0
  5. package/dist/entities/domain.test.js +8 -0
  6. package/dist/entities/invoice.js +4 -0
  7. package/dist/entities/invoice.test.js +6 -0
  8. package/dist/entities/payment.js +16 -0
  9. package/dist/entities/payment.test.js +6 -0
  10. package/dist/entities/product.js +4 -0
  11. package/package.json +1 -1
  12. package/src/entities/cart.test.ts +7 -0
  13. package/src/entities/cart.ts +3 -0
  14. package/src/entities/domain.test.ts +11 -0
  15. package/src/entities/domain.ts +19 -0
  16. package/src/entities/invoice.test.ts +7 -0
  17. package/src/entities/invoice.ts +3 -0
  18. package/src/entities/payment.test.ts +8 -0
  19. package/src/entities/payment.ts +12 -0
  20. package/src/entities/product.ts +3 -0
  21. package/coverage/clover.xml +0 -369
  22. package/coverage/coverage-final.json +0 -8
  23. package/coverage/lcov-report/base.css +0 -224
  24. package/coverage/lcov-report/block-navigation.js +0 -87
  25. package/coverage/lcov-report/discount.ts.html +0 -136
  26. package/coverage/lcov-report/estimate.ts.html +0 -1015
  27. package/coverage/lcov-report/favicon.png +0 -0
  28. package/coverage/lcov-report/index.html +0 -206
  29. package/coverage/lcov-report/index.ts.html +0 -106
  30. package/coverage/lcov-report/inventory.ts.html +0 -352
  31. package/coverage/lcov-report/matrix.ts.html +0 -736
  32. package/coverage/lcov-report/prettify.css +0 -1
  33. package/coverage/lcov-report/prettify.js +0 -2
  34. package/coverage/lcov-report/round.ts.html +0 -166
  35. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  36. package/coverage/lcov-report/sorter.js +0 -196
  37. package/coverage/lcov-report/src/constants/auto_assign_production_on_actions.ts.html +0 -103
  38. package/coverage/lcov-report/src/constants/call_to_actions.ts.html +0 -127
  39. package/coverage/lcov-report/src/constants/discount_types.ts.html +0 -100
  40. package/coverage/lcov-report/src/constants/domain_types.ts.html +0 -121
  41. package/coverage/lcov-report/src/constants/errors.ts.html +0 -181
  42. package/coverage/lcov-report/src/constants/event_types.ts.html +0 -100
  43. package/coverage/lcov-report/src/constants/field_types.ts.html +0 -133
  44. package/coverage/lcov-report/src/constants/index.html +0 -551
  45. package/coverage/lcov-report/src/constants/index.ts.html +0 -238
  46. package/coverage/lcov-report/src/constants/input_types.ts.html +0 -124
  47. package/coverage/lcov-report/src/constants/inventory_statuses.ts.html +0 -103
  48. package/coverage/lcov-report/src/constants/invoice_types.ts.html +0 -100
  49. package/coverage/lcov-report/src/constants/item_types.ts.html +0 -100
  50. package/coverage/lcov-report/src/constants/job/drafting_status.ts.html +0 -106
  51. package/coverage/lcov-report/src/constants/job/index.html +0 -176
  52. package/coverage/lcov-report/src/constants/job/payment_status.ts.html +0 -106
  53. package/coverage/lcov-report/src/constants/job/production_status.ts.html +0 -121
  54. package/coverage/lcov-report/src/constants/job/shipment_status.ts.html +0 -118
  55. package/coverage/lcov-report/src/constants/job/supply_chain_request_status.ts.html +0 -103
  56. package/coverage/lcov-report/src/constants/job_priorities.ts.html +0 -103
  57. package/coverage/lcov-report/src/constants/job_status.ts.html +0 -232
  58. package/coverage/lcov-report/src/constants/job_types.ts.html +0 -133
  59. package/coverage/lcov-report/src/constants/notification_sections.ts.html +0 -124
  60. package/coverage/lcov-report/src/constants/notification_types.ts.html +0 -376
  61. package/coverage/lcov-report/src/constants/notification_urgencies.ts.html +0 -106
  62. package/coverage/lcov-report/src/constants/payment_types.ts.html +0 -115
  63. package/coverage/lcov-report/src/constants/platform.ts.html +0 -103
  64. package/coverage/lcov-report/src/constants/product_types.ts.html +0 -163
  65. package/coverage/lcov-report/src/constants/rights.ts.html +0 -100
  66. package/coverage/lcov-report/src/constants/robots_meta_directives.ts.html +0 -118
  67. package/coverage/lcov-report/src/constants/roles.ts.html +0 -199
  68. package/coverage/lcov-report/src/constants/shipment_companies.ts.html +0 -142
  69. package/coverage/lcov-report/src/constants/shipment_services.ts.html +0 -94
  70. package/coverage/lcov-report/src/constants/system_roles.ts.html +0 -94
  71. package/coverage/lcov-report/src/constants/theme_foundations.ts.html +0 -103
  72. package/coverage/lcov-report/src/constants/theme_status.ts.html +0 -100
  73. package/coverage/lcov-report/src/constants/user_types.ts.html +0 -136
  74. package/coverage/lcov-report/src/constants/white_label_accessibilities.ts.html +0 -103
  75. package/coverage/lcov-report/src/cookie.ts.html +0 -133
  76. package/coverage/lcov-report/src/entities/address.ts.html +0 -280
  77. package/coverage/lcov-report/src/entities/agent_conversation.ts.html +0 -202
  78. package/coverage/lcov-report/src/entities/agent_skill.ts.html +0 -382
  79. package/coverage/lcov-report/src/entities/agent_skill_approval.ts.html +0 -163
  80. package/coverage/lcov-report/src/entities/agent_skill_version.ts.html +0 -277
  81. package/coverage/lcov-report/src/entities/agent_token_usage.ts.html +0 -349
  82. package/coverage/lcov-report/src/entities/assignment.ts.html +0 -382
  83. package/coverage/lcov-report/src/entities/automatic_payment_relationship.ts.html +0 -172
  84. package/coverage/lcov-report/src/entities/bank.ts.html +0 -220
  85. package/coverage/lcov-report/src/entities/cart.ts.html +0 -373
  86. package/coverage/lcov-report/src/entities/cart_item.ts.html +0 -340
  87. package/coverage/lcov-report/src/entities/cart_shipment_group.ts.html +0 -148
  88. package/coverage/lcov-report/src/entities/cart_shipment_quote.ts.html +0 -184
  89. package/coverage/lcov-report/src/entities/category.ts.html +0 -262
  90. package/coverage/lcov-report/src/entities/company.ts.html +0 -1258
  91. package/coverage/lcov-report/src/entities/company_invitation.ts.html +0 -184
  92. package/coverage/lcov-report/src/entities/component.ts.html +0 -361
  93. package/coverage/lcov-report/src/entities/component_tag.ts.html +0 -136
  94. package/coverage/lcov-report/src/entities/component_version.ts.html +0 -175
  95. package/coverage/lcov-report/src/entities/country_tax.ts.html +0 -223
  96. package/coverage/lcov-report/src/entities/discount.ts.html +0 -214
  97. package/coverage/lcov-report/src/entities/discount_group.ts.html +0 -214
  98. package/coverage/lcov-report/src/entities/domain.ts.html +0 -3274
  99. package/coverage/lcov-report/src/entities/domain_chat_settings.ts.html +0 -331
  100. package/coverage/lcov-report/src/entities/domain_invitation.ts.html +0 -193
  101. package/coverage/lcov-report/src/entities/domain_tag.ts.html +0 -211
  102. package/coverage/lcov-report/src/entities/draft.ts.html +0 -313
  103. package/coverage/lcov-report/src/entities/draft_comment.ts.html +0 -265
  104. package/coverage/lcov-report/src/entities/draft_preview.ts.html +0 -196
  105. package/coverage/lcov-report/src/entities/draft_preview_layer.ts.html +0 -148
  106. package/coverage/lcov-report/src/entities/draft_template.ts.html +0 -346
  107. package/coverage/lcov-report/src/entities/email_address.ts.html +0 -157
  108. package/coverage/lcov-report/src/entities/email_counter.ts.html +0 -145
  109. package/coverage/lcov-report/src/entities/enrolled_domain.ts.html +0 -205
  110. package/coverage/lcov-report/src/entities/exchange_rate.ts.html +0 -151
  111. package/coverage/lcov-report/src/entities/file.ts.html +0 -580
  112. package/coverage/lcov-report/src/entities/index.html +0 -1271
  113. package/coverage/lcov-report/src/entities/internal_tag.ts.html +0 -238
  114. package/coverage/lcov-report/src/entities/inventory.ts.html +0 -274
  115. package/coverage/lcov-report/src/entities/inventory_group.ts.html +0 -193
  116. package/coverage/lcov-report/src/entities/inventory_unit_variation.ts.html +0 -172
  117. package/coverage/lcov-report/src/entities/invoice.ts.html +0 -643
  118. package/coverage/lcov-report/src/entities/item.ts.html +0 -262
  119. package/coverage/lcov-report/src/entities/job.ts.html +0 -1270
  120. package/coverage/lcov-report/src/entities/job_comment.ts.html +0 -235
  121. package/coverage/lcov-report/src/entities/job_note.ts.html +0 -205
  122. package/coverage/lcov-report/src/entities/job_operation_log.ts.html +0 -208
  123. package/coverage/lcov-report/src/entities/matching_inventory.ts.html +0 -172
  124. package/coverage/lcov-report/src/entities/menu.ts.html +0 -175
  125. package/coverage/lcov-report/src/entities/menu_item.ts.html +0 -172
  126. package/coverage/lcov-report/src/entities/notification.ts.html +0 -403
  127. package/coverage/lcov-report/src/entities/page.ts.html +0 -181
  128. package/coverage/lcov-report/src/entities/payment.ts.html +0 -280
  129. package/coverage/lcov-report/src/entities/payment_device.ts.html +0 -175
  130. package/coverage/lcov-report/src/entities/phone_number.ts.html +0 -193
  131. package/coverage/lcov-report/src/entities/product.ts.html +0 -1525
  132. package/coverage/lcov-report/src/entities/product_form.ts.html +0 -238
  133. package/coverage/lcov-report/src/entities/product_form_version.ts.html +0 -238
  134. package/coverage/lcov-report/src/entities/product_review.ts.html +0 -748
  135. package/coverage/lcov-report/src/entities/production_comment.ts.html +0 -235
  136. package/coverage/lcov-report/src/entities/quote.ts.html +0 -505
  137. package/coverage/lcov-report/src/entities/quote_item.ts.html +0 -298
  138. package/coverage/lcov-report/src/entities/reminder.ts.html +0 -307
  139. package/coverage/lcov-report/src/entities/seo_domain_page.ts.html +0 -184
  140. package/coverage/lcov-report/src/entities/session.ts.html +0 -169
  141. package/coverage/lcov-report/src/entities/shipment.ts.html +0 -664
  142. package/coverage/lcov-report/src/entities/shipment_item.ts.html +0 -130
  143. package/coverage/lcov-report/src/entities/shipment_item_fulfillment.ts.html +0 -130
  144. package/coverage/lcov-report/src/entities/shipment_log.ts.html +0 -196
  145. package/coverage/lcov-report/src/entities/shipment_method.ts.html +0 -268
  146. package/coverage/lcov-report/src/entities/shipment_method_variation.ts.html +0 -202
  147. package/coverage/lcov-report/src/entities/short_url.ts.html +0 -193
  148. package/coverage/lcov-report/src/entities/subscription_plan.ts.html +0 -304
  149. package/coverage/lcov-report/src/entities/supply_domain.ts.html +0 -166
  150. package/coverage/lcov-report/src/entities/support_conversation.ts.html +0 -280
  151. package/coverage/lcov-report/src/entities/support_message.ts.html +0 -175
  152. package/coverage/lcov-report/src/entities/system_role.ts.html +0 -136
  153. package/coverage/lcov-report/src/entities/theme.ts.html +0 -331
  154. package/coverage/lcov-report/src/entities/theme_css_setting.ts.html +0 -154
  155. package/coverage/lcov-report/src/entities/user.ts.html +0 -1369
  156. package/coverage/lcov-report/src/entities/user_company.ts.html +0 -166
  157. package/coverage/lcov-report/src/entities/variation.ts.html +0 -277
  158. package/coverage/lcov-report/src/entities/variation_field.ts.html +0 -889
  159. package/coverage/lcov-report/src/entities/variation_fields_option.ts.html +0 -406
  160. package/coverage/lcov-report/src/entities/variation_option.ts.html +0 -259
  161. package/coverage/lcov-report/src/entities/variations_group.ts.html +0 -208
  162. package/coverage/lcov-report/src/entity.ts.html +0 -3367
  163. package/coverage/lcov-report/src/index.html +0 -221
  164. package/coverage/lcov-report/src/index.ts.html +0 -652
  165. package/coverage/lcov-report/src/merchi.ts.html +0 -1420
  166. package/coverage/lcov-report/src/pricing/discount.ts.html +0 -136
  167. package/coverage/lcov-report/src/pricing/estimate.ts.html +0 -1015
  168. package/coverage/lcov-report/src/pricing/index.html +0 -206
  169. package/coverage/lcov-report/src/pricing/index.ts.html +0 -106
  170. package/coverage/lcov-report/src/pricing/inventory.ts.html +0 -352
  171. package/coverage/lcov-report/src/pricing/matrix.ts.html +0 -736
  172. package/coverage/lcov-report/src/pricing/round.ts.html +0 -166
  173. package/coverage/lcov-report/src/pricing/visibility.ts.html +0 -418
  174. package/coverage/lcov-report/src/request.ts.html +0 -673
  175. package/coverage/lcov-report/src/test_util.ts.html +0 -139
  176. package/coverage/lcov-report/src/toasts.ts.html +0 -187
  177. package/coverage/lcov-report/src/util/float.ts.html +0 -121
  178. package/coverage/lcov-report/src/util/index.html +0 -161
  179. package/coverage/lcov-report/src/util/index.ts.html +0 -106
  180. package/coverage/lcov-report/src/util/query_string.ts.html +0 -124
  181. package/coverage/lcov-report/src/util/validation.ts.html +0 -91
  182. package/coverage/lcov-report/src/uuid.ts.html +0 -109
  183. package/coverage/lcov-report/visibility.ts.html +0 -418
  184. package/coverage/lcov.info +0 -769
  185. package/dist/constants/theme_foundations.js +0 -7
  186. package/dist/constants/theme_foundations.test.js +0 -4
  187. package/dist/entities/backup.js +0 -45
  188. package/dist/entities/backup.test.js +0 -6
  189. package/dist/entities/company_invoice_settings.js +0 -80
  190. package/dist/entities/company_invoice_settings_version.js +0 -64
  191. package/dist/entities/component.js +0 -141
  192. package/dist/entities/component.test.js +0 -12
  193. package/dist/entities/component_tag.js +0 -49
  194. package/dist/entities/component_tag.test.js +0 -6
  195. package/dist/entities/component_version.js +0 -65
  196. package/dist/entities/component_version.test.js +0 -6
  197. package/dist/entities/invoice_template.js +0 -60
  198. package/dist/entities/invoice_template_version.js +0 -52
  199. package/dist/entities/menu.js +0 -65
  200. package/dist/entities/menu.test.js +0 -6
  201. package/dist/entities/menu_item.js +0 -65
  202. package/dist/entities/menu_item.test.js +0 -6
  203. package/dist/entities/page.js +0 -69
  204. package/dist/entities/page.test.js +0 -6
  205. package/dist/entities/seo_domain_page.js +0 -70
  206. package/dist/entities/seo_domain_page.test.js +0 -6
  207. 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.
@@ -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
+ });
@@ -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();
@@ -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
+ });
@@ -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
+ });
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.34.0",
3
+ "version": "1.35.1",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
@@ -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
+ });
@@ -19,6 +19,9 @@ export class Cart extends Entity {
19
19
  @Cart.property()
20
20
  public id?: number;
21
21
 
22
+ @Cart.property()
23
+ public stripePaymentEngine?: string;
24
+
22
25
  @Cart.property()
23
26
  public creationDate?: Date;
24
27
 
@@ -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();
@@ -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
+ });
@@ -28,6 +28,9 @@ export class Invoice extends Entity {
28
28
  @Invoice.property()
29
29
  public id?: number;
30
30
 
31
+ @Invoice.property()
32
+ public stripePaymentEngine?: string;
33
+
31
34
  @Invoice.property({type: Date})
32
35
  public creationDate?: Date | null;
33
36
 
@@ -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
+ });
@@ -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
 
@@ -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