public void CompleteCheckout(Action <Checkout, Response> success, Action <RetrofitError> failure) { BuyClient.CompleteCheckout(Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
private void CheckoutWithCreditCard(object sender, EventArgs e) { // First, the credit card must be stored on the checkout AddCreditCardToCheckout(success => { if (success) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; // Upon successfully adding the credit card to the checkout, complete checkout must be called immediately client.CompleteCheckout(checkout, (checkout, error) => { if (error == null && checkout != null) { Console.WriteLine("Successfully completed checkout"); this.checkout = checkout; var completionOperation = new GetCompletionStatusOperation(client, checkout); completionOperation.DidReceiveCompletionStatus += (op, status) => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; Console.WriteLine("Successfully got completion status: {0}", status); GetCompletedCheckout(null); }; completionOperation.FailedToReceiveCompletionStatus += (op, err) => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; Console.WriteLine("Error getting completion status: {0}", err); }; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; NSOperationQueue.MainQueue.AddOperation(completionOperation); } else { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; Console.WriteLine("Error completing checkout: {0}", error); } }); } }); }