예제 #1
0
            public override async void PaymentContext(STPPaymentContext paymentContext, STPPaymentResult paymentResult,
                                                      STPErrorBlock completion)
            {
                var result = await _stripeRemoteService.RequestPaymentAsync((int)paymentContext.PaymentAmount,
                                                                            paymentResult.Source.StripeID, paymentContext.PaymentCurrency, "test_ios");

                completion(result ? null : new NSError());
            }
        public async void AttachSourceToCustomer(ISTPSourceProtocol source, STPErrorBlock completion)
        {
            var kv = new KeyValuePair <string, string>[] {
                new KeyValuePair <string, string>("source", source.StripeID)
            };
            var json = await client.PostAsync("/customer/sources", new FormUrlEncodedContent(kv));

            completion(null);
        }
        public override void DetachSource(ISourceProtocol source, STPErrorBlock completion)
        {
            customer.RemoveSource(source);

            if (completion != null)
            {
                completion(null);
            }
        }
        public override void UpdateCustomer(Address shipping, STPErrorBlock completion)
        {
            customer.SetShippingAddress(shipping);

            if (completion != null)
            {
                completion(null);
            }
        }
        public override void SelectDefaultCustomerSource(ISourceProtocol source, STPErrorBlock completion)
        {
            if (customer.Sources.Where(p => p.StripeId == source.StripeId).Any())
            {
                customer.SetDefaultSource(source);
            }

            if (completion != null)
            {
                completion(null);
            }
        }
        public override void AttachSourceToCustomer(ISourceProtocol source, STPErrorBlock completion)
        {
            var token = source as Token;

            if (token != null)
            {
                var card = token.Card;
                if (card != null)
                {
                    customer.AddSource(card);
                }
            }

            if (completion != null)
            {
                completion(null);
            }
        }
 public void PaymentContext(STPPaymentContext paymentContext, STPPaymentResult paymentResult, STPErrorBlock completion)
 {
 }
예제 #8
0
 public void AddCardViewControllerCreatedToken(AddCardViewController addCardViewController, Token token, STPErrorBlock completion)
 {
     DismissViewController(true, null);
 }
예제 #9
0
            public override async void DetachSourceFromCustomer(ISTPSourceProtocol source, STPErrorBlock completion)
            {
                var result = await _stripeRemoteService.DetachSourceFromCustomer(source.StripeID);

                if (completion != null)
                {
                    completion(result ? null : new NSError());
                }
            }
예제 #10
0
            public override async void AttachSourceToCustomer(ISTPSourceProtocol source, STPErrorBlock completion)
            {
                var result = await _stripeRemoteService.AttachSourceToCustomer(source.StripeID);

                completion(result ? null : new NSError());
            }