Fix Member Import

This commit is contained in:
2022-07-25 11:59:11 +07:00
parent 1edd8157c7
commit d7de76798e
8 changed files with 121 additions and 14 deletions

View File

@@ -135,7 +135,7 @@ class MemberEnrollmentService
"member_id" => $row['member_id'],
"payor_id" => $row['payor_id'],
"nik" => $row['nik'],
"birth_date" => Carbon::parse($row['date_of_birth']),
"birth_date" => Carbon::parse(strtotime($row['date_of_birth'])),
"gender" => Helper::genderNormalization($row['sex']),
"language" => $row['language'],
"race" => $row['race'],
@@ -144,9 +144,29 @@ class MemberEnrollmentService
"principal_id" => $row['principal_id'],
"relation_with_principal" => $row['relationship_with_principal'],
"bpjs_class" => $row['bpjs_class'],
"nric" => $row['nric'],
"email" => $row['email'],
"bank_info" => $row['banks_info'],
"agent_code" => $row['agent_code'],
"address1" => $row['address1'],
"address2" => $row['address2'],
"address3" => $row['address3'],
"address4" => $row['address4'],
"city" => $row['city'],
"state" => $row['state'],
"postal_code" => $row['post_code'],
"passport_no" => $row['passport_number'],
"passport_country" => $row['passport_country'],
"identification_code" => $row['identification_code'],
"pre_existing" => $row['pre_existing'],
"bpjs_id" => $row['bpjs_id'],
"endorsement_date" => $row['endorsement_date'],
"remarks" => $row['remarks'],
"policy_in_force" => $row['policy_in_force'],
"start_no_claim" => $row['start_no_claim'],
"end_no_claim" => $row['end_no_claim'],
];
if ($corporate->currentPolicy->code != $row['policy_number']) {
throw new ImportRowException(__('enrollment.POLICY_NUMBER_NOT_MATCH', [
'policy_id' => $row['policy_number']
@@ -206,7 +226,8 @@ class MemberEnrollmentService
'corporate_id' => $corporate->id,
'branch_code' => $row['branch_code'],
'division_id' => $division_id ?? null,
'nik' => $row['nik']
'nik' => $row['nik'],
'status' => $row['employment_status']
]);
}
DB::commit();
@@ -295,7 +316,7 @@ class MemberEnrollmentService
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_NO_CHANGE'), 0, null, $row);
}
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse($row['end_date'])) {
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
}