Skip to content

Commit

Permalink
Merge branch 'main' into ORV2-3221-2
Browse files Browse the repository at this point in the history
  • Loading branch information
cberg-aot authored Jan 8, 2025
2 parents 356ea4b + dade323 commit ced6396
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,26 @@ export class PaymentService {
this.cacheManager,
CacheKey.FEATURE_FLAG_TYPE,
);
const isStaffCanPayEnabled =
featureFlags?.['STAFF-CAN-PAY'] &&
(featureFlags['STAFF-CAN-PAY'] as FeatureFlagValue) ===
FeatureFlagValue.ENABLED;
const isRefundOrNoPayment =
createTransactionDto.transactionTypeId == TransactionType.REFUND ||
createTransactionDto.paymentMethodTypeCode ===
PaymentMethodTypeEnum.NO_PAYMENT;

// If the user is a staff user,
// transacation is NOT a refund or no payment and STAFF-CAN-PAY is disabled,
// throw an error
if (
doesUserHaveRole(currentUser.orbcUserRole, IDIR_USER_ROLE_LIST) &&
featureFlags?.['STAFF-CAN-PAY'] &&
(featureFlags['STAFF-CAN-PAY'] as FeatureFlagValue) !==
FeatureFlagValue.ENABLED
!isRefundOrNoPayment &&
!isStaffCanPayEnabled
) {
throwUnprocessableEntityException('Disabled feature');
throwUnprocessableEntityException(
'Disabled feature - Feature flag: STAFF-CAN-PAY',
);
}
if (
!doesUserHaveRole(currentUser.orbcUserRole, IDIR_USER_ROLE_LIST) &&
Expand Down

0 comments on commit ced6396

Please sign in to comment.