コード例 #1
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));
        }
コード例 #2
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);
        }