当前位置: 首页>>代码示例>>C#>>正文


C# IPayment类代码示例

本文整理汇总了C#中IPayment的典型用法代码示例。如果您正苦于以下问题:C# IPayment类的具体用法?C# IPayment怎么用?C# IPayment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPayment类属于命名空间,在下文中一共展示了IPayment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: Transaction

 public Transaction(IAccount account, IPayment payout, string currency)
 {
     Account = account;
     Payment = payout;
     Currency = currency;
     CreatedAt = DateTime.Now;
 }
开发者ID:carloslozano,项目名称:CoiniumServ,代码行数:7,代码来源:Transaction.cs

示例3: PurchaseController

 /// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="paymentRepo">Payment repository</param>
 public PurchaseController(CourseController courseCtrl,
     MyCourseController myCourseCtrl,
     IUserProfileRepository userProfileRepo,
     IClassRoomRepository classRoomRepo,
     IClassCalendarRepository classCalendarRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     IUserActivityRepository userActivityRepo,
     IPaymentRepository paymentRepo,
     IOptions<AppConfigOptions> appConfig,
     IOptions<ErrorMessageOptions> errorMsgs,
     ILoggerFactory loggerFactory,
     IPayment payment,
     IDateTime dateTime)
 {
     _courseCtrl = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
     _userprofileRepo = userProfileRepo;
     _classRoomRepo = classRoomRepo;
     _classCalendarRepo = classCalendarRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _userActivityRepo = userActivityRepo;
     _paymentRepo = paymentRepo;
     _dateTime = dateTime;
     _appConfig = appConfig.Value;
     _errorMsgs = errorMsgs.Value;
     _logger = loggerFactory.CreateLogger<PurchaseController>();
     _payment = payment;
 }
开发者ID:teerachail,项目名称:mindsage2016,代码行数:39,代码来源:PurchaseController.cs

示例4: 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

示例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: 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

示例7: AddPayment

        public void AddPayment(IPayment payment)
        {
            try
            {
                if (!IsEnabled)
                    return;

                using (var connection = new MySqlConnection(_mySqlProvider.ConnectionString))
                {
                    connection.Execute(
                        @"INSERT INTO Payment(Block, AccountId, Amount, CreatedAt) VALUES(@blockId, @accountId, @amount, @createdAt)",
                        new
                        {
                            blockId = payment.BlockId,
                            accountId = payment.AccountId,
                            amount = payment.Amount,
                            createdAt = DateTime.Now
                        });
                }
            }
            catch (Exception e)
            {
                _logger.Error("An exception occured while committing payment; {0:l}", e.Message);
            }
        }
开发者ID:carloslozano,项目名称:CoiniumServ,代码行数:25,代码来源:HybridStorage.Payments.cs

示例8: 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

示例9: Action

		public void Action(string addInfo, IPayment payment) {
			if (log.IsDebugEnabled) {
				log.Debug("invoked " + addInfo + " " + payment);
			}

			var paymentTransaction = new PaymentTransaction(this);

			if (DateTime.Now < dontLeakUntil)
				return;

			if (alreadyLeakedSize < MaxMemoryLeakSize) {
				paymentTransaction.SendData(new long[MemoryGrowSize]);
				alreadyLeakedSize += MemoryGrowSize;
				if (log.IsDebugEnabled) {
					log.Debug(string.Format("{0} MB leaked, {1} MB in total", MemoryGrowSize / MB, alreadyLeakedSize / MB));
				}
			} else {
				if (log.IsDebugEnabled) {
					log.Debug(string.Format("maximum amount of memory leak reached ({0} MB)", MaxMemoryLeakSize / MB));
				}
				// try to allocate an impossibly large array to trigger OutOfMemoryException
				paymentTransaction.SendData(new long[int.MaxValue]);

				// dispose all leaked data
				OnAbortTransaction();

				// don't leak for some time
				dontLeakUntil = DateTime.Now + pauseLeakingTimeSpan;

				alreadyLeakedSize = 0;
			}
		}
开发者ID:daniel-busquets,项目名称:ET21,代码行数:32,代码来源:MemoryLeakPaymentPlugin.cs

示例10: 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

示例11: getQueryString

 private static NameValueCollection getQueryString(IPayment payment)
 {
     try
     {
         var queryString = HttpUtility.ParseQueryString(String.Empty);
         queryString["merchantAccount"] = Globals.Instance.settings["AdyenMerchantAccount"];
         queryString["skinCode"] = Globals.Instance.settings["AdyenPaypalSkinCode"];
         queryString["shipBeforeDate"] = DateTime.Now.AddDays(5).ToUniversalTime().ToString("yyyy-MM-dd");
         queryString["sessionValidity"] = DateTime.Now.AddHours(3).ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z"; ;
         queryString["allowedMethods"] = "paypal";
         //queryString["paymentAmount"] = payment.amount.ToString(CultureInfo.InvariantCulture);
         queryString["paymentAmount"] = 50.ToString(CultureInfo.InvariantCulture);
         queryString["currencyCode"] = payment.currency;
         queryString["shopperLocale"] = "de_DE";
         queryString["merchantReference"] = payment.paymentRef;
         queryString["brandCode"] = "paypal";
         queryString["merchantReturnData"] = payment.paymentRef;
         return queryString;
     }
     catch(Exception exp)
     {
         log.Error(exp);
         throw;
     }
 }
开发者ID:HarryMcCarney,项目名称:HackandCraft,代码行数:25,代码来源:PaypalBuilder.cs

示例12: PerformCapturePayment

		protected override IPaymentResult PerformCapturePayment(IInvoice invoice, IPayment payment, decimal amount, ProcessorArgumentCollection args)
		{
			
			var payedTotalList = invoice.AppliedPayments().Select(item => item.Amount).ToList();
			var payedTotal = (payedTotalList.Count == 0 ? 0 : payedTotalList.Aggregate((a, b) => a + b));
			var isPartialPayment = amount + payedTotal < invoice.Total;

			var result = _processor.CapturePayment(invoice, payment, amount, isPartialPayment);
			//GatewayProviderService.Save(payment);
			
			if (!result.Payment.Success)
			{
				//payment.VoidPayment(invoice, payment.PaymentMethodKey.Value);
				GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, "PayPal: request capture error: " + result.Payment.Exception.Message, 0);
			}
			else
			{
				GatewayProviderService.Save(payment);
				GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "PayPal: captured", amount);
				//GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.CaptureTransactionResult), amount);
			}
			

			return result;
		}
开发者ID:drpeck,项目名称:Merchello,代码行数:25,代码来源:PayPalPaymentGatewayMethod.cs

示例13: 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

示例14: DirectpayRequest

 public DirectpayRequest(IPayment payment, IDictionary parameters)
 {
     foreach (KeyValuePair<string, string> temp in PaymentConvert(payment)) {
         parameters.Add(temp.Key, temp.Value);
     }
     _formData = BuildFormData(parameters);
 }
开发者ID:yhhno,项目名称:thinkpay,代码行数:7,代码来源:DirectpayRequest.cs

示例15: MakePayment

 public bool MakePayment(decimal amountToBePaid, IPayment paymentAgent)
 {
     paymentAgent.SetAmountToBePaid(amountToBePaid);
     bool result = paymentAgent.MakePayment(); //ödeme yapılamazsa kesin error message'ini göster
     StatusMessage = paymentAgent.StatusMessage;
     PaymentCode = paymentAgent.PaymentCode;
     return result;
 }
开发者ID:anarbek,项目名称:daily-deal,代码行数:8,代码来源:PaymentBLL.cs


注:本文中的IPayment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。