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

com.svea.businessobjects.paymentgw.SveaPmtGwBusinessObjectFactory Maven / Gradle / Ivy

The newest version!
package com.svea.businessobjects.paymentgw;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.notima.generic.businessobjects.BasicBusinessObjectFactory;
import org.notima.generic.businessobjects.BusinessPartner;
import org.notima.generic.businessobjects.BusinessPartnerList;
import org.notima.generic.businessobjects.DunningRun;
import org.notima.generic.businessobjects.Invoice;
import org.notima.generic.businessobjects.Order;
import org.notima.generic.businessobjects.PaymentTerm;
import org.notima.generic.businessobjects.PriceList;
import org.notima.generic.businessobjects.Product;
import org.notima.generic.businessobjects.ProductCategory;
import org.notima.generic.businessobjects.Tax;
import org.notima.generic.businessobjects.exception.NoSuchTenantException;
import org.notima.generic.ifacebusinessobjects.FactoringReservation;

import com.svea.webpay.paymentgw.PaymentGwClient;
import com.svea.webpay.paymentgw.entity.Customer;
import com.svea.webpay.paymentgw.entity.Transaction;

public class SveaPmtGwBusinessObjectFactory extends BasicBusinessObjectFactory <
		PaymentGwClient, 
		Object,		// Invoice 
		com.svea.webpay.paymentgw.entity.Transaction,	// Order
		Object,		// Product
		com.svea.webpay.paymentgw.entity.Customer, // BusinessPartner
		Object		// Tenant (UG)
		>
		
{

	private PaymentGwClient	client = null;

	/**
	 * To initialize this object factory it must be initialized with credentials.
	 * 
	 * @param cardMerchantId
	 * @param cardSecretWord
	 */
	public void init(Integer cardMerchantId, String cardSecretWord) {
		
		client = new PaymentGwClient(cardMerchantId, cardSecretWord);
		
	}
	
	
	@Override
	public String getSystemName() {
		return "SveaPaymentGateway";
	}

	@Override
	public BusinessPartnerList listTenants() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public BusinessPartner lookupBusinessPartner(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List> lookupAllBusinessPartners() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List> lookupBusinessPartners(int maxCount, boolean customers, boolean suppliers)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public BusinessPartner lookupThisCompanyInformation() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public DunningRun lookupDunningRun(String key, Date dueDateUntil) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public PaymentGwClient getClient() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object lookupNativeInvoice(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object persistNativeInvoice(Object invoice) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Transaction lookupNativeOrder(String key) throws Exception {

		if (key==null) return null;
		Long transactionId = Long.parseLong(key);
		
		Transaction tr = client.queryByTransactionId(transactionId);
		
		return tr;
	}

	@Override
	public Transaction persistNativeOrder(Transaction order) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Invoice lookupInvoice(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Order lookupOrder(String key) throws Exception {

		Transaction tr = lookupNativeOrder(key);
		Order order = SveaPmtGwConverter.convert(tr);
		
		return order;
	}

	@Override
	public Product lookupProduct(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Product lookupProductByEan(String ean) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List> lookupProductByName(String name) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public PriceList lookupPriceForProduct(String productKey, String currency, Boolean salesPriceList)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List lookupProductCategory(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map lookupList(String listName) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Product lookupRoundingProduct() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Tax lookupTax(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public PaymentTerm lookupPaymentTerm(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public FactoringReservation lookupFactoringReservation(String key) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List lookupFactoringReservationForOrder(String orderKey) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List lookupFactoringReservationForInvoice(String invoiceKey) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object persist(Object o) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isConnected() throws Exception {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void destroy() throws Exception {
		// TODO Auto-generated method stub
		
	}
	
}