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)); }
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); }