@shisyamo4131/air-guard-v2-schemas 2.4.2-dev.62 → 2.4.2-dev.64

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/Insurance.js +23 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "2.4.2-dev.62",
3
+ "version": "2.4.2-dev.64",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/Insurance.js CHANGED
@@ -57,7 +57,7 @@ export default class Insurance extends BaseClass {
57
57
  number: defField("insuranceNumber"),
58
58
  lossDateAt: defField("lossDateAt"),
59
59
  lossReason: defField("lossReason"),
60
- isProcessing: defField("check", { default: false }),
60
+ isProcessing: defField("check", { label: "加入手続き中", default: false }),
61
61
  history: defField("array"), // 状態遷移の履歴を記録するための配列
62
62
  };
63
63
 
@@ -213,17 +213,25 @@ export default class Insurance extends BaseClass {
213
213
  /**
214
214
  * 状態を `ENROLLED (加入)` に更新します。
215
215
  * - `NOT_ENROLLED (未加入)` または `EXEMPT (適用除外)` の状態でなければ加入手続きは行えません。
216
- * - `immediate` が true の場合、被保険者番号(整理記号)の指定が必要です。
216
+ * - `isProcessing` が true の場合、被保険者番号(整理記号)の指定が必要です。
217
217
  * @param {Object} options
218
- * @param {Date} options.enrollmentDateAt 加入日
218
+ * @param {Date} options.enrollmentDateAt 資格取得日
219
219
  * @param {String} options.number 被保険者番号(整理記号)
220
- * @param {Boolean} immediate 即時加入フラグ
220
+ * @param {Boolean} options.isProcessing 加入手続き中フラグ(true の場合、加入手続き中の状態で更新します)
221
221
  * @returns {void}
222
222
  * @throws {Error} `status` が `NOT_ENROLLED (未加入)` または `EXEMPT (適用除外)` でない場合にエラーをスローします。
223
223
  * @throws {Error} `enrollmentDateAt` が日付オブジェクトでない場合にエラーをスローします。
224
- * @throws {Error} `immediate` が true で `number` が指定されていない場合にエラーをスローします。
224
+ * @throws {Error} `isProcessing` が true で `number` が指定されていない場合にエラーをスローします。
225
225
  */
226
- enroll({ enrollmentDateAt, number } = {}, immediate = false) {
226
+ enroll({ enrollmentDateAt, number, isProcessing = false } = {}) {
227
+ console.log("=== Insurance.enroll() DEBUG ===");
228
+ console.log("Received arguments:");
229
+ console.log(" enrollmentDateAt:", enrollmentDateAt);
230
+ console.log(" number:", number);
231
+ console.log(" isProcessing:", isProcessing);
232
+ console.log(" typeof isProcessing:", typeof isProcessing);
233
+ console.log(" !!isProcessing:", !!isProcessing);
234
+
227
235
  // validation
228
236
  const transitionCheck = this._canTransitionTo(
229
237
  INSURANCE_STATUS.ENROLLED.value,
@@ -235,10 +243,10 @@ export default class Insurance extends BaseClass {
235
243
  }
236
244
 
237
245
  if (!enrollmentDateAt || !(enrollmentDateAt instanceof Date)) {
238
- throw new Error(ERROR_MESSAGES.REQUIRED_DATE("加入日"));
246
+ throw new Error(ERROR_MESSAGES.REQUIRED_DATE("資格取得日"));
239
247
  }
240
248
 
241
- if (immediate && !number) {
249
+ if (!isProcessing && !number) {
242
250
  throw new Error(
243
251
  ERROR_MESSAGES.REQUIRED_FIELD("被保険者番号(整理記号)"),
244
252
  );
@@ -248,10 +256,15 @@ export default class Insurance extends BaseClass {
248
256
  this.previousStatus = this.status;
249
257
  this.status = INSURANCE_STATUS.ENROLLED.value;
250
258
  this.enrollmentDateAt = enrollmentDateAt;
251
- this.number = immediate ? number : null;
252
- this.isProcessing = immediate ? false : true;
259
+ this.number = isProcessing ? null : number;
260
+ this.isProcessing = !!isProcessing;
253
261
  this.lossDateAt = null; // 念のため null に更新しておく
254
262
  this.lossReason = null; // 念のため null に更新しておく
263
+
264
+ console.log("After setting:");
265
+ console.log(" this.isProcessing:", this.isProcessing);
266
+ console.log(" this.number:", this.number);
267
+ console.log("=== END Insurance.enroll() DEBUG ===");
255
268
  }
256
269
 
257
270
  /**