public override TransactionInfo ProcessSubscription(ref SubscriptionInfo sub, GatewayInfo gateway, GatewayTypeInfo gatewayType, ICustomer customer, CreditCardInfo card, bool isTrial, bool testTransaction) { ProPayRequest request = null; ProPayResponse response = null; TransactionInfo transactionInfo = new TransactionInfo(); string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl; string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId; string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey; decimal amount = isTrial == true ? sub.TrialAmount : sub.Amount; request = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction); response = request.Process(); sub.LastProcessedDate = DateTime.Now; transactionInfo.Id = Guid.NewGuid(); transactionInfo.SubscriptionId = sub.Id; transactionInfo.GatewayId = sub.GatewayId; transactionInfo.CreateDate = DateTime.Now; transactionInfo.IsTrial = isTrial; transactionInfo.Type = TransactionType.Standard; transactionInfo.Amount = amount; transactionInfo.GatewayAmount = gateway.TransactionFee; transactionInfo.OrderId = sub.RefId; if (response == null) { sub.LastProcessingStatus = TransactionStatus.Error; transactionInfo.ResponseText = ""; transactionInfo.Status = TransactionStatus.Error; } else if (response.Code == ProPayResponseCode.Success) { sub.LastProcessingStatus = TransactionStatus.Approved; if (isTrial) sub.TrialOccurrencesDone += 1; else sub.TotalOccurrencesDone += 1; transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Approved; } else { sub.LastProcessingStatus = TransactionStatus.Error; transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Error; } return transactionInfo; }
public override void Refund(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, string refID, TransactionInfo transaction, bool testTransaction) { throw new NotImplementedException(); }
public override TransactionInfo PreAuthorize(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction) { throw new NotImplementedException(); }
public override TransactionInfo ProcessPayment(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction) { ProPayRequest request = null; ProPayResponse response = null; TransactionInfo transactionInfo = new TransactionInfo(); string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl; string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId; string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey; request = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction); response = request.Process(); transactionInfo.Id = Guid.NewGuid(); transactionInfo.SubscriptionId = Guid.Empty; transactionInfo.GatewayId = gateway.Id; transactionInfo.CreateDate = DateTime.Now; //transactionInfo.IsTrial = ??; transactionInfo.Type = TransactionType.Standard; transactionInfo.Amount = amount; transactionInfo.GatewayAmount = gateway.TransactionFee; transactionInfo.OrderId = orderId; if (response == null) { transactionInfo.ResponseText = ""; transactionInfo.Status = TransactionStatus.Error; } else if (response.Code == ProPayResponseCode.Success) { transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Approved; } else { transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Error; } return transactionInfo; }
public override void Refund(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, string refID, TransactionInfo transaction, bool testTransaction) { ANetRequest request = null; ANetResponse response = null; string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl; string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId; string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey; request = new ANetRequest(requestUrl, loginId, transactionKey, customer, card, refID, transaction, testTransaction, transaction.Amount); response = request.ProcessRefund(); if (response.Code == ANetResponseCode.Approved) { transaction.Status = TransactionStatus.Refunded; } }
public override TransactionInfo PreAuthorize(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction) { ANetRequest request = null; ANetResponse response = null; TransactionInfo transactionInfo = new TransactionInfo(); string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl; string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId; string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey; request = new ANetRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction); response = request.ProcessAuthOnly(); transactionInfo.Id = Guid.NewGuid(); //transactionInfo.CustomerName = System.Web.Security.Membership.GetUser(customer.ID).UserName; transactionInfo.SubscriptionId = Guid.Empty; transactionInfo.GatewayId = gateway.Id; transactionInfo.CreateDate = DateTime.Now; //transactionInfo.IsTrial = ??; transactionInfo.Type = TransactionType.Standard; transactionInfo.Amount = amount; transactionInfo.GatewayAmount = gateway.TransactionFee; transactionInfo.OrderId = orderId; if (response == null) { transactionInfo.ResponseText = ""; transactionInfo.Status = TransactionStatus.Error; } else if (response.Code == ANetResponseCode.Approved) { transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Approved; } else { transactionInfo.ResponseText = response.ResponseText; transactionInfo.Status = TransactionStatus.Error; } return transactionInfo; }