예제 #1
0
        public AcApiResponse <FeeLookupResponse, ApiData> FeeLookup(FeeLookupRequest req)
        {
            // If Transactional limit is exceeded, throw an exception
            var     transactionalLimits = AuthIntegration.GetTransactionalLimits();
            decimal?limit = null;

            switch (req.MgiSessionType)
            {
            case SessionType.SEND:
                limit = transactionalLimits.MaxSendAmount;
                break;

            case SessionType.BP:
                limit = transactionalLimits.MaxBillPayAmount;
                break;
            }
            if (limit != null && req.Item > limit)
            {
                throw new TransactionalLimitsException();
            }

            // AgentConnect FeeLookup call for SEND
            var resp = agentConnectIntegration.FeeLookup(req);

            var apiResp = new AcApiResponse <FeeLookupResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(resp.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = resp
            };

            return(apiResp);
        }
예제 #2
0
        public void ExceedsTransactionalLimit(SessionType tranType, decimal tranAmount)
        {
            if (tranAmount == 0m)
            {
                return;
            }

            var  transactionalLimits = AuthIntegration.GetTransactionalLimits();
            bool exceedsTransactionalLimit;

            switch (tranType)
            {
            case SessionType.SEND:
                exceedsTransactionalLimit = transactionalLimits.MaxSendAmount != null && tranAmount > transactionalLimits.MaxSendAmount;
                break;

            case SessionType.RCV:
                exceedsTransactionalLimit = transactionalLimits.MaxReceiveAmount != null && tranAmount > transactionalLimits.MaxReceiveAmount;
                break;

            case SessionType.BP:
                exceedsTransactionalLimit = transactionalLimits.MaxBillPayAmount != null && tranAmount > transactionalLimits.MaxBillPayAmount;
                break;

            case SessionType.SREV:
                exceedsTransactionalLimit = transactionalLimits.MaxSendCancellationAmount != null && tranAmount > transactionalLimits.MaxSendCancellationAmount;
                break;

            case SessionType.RREV:
                exceedsTransactionalLimit = transactionalLimits.MaxReceiveCancellationAmount != null && tranAmount > transactionalLimits.MaxReceiveCancellationAmount;
                break;

            case SessionType.AMD:
                exceedsTransactionalLimit = transactionalLimits.MaxAmendAmount != null && tranAmount > transactionalLimits.MaxAmendAmount;
                break;

            default:
                exceedsTransactionalLimit = false;
                break;
            }

            if (exceedsTransactionalLimit)
            {
                throw new TransactionalLimitsException();
            }
        }