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