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