Skip to content

Commit

Permalink
Customer 1:N related_customer payload fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnakamura committed Jun 29, 2022
1 parent ac2df8d commit fa6201b
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Observers/Customer/BankAccountObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($bankAccount)
'customer',
'bank',
);
if ($bankAccount->customer) {
$bankAccount->customer->loadMissing(
'related_customer'
);
}
$data = $bankAccount->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($bankAccount)
'customer',
'bank',
);
if ($bankAccount->customer) {
$bankAccount->customer->loadMissing(
'related_customer'
);
}
$data = $bankAccount->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/CreditCardObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($creditCard)
'customer',
'credit_card_flag',
);
if ($creditCard->customer) {
$creditCard->customer->loadMissing(
'related_customer'
);
}
$data = $creditCard->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($creditCard)
'customer',
'credit_card_flag',
);
if ($creditCard->customer) {
$creditCard->customer->loadMissing(
'related_customer'
);
}
$data = $creditCard->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/DependentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public function created($dependent)
'educational_institution',
'educational_course',
);
if ($dependent->customer) {
$dependent->customer->loadMissing(
'related_customer'
);
}
$data = $dependent->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -46,6 +51,11 @@ public function updated($dependent)
'educational_institution',
'educational_course',
);
if ($dependent->customer) {
$dependent->customer->loadMissing(
'related_customer'
);
}
$data = $dependent->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/DocumentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($document)
'customer',
'document_type',
);
if ($document->customer) {
$document->customer->loadMissing(
'related_customer'
);
}
$data = $document->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -45,6 +50,11 @@ public function updated($document)
'customer',
'document_type',
);
if ($document->customer) {
$document->customer->loadMissing(
'related_customer'
);
}
$data = $document->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/FgtsAccountObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public function created($fgtsAccount)
$fgtsAccount->loadMissing(
'customer',
);
if ($fgtsAccount->customer) {
$fgtsAccount->customer->loadMissing(
'related_customer'
);
}
$data = $fgtsAccount->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -40,6 +45,11 @@ public function updated($fgtsAccount)
$fgtsAccount->loadMissing(
'customer',
);
if ($fgtsAccount->customer) {
$fgtsAccount->customer->loadMissing(
'related_customer'
);
}
$data = $fgtsAccount->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/FinancialCommitmentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($financialCommitment)
'customer',
'financial_commitment',
);
if ($financialCommitment->customer) {
$financialCommitment->customer->loadMissing(
'related_customer'
);
}
$data = $financialCommitment->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($financialCommitment)
'customer',
'financial_commitment',
);
if ($financialCommitment->customer) {
$financialCommitment->customer->loadMissing(
'related_customer'
);
}
$data = $financialCommitment->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/FormalIncomeObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public function created($formalIncome)
'occupation',
'proof_of_income_type',
);
if ($formalIncome->customer) {
$formalIncome->customer->loadMissing(
'related_customer'
);
}
$data = $formalIncome->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -44,6 +49,11 @@ public function updated($formalIncome)
'occupation',
'proof_of_income_type',
);
if ($formalIncome->customer) {
$formalIncome->customer->loadMissing(
'related_customer'
);
}
$data = $formalIncome->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/HeritageCarObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($heritageCar)
'customer',
'car_type',
);
if ($heritageCar->customer) {
$heritageCar->customer->loadMissing(
'related_customer'
);
}
$data = $heritageCar->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($heritageCar)
'customer',
'car_type',
);
if ($heritageCar->customer) {
$heritageCar->customer->loadMissing(
'related_customer'
);
}
$data = $heritageCar->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/HeritagePropertyObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($heritageProperty)
'customer',
'property_type',
);
if ($heritageProperty->customer) {
$heritageProperty->customer->loadMissing(
'related_customer'
);
}
$data = $heritageProperty->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($heritageProperty)
'customer',
'property_type',
);
if ($heritageProperty->customer) {
$heritageProperty->customer->loadMissing(
'related_customer'
);
}
$data = $heritageProperty->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/InformalIncomeObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($informalIncome)
'customer',
'occupation',
);
if ($informalIncome->customer) {
$informalIncome->customer->loadMissing(
'related_customer'
);
}
$data = $informalIncome->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($informalIncome)
'customer',
'occupation',
);
if ($informalIncome->customer) {
$informalIncome->customer->loadMissing(
'related_customer'
);
}
$data = $informalIncome->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/InvestmentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($investment)
'customer',
'bank',
);
if ($investment->customer) {
$investment->customer->loadMissing(
'related_customer'
);
}
$data = $investment->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($investment)
'customer',
'bank',
);
if ($investment->customer) {
$investment->customer->loadMissing(
'related_customer'
);
}
$data = $investment->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/MonthlyFamilyExpenseObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public function created($monthlyFamilyExpense)
$monthlyFamilyExpense->loadMissing(
'customer',
);
if ($monthlyFamilyExpense->customer) {
$monthlyFamilyExpense->customer->loadMissing(
'related_customer'
);
}
$data = $monthlyFamilyExpense->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -40,6 +45,11 @@ public function updated($monthlyFamilyExpense)
$monthlyFamilyExpense->loadMissing(
'customer',
);
if ($monthlyFamilyExpense->customer) {
$monthlyFamilyExpense->customer->loadMissing(
'related_customer'
);
}
$data = $monthlyFamilyExpense->toArray();
$data['sync_to'] = 'sys';

Expand Down
10 changes: 10 additions & 0 deletions src/Observers/Customer/PersonalReferenceObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function created($personalReference)
'customer',
'relation_type',
);
if ($personalReference->customer) {
$personalReference->customer->loadMissing(
'related_customer'
);
}
$data = $personalReference->toArray();
$data['sync_to'] = 'sys';

Expand All @@ -42,6 +47,11 @@ public function updated($personalReference)
'customer',
'relation_type',
);
if ($personalReference->customer) {
$personalReference->customer->loadMissing(
'related_customer'
);
}
$data = $personalReference->toArray();
$data['sync_to'] = 'sys';

Expand Down

0 comments on commit fa6201b

Please sign in to comment.