public PaymentService(
            string merchantId, string terminalId, string provisionUserId,
            string terminalPassword, string userId, Mode mode, CardholderPresentCode cardholderPresentCode)
        {
            if(string.IsNullOrEmpty(merchantId))
                throw new ArgumentNullException("merchantId");

            if (string.IsNullOrEmpty(terminalId))
                throw new ArgumentNullException("terminalId");

            if (string.IsNullOrEmpty(provisionUserId))
                throw new ArgumentNullException("provisionUserId");

            if (string.IsNullOrEmpty(terminalPassword))
                throw new ArgumentNullException("terminalPassword");

            if (string.IsNullOrEmpty(userId))
                throw new ArgumentNullException("userId");

            if(!Enum.IsDefined(typeof(Mode), mode))
                throw new ArgumentNullException("mode");

            //NOTE: 3D is not supported for now
            if (cardholderPresentCode == CardholderPresentCode.ThreeD)
                throw new NotSupportedException("3D transactions is not supported for now.");

            _merchantId = merchantId;
            _terminalId = terminalId;
            _provisionUserId = provisionUserId;
            _terminalPassword = terminalPassword;
            _userId = userId;
            _mode = mode;
            _cardholderPresentCode = cardholderPresentCode;
        }
예제 #2
0
        public PaymentService(
            string merchantId, string terminalId, string provisionUserId,
            string terminalPassword, string userId, Mode mode, CardholderPresentCode cardholderPresentCode)
        {
            if (string.IsNullOrEmpty(merchantId))
            {
                throw new ArgumentNullException("merchantId");
            }

            if (string.IsNullOrEmpty(terminalId))
            {
                throw new ArgumentNullException("terminalId");
            }

            if (string.IsNullOrEmpty(provisionUserId))
            {
                throw new ArgumentNullException("provisionUserId");
            }

            if (string.IsNullOrEmpty(terminalPassword))
            {
                throw new ArgumentNullException("terminalPassword");
            }

            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentNullException("userId");
            }

            if (!Enum.IsDefined(typeof(Mode), mode))
            {
                throw new ArgumentNullException("mode");
            }

            //NOTE: 3D is not supported for now
            if (cardholderPresentCode == CardholderPresentCode.ThreeD)
            {
                throw new NotSupportedException("3D transactions is not supported for now.");
            }

            _merchantId            = merchantId;
            _terminalId            = terminalId;
            _provisionUserId       = provisionUserId;
            _terminalPassword      = terminalPassword;
            _userId                = userId;
            _mode                  = mode;
            _cardholderPresentCode = cardholderPresentCode;
        }