Search in sources :

Example 1 with Order

use of com.google.api.ads.admanager.axis.v202202.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method updateDestinationCountryCode.

public int updateDestinationCountryCode(int orderIdToUpdate, CountryCode destinationCountryCode, Order.QualityLevel qualityLevel, boolean useTrackedShipping) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    order = order.createCloneWithDestinationCountryCode(destinationCountryCode, qualityLevel, useTrackedShipping);
    System.out.println(order);
    System.out.println(pwinty.getOrder(order.getId()));
    System.out.println("**** NOTE: ORDER NUMBER HAS NOW CHANGED !! ****");
    System.out.println("New order number is : " + order.getId());
    return order.getId();
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty)

Example 2 with Order

use of com.google.api.ads.admanager.axis.v202202.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method display.

public void display(int orderId) {
    Pwinty pwinty = getPwinty(environment);
    Order order = pwinty.getOrder(orderId);
    System.out.println(order);
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty)

Example 3 with Order

use of com.google.api.ads.admanager.axis.v202202.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method addPhotoToOrder.

public void addPhotoToOrder(int orderIdToUpdate, URL newUrl, Photo.Type type, int copies, Photo.Sizing sizing) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    order.addPhoto(newUrl, type, copies, sizing);
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty)

Example 4 with Order

use of com.google.api.ads.admanager.axis.v202202.Order in project pwinty-java-sdk by OddPrints.

the class OrderUpdater method updateImageUrl.

public void updateImageUrl(int orderIdToUpdate, int photoIdToUpdate, URL newUrl) {
    Pwinty pwinty = getPwinty(environment);
    System.out.println(pwinty.getOrder(orderIdToUpdate));
    Order order = pwinty.getOrder(orderIdToUpdate);
    List<Photo> photos = order.getPhotos();
    Photo.Type type = null;
    Photo.Sizing sizing = null;
    int copies = 0;
    for (Photo photo : photos) {
        if (photo.getId() == photoIdToUpdate) {
            type = photo.getType();
            sizing = photo.getSizing();
            copies = photo.getCopies();
            order.deletePhoto(photo);
        }
    }
    order.addPhoto(newUrl, type, copies, sizing);
}
Also used : Order(uk.co.mattburns.pwinty.v2_3.Order) Pwinty(uk.co.mattburns.pwinty.v2_3.Pwinty) Photo(uk.co.mattburns.pwinty.v2_3.Photo)

Example 5 with Order

use of com.google.api.ads.admanager.axis.v202202.Order in project googleads-java-lib by googleads.

the class GetAllOrders method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
    // Get the OrderService.
    OrderServiceInterface orderService = adManagerServices.get(session, OrderServiceInterface.class);
    // Create a statement to select all orders.
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    int totalResultSetSize = 0;
    do {
        // Get orders by statement.
        OrderPage page = orderService.getOrdersByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (Order order : page.getResults()) {
                System.out.printf("%d) Order with ID %d and name '%s' was found.%n", i++, order.getId(), order.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : Order(com.google.api.ads.admanager.axis.v202111.Order) OrderPage(com.google.api.ads.admanager.axis.v202111.OrderPage) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder) OrderServiceInterface(com.google.api.ads.admanager.axis.v202111.OrderServiceInterface)

Aggregations

Order (uk.co.mattburns.pwinty.v2_3.Order)7 Pwinty (uk.co.mattburns.pwinty.v2_3.Pwinty)7 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)6 Random (java.util.Random)6 Order (com.google.api.ads.admanager.axis.v202108.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202108.OrderServiceInterface)5 Order (com.google.api.ads.admanager.axis.v202111.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202111.OrderServiceInterface)5 Order (com.google.api.ads.admanager.axis.v202202.Order)5 OrderServiceInterface (com.google.api.ads.admanager.axis.v202202.OrderServiceInterface)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)4 OrderPage (com.google.api.ads.admanager.axis.v202108.OrderPage)4 OrderPage (com.google.api.ads.admanager.axis.v202111.OrderPage)4 OrderPage (com.google.api.ads.admanager.axis.v202202.OrderPage)4 AdUnitTargeting (com.google.api.ads.admanager.axis.v202202.AdUnitTargeting)3 CreativePlaceholder (com.google.api.ads.admanager.axis.v202202.CreativePlaceholder)3 Goal (com.google.api.ads.admanager.axis.v202202.Goal)3 InventoryTargeting (com.google.api.ads.admanager.axis.v202202.InventoryTargeting)3 LineItem (com.google.api.ads.admanager.axis.v202202.LineItem)3