Exemplo n.º 1
0
        private async void btnSearchTowns_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            SearchTownsResponse townsResp = await collivery.search_towns(new SearchTownsRequest()
            {
                town_name = "pretoria",
                token     = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Towns Returned: " + townsResp.towns.Count;
            }
        }
Exemplo n.º 2
0
        private async void btnGetTowns_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetTownsResponse townsResp = await collivery.get_towns(new GetTownsRequest()
            {
                country  = "ZAF",
                province = "",
                token    = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Towns Returned: " + townsResp.towns.Count;
            }
        }
Exemplo n.º 3
0
        private async void btnCancelCollivery_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            CancelColliveryResponse townsResp = await collivery.cancel_collivery(new CancelColliveryRequest()
            {
                collivery_id = 1565472,
                token        = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Collivery Cancel Result: " + townsResp.success;
            }
        }
Exemplo n.º 4
0
        private async void btnGetParcelImage_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetParcelImageResponse townsResp = await collivery.get_parcel_image(new GetParcelImageRequest()
            {
                parcel_id = "1534213-1",
                token     = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Images Returned: " + townsResp.image.file;
            }
        }
Exemplo n.º 5
0
        private async void btnGetColliveryStatus_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetColliveryStatusResponse townsResp = await collivery.get_collivery_status(new GetColliveryStatusRequest()
            {
                collivery_id = 1534213,
                token        = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Status: " + townsResp.status.status_text;
            }
        }
Exemplo n.º 6
0
        private async void btnAddContact_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            AddContactResponse townsResp = await collivery.add_contact(new AddContactRequest()
            {
                data = new AddContactRequestData()
                {
                    address_id = 920466,
                    cellphone  = "0836198880",
                    email      = "*****@*****.**",
                    full_name  = "Dezi van Vuuren",
                    phone      = ""
                },
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Contact Added: " + townsResp.contact_id;
            }
        }
Exemplo n.º 7
0
        private async void btnGetPOD_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetProofOfDeliveryResponse townsResp = await collivery.get_pod(new GetProofOfDeliveryRequest()
            {
                collivery_id = 1534213,
                token        = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - POD Returned: " + townsResp.pod.file;
            }
        }
Exemplo n.º 8
0
        private async void btnGetContacts_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetContactsResponse townsResp = await collivery.get_contacts(new GetContactsRequest()
            {
                address_id = 870418,
                token      = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Contacts Returned: " + townsResp.contacts.Count;
            }
        }
Exemplo n.º 9
0
        private async void btnGetAddresses_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetAddressesResponse townsResp = await collivery.get_addresses(new GetAddressesRequest()
            {
                filter = new GetAddressesRequestFilter()
                {
                    custom_id = "4"
                },
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Addresses Returned: " + townsResp.addresses.Count;
            }
        }
Exemplo n.º 10
0
        private async void btnGetLocationTypes_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetLocationTypesResponse townsResp = await collivery.get_location_types(new GetLocationTypesRequest()
            {
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Suburbs Returned: " + townsResp.results.Count;
            }
        }
Exemplo n.º 11
0
        private async void btnGetPrice_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            GetPriceResponse townsResp = await collivery.get_price(new GetPriceRequest()
            {
                data = new GetPriceRequestData()
                {
                    collivery_from  = 920466,
                    collivery_to    = 870418,
                    collivery_type  = 2,
                    cover           = 0,
                    exclude_weekend = 1,
                    parcel_count    = 1,
                    parcels         = new List <Parcel>()
                    {
                        new Parcel()
                        {
                            height = 22,
                            length = 23,
                            weight = 1.3m,
                            width  = 24
                        }
                    },
                    service = 1,
                    weight  = 1.3m
                },
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Price Returned: " + townsResp.price.inc_vat;
            }
        }
Exemplo n.º 12
0
        private async void btnAddAddress_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            AddAddressResponse townsResp = await collivery.add_address(new AddAddressRequest()
            {
                data = new AddAddressRequestData()
                {
                    building      = "KooBoo test building 1",
                    cellphone     = "0836198880",
                    company_name  = "KooBoo",
                    country       = "ZAF",
                    custom_id     = "4",
                    email         = "*****@*****.**",
                    full_name     = "Dezi van Vuuren",
                    location_type = 1,
                    phone         = "",
                    street        = "South Street",
                    suburb_id     = 298,
                    town_id       = 248,
                    zip_code      = "0157"
                },
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Address Added: " + townsResp.address_id;
            }
        }
Exemplo n.º 13
0
        private async void btnAuth_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            authResp = await collivery.authenticate();

            if (authResp.error != null)
            {
                txtResult.Text = "Error - " + authResp.error.error;
            }
            else
            {
                txtResult.Text = "Success - Token: " + authResp.token;
            }
        }
Exemplo n.º 14
0
        private async void btnAddCollivery_Click(object sender, EventArgs e)
        {
            Collivery collivery = new Collivery()
            {
                auth = new AuthenticateRequest()
                {
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                }
            };

            ValidateColliveryResponse townsResp = await collivery.validate_collivery(new ValidateColliveryRequest()
            {
                data = new ValidateColliveryRequestData()
                {
                    collivery_from = 920466,
                    collivery_to   = 870418,
                    collivery_type = 2,
                    contact_from   = 951676,
                    contact_to     = 900189,
                    cover          = 0,
                    parcel_count   = 1,
                    parcels        = new List <Parcel>()
                    {
                        new Parcel()
                        {
                            height = 22,
                            length = 23,
                            weight = 1.3m,
                            width  = 24
                        }
                    },
                    service = 1,
                    weight  = 1.3m
                },
                token = authResp.token
            });

            if (townsResp.error != null)
            {
                txtResult.Text = "Error - " + townsResp.error.error;
            }
            else
            {
                //After validate add collivery
                AddColliveryResponse addResp = await collivery.add_collivery(new AddColliveryRequest()
                {
                    data = new AddColliveryRequestData()
                    {
                        collection_time          = townsResp.collection_time,
                        collivery_from           = townsResp.collivery_from,
                        collivery_to             = townsResp.collivery_to,
                        collivery_type           = townsResp.collivery_type,
                        contact_from             = townsResp.contact_from,
                        contact_to               = townsResp.contact_to,
                        cover                    = townsResp.cover,
                        cust_ref                 = "Invoice # 12234",
                        custom_id                = "#12234",
                        delivery_time            = townsResp.delivery_time,
                        ignore_validation_change = 0,
                        instructions             = "Some custom instructions. Test",
                        parcel_count             = townsResp.parcel_count,
                        parcels                  = townsResp.parcels,
                        price                    = townsResp.price,
                        service                  = townsResp.service,
                        time_changed             = townsResp.time_changed,
                        time_changed_reason      = townsResp.time_changed_reason,
                        vm_divisor               = townsResp.vm_divisor,
                        vol_weight               = townsResp.vol_weight,
                        weight                   = townsResp.weight
                    },
                    token = authResp.token
                });

                if (addResp.error == null)
                {
                    txtResult.Text = "Collivery Added: " + addResp.collivery_id;
                }
            }
        }