public void OrdersGetTest() { // TODO uncomment below and replace merchant access key to test the basic method //var client = new RestClient("https://sandbox.zip.co/nz/api/order/{{order_id}}"); //client.Timeout = -1; //var request = new RestRequest(Method.GET); //request.AddHeader("Content-Type", "application/json"); //request.AddHeader("Authorization", "Bearer <AccessToken>"); //IRestResponse response = client.Execute(request); //Console.WriteLine(response.Content); string id = null; var authorization = authorizationApi.AuthorizationCreateToken("https://auth-dev.partpay.co.nz"); var createOrderRequest = CreateRequest(CreateOrderRequest.PaymentFlowEnum.Payment); var createOrderResponse = instance.OrderCreate(authorization, "IK002", createOrderRequest); id = createOrderResponse.OrderId; System.Threading.Thread.Sleep(2000); // Give the system time to complete the creation of the order var response = instance.OrderGet(authorization, id); Assert.IsInstanceOf <CheckoutOrder> (response, "response is Checkout"); }
public void main() { // Configure API key authorization, get an Access Token, Create an Order, Get an Order try { // Setup Authorization authorizationApi = new AuthorizationApi("https://merchant-auth-nz.sandbox.zip.co"); authorizationApi.Configuration.ClientId = "Your Client Id"; authorizationApi.Configuration.ClientSecret = "Your Client Secret"; // Create Acces Token var authorization = authorizationApi.AuthorizationCreateToken(); Debug.WriteLine(authorization); } catch (Exception e) { Debug.Print("Exception when calling AuthorizationApi: " + e.Message); } try { // Create Order ordersApi = new OrdersApi("https://sandbox.zip.co/nz/api"); var createOrderRequest = CreateRequest(CreateOrderRequest.PaymentFlowEnum.Payment); var authorization = authorizationApi.AuthorizationCreateToken(); // Create Order var createOrderResponse = ordersApi.OrderCreate(authorization, "Idempotency-Key", createOrderRequest); Debug.WriteLine(createOrderResponse); // Get Order var id = createOrderResponse.OrderId; var order = ordersApi.OrderGet(id); Debug.WriteLine(order); } catch (Exception e) { Debug.Print("Exception when calling OrdersApi: " + e.Message); } }