All Downloads are FREE. Search and download functionalities are using the official Maven repository.

widget.WidgetTest Maven / Gradle / Ivy

package widget;

import com.paymentwall.java.*;
import java.util.HashMap;
import java.util.ArrayList;

public class WidgetTest {
	public static void main(String [] args) {
		Config.getInstance().setLocalApiType(Config.API_CART);
		Config.getInstance().setPublicKey("35fd73bc56d6243fe9e0c310589db948");
		Config.getInstance().setPrivateKey("b07db72cc8687d0f755a007d2183f680");

		WidgetBuilder widgetBuilder = new WidgetBuilder("T3_TEST_210508","p1_1");

		widgetBuilder.setProducts(new ArrayList(){{
			add(
				new ProductBuilder("202104261556") {{
					setAmount(29.99);
					setName("ELYON_BUNDLE_CLASSIC");
					setCurrencyCode("USD");
				}}.build()
			);
			add(
				new ProductBuilder("202104261557"){{
					setAmount(9.99);
					setName("ELYON_BUNDLE_GAME");
					setCurrencyCode("USD");
				}}.build()
			);
		}});

		widgetBuilder.setExtraParams(
			new HashMap() {{
				put("flexible_cart_api", "1");
			}}
		);

		Widget w = widgetBuilder.build();
		System.out.println(w.getHtmlCode());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy