Package com.eclipsesource.tabris.tracking

Examples of com.eclipsesource.tabris.tracking.Order


    verify( out ).println( "SEARCH - query=query [appId, model, vendor, osVersion]" );
  }

  @Test
  public void testPrintsOrder() {
    Order order = new Order( "foo", BigDecimal.ONE );
    TrackingEvent event = new TrackingEvent( EventType.ORDER, createInfo(), order, 23 );

    tracker.handleEvent( event );

    verify( out ).println( "ORDER - " + order.getOrderId() + " (1, 0, 0) [appId, model, vendor, osVersion]" );
  }
View Full Code Here


  public void testSendsEcommerceAction() {
    Piwik piwik = mock( Piwik.class );
    PiwikTracker tracker = new PiwikTracker( piwik, fakeTokenAuth );
    TrackingEvent event = new TrackingEvent( EventType.ORDER,
                                             createInfo(),
                                             new Order( "orderId", new BigDecimal( 20 ) ),
                                             1 );

    tracker.handleEvent( event );

    ArgumentCaptor<Action> actionCaptor = ArgumentCaptor.forClass( Action.class );
View Full Code Here

  @Test
  public void testSendsOrder() {
    GoogleAnalytics analytics = mock( GoogleAnalytics.class );
    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker( analytics );
    Order order = new Order( "foo", BigDecimal.ONE );
    TrackingEvent event = new TrackingEvent( EventType.ORDER, createInfo(), order, 1 );

    tracker.handleEvent( event );

    ArgumentCaptor<Hit> hitCaptor = ArgumentCaptor.forClass( Hit.class );
    ArgumentCaptor<AdvancedConfiguration> configCaptor = ArgumentCaptor.forClass( AdvancedConfiguration.class );
    verify( analytics ).track( hitCaptor.capture(), eq( "clientId" ), configCaptor.capture() );
    assertAdvancedConfiguration( configCaptor.getValue() );
    assertEquals( order.getOrderId(), hitCaptor.getValue().getParameter().get( getRequestKey( RequestKeys.TRANSACTION_ID ) ) );
    assertEquals( Double.valueOf( 1 ), hitCaptor.getValue().getParameter().get( getRequestKey( RequestKeys.TRANSACTION_REVENUE ) ) );
    assertEquals( Double.valueOf( 0 ), hitCaptor.getValue().getParameter().get( getRequestKey( RequestKeys.TRANSACTION_SHIPPING ) ) );
    assertEquals( Double.valueOf( 0 ), hitCaptor.getValue().getParameter().get( getRequestKey( RequestKeys.TRANSACTION_TAX ) ) );
  }
View Full Code Here

  @Test
  public void testSendsOrderWithItems() {
    GoogleAnalytics analytics = mock( GoogleAnalytics.class );
    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker( analytics );
    Order order = new Order( "foo", BigDecimal.ONE );
    order.addItem( new OrderItem( "bar" ).setCategory( "blub" ).setSKU( "hmpf" ) );
    TrackingEvent event = new TrackingEvent( EventType.ORDER, createInfo(), order, 1 );

    tracker.handleEvent( event );

    ArgumentCaptor<Hit> hitCaptor = ArgumentCaptor.forClass( Hit.class );
View Full Code Here

    String actionId = ( String )event.getDetail();
    return new SearchAction( createHost( event ) + "/action/search/" + actionId, event.getInfo().getSearchQuery() );
  }

  private Action createEcommerceAction( TrackingEvent event ) {
    Order order = ( Order )event.getDetail();
    EcommerceAction action = new EcommerceAction( createHost( event ) + "/action/ecommerce/" + order.getOrderId(),
                                                  order.getOrderId(),
                                                  order.getTotal() );
    action.setTax( order.getTax() );
    action.setShipping( order.getShipping() );
    if( !order.getItems().isEmpty() ) {
      action.setItems( getOrderItems( order.getItems() ) );
    }
    return action;
  }
View Full Code Here

    builder.append( "query=" );
    builder.append( event.getInfo().getSearchQuery() );
  }

  private void appendOrder( StringBuilder builder, TrackingEvent event ) {
    Order info = ( Order )event.getDetail();
    builder.append( info.getOrderId() );
    builder.append( " (" );
    builder.append( info.getTotal() + ", " + info.getShipping() + ", " + info.getTax() );
    builder.append( ")" );
  }
View Full Code Here

    advancedConfiguration.setCustomDimension( searchIndex, event.getInfo().getSearchQuery() );
    return eventHit;
  }

  private Hit createTransactionHit( TrackingEvent event, AdvancedConfiguration advancedConfiguration ) {
    Order order = ( Order )event.getDetail();
    TransactionHit hit = new TransactionHit( order.getOrderId() );
    hit.setRevenue( toDouble( order.getTotal() ) );
    hit.setShipping( toDouble( order.getShipping() ) );
    hit.setTax( toDouble( order.getTax() ) );
    return hit;
  }
View Full Code Here

    hit.setTax( toDouble( order.getTax() ) );
    return hit;
  }

  private List<Hit> createItemHits( TrackingEvent event, AdvancedConfiguration advancedConfiguration ) {
    Order order = ( Order )event.getDetail();
    List<Hit> itemHits = new ArrayList<Hit>();
    for( OrderItem item : order.getItems() ) {
      itemHits.add( createItemHit( order.getOrderId(), item ) );
    }
    return itemHits;
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.tracking.Order

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.