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

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 +7 -7
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.63",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/Insurance.js CHANGED
@@ -213,17 +213,17 @@ 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
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
227
  // validation
228
228
  const transitionCheck = this._canTransitionTo(
229
229
  INSURANCE_STATUS.ENROLLED.value,
@@ -238,7 +238,7 @@ export default class Insurance extends BaseClass {
238
238
  throw new Error(ERROR_MESSAGES.REQUIRED_DATE("加入日"));
239
239
  }
240
240
 
241
- if (immediate && !number) {
241
+ if (!isProcessing && !number) {
242
242
  throw new Error(
243
243
  ERROR_MESSAGES.REQUIRED_FIELD("被保険者番号(整理記号)"),
244
244
  );
@@ -248,8 +248,8 @@ export default class Insurance extends BaseClass {
248
248
  this.previousStatus = this.status;
249
249
  this.status = INSURANCE_STATUS.ENROLLED.value;
250
250
  this.enrollmentDateAt = enrollmentDateAt;
251
- this.number = immediate ? number : null;
252
- this.isProcessing = immediate ? false : true;
251
+ this.number = isProcessing ? null : number;
252
+ this.isProcessing = !!isProcessing;
253
253
  this.lossDateAt = null; // 念のため null に更新しておく
254
254
  this.lossReason = null; // 念のため null に更新しておく
255
255
  }