// Create a new checkout with the selected product. For convenience in the sample app we will hardcode the user's shipping address. // The shipping rates fetched in ShippingRateListActivity will be for this address. public void CreateCheckout(Product product, Action <Checkout, Response> success, Action <RetrofitError> failure) { var cart = new Cart(); cart.AddVariant(product.Variants[0]); Checkout = new Checkout(cart); Checkout.ShippingAddress = new Address { FirstName = "Dinosaur", LastName = "Banana", Address1 = "421 8th Ave", City = "New York", Province = "NY", Zip = "10001", CountryCode = "US" }; Checkout.Email = "*****@*****.**"; Checkout.SetWebReturnToUrl(GetString(Resource.String.web_return_to_url)); Checkout.SetWebReturnToLabel(GetString(Resource.String.web_return_to_label)); BuyClient.CreateCheckout(Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Collections"; TableView.RegisterClassForCellReuse(typeof(UITableViewCell), "Cell"); client = new BuyClient(AppDelegate.SHOP_DOMAIN, AppDelegate.API_KEY, AppDelegate.CHANNEL_ID); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; client.GetCollections((collections, error) => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (error == null && collections != null) { this.collections = collections; TableView.ReloadData(); } else { Console.WriteLine("Error fetching products: {0}", error); } }); }
public async Task <Checkout> SetDiscountCodeAsync(string code) { Checkout.SetDiscountCode(code); Checkout = await BuyClient.UpdateCheckoutAsync(Checkout); return(Checkout); }
public async Task <Checkout> StoreCreditCardAsync(CreditCard card) { Checkout.BillingAddress = Checkout.ShippingAddress; Checkout = await BuyClient.StoreCreditCardAsync(card, Checkout); return(Checkout); }
public async Task <Checkout> SetShippingRateAsync(ShippingRate shippingRate) { Checkout.ShippingRate = shippingRate; Checkout = await BuyClient.UpdateCheckoutAsync(Checkout); return(Checkout); }
// Create a new checkout with the selected product. For convenience in the sample app we will hardcode the user's shipping address. // The shipping rates fetched in ShippingRateListActivity will be for this address. public async Task <Checkout> CreateCheckoutAsync(Product product) { var cart = new Cart(); cart.AddVariant(product.Variants[0]); Checkout = new Checkout(cart); Checkout.ShippingAddress = new Address { FirstName = "Dinosaur", LastName = "Banana", Address1 = "421 8th Ave", City = "New York", Province = "NY", Zip = "10001", CountryCode = "US" }; Checkout.Email = "*****@*****.**"; Checkout.SetWebReturnToUrl(GetString(Resource.String.web_return_to_url)); Checkout.SetWebReturnToLabel(GetString(Resource.String.web_return_to_label)); Checkout = await BuyClient.CreateCheckoutAsync(Checkout); return(Checkout); }
public void AddGiftCard(string code, Action <Checkout, Response> success, Action <RetrofitError> failure) { BuyClient.ApplyGiftCard(code, Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
public void CompleteCheckout(Action <Checkout, Response> success, Action <RetrofitError> failure) { BuyClient.CompleteCheckout(Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
public void SetShippingRate(ShippingRate shippingRate, Action <Checkout, Response> success, Action <RetrofitError> failure) { Checkout.ShippingRate = shippingRate; BuyClient.UpdateCheckout(Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
public void SetDiscountCode(string code, Action <Checkout, Response> success, Action <RetrofitError> failure) { Checkout.SetDiscountCode(code); BuyClient.UpdateCheckout(Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
public void StoreCreditCard(CreditCard card, Action <Checkout, Response> success, Action <RetrofitError> failure) { Checkout.BillingAddress = Checkout.ShippingAddress; BuyClient.StoreCreditCard(card, Checkout, (data, response) => { Checkout = data; success(data, response); }, failure); }
private void InitializeBuyClient() { var shopUrl = GetString(Resource.String.shop_url); if (string.IsNullOrEmpty(shopUrl)) { throw new ArgumentException("You must populate the 'shop_url' entry in strings.xml, in the form '<myshop>.myshopify.com'"); } var shopifyApiKey = GetString(Resource.String.shopify_api_key); if (string.IsNullOrEmpty(shopifyApiKey)) { throw new ArgumentException("You must populate the 'shopify_api_key' entry in strings.xml"); } var channelId = GetString(Resource.String.channel_id); if (string.IsNullOrEmpty(channelId)) { throw new ArgumentException("You must populate the 'channel_id' entry in the strings.xml"); } var applicationName = PackageName; // Create the BuyClient BuyClient = BuyClientFactory.GetBuyClient(shopUrl, shopifyApiKey, channelId, applicationName); BuyClient.GetShop( (shop, response) => { Shop = shop; }, (error) => { Toast.MakeText(this, Resource.String.shop_error, ToastLength.Long).Show(); }); }
public async override void ViewDidLoad() { base.ViewDidLoad(); Title = "Collections"; TableView.RegisterClassForCellReuse(typeof(UITableViewCell), "Cell"); client = new BuyClient(AppDelegate.SHOP_DOMAIN, AppDelegate.API_KEY, AppDelegate.CHANNEL_ID); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; try { collections = await client.GetCollectionsAsync(); TableView.ReloadData(); } catch (NSErrorException ex) { Console.WriteLine("Error fetching products: {0}", ex.Error); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }
protected void OnError(RetrofitError error) { OnError(BuyClient.GetErrorBody(error)); }
public Task <IEnumerable <ShippingRate> > GetShippingRatesAsync() { return(BuyClient.GetShippingRatesAsync(Checkout.Token)); }
public async Task <Checkout> AddGiftCardAsync(string code) { Checkout = await BuyClient.ApplyGiftCardAsync(code, Checkout); return(Checkout); }
public async Task <Checkout> CompleteCheckoutAsync() { Checkout = await BuyClient.CompleteCheckoutAsync(Checkout); return(Checkout); }
public Task <bool> GetCheckoutCompletionStatusAsync() { return(BuyClient.GetCheckoutCompletionStatusAsync(Checkout)); }
public void GetShippingRates(Action <IEnumerable <ShippingRate>, Response> success, Action <RetrofitError> failure) { BuyClient.GetShippingRates(Checkout.Token, success, failure); }
public GetShopOperation(BuyClient client) { this.client = client; }
public void GetProducts(string collectionId, Action <IEnumerable <Product>, Response> success, Action <RetrofitError> failure) { // For this sample app, we'll just fetch the first page of products in the collection BuyClient.GetProducts(1, collectionId, success, failure); }
public void GetAllProducts(Action <IEnumerable <Product>, Response> success, Action <RetrofitError> failure) { // For this sample app, "all" products will just be the first page of products BuyClient.GetProductPage(1, success, failure); }
public void GetCollections(Action <IEnumerable <Collection>, Response> success, Action <RetrofitError> failure) { BuyClient.GetCollections(success, failure); }
public ProductListViewController(BuyClient client, Collection collection) : base(UITableViewStyle.Grouped) { this.client = client; this.collection = collection; }
public PreCheckoutViewController(BuyClient client, Checkout checkout) : base(UITableViewStyle.Grouped) { this.client = client; this.checkout = checkout; }
public void GetCheckoutCompletionStatus(Action <bool, Response> success, Action <RetrofitError> failure) { BuyClient.GetCheckoutCompletionStatus(Checkout, success, failure); }
public GetShippingRatesOperation(BuyClient client, Checkout checkout) { this.client = client; this.Checkout = checkout; }
public ShippingRatesTableViewController(BuyClient client, Checkout checkout) { this.client = client; this.checkout = checkout; }
public GetCompletionStatusOperation(BuyClient client, Checkout checkout) { this.client = client; this.Checkout = checkout; }
public Task <IEnumerable <Product> > GetProductsAsync(string collectionId) { // For this sample app, we'll just fetch the first page of products in the collection return(BuyClient.GetProductsAsync(1, collectionId)); }