Skip to content

Commit

Permalink
address nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen293 committed Jul 10, 2024
1 parent bb1c123 commit 8bdfbdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/EasyPost/Constant/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class Constants
'FedexSmartpostAccount'
];

const UPS_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOWS = [
const UPS_OAUTH_ACCOUNT_TYPES = [
'UpsAccount',
'UpsMailInnovationsAccount',
'UpsSurepostAccount'
Expand Down
12 changes: 6 additions & 6 deletions lib/EasyPost/Service/CarrierAccountService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public function update(string $id, mixed $params): mixed
{
$carrierAccount = self::retrieve($id);
$carrierAccountType = $carrierAccount['type'];
if (in_array($carrierAccountType, Constants::UPS_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOWS, true)) {
$updateUrl = 'upsOauthRegistration';
if (in_array($carrierAccountType, Constants::UPS_OAUTH_ACCOUNT_TYPES, true)) {
$className = 'UpsOauthRegistration';
$params = [self::selectTopLayerKey($carrierAccountType) => $params];
} else {
$updateUrl = 'carrierAccount';
$className = 'CarrierAccount';
$params = [self::selectTopLayerKey($carrierAccountType) => $params];
}
return self::updateResource($updateUrl, $id, $params);
return self::updateResource($className, $id, $params);
}

/**
Expand Down Expand Up @@ -111,7 +111,7 @@ private function selectCarrierAccountCreationEndpoint(string $carrierAccountType
{
if (in_array($carrierAccountType, Constants::CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOWS, true)) {
return '/carrier_accounts/register';
} else if (in_array($carrierAccountType, Constants::UPS_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOWS, true)) {
} else if (in_array($carrierAccountType, Constants::UPS_OAUTH_ACCOUNT_TYPES, true)) {
return '/ups_oauth_registrations';
}

Expand All @@ -126,7 +126,7 @@ private function selectCarrierAccountCreationEndpoint(string $carrierAccountType
*/
private function selectTopLayerKey(string $carrierAccountType): string
{
return in_array($carrierAccountType, Constants::UPS_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOWS, true)
return in_array($carrierAccountType, Constants::UPS_OAUTH_ACCOUNT_TYPES, true)
? 'ups_oauth_registrations'
: 'carrier_account';
}
Expand Down

0 comments on commit 8bdfbdc

Please sign in to comment.