Examples of ShipItemsRequest


Examples of com.google.checkout.orderprocessing.lineitem.ShipItemsRequest

    private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException {
        List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId));
        if (UtilValidate.isNotEmpty(issued)) {
            try {
                GenericValue googleOrder = null;
                ShipItemsRequest isr = null;
                for (GenericValue issue : issued) {
                    GenericValue orderItem = issue.getRelatedOne("OrderItem");
                    String shipmentItemSeqId = issue.getString("shipmentItemSeqId");
                    String productId = orderItem.getString("productId");
                    String orderId = issue.getString("orderId");
                    googleOrder = findGoogleOrder(delegator, orderId);
                    if (UtilValidate.isNotEmpty(googleOrder)) {
                        MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(googleOrder));
                        if (UtilValidate.isEmpty(mInfo)) {
                            Debug.logInfo("Cannot find Google MerchantInfo for Order #" + orderId, module);
                            continue;
                        }
                        String externalId = googleOrder.getString("externalId");
                        if (UtilValidate.isEmpty(isr)) {
                            isr = new ShipItemsRequest(mInfo, externalId);
                        }
                        // locate the shipment package content record
                        Map<String, ? extends Object> spcLup = UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId);
                        List<GenericValue> spc = delegator.findByAnd("ShipmentPackageContent", spcLup);
                        GenericValue packageContent = EntityUtil.getFirst(spc);
                        String carrier = null;
                        if (UtilValidate.isNotEmpty(packageContent)) {
                            GenericValue shipPackage = packageContent.getRelatedOne("ShipmentPackage");
                            if (UtilValidate.isNotEmpty(shipPackage)) {
                                List<GenericValue> prs = shipPackage.getRelated("ShipmentPackageRouteSeg");
                                GenericValue packageRoute = EntityUtil.getFirst(prs);
                                if (UtilValidate.isNotEmpty(packageRoute)) {
                                    List<GenericValue> srs = packageRoute.getRelated("ShipmentRouteSegment");
                                    GenericValue route = EntityUtil.getFirst(srs);
                                    String track = packageRoute.getString("trackingCode");
                                    if (UtilValidate.isNotEmpty(route)) {
                                        carrier = route.getString("carrierPartyId");
                                    if (UtilValidate.isEmpty(track)) {
                                        track = route.getString("trackingIdNumber");
                                    }
                                    if (track == null) {
                                        track = "";
                                    }
                                    isr.addItemShippingInformation(productId, carrier, track);
                                    Debug.logInfo("Sending item shipped notification: " + productId + " / " + carrier + " / " + track, module);
                                    Debug.logInfo("Using merchantInfo : " + mInfo.getMerchantId() + " #" + externalId, module);
                                }
                            }
                        }
                    }
                }
            }
            if (UtilValidate.isNotEmpty(googleOrder)) {
                isr.send();
            }
            } catch (CheckoutException e) {
                Debug.logError(e, module);
                throw new GeneralException(e);
            }
View Full Code Here

Examples of com.google.checkout.orderprocessing.lineitem.ShipItemsRequest

    private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException {
        List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId));
        if (UtilValidate.isNotEmpty(issued)) {
            try {
                GenericValue googleOrder = null;
                ShipItemsRequest isr = null;
                for (GenericValue issue : issued) {
                    GenericValue orderItem = issue.getRelatedOne("OrderItem");
                    String shipmentItemSeqId = issue.getString("shipmentItemSeqId");
                    String productId = orderItem.getString("productId");
                    String orderId = issue.getString("orderId");
                    googleOrder = findGoogleOrder(delegator, orderId);
                    if (UtilValidate.isNotEmpty(googleOrder)) {
                        MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(googleOrder));
                        if (UtilValidate.isEmpty(mInfo)) {
                            Debug.logInfo("Cannot find Google MerchantInfo for Order #" + orderId, module);
                            continue;
                        }
                        String externalId = googleOrder.getString("externalId");
                        if (UtilValidate.isEmpty(isr)) {
                            isr = new ShipItemsRequest(mInfo, externalId);
                        }
                        // locate the shipment package content record
                        Map<String, ? extends Object> spcLup = UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId);
                        List<GenericValue> spc = delegator.findByAnd("ShipmentPackageContent", spcLup);
                        GenericValue packageContent = EntityUtil.getFirst(spc);
                        String carrier = null;
                        if (UtilValidate.isNotEmpty(packageContent)) {
                            GenericValue shipPackage = packageContent.getRelatedOne("ShipmentPackage");
                            if (UtilValidate.isNotEmpty(shipPackage)) {
                                List<GenericValue> prs = shipPackage.getRelated("ShipmentPackageRouteSeg");
                                GenericValue packageRoute = EntityUtil.getFirst(prs);
                                if (UtilValidate.isNotEmpty(packageRoute)) {
                                    List<GenericValue> srs = packageRoute.getRelated("ShipmentRouteSegment");
                                    GenericValue route = EntityUtil.getFirst(srs);
                                    String track = packageRoute.getString("trackingCode");
                                    if (UtilValidate.isNotEmpty(route)) {
                                        carrier = route.getString("carrierPartyId");
                                    if (UtilValidate.isEmpty(track)) {
                                        track = route.getString("trackingIdNumber");
                                    }
                                    if (track == null) {
                                        track = "";
                                    }
                                    isr.addItemShippingInformation(productId, carrier, track);
                                    Debug.logInfo("Sending item shipped notification: " + productId + " / " + carrier + " / " + track, module);
                                    Debug.logInfo("Using merchantInfo : " + mInfo.getMerchantId() + " #" + externalId, module);
                                }
                            }
                        }
                    }
                }
            }
            if (UtilValidate.isNotEmpty(googleOrder)) {
                isr.send();
            }
            } catch (CheckoutException e) {
                Debug.logError(e, module);
                throw new GeneralException(e);
            }
View Full Code Here

Examples of com.google.checkout.orderprocessing.lineitem.ShipItemsRequest

    private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException {
        List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId));
        if (UtilValidate.isNotEmpty(issued)) {
            try {
                GenericValue googleOrder = null;
                ShipItemsRequest isr = null;
                for (GenericValue issue : issued) {
                    GenericValue orderItem = issue.getRelatedOne("OrderItem");
                    String shipmentItemSeqId = issue.getString("shipmentItemSeqId");
                    String productId = orderItem.getString("productId");
                    String orderId = issue.getString("orderId");
                    googleOrder = findGoogleOrder(delegator, orderId);
                    if (UtilValidate.isNotEmpty(googleOrder)) {
                        MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(googleOrder));
                        if (UtilValidate.isEmpty(mInfo)) {
                            Debug.logInfo("Cannot find Google MerchantInfo for Order #" + orderId, module);
                            continue;
                        }
                        String externalId = googleOrder.getString("externalId");
                        if (UtilValidate.isEmpty(isr)) {
                            isr = new ShipItemsRequest(mInfo, externalId);
                        }
                        // locate the shipment package content record
                        Map<String, ? extends Object> spcLup = UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId);
                        List<GenericValue> spc = delegator.findByAnd("ShipmentPackageContent", spcLup);
                        GenericValue packageContent = EntityUtil.getFirst(spc);
                        String carrier = null;
                        if (UtilValidate.isNotEmpty(packageContent)) {
                            GenericValue shipPackage = packageContent.getRelatedOne("ShipmentPackage");
                            if (UtilValidate.isNotEmpty(shipPackage)) {
                                List<GenericValue> prs = shipPackage.getRelated("ShipmentPackageRouteSeg");
                                GenericValue packageRoute = EntityUtil.getFirst(prs);
                                if (UtilValidate.isNotEmpty(packageRoute)) {
                                    List<GenericValue> srs = packageRoute.getRelated("ShipmentRouteSegment");
                                    GenericValue route = EntityUtil.getFirst(srs);
                                    String track = packageRoute.getString("trackingCode");
                                    if (UtilValidate.isNotEmpty(route)) {
                                        carrier = route.getString("carrierPartyId");
                                    if (UtilValidate.isEmpty(track)) {
                                        track = route.getString("trackingIdNumber");
                                    }
                                    if (track == null) {
                                        track = "";
                                    }
                                    isr.addItemShippingInformation(productId, carrier, track);
                                    Debug.logInfo("Sending item shipped notification: " + productId + " / " + carrier + " / " + track, module);
                                    Debug.logInfo("Using merchantInfo : " + mInfo.getMerchantId() + " #" + externalId, module);
                                }
                            }
                        }
                    }
                }
            }
            if (UtilValidate.isNotEmpty(googleOrder)) {
                isr.send();
            }
            } catch (CheckoutException e) {
                Debug.logError(e, module);
                throw new GeneralException(e);
            }
View Full Code Here

Examples of com.google.checkout.orderprocessing.lineitem.ShipItemsRequest

    private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException {
        List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId));
        if (UtilValidate.isNotEmpty(issued)) {
            try {
                GenericValue googleOrder = null;
                ShipItemsRequest isr = null;
                for (GenericValue issue : issued) {
                    GenericValue orderItem = issue.getRelatedOne("OrderItem");
                    String shipmentItemSeqId = issue.getString("shipmentItemSeqId");
                    String productId = orderItem.getString("productId");
                    String orderId = issue.getString("orderId");
                    googleOrder = findGoogleOrder(delegator, orderId);
                    if (UtilValidate.isNotEmpty(googleOrder)) {
                        MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(googleOrder));
                        if (UtilValidate.isEmpty(mInfo)) {
                            Debug.logInfo("Cannot find Google MerchantInfo for Order #" + orderId, module);
                            continue;
                        }
                        String externalId = googleOrder.getString("externalId");
                        if (UtilValidate.isEmpty(isr)) {
                            isr = new ShipItemsRequest(mInfo, externalId);
                        }
                        // locate the shipment package content record
                        Map<String, ? extends Object> spcLup = UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId);
                        List<GenericValue> spc = delegator.findByAnd("ShipmentPackageContent", spcLup);
                        GenericValue packageContent = EntityUtil.getFirst(spc);
                        String carrier = null;
                        if (UtilValidate.isNotEmpty(packageContent)) {
                            GenericValue shipPackage = packageContent.getRelatedOne("ShipmentPackage");
                            if (UtilValidate.isNotEmpty(shipPackage)) {
                                List<GenericValue> prs = shipPackage.getRelated("ShipmentPackageRouteSeg");
                                GenericValue packageRoute = EntityUtil.getFirst(prs);
                                if (UtilValidate.isNotEmpty(packageRoute)) {
                                    List<GenericValue> srs = packageRoute.getRelated("ShipmentRouteSegment");
                                    GenericValue route = EntityUtil.getFirst(srs);
                                    String track = packageRoute.getString("trackingCode");
                                    if (UtilValidate.isNotEmpty(route)) {
                                        carrier = route.getString("carrierPartyId");
                                    if (UtilValidate.isEmpty(track)) {
                                        track = route.getString("trackingIdNumber");
                                    }
                                    if (track == null) {
                                        track = "";
                                    }
                                    isr.addItemShippingInformation(productId, carrier, track);
                                    Debug.logInfo("Sending item shipped notification: " + productId + " / " + carrier + " / " + track, module);
                                    Debug.logInfo("Using merchantInfo : " + mInfo.getMerchantId() + " #" + externalId, module);
                                }
                            }
                        }
                    }
                }
            }
            if (UtilValidate.isNotEmpty(googleOrder)) {
                isr.send();
            }
            } catch (CheckoutException e) {
                Debug.logError(e, module);
                throw new GeneralException(e);
            }
View Full Code Here

Examples of com.google.checkout.sdk.domain.ShipItemsRequest

  }

  @Override
  public void shipItems(ItemShippingInformationBuilder shipping)
      throws CheckoutException {
    ShipItemsRequest shipItemsRequest = new ShipItemsRequest();
    shipItemsRequest.setGoogleOrderNumber(googleOrderNumber);
    List<ItemShippingInformation> trackingDatas = shipping.build();
    ShipItemsRequest.ItemShippingInformationList itemShippingList =
      new ShipItemsRequest.ItemShippingInformationList();
    itemShippingList.getItemShippingInformation().addAll(trackingDatas);
    shipItemsRequest.setItemShippingInformationList(itemShippingList);
    shipItemsRequest.setSendEmail(sendEmails);
    postCommand(shipItemsRequest.toJAXB());
  }
View Full Code Here

Examples of com.google.checkout.sdk.domain.ShipItemsRequest

    tester.shipItems(
        new ItemShippingInformationBuilder().addShipping("itemId", new TrackingDataBuilder()
            .addTrackingData("c1", "tn1")
            .addTrackingData("c2", "tn2")));
    assertEquals(1, commands.size());
    ShipItemsRequest shipItemsRequest =
      (ShipItemsRequest) commands.get(0).getValue();
    List<ItemShippingInformation> itemShippingInformation =
      shipItemsRequest.getItemShippingInformationList().getItemShippingInformation();
    assertEquals(Boolean.FALSE, shipItemsRequest.isSendEmail());
    assertEquals("googleOrderNumber", shipItemsRequest.getGoogleOrderNumber());
    assertEquals(1, itemShippingInformation.size());
    assertEquals("itemId", itemShippingInformation.get(0).getItemId().getMerchantItemId());

    assertEquals(2, itemShippingInformation.get(0).getTrackingDataList().getTrackingData().size());
    assertEquals("c1", getTrackingData(itemShippingInformation, 0).getCarrier());
View Full Code Here

Examples of com.google.checkout.sdk.domain.ShipItemsRequest

  public void testNoEmailShipItems() {
    OrderCommands tester = new CommandPosterImplTester(
        apiContext(), "googleOrderNumber", false, commands);
    tester.itemCommands("itemId1", "itemId2").shipItems("c", "tn");
    assertEquals(1, commands.size());
    ShipItemsRequest shipItemsRequest =
      (ShipItemsRequest) commands.get(0).getValue();
    assertEquals(Boolean.FALSE, shipItemsRequest.isSendEmail());
    assertEquals("googleOrderNumber", shipItemsRequest.getGoogleOrderNumber());
    List<ItemShippingInformation> itemShippingInformation =
      shipItemsRequest.getItemShippingInformationList().getItemShippingInformation();
    assertEquals(2, itemShippingInformation.size());
    assertEquals("itemId1", itemShippingInformation.get(0).getItemId().getMerchantItemId());
    assertEquals("itemId2", itemShippingInformation.get(1).getItemId().getMerchantItemId());
    for (ItemShippingInformation i : itemShippingInformation) {
      List<TrackingData> trackingDataList = i.getTrackingDataList().getTrackingData();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.