def create_from_payment_method(payment_method: str):
        """Create the payment system implementation from payment method."""
        _instance: PaymentSystemService = None
        if payment_method == PaymentMethod.DIRECT_PAY.value:
            _instance = DirectPayService()
        elif payment_method == PaymentMethod.CC.value:
            _instance = PaybcService()
        elif payment_method == PaymentMethod.DRAWDOWN.value:
            _instance = BcolService()
        elif payment_method == PaymentMethod.INTERNAL.value:
            _instance = InternalPayService()
        elif payment_method == PaymentMethod.ONLINE_BANKING.value:
            _instance = OnlineBankingService()
        elif payment_method == PaymentMethod.PAD.value:
            _instance = PadService()
        elif payment_method == PaymentMethod.EFT.value:
            _instance = EftService()
        elif payment_method == PaymentMethod.WIRE.value:
            _instance = WireService()
        elif payment_method == PaymentMethod.EJV.value:
            _instance = EjvPayService()

        if not _instance:
            raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)
        return _instance
    def create(**kwargs):
        """Create a subclass of PaymentSystemService based on input params."""
        current_app.logger.debug('<create')
        user: UserContext = kwargs['user']
        total_fees: int = kwargs.get('fees', None)
        payment_method = kwargs.get('payment_method', 'CC')
        corp_type = kwargs.get('corp_type', None)

        _instance: PaymentSystemService = None
        current_app.logger.debug('payment_method: {}, corp_type : {}'.format(
            payment_method, corp_type))

        if not payment_method and not corp_type:
            raise BusinessException(Error.PAY003)

        if total_fees == 0 or (Role.STAFF.value in user.roles):
            _instance = InternalPayService()
        else:
            if payment_method == 'CC':
                _instance = PaybcService()
            elif payment_method == 'PREMIUM':
                _instance = BcolService()

        if not _instance:
            raise BusinessException(Error.PAY003)

        return _instance
Beispiel #3
0
    def create(**kwargs):
        """Create a subclass of PaymentSystemService based on input params."""
        current_app.logger.debug('<create')
        user: UserContext = kwargs['user']
        total_fees: int = kwargs.get('fees', None)
        payment_method = kwargs.get('payment_method', 'CC')
        account_info = kwargs.get('account_info', None)

        _instance: PaymentSystemService = None
        current_app.logger.debug('payment_method: {}'.format(payment_method))

        if not payment_method:
            raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)

        if total_fees == 0:
            _instance = InternalPayService()
        elif Role.STAFF.value in user.roles:
            if account_info is not None and account_info.get(
                    'bcolAccountNumber') is not None:
                _instance = BcolService()
            else:
                _instance = InternalPayService()
        else:
            if payment_method == 'CC':
                _instance = PaybcService()
            elif payment_method == 'DRAWDOWN':
                _instance = BcolService()

        if not _instance:
            raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)

        return _instance
 def create_from_system_code(payment_system: str):
     """Create the payment system implementation from the payment system code."""
     _instance: PaymentSystemService = None
     if payment_system == PaymentSystem.PAYBC.value:
         _instance = PaybcService()
     elif payment_system == PaymentSystem.BCOL.value:
         _instance = BcolService()
     elif payment_system == PaymentSystem.INTERNAL.value:
         _instance = InternalPayService()
     if not _instance:
         raise BusinessException(Error.PAY003)
     return _instance
 def create_from_system_code(payment_system: str, payment_method: str):
     """Create the payment system implementation from the payment system code and payment method."""
     _instance: PaymentSystemService = None
     if payment_system == PaymentSystem.PAYBC.value:
         if payment_method == PaymentMethod.DIRECT_PAY.value:
             _instance = DirectPayService()
         else:
             _instance = PaybcService()
     elif payment_system == PaymentSystem.BCOL.value:
         _instance = BcolService()
     elif payment_system == PaymentSystem.INTERNAL.value:
         _instance = InternalPayService()
     if not _instance:
         raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)
     return _instance
Beispiel #6
0
    def create(payment_method: str = None,
               corp_type: str = None,
               payment_system: str = None):
        """Create a subclass of PaymentSystemService based on input params."""
        current_app.logger.debug('<create')

        _instance: PaymentSystemService = None
        current_app.logger.debug('payment_method: {}, corp_type : {}'.format(
            payment_method, corp_type))
        if not payment_method and not corp_type and not payment_system:
            raise BusinessException(Error.PAY003)

        if (payment_method == 'CC'
                and corp_type == 'CP') or payment_system == 'PAYBC':
            _instance = PaybcService()
        else:
            raise BusinessException(Error.PAY003)

        return _instance
    def create(**kwargs):
        """Create a subclass of PaymentSystemService based on input params."""
        current_app.logger.debug('<create')
        user: UserContext = kwargs['user']
        total_fees: int = kwargs.get('fees', None)
        payment_method = kwargs.get(
            'payment_method', PaymentMethod.DIRECT_PAY.value
            if current_app.config.get('DIRECT_PAY_ENABLED') else
            PaymentMethod.CC.value)
        account_info = kwargs.get('account_info', None)
        has_bcol_account_number = account_info is not None and account_info.get(
            'bcolAccountNumber') is not None

        _instance: PaymentSystemService = None
        current_app.logger.debug('payment_method: {}'.format(payment_method))

        if not payment_method:
            raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)

        if total_fees == 0:
            _instance = InternalPayService()
        elif Role.STAFF.value in user.roles:
            if has_bcol_account_number:
                _instance = BcolService()
            else:
                _instance = InternalPayService()
        else:
            # System accounts can create BCOL payments similar to staff by providing as payload
            if has_bcol_account_number and Role.SYSTEM.value in user.roles:
                _instance = BcolService()
            elif payment_method == PaymentMethod.CC.value:
                _instance = PaybcService()
            elif payment_method == PaymentMethod.DIRECT_PAY.value:
                _instance = DirectPayService()
            elif payment_method == PaymentMethod.DRAWDOWN.value:
                _instance = BcolService()

        if not _instance:
            raise BusinessException(Error.INVALID_CORP_OR_FILING_TYPE)

        return _instance