JudoDotNetXamarin.ApplePayModel.ItemsTotalAmount C# (CSharp) Méthode

ItemsTotalAmount() public méthode

public ItemsTotalAmount ( ) : decimal
Résultat decimal
		public decimal ItemsTotalAmount()
		{
			return Items.Sum(x => x.Amount);
		}
	}

Usage Example

		PKPaymentRequest GetPKPaymentRequest(ApplePayModel model)
		{
			var summaryItems = model.Items.Select(x => new PKPaymentSummaryItem
			{
				Amount = new NSDecimalNumber(x.Amount),
				Label = x.Label
			}).ToList();

			var applePayment = new PKPaymentRequest
			{
				CurrencyCode = new NSString(model.CurrencyCode),
				CountryCode = new NSString(model.CountryCode),
				SupportedNetworks = GetSupportedNetworks(model.SupportedCardNetworks).ToArray(),
				MerchantIdentifier = new NSString(model.MerchantIdentifier),
				MerchantCapabilities = PKMerchantCapability.ThreeDS
			};

			if (!string.IsNullOrWhiteSpace(model.ItemsSummaryLabel))
			{
				summaryItems.Add(new PKPaymentSummaryItem
				{
					Amount = new NSDecimalNumber(model.ItemsTotalAmount()),
					Label = model.ItemsSummaryLabel
				});
			}

			applePayment.PaymentSummaryItems = summaryItems.ToArray();

			return applePayment;
		}