public JudoPKPaymentAuthorizationViewControllerDelegate(Judo judo, ApplePayModel applePayModel, JudoSuccessCallback success, JudoFailureCallback failure, IApplePayRequest applePayRequest)
		{
			_successCallBack = success;
			_failureCallback = failure;
			_applePayModel = applePayModel;
			_judo = judo;
			_applePayRequest = applePayRequest;
		}
Ejemplo n.º 2
0
		void PerformApplePayAction(Judo judo, ApplePayModel model, JudoSuccessCallback success, JudoFailureCallback failure, IApplePayRequest applePayRequest)
		{
			try
			{
				PKPaymentRequest request = GetPKPaymentRequest(model);
				var rootView = GetCurrentViewController();
				var pkDelegate = new JudoPKPaymentAuthorizationViewControllerDelegate(judo, model, success, failure, applePayRequest);

				PKPaymentAuthorizationViewController pkController = new PKPaymentAuthorizationViewController(request) { Delegate = pkDelegate };
				rootView.PresentViewController(pkController, true, null);

			}
			catch (Exception e)
			{
				var judoError = new JudoError { Exception = e.InnerException };
				failure(judoError);
			}
		}
Ejemplo n.º 3
0
		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;
		}
Ejemplo n.º 4
0
		public void PreAuth(Judo judo, ApplePayModel model, JudoSuccessCallback success, JudoFailureCallback failure)
		{
			var paymentService = GetPaymentService(judo);
			PerformApplePayAction(judo, model, success, failure, new ApplePayPreAuthRequest(paymentService));
		}