本文整理汇总了C#中IInvoice类的典型用法代码示例。如果您正苦于以下问题:C# IInvoice类的具体用法?C# IInvoice怎么用?C# IInvoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInvoice类属于命名空间,在下文中一共展示了IInvoice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PerformAuthorizePayment
/// <summary>
/// Does the actual work of creating and processing the payment
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/></param>
/// <param name="args">Any arguments required to process the payment.</param>
/// <returns>The <see cref="IPaymentResult"/></returns>
protected override IPaymentResult PerformAuthorizePayment(IInvoice invoice, ProcessorArgumentCollection args)
{
var po = args.AsPurchaseOrderFormData();
var payment = GatewayProviderService.CreatePayment(PaymentMethodType.PurchaseOrder, invoice.Total, PaymentMethod.Key);
payment.CustomerKey = invoice.CustomerKey;
payment.PaymentMethodName = PaymentMethod.Name;
payment.ReferenceNumber = PaymentMethod.PaymentCode + "-" + invoice.PrefixedInvoiceNumber();
payment.Collected = false;
payment.Authorized = true;
if (string.IsNullOrEmpty(po.PurchaseOrderNumber))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Error Purchase Order Number is empty")), invoice, false);
}
invoice.PoNumber = po.PurchaseOrderNumber;
MerchelloContext.Current.Services.InvoiceService.Save(invoice);
GatewayProviderService.Save(payment);
// In this case, we want to do our own Apply Payment operation as the amount has not been collected -
// so we create an applied payment with a 0 amount. Once the payment has been "collected", another Applied Payment record will
// be created showing the full amount and the invoice status will be set to Paid.
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, string.Format("To show promise of a {0} payment", PaymentMethod.Name), 0);
//// If this were using a service we might want to store some of the transaction data in the ExtendedData for record
////payment.ExtendData
return new PaymentResult(Attempt.Succeed(payment), invoice, false);
}
开发者ID:rustyswayne,项目名称:Merchello,代码行数:37,代码来源:PurchaseOrderPaymentGatewayMethod.cs
示例2: AuthorizePayment
public IPaymentResult AuthorizePayment(IInvoice invoice, IPayment payment, string signature, string data)
{
MessageObject messageObject = VerifyResponse(data, signature);
var id = messageObject.GetAttribute(SaferPayConstants.MessageAttributes.Id);
var token = messageObject.GetAttribute(SaferPayConstants.MessageAttributes.Token);
if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(token))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment), invoice, false);
}
// save this values to payment
payment.ExtendedData.SetValue(SaferPayConstants.MessageAttributes.Id, id);
payment.ExtendedData.SetValue(SaferPayConstants.MessageAttributes.Token, id);
// Complete order for saferpay
MessageObject payComplete = _messageFactory.CreateRequest(SaferPayConstants.PayCompleteKey);
payComplete.SetAttribute(SaferPayConstants.MessageAttributes.AccountId, _settings.AccountId);
payComplete.SetAttribute(SaferPayConstants.MessageAttributes.Id, id);
payComplete.SetAttribute(SaferPayConstants.MessageAttributes.Token, token);
MessageObject payCompleteResult = payComplete.Capture();
// authorize in merchello
payment.Authorized = true;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
开发者ID:ninjaonsafari,项目名称:Opten.Umbraco.Merchello.Plugins.Payment.SaferPay,代码行数:28,代码来源:SaferPayPaymentProcessor.cs
示例3: Build
/// <summary>
/// Builds the <see cref="PaymentDetailsItemType"/>.
/// </summary>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="actionCode">
/// The <see cref="PaymentActionCodeType"/>.
/// </param>
/// <returns>
/// The <see cref="PaymentDetailsType"/>.
/// </returns>
public PaymentDetailsType Build(IInvoice invoice, PaymentActionCodeType actionCode)
{
// Get the decimal configuration for the current currency
var currencyCodeType = PayPalApiHelper.GetPayPalCurrencyCode(invoice.CurrencyCode);
var basicAmountFactory = new PayPalBasicAmountTypeFactory(currencyCodeType);
// Get the tax total
var itemTotal = basicAmountFactory.Build(invoice.TotalItemPrice());
var shippingTotal = basicAmountFactory.Build(invoice.TotalShipping());
var taxTotal = basicAmountFactory.Build(invoice.TotalTax());
var invoiceTotal = basicAmountFactory.Build(invoice.Total);
var items = BuildPaymentDetailsItemTypes(invoice.ProductLineItems(), basicAmountFactory);
var paymentDetails = new PaymentDetailsType
{
PaymentDetailsItem = items.ToList(),
ItemTotal = itemTotal,
TaxTotal = taxTotal,
ShippingTotal = shippingTotal,
OrderTotal = invoiceTotal,
PaymentAction = actionCode,
InvoiceID = invoice.PrefixedInvoiceNumber()
};
// ShipToAddress
if (invoice.ShippingLineItems().Any())
{
var addressTypeFactory = new PayPalAddressTypeFactory();
paymentDetails.ShipToAddress = addressTypeFactory.Build(invoice.GetShippingAddresses().FirstOrDefault());
}
return paymentDetails;
}
开发者ID:ryanology,项目名称:Merchello,代码行数:46,代码来源:PayPalPaymentDetailsTypeFactory.cs
示例4: PerformTask
/// <summary>
/// Adds billing information to the invoice
/// </summary>
/// <param name="value">
/// The <see cref="IInvoice"/>
/// </param>
/// <returns>
/// The <see cref="Attempt"/>.
/// </returns>
public override Attempt<IInvoice> PerformTask(IInvoice value)
{
var noteDisplay = SalePreparation.Customer.ExtendedData.GetNote();
if (noteDisplay == null) return Attempt<IInvoice>.Succeed(value);
var note = new Note
{
EntityKey = value.Key,
EntityTfKey =
EnumTypeFieldConverter.EntityType.GetTypeField(EntityType.Invoice).TypeKey,
Message = noteDisplay.Message
};
if (value.Notes != null)
{
if (value.Notes.All(x => x.Message != note.Message))
{
value.Notes.Add(note);
}
}
else
{
value.Notes = new System.Collections.Generic.List<Note> { note };
}
return Attempt<IInvoice>.Succeed(value);
}
开发者ID:drpeck,项目名称:Merchello,代码行数:37,代码来源:AddNotesToInvoiceTask.cs
示例5: ProcessPayment
/// <summary>
/// Processes the Authorize and AuthorizeAndCapture transactions
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/> to be paid</param>
/// <param name="payment">The <see cref="IPayment"/> record</param>
/// <param name="args"></param>
/// <returns>The <see cref="IPaymentResult"/></returns>
public IPaymentResult ProcessPayment(IInvoice invoice, IPayment payment, ProcessorArgumentCollection args)
{
var setExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType
{
ReturnURL = String.Format("{0}/App_Plugins/Merchello.PayPal/PayPalExpressCheckout.html?InvoiceKey={1}&PaymentKey={2}&PaymentMethodKey={3}", GetWebsiteUrl(), invoice.Key, payment.Key, payment.PaymentMethodKey),
CancelURL = "http://localhost/cancel",
PaymentDetails = new List<PaymentDetailsType> { GetPaymentDetails(invoice) }
};
var setExpressCheckout = new SetExpressCheckoutReq();
var setExpressCheckoutRequest = new SetExpressCheckoutRequestType(setExpressCheckoutRequestDetails);
setExpressCheckout.SetExpressCheckoutRequest = setExpressCheckoutRequest;
var config = new Dictionary<string, string>
{
{"mode", "sandbox"},
{"account1.apiUsername", _settings.ApiUsername},
{"account1.apiPassword", _settings.ApiPassword},
{"account1.apiSignature", _settings.ApiSignature}
};
var service = new PayPalAPIInterfaceServiceService(config);
var responseSetExpressCheckoutResponseType = service.SetExpressCheckout(setExpressCheckout);
// If this were using a service we might want to store some of the transaction data in the ExtendedData for record
payment.ExtendedData.SetValue("RedirectUrl", "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + responseSetExpressCheckoutResponseType.Token);
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, false);
}
开发者ID:arknu,项目名称:Merchello,代码行数:35,代码来源:PayPalPaymentProcessor.cs
示例6: Delete
public int Delete(IInvoice entity)
{
if (entity == null)
{
throw new ArgumentException("Invoice entity provide is null.");
}
if (entity.Id < 0)
{
throw new ArgumentException("You must provide ");
}
try
{
using (_connection)
{
string sqlQuery = $"DELETE FROM {TableName} WHERE Id = {entity.Id}";
using (DbCommand deleteCommand = new SqlCommand(sqlQuery, _connection))
{
return deleteCommand.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
throw new Exception($"Unable to delete InvoiceHeader ID {entity.Id}", ex);
}
}
开发者ID:Predian,项目名称:AccountsSoftware,代码行数:29,代码来源:InvoiceDao.cs
示例7: PerformTask
/// <summary>
/// Performs the task of asserting everything is billed in a common currency.
/// </summary>
/// <param name="value">
/// The value.
/// </param>
/// <returns>
/// The <see cref="Attempt"/>.
/// </returns>
public override Attempt<IInvoice> PerformTask(IInvoice value)
{
var unTagged = value.Items.Where(x => !x.ExtendedData.ContainsKey(Constants.ExtendedDataKeys.CurrencyCode)).ToArray();
if (unTagged.Any())
{
var defaultCurrency =
this.CheckoutManager.Context.Services.StoreSettingService.GetByKey(
Constants.StoreSettingKeys.CurrencyCodeKey);
foreach (var item in unTagged)
{
item.ExtendedData.SetValue(Constants.ExtendedDataKeys.CurrencyCode, defaultCurrency.Value);
}
}
var allCurrencyCodes =
value.Items.Select(x => x.ExtendedData.GetValue(Constants.ExtendedDataKeys.CurrencyCode)).Distinct().ToArray();
//// Assign the currency code on the invoice
if (allCurrencyCodes.Length == 1) value.CurrencyCode = allCurrencyCodes.First();
return 1 == allCurrencyCodes.Length
? Attempt<IInvoice>.Succeed(value)
: Attempt<IInvoice>.Fail(new InvalidDataException("Invoice is being created with line items costed in different currencies."));
}
开发者ID:Teknyc,项目名称:Merchello,代码行数:36,代码来源:ValidateCommonCurrency.cs
示例8: PerformCapturePayment
/// <summary>
/// Does the actual work capturing a payment
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/></param>
/// <param name="payment">The previously Authorize payment to be captured</param>
/// <param name="amount">The amount to capture</param>
/// <param name="args">Any arguments required to process the payment.</param>
/// <returns>The <see cref="IPaymentResult"/></returns>
protected override IPaymentResult PerformCapturePayment(IInvoice invoice, IPayment payment, decimal amount, ProcessorArgumentCollection args)
{
var result = _processor.PriorAuthorizeCapturePayment(invoice, payment);
GatewayProviderService.Save(payment);
if (!result.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(
payment.Key,
invoice.Key,
AppliedPaymentType.Denied,
result.Payment.Exception.Message,
0);
}
else
{
GatewayProviderService.ApplyPaymentToInvoice(
payment.Key,
invoice.Key,
AppliedPaymentType.Debit,
payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.CaptureTransactionResult),
amount);
}
return result;
}
开发者ID:qz2rg4,项目名称:Merchello-Debit-Order-Payment-Provider,代码行数:35,代码来源:PurchaseOrderPaymentGatewayMethod.cs
示例9: PriorAuthorizeCapturePayment
/// <summary>
/// Captures a previously authorized payment
/// </summary>
/// <param name="invoice">The invoice associated with the <see cref="IPayment"/></param>
/// <param name="payment">The <see cref="IPayment"/> to capture</param>
/// <returns>The <see cref="IPaymentResult"/></returns>
public IPaymentResult PriorAuthorizeCapturePayment(IInvoice invoice, IPayment payment)
{
if (!payment.Authorized) return new PaymentResult(Attempt<IPayment>.Fail(payment, new InvalidOperationException("Payment is not Authorized")), invoice, false);
payment.Collected = true;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
开发者ID:drpeck,项目名称:Merchello,代码行数:13,代码来源:PurchaseOrderPaymentProcessor.cs
示例10: PerformAuthorizePayment
/// <summary>
/// Does the actual work of authorizing the payment
/// </summary>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="args">
/// The args.
/// </param>
/// <returns>
/// The <see cref="IPaymentResult"/>.
/// </returns>
protected override IPaymentResult PerformAuthorizePayment(IInvoice invoice, ProcessorArgumentCollection args)
{
// The Provider settings
if (BraintreeApiService.BraintreeProviderSettings.DefaultTransactionOption == TransactionOption.SubmitForSettlement)
{
return this.PerformAuthorizeCapturePayment(invoice, invoice.Total, args);
}
var paymentMethodNonce = args.GetPaymentMethodNonce();
if (string.IsNullOrEmpty(paymentMethodNonce))
{
var error = new InvalidOperationException("No payment method nonce was found in the ProcessorArgumentCollection");
LogHelper.Debug<BraintreeStandardTransactionPaymentGatewayMethod>(error.Message);
return new PaymentResult(Attempt<IPayment>.Fail(error), invoice, false);
}
var attempt = ProcessPayment(invoice, TransactionOption.Authorize, invoice.Total, paymentMethodNonce);
var payment = attempt.Payment.Result;
GatewayProviderService.Save(payment);
if (!attempt.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, attempt.Payment.Exception.Message, 0);
}
else
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "To show record of Braintree Authorization", 0);
}
return attempt;
}
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:46,代码来源:BraintreeStandardTransactionPaymentGatewayMethod.cs
示例11: ProcessPayment
/// <summary>
/// Processes the Authorize and AuthorizeAndCapture transactions
/// </summary>
/// <param name="invoice">The <see cref="IInvoice" /> to be paid</param>
/// <param name="payment">The <see cref="IPayment" /> record</param>
/// <param name="transactionMode">Authorize or AuthorizeAndCapture</param>
/// <param name="amount">The money amount to be processed</param>
/// <returns>The <see cref="IPaymentResult" /></returns>
public IPaymentResult ProcessPayment(IInvoice invoice, IPayment payment, TransactionMode transactionMode, decimal amount)
{
if (!IsValidCurrencyCode(invoice.CurrencyCode()))
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Invalid currency. Invoice Currency: '{0}'", invoice.CurrencyCode()))), invoice, false);
if (transactionMode == TransactionMode.Authorize) {
//var paymentId = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.QuickpayPaymentId);
var currency = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.PaymentCurrency);
var amountAuthorizedMinorString = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.PaymentAmount);
var amountAuthorized = decimal.Parse(amountAuthorizedMinorString) / (IsZeroDecimalCurrency(currency) ? 100 : 1);
if (invoice.CurrencyCode() != currency) {
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Currency mismatch. Invoice Currency: {0}, Payment Currency: {1}", invoice.CurrencyCode(), currency))), invoice, false);
}
if (invoice.Total > amountAuthorized) {
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Amount mismatch. Invoice Amount: {0}, Payment Amount: {1}", invoice.Total.ToString("F2"), amountAuthorized.ToString("F2")))), invoice, false);
}
payment.Authorized = true;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, invoice.ShippingLineItems().Any());
}
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("{0}", "QuickPay Payment AuthorizeAndCapture Not Implemented Yet"))), invoice, false);
}
开发者ID:joelbhansen,项目名称:MerchelloQuickPayProvider,代码行数:35,代码来源:QuickPayPaymentProcessor.cs
示例12: InitializePayment
public IPaymentResult InitializePayment(IInvoice invoice, IPayment payment, ProcessorArgumentCollection args)
{
string postUrl = GetPostUrl(invoice, payment);
payment.ExtendedData.SetValue("RedirectUrl", postUrl);
HttpContext.Current.Response.Redirect(postUrl);
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
开发者ID:ninjaonsafari,项目名称:Opten.Umbraco.Merchello.Plugins.Payment.SaferPay,代码行数:7,代码来源:SaferPayPaymentProcessor.cs
示例13: PerformAuthorizeCapturePayment
/// <summary>
/// Does the actual work of authorizing and capturing a payment
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/></param>
/// <param name="amount">The amount to capture</param>
/// <param name="args">Any arguments required to process the payment.</param>
/// <returns>The <see cref="IPaymentResult"/></returns>
protected override IPaymentResult PerformAuthorizeCapturePayment(IInvoice invoice, decimal amount, ProcessorArgumentCollection args)
{
var payment = GatewayProviderService.CreatePayment(PaymentMethodType.PurchaseOrder, amount, PaymentMethod.Key);
payment.CustomerKey = invoice.CustomerKey;
payment.PaymentMethodName = PaymentMethod.Name;
payment.ReferenceNumber = PaymentMethod.PaymentCode + "-" + invoice.PrefixedInvoiceNumber();
payment.Collected = true;
payment.Authorized = true;
var po = args.AsPurchaseOrderFormData();
if (string.IsNullOrEmpty(po.PurchaseOrderNumber))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Error Purchase Order Number is empty")), invoice, false);
}
invoice.PoNumber = po.PurchaseOrderNumber;
MerchelloContext.Current.Services.InvoiceService.Save(invoice);
GatewayProviderService.Save(payment);
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "Cash payment", amount);
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, CalculateTotalOwed(invoice).CompareTo(amount) <= 0);
}
开发者ID:rustyswayne,项目名称:Merchello,代码行数:32,代码来源:PurchaseOrderPaymentGatewayMethod.cs
示例14: ProcessPayment
private IPaymentResult ProcessPayment(IInvoice invoice, TransactionMode transactionMode, decimal amount, ProcessorArgumentCollection args)
{
var po = args.AsPurchaseOrderFormData();
var payment = GatewayProviderService.CreatePayment(PaymentMethodType.PurchaseOrder, invoice.Total, PaymentMethod.Key);
payment.CustomerKey = invoice.CustomerKey;
payment.Authorized = false;
payment.Collected = false;
payment.PaymentMethodName = "Purchase Order";
var result = _processor.ProcessPayment(invoice, payment, amount, po);
GatewayProviderService.Save(payment);
if (!result.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, result.Payment.Exception.Message, 0);
}
else
{
MerchelloContext.Current.Services.InvoiceService.Save(invoice, false);
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit,
payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.AuthorizationTransactionResult) +
(transactionMode == TransactionMode.AuthorizeAndCapture ? string.Empty : " to show record of Authorization"),
transactionMode == TransactionMode.AuthorizeAndCapture ? invoice.Total : 0);
}
return result;
}
开发者ID:drpeck,项目名称:Merchello,代码行数:30,代码来源:PurchaseOrderPaymentGatewayMethod.cs
示例15: CalculateTaxForInvoice
/// <summary>
/// Calculates tax for invoice.
/// </summary>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="taxAddress">
/// The tax address.
/// </param>
/// <returns>
/// The <see cref="ITaxCalculationResult"/>.
/// </returns>
public override ITaxCalculationResult CalculateTaxForInvoice(IInvoice invoice, IAddress taxAddress)
{
decimal amount = 0m;
foreach (var item in invoice.Items)
{
// can I use?: https://github.com/Merchello/Merchello/blob/5706b8c9466f7417c41fdd29de7930b3e8c4dd2d/src/Merchello.Core/Models/ExtendedDataExtensions.cs#L287-L295
if (item.ExtendedData.GetTaxableValue())
amount = amount + item.TotalPrice;
}
TaxRequest taxRequest = new TaxRequest();
taxRequest.Amount = amount;
taxRequest.Shipping = invoice.TotalShipping();
taxRequest.ToCity = taxAddress.Locality;
taxRequest.ToCountry = taxAddress.CountryCode;
taxRequest.ToState = taxAddress.Region;
taxRequest.ToZip = taxAddress.PostalCode;
Models.TaxResult taxResult = _taxjarService.GetTax(taxRequest);
if (taxResult.Success)
{
var extendedData = new ExtendedDataCollection();
extendedData.SetValue(Core.Constants.ExtendedDataKeys.TaxTransactionResults, JsonConvert.SerializeObject(taxResult));
return new TaxCalculationResult(TaxMethod.Name, taxResult.Rate, taxResult.TotalTax, extendedData);
}
throw new Exception("TaxJar.com error");
}
开发者ID:drpeck,项目名称:Merchello,代码行数:43,代码来源:TaxJarTaxationGatewayMethod.cs
示例16: ProcessPayment
private IPaymentResult ProcessPayment(IInvoice invoice, TransactionMode transactionMode, decimal amount, ProcessorArgumentCollection args)
{
var cc = args.AsCreditCardFormData();
var payment = GatewayProviderService.CreatePayment(PaymentMethodType.CreditCard, invoice.Total, PaymentMethod.Key);
payment.CustomerKey = invoice.CustomerKey;
payment.Authorized = false;
payment.Collected = false;
payment.PaymentMethodName = string.Format("{0} Stripe Credit Card", cc.CreditCardType);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.CcLastFour, cc.CardNumber.Substring(cc.CardNumber.Length - 4, 4).EncryptWithMachineKey());
var result = _processor.ProcessPayment(invoice, payment, transactionMode, amount, cc);
GatewayProviderService.Save(payment);
if (!result.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, result.Payment.Exception.Message, 0);
}
else
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit,
//payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.AuthorizationTransactionResult) +
(transactionMode == TransactionMode.AuthorizeAndCapture ? string.Empty : " to show record of Authorization"),
transactionMode == TransactionMode.AuthorizeAndCapture ? invoice.Total : 0);
}
return result;
}
开发者ID:drpeck,项目名称:Merchello,代码行数:30,代码来源:StripePaymentGatewayMethod.cs
示例17: FixedRateTaxCalculationStrategy
/// <summary>
/// Initializes a new instance of the <see cref="FixedRateTaxCalculationStrategy"/> class.
/// </summary>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="taxAddress">
/// The tax address.
/// </param>
/// <param name="taxMethod">
/// The tax method.
/// </param>
public FixedRateTaxCalculationStrategy(IInvoice invoice, IAddress taxAddress, ITaxMethod taxMethod)
: base(invoice, taxAddress)
{
Mandate.ParameterNotNull(taxMethod, "countryTaxRate");
_taxMethod = taxMethod;
}
开发者ID:arknu,项目名称:Merchello,代码行数:19,代码来源:FixedRateTaxCalculationStrategy.cs
示例18: PerformAuthorizeCapturePayment
/// <summary>
/// Performs the actual work of authorizing and capturing a payment.
/// </summary>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="amount">
/// The amount.
/// </param>
/// <param name="args">
/// The args.
/// </param>
/// <returns>
/// The <see cref="IPaymentResult"/>.
/// </returns>
/// <remarks>
/// This is a transaction with SubmitForSettlement = true
/// </remarks>
protected override IPaymentResult PerformAuthorizeCapturePayment(IInvoice invoice, decimal amount, ProcessorArgumentCollection args)
{
var paymentMethodNonce = args.GetPaymentMethodNonce();
if (string.IsNullOrEmpty(paymentMethodNonce))
{
var error = new InvalidOperationException("No payment method nonce was found in the ProcessorArgumentCollection");
LogHelper.Debug<BraintreeSimpleTransactionPaymentGatewayMethod>(error.Message);
return new PaymentResult(Attempt<IPayment>.Fail(error), invoice, false);
}
var attempt = ProcessPayment(invoice, TransactionOption.Authorize, invoice.Total, paymentMethodNonce);
var payment = attempt.Payment.Result;
GatewayProviderService.Save(payment);
if (!attempt.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, attempt.Payment.Exception.Message, 0);
}
else
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "Braintree transaction - authorized and captured", amount);
}
return attempt;
}
开发者ID:GaryLProthero,项目名称:Merchello,代码行数:46,代码来源:BraintreeSimpleTransactionPaymentGatewayMethod.cs
示例19: PerformCapturePayment
protected override IPaymentResult PerformCapturePayment(IInvoice invoice, IPayment payment, decimal amount,
ProcessorArgumentCollection args)
{
var token = args["token"];
var payerId = args["PayerID"];
var result = _processor.ComplitePayment(invoice, payment, token, payerId);
GatewayProviderService.Save(payment);
// TODO
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "Cash payment", payment.Amount);
/*
if (!result.Payment.Success)
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied,
result.Payment.Exception.Message, 0);
}
else
{
GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit,
payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.CaptureTransactionResult), amount);
}
*/
return result;
}
开发者ID:VDBBjorn,项目名称:Merchello,代码行数:28,代码来源:PayPalPaymentGatewayMethod.cs
示例20: PaymentResult
/// <summary>
/// Initializes a new instance of the <see cref="PaymentResult"/> class.
/// </summary>
/// <param name="payment">
/// The payment.
/// </param>
/// <param name="invoice">
/// The invoice.
/// </param>
/// <param name="approveOrderCreation">
/// The approve order creation.
/// </param>
/// <param name="redirectUrl">
/// The redirect URL.
/// </param>
public PaymentResult(Attempt<IPayment> payment, IInvoice invoice, bool approveOrderCreation, string redirectUrl)
{
Payment = payment;
Invoice = invoice;
ApproveOrderCreation = approveOrderCreation;
RedirectUrl = redirectUrl;
}
开发者ID:jlarc,项目名称:Merchello,代码行数:22,代码来源:PaymentResult.cs
注:本文中的IInvoice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论