Package com.google.checkout.schema._2.impl

Examples of com.google.checkout.schema._2.impl.ResultImpl$Unmarshaller


   */
  public ShippingMethodsType createFlatRateShipping(String shippingName,
      float shippingCost, String currency, ShippingRestrictions shipRestrictions)
      throws ProtocolException {
    try {
      FlatRateShipping flatRate = _objectFact.createFlatRateShipping();
      flatRate.setName(shippingName);
      flatRate.setPrice(createMoney(shippingCost, currency));
      flatRate.setShippingRestrictions(shipRestrictions);
      return addShippingMethod(flatRate);
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
    }
  }
View Full Code Here


  * Test method for 'com.google.checkout.sample.protocol.MerchantCalculationResultBuilder.createGiftCertResult(boolean, float, String, String)'
  */
  public void testCreateGiftCertResult() throws Exception {
    MerchantCalculationResultBuilder builder
        = MerchantCalculationResultBuilder.getInstance();
    GiftCertificateResult gift1 = builder.createGiftCertResult(true, 100F,
        "GIFT100", "100$USD value");
    assertEquals("GIFT100", gift1.getCode());
   
    try {
      GiftCertificateResult invalidGiftCert
        = builder.createGiftCertResult(false, -100.00F, "X1093432222",
            "negative gift value");
    } catch (ProtocolException protoEx) {
      assertContains(protoEx.getMessage(), "negative");
    }
View Full Code Here

  * Test method for 'com.google.checkout.sample.protocol.MerchantCalculationResultBuilder.createMerchantCalResultsByGiftCert(List, float, float, boolean, String)'
  */
  public void testCreateMerchantCalResultsByGiftCert() throws Exception {
    MerchantCalculationResultBuilder builder
        = MerchantCalculationResultBuilder.getInstance();
    GiftCertificateResult giftCert1 = builder.createGiftCertResult(true, 1F,
        "G100001A", "gift certA");
    GiftCertificateResult giftCert2 = builder.createGiftCertResult(true, 1F,
        "G10023343B", "gift certB");
    List giftList = new ArrayList();
    giftList.add(giftCert1);
    giftList.add(giftCert2);
   
View Full Code Here

  public void testCreateMerchantCalResults() throws Exception {
    MerchantCalculationResultBuilder builder
        = MerchantCalculationResultBuilder.getInstance();
    CouponResult coupon = builder.createCouponResult(true, 10.00F,
        "C0000111A", "normal coupon");
    GiftCertificateResult giftCert = builder.createGiftCertResult(true, 1F,
        "G10023343B", "gift certB");
   
    List couponList = new ArrayList();
    couponList.add(coupon);
   
View Full Code Here

      throws ProtocolException {
    if (StringUtil.isEmpty(certificateCode)) {
      throw new ProtocolException();
    }
   
    GiftCertificateResult gResult = _objectFact.createGiftCertificateResult();
    gResult.setCalculatedAmount(createMoney(certificateValue));
    gResult.setCode(certificateCode);
    gResult.setValid(isCodeValid);
    gResult.setMessage(additionalMsg);
    return gResult;
  }
View Full Code Here

    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue());
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here

    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List<Item> itemList = new ArrayList<Item>();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);

    if (taxTableSelector != null) {
      item.setTaxTableSelector(taxTableSelector);
    }
   
    if (privateItemData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(privateItemData);
      item.setMerchantPrivateItemData(anyType);
    }
   
    return item;
  }
View Full Code Here

      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
   
    try {
      Money money = createMoney(unitPrice, currency);
      Item item = _objectFact.createItem();
      item.setItemName(itemName);
      item.setItemDescription(itemDesc);
      item.setQuantity(quantity);
      item.setUnitPrice(money);
 
      if (taxTableSelector != null) {
        item.setTaxTableSelector(taxTableSelector);
      }
     
      if (privateItemData != null) {
        AnyType anyType = _objectFact.createAnyType();
        anyType.setAny(privateItemData);
        item.setMerchantPrivateItemData(anyType);
      }
     
      return item;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

   * @return ShippingMethods object
   */
  public ShippingMethods createMerchantShipping(String shippingName,
      float shippingCost, String currency, ShippingRestrictions shipRestrictions)
      throws ProtocolException {
    MerchantCalculatedShipping merchantCal
        = _objectFact.createMerchantCalculatedShipping();
    merchantCal.setName(shippingName);
    merchantCal.setPrice(createMoney(shippingCost, currency));
    merchantCal.setShippingRestrictions(shipRestrictions);
    return addShippingMethod(merchantCal);
 
View Full Code Here

TOP

Related Classes of com.google.checkout.schema._2.impl.ResultImpl$Unmarshaller

Copyright © 2018 www.massapicom. 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.