Skip to content

Commit

Permalink
BTHAB-186: Rename service class
Browse files Browse the repository at this point in the history
The renaming is to align with other objects and provides more meaningful
  • Loading branch information
erawat committed Sep 22, 2023
1 parent 13b7c16 commit 4a7ad7a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class CRM_Civicase_Hook_Post_CaseSalesOrderPayment {

/**
* Updates CaseSaleOrder statuses when creating a payment transcation.
* Updates CaseSalesOrder statuses when creating a payment transaction.
*
* @param string $op
* The operation being performed.
Expand Down Expand Up @@ -50,7 +50,7 @@ public function run($op, $objectName, $objectId, &$objectRef) {
$transaction = CRM_Core_Transaction::create();

try {
$caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSaleOrderContribution($salesOrderID);
$caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSalesOrderContributionCalculator($salesOrderID);
$paymentStatusID = $caseSaleOrderContributionService->calculatePaymentStatus();
$invoicingStatusID = $caseSaleOrderContributionService->calculateInvoicingStatus();

Expand Down
2 changes: 1 addition & 1 deletion CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function run($op, $objectName, $objectId, &$objectRef) {

$transaction = CRM_Core_Transaction::create();
try {
$caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSaleOrderContribution($salesOrderId);
$caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSalesOrderContributionCalculator($salesOrderId);
$paymentStatusID = $caseSaleOrderContributionService->calculatePaymentStatus();
$invoicingStatusID = $caseSaleOrderContributionService->calculateInvoicingStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* This class provides calculations for payment and invoices that
* attached to the sale order.
*/
class CRM_Civicase_Service_CaseSaleOrderContribution {
class CRM_Civicase_Service_CaseSalesOrderContributionCalculator {

/**
* Case Sales Order object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function _run(Result $result) { // phpcs:ignore
if (!$this->salesOrderID) {
return;
}
$service = new \CRM_Civicase_Service_CaseSaleOrderContribution($this->salesOrderID);
$service = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($this->salesOrderID);
$result['amount'] = $service->calculateTotalInvoicedAmount();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function _run(Result $result) { // phpcs:ignore
if (!$this->salesOrderID) {
return;
}
$service = new \CRM_Civicase_Service_CaseSaleOrderContribution($this->salesOrderID);
$service = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($this->salesOrderID);
$result['amount'] = $service->calculateTotalPaidAmount();
}

Expand Down
2 changes: 1 addition & 1 deletion Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function writeRecord($items) {
$salesOrder['total_after_tax'] = $total['totalAfterTax'];

$saleOrderId = $salesOrder['id'] ?? NULL;
$caseSaleOrderContributionService = new \CRM_Civicase_Service_CaseSaleOrderContribution($saleOrderId);
$caseSaleOrderContributionService = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($saleOrderId);
$salesOrder['payment_status_id'] = $caseSaleOrderContributionService->calculateInvoicingStatus();
$salesOrder['invoicing_status_id'] = $caseSaleOrderContributionService->calculatePaymentStatus();

Expand Down

0 comments on commit 4a7ad7a

Please sign in to comment.