コード例 #1
0
        public CIMResponse AuthCapture(Int64 profileId, Int64 paymentProfileId, int orderNumber, decimal amount)
        {
            ServiceProcessContext serviceCtx = new ServiceProcessContext();

            var orderType           = ServiceTools.CreateOrderExType(orderNumber.ToString(), string.Empty, string.Empty);
            var authTransactionType = ServiceTools.CreateProfileTransAuthCaptureType(profileId, paymentProfileId, orderType, amount);
            var transactionType     = ServiceTools.CreateProfileTransactionType(authTransactionType);

            var transactionResponse = serviceCtx.Service.CreateCustomerProfileTransaction(serviceCtx.MerchantAuthenticationType, transactionType, string.Empty);

            Trace.WriteLine(transactionResponse.directResponse);

            foreach (var message in transactionResponse.messages)
            {
                Trace.WriteLine(string.Format("{0}: {1}", message.code, message.text));
            }

            if (transactionResponse.directResponse == null)
            {
                //if directResponse is empty, the first message will say why
                return(new CIMResponse()
                {
                    AuthMessage = transactionResponse.messages[0].text,
                    Success = false
                });
            }
            else
            {
                return(ServiceTools.ParseDirectResponse(transactionResponse.directResponse));
            }
        }
コード例 #2
0
ファイル: ProfileManager.cs プロジェクト: giagiigi/WE
        public CIMResponse UpdatePaymentProfile(long paymentProfileId, CustomerAddressType address, string creditCardNumber, string cardCode, Int32 expMonth, Int32 expYear)
        {
            var serviceCtx = new ServiceProcessContext();

            string expDate            = ServiceTools.GetAuthNetExpirationDate(expMonth, expYear);
            var    paymentType        = ServiceTools.CreatePaymentType(creditCardNumber, cardCode, expDate);
            var    paymentProfileType = ServiceTools.CreatePaymentProfileExType(paymentProfileId, address, paymentType);

            var response = serviceCtx.Service.UpdateCustomerPaymentProfile(serviceCtx.MerchantAuthenticationType, this.ProfileId, paymentProfileType, ValidationMode);

            return(ServiceTools.ParseDirectResponse(response.validationDirectResponse));
        }
コード例 #3
0
        public CIMResponse Capture(Int64 profileId, Int64 paymentProfileId, string authCode, decimal amount)
        {
            ServiceProcessContext serviceCtx = new ServiceProcessContext();

            var profileTransactionType = ServiceTools.CreateProfileTransCaptureOnlyType(profileId, paymentProfileId, authCode, amount);
            var transactionType        = ServiceTools.CreateProfileTransactionType(profileTransactionType);

            var transactionResponse = serviceCtx.Service.CreateCustomerProfileTransaction(serviceCtx.MerchantAuthenticationType, transactionType, string.Empty);

            Trace.WriteLine(transactionResponse.directResponse);

            foreach (var message in transactionResponse.messages)
            {
                Trace.WriteLine(string.Format("{0}: {1}", message.code, message.text));
            }

            return(ServiceTools.ParseDirectResponse(transactionResponse.directResponse));
        }
コード例 #4
0
ファイル: ProfileManager.cs プロジェクト: giagiigi/WE
        public CIMResponse CreatePaymentProfile(CustomerAddressType address, string creditCardNumber, string cardCode, Int32 expMonth, Int32 expYear)
        {
            var serviceCtx = new ServiceProcessContext();

            string expDate            = ServiceTools.GetAuthNetExpirationDate(expMonth, expYear);
            var    paymentType        = ServiceTools.CreatePaymentType(creditCardNumber, cardCode, expDate);
            var    paymentProfileType = ServiceTools.CreatePaymentProfileType(address, paymentType);

            var response = serviceCtx.Service.CreateCustomerPaymentProfile(serviceCtx.MerchantAuthenticationType, this.ProfileId, paymentProfileType, ValidationMode);

            var retResponse = ServiceTools.ParseDirectResponse(response.validationDirectResponse);

            if (response.resultCode == MessageTypeEnum.Error)
            {
                retResponse.ErrorMessage = response.messages[0].text;
                retResponse.ErrorCode    = response.messages[0].code;
                retResponse.Success      = false;
            }
            retResponse.PaymentProfileId = response.customerPaymentProfileId;
            return(retResponse);
        }