// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov  Date: 21.11.2008 г. 18:46:12

// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!

// Decompiler options: packimports(3)

// Source File Name:   eBaySvc.java

package eBay;

import com.bas.shared.data.FunctionDescription;

import com.bas.shared.functions.IFunctionLibrary;

import com.bas.shared.ruleparser.INodeHelper;

import com.bas.shared.ruleparser.ISQLBuilderHelper;

import com.ebay.sdk.*;

import com.ebay.soap.eBLBaseComponents.*;

import java.io.PrintStream;

import java.util.Collection;

import org.apache.axis.types.Token;

import org.apache.axis.types.URI;

import org.openadaptor.util.DateTimeHolder;

// Referenced classes of package eBay:

//            eBayCall

public class eBaySvc

    implements IFunctionLibrary

{

    public eBaySvc()

    {

        shippingServices = null;

    }

    public Object calculate(String arg0, Object arg1[], INodeHelper arg2)

    {

        for(int i = 0; i < arg1.length; i++)

            System.out.println(arg1[i].toString());

        if(arg0.compareTo("GetEbayTime") != 0)

            break MISSING_BLOCK_LABEL_171;

        if(arg1.length != 1)

            return "-1";

        ApiCall call;

        GetItemTransactionsRequestType request;

        AbstractResponseType response;

        DateTimeHolder date;

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[0]);

        request = new GeteBayOfficialTimeRequestType();

        date = null;

        response = call.executeByApiName("GeteBayOfficialTime", request);

        if(response.getAck() == AckCodeType.Success)

            break MISSING_BLOCK_LABEL_154;

        ErrorType error[] = response.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return date;

        date = new DateTimeHolder(response.getTimestamp());

        return date;

        AbstractResponseType response;

        String retval;

        if(arg0.compareTo("GetBuyer") != 0)

            break MISSING_BLOCK_LABEL_547;

        if(arg1.length != 2)

            break MISSING_BLOCK_LABEL_544;

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[1]);

        request = new GetItemTransactionsRequestType();

        ItemIDType itemID = new ItemIDType(arg1[0].toString());

        UserType buyer = new UserType();

        BuyerType buyerInfo = new BuyerType();

        AddressType address = new AddressType();

        request.setItemID(itemID);

        response = call.executeByApiName("GetItemTransactions", request);

        if(response.getAck() != AckCodeType.Success)

            break MISSING_BLOCK_LABEL_493;

        TransactionArrayType array = ((GetItemTransactionsResponseType)response).getTransactionArray();

        TransactionType transactions[] = array.getTransaction();

        buyer = transactions[0].getBuyer();

        buyerInfo = buyer.getBuyerInfo();

        address = buyerInfo.getShippingAddress();

        String testString = "////" + address.getStreet2() + "/////";

        if(testString.compareTo("////null/////") == 0)

            testString = " ";

        retval = address.getName() + " / " + buyer.getEmail() + " // " + address.getPhone() + " /// " + address.getStreet1() + " //// " + testString + " ///// " + address.getCityName() + " ////// " + address.getStateOrProvince() + " /////// " + address.getCountryName() + " //////// " + address.getPostalCode();

        return retval;

        ErrorType error[] = response.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        return "-1";

        if(arg0.compareTo("AddItem") != 0)

            break MISSING_BLOCK_LABEL_1513;

        if(arg1.length != 15)

            return "-1";

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[14]);

        request = new AddItemRequestType();

        ItemType myItem = new ItemType();

        CategoryType cat = new CategoryType();

        cat.setCategoryID((String)arg1[9]);

        StorefrontType store = new StorefrontType();

        store.setStoreCategoryID((new Long((String)arg1[13])).longValue());

        ShippingDetailsType shipDetails = new ShippingDetailsType();

        shipDetails.setChangePaymentInstructions(new Boolean(true));

        String paymentInstruction = (String)arg1[10];

        shipDetails.setPaymentInstructions(paymentInstruction);

        if(((String)arg1[5]).compareTo("Y") == 0)

            shipDetails.setInsuranceOption(InsuranceOptionCodeType.Optional);

        else

        if(((String)arg1[5]).compareTo("N") == 0)

            shipDetails.setInsuranceOption(InsuranceOptionCodeType.Required);

        double adjustment = 0.0D;

        if(arg1[7] instanceof Double)

        {

            double insuranceCost = ((Double)arg1[7]).doubleValue();

            if(((String)arg1[5]).compareTo("Y") == 0)

                adjustment = insuranceCost;

            shipDetails.setInsuranceFee(new AmountType(insuranceCost));

        } else

        {

            String insuranceCost = (String)arg1[7];

            if(((String)arg1[5]).compareTo("Y") == 0)

                adjustment = (new Double(insuranceCost)).doubleValue();

            shipDetails.setInsuranceFee(new AmountType(insuranceCost));

        }

        String shipTo[] = new String[1];

        shipTo[0] = "Worldwide";

        myItem.setShipToLocations(shipTo);

        shipDetails.setShippingType(ShippingTypeCodeType.Flat);

        ShippingServiceOptionsType serviceOptions[] = new ShippingServiceOptionsType[1];

        serviceOptions[0] = new ShippingServiceOptionsType();

        serviceOptions[0].setShippingService(ShippingServiceCodeType.ShippingMethodStandard.getValue());

        if(arg1[8] instanceof Double)

        {

            double shippingCost = ((Double)arg1[8]).doubleValue() + adjustment;

            serviceOptions[0].setShippingServiceCost(new AmountType(shippingCost));

        } else

        {

            double shippingCost = (new Double((String)arg1[8])).doubleValue() + adjustment;

            serviceOptions[0].setShippingServiceCost(new AmountType(shippingCost));

        }

        if(arg1[7] instanceof Double)

        {

            double insuranceCost = ((Double)arg1[7]).doubleValue();

            serviceOptions[0].setShippingInsuranceCost(new AmountType(insuranceCost));

        } else

        {

            String insuranceCost = (String)arg1[7];

            serviceOptions[0].setShippingInsuranceCost(new AmountType(insuranceCost));

        }

        serviceOptions[0].setShippingServiceAdditionalCost(new AmountType((new Double("0.00")).doubleValue()));

        shipDetails.setShippingServiceOptions(serviceOptions);

        BuyerPaymentMethodCodeType payments[] = new BuyerPaymentMethodCodeType[3];

        payments[0] = BuyerPaymentMethodCodeType.PayPal;

        payments[1] = BuyerPaymentMethodCodeType.VisaMC;

        payments[2] = BuyerPaymentMethodCodeType.AmEx;

        myItem.setSite(SiteCodeType.US);

        myItem.setPrimaryCategory(cat);

        myItem.setShippingDetails(shipDetails);

        myItem.setCountry(CountryCodeType.CA);

        myItem.setCurrency(CurrencyCodeType.USD);

        myItem.setPayPalEmailAddress((String)arg1[11]);

        BuyerProtectionDetailsType protDetails = new BuyerProtectionDetailsType();

        protDetails.setBuyerProtectionSource(BuyerProtectionSourceCodeType.PayPal);

        protDetails.setBuyerProtectionStatus(BuyerProtectionCodeType.ItemEligible);

        myItem.setApplyBuyerProtection(protDetails);

        myItem.setStorefront(store);

        myItem.setListingType(ListingTypeCodeType.FixedPriceItem);

        myItem.setListingDuration(ListingDurationCodeType._Days_7);

        myItem.setLocation((String)arg1[12]);

        myItem.setPaymentMethods(payments);

        myItem.setShippingDetails(shipDetails);

        myItem.setTitle((String)arg1[0]);

        if(arg1[1] instanceof Double)

        {

            System.out.println("DOUBLE Price");

            double price = ((Double)arg1[1]).doubleValue();

            myItem.setStartPrice(new AmountType(price));

        } else

        {

            String price = (String)arg1[1];

            myItem.setStartPrice(new AmountType((new Double(price)).doubleValue()));

        }

        myItem.setQuantity(new Integer((String)arg1[2]));

        myItem.setDescription((String)arg1[3]);

        PictureDetailsType picture = new PictureDetailsType();

        URI pictureLocation[] = new URI[1];

        pictureLocation[0] = new URI((String)arg1[4]);

        picture.setPictureURL(pictureLocation);

        myItem.setPictureDetails(picture);

        request.setItem(myItem);

        itemID = call.executeByApiName("AddItem", request);

        if(itemID.getAck() == AckCodeType.Success)

            return ((AddItemResponseType)itemID).getItemID().toString();

        ErrorType error[] = itemID.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        if(arg0.compareTo("RelistItem") != 0)

            break MISSING_BLOCK_LABEL_1736;

        if(arg1.length != 2)

            break MISSING_BLOCK_LABEL_1733;

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[1]);

        ApiCall callRelist = eBay.newCall((String)arg1[1]);

        GetItemRequestType itemRequest = new GetItemRequestType();

        ItemIDType itemID = new ItemIDType();

        RelistItemRequestType request = new RelistItemRequestType();

        ItemType item = new ItemType();

        itemID.setValue((String)arg1[0]);

        itemRequest.setItemID(itemID);

        myItem = call.executeByApiName("GetItem", itemRequest);

        item = ((GetItemResponseType)myItem).getItem();

        request.setItem(item);

        myItem = callRelist.executeByApiName("RelistItem", request);

        if(myItem.getAck() == AckCodeType.Success)

            return ((RelistItemResponseType)myItem).getItemID().toString();

        ErrorType error[] = myItem.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        return "-1";

        if(arg0.compareTo("EndItem") != 0)

            break MISSING_BLOCK_LABEL_2024;

        if(arg1.length != 3)

            break MISSING_BLOCK_LABEL_2021;

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[2]);

        callRelist = new EndItemRequestType();

        ItemIDType itemID = new ItemIDType();

        itemID.setValue((String)arg1[0]);

        callRelist.setItemID(itemID);

        if(((String)arg1[1]).compareTo("Incorrect") == 0)

        {

            callRelist.setEndingReason(EndReasonCodeType.Incorrect);

            break MISSING_BLOCK_LABEL_1943;

        }

        if(((String)arg1[1]).compareTo("LostOrBroken") == 0)

        {

            callRelist.setEndingReason(EndReasonCodeType.LostOrBroken);

            break MISSING_BLOCK_LABEL_1943;

        }

        if(((String)arg1[1]).compareTo("NotAvailable") == 0)

        {

            callRelist.setEndingReason(EndReasonCodeType.NotAvailable);

            break MISSING_BLOCK_LABEL_1943;

        }

        if(((String)arg1[1]).compareTo("OtherListingError") == 0)

        {

            callRelist.setEndingReason(EndReasonCodeType.OtherListingError);

            break MISSING_BLOCK_LABEL_1943;

        }

        if(((String)arg1[1]).compareTo("SellToHighBidder") == 0)

        {

            callRelist.setEndingReason(EndReasonCodeType.SellToHighBidder);

            break MISSING_BLOCK_LABEL_1943;

        }

        return "-1";

        itemRequest = call.executeByApiName("EndItem", callRelist);

        if(itemRequest.getAck() == AckCodeType.Success)

            return "1";

        ErrorType error[] = itemRequest.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        return "-1";

        if(arg0.compareTo("SetNotificationPreferences") != 0)

            break MISSING_BLOCK_LABEL_2391;

        if(arg1.length != 2)

            break MISSING_BLOCK_LABEL_4625;

        eBayCall eBay = new eBayCall();

        call = eBay.newCall((String)arg1[1]);

        callRelist = new SetNotificationPreferencesRequestType();

        ApplicationDeliveryPreferencesType appPreference = new ApplicationDeliveryPreferencesType();

        NotificationEnableType enableType[] = new NotificationEnableType[5];

        NotificationEnableArrayType enableArray = new NotificationEnableArrayType();

        appPreference.setApplicationURL(new URI("mailto://" + (String)arg1[0]));

        appPreference.setApplicationEnable(EnableCodeType.Enable);

        callRelist.setApplicationDeliveryPreferences(appPreference);

        enableType[0] = new NotificationEnableType();

        enableType[1] = new NotificationEnableType();

        enableType[2] = new NotificationEnableType();

        enableType[3] = new NotificationEnableType();

        enableType[4] = new NotificationEnableType();

        enableType[0].setEventType(NotificationEventTypeCodeType.AuctionCheckoutComplete);

        enableType[1].setEventType(NotificationEventTypeCodeType.CheckoutBuyerRequestsTotal);

        enableType[2].setEventType(NotificationEventTypeCodeType.EndOfAuction);

        enableType[3].setEventType(NotificationEventTypeCodeType.FeedbackReceived);

        enableType[4].setEventType(NotificationEventTypeCodeType.Feedback);

        enableType[0].setEventEnable(EnableCodeType.Enable);

        enableType[1].setEventEnable(EnableCodeType.Enable);

        enableType[2].setEventEnable(EnableCodeType.Enable);

        enableType[3].setEventEnable(EnableCodeType.Enable);

        enableType[4].setEventEnable(EnableCodeType.Disable);

        enableArray.setNotificationEnable(enableType);

        callRelist.setUserDeliveryPreferenceArray(enableArray);

        itemID = call.executeByApiName("SetNotificationPreferences", callRelist);

        if(itemID.getAck() == AckCodeType.Success)

            return "1";

        ErrorType error[] = itemID.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        if(arg0.compareTo("GetAmountPaid") != 0)

            break MISSING_BLOCK_LABEL_2459;

        if(arg1.length != 1)

            return "-1";

        String retval;

        int first = ((String)arg1[0]).indexOf("<AmountPaid currencyID=\"USD\">") + 29;

        int second = ((String)arg1[0]).indexOf("</AmountPaid>");

        retval = ((String)arg1[0]).substring(first, second);

        return retval;

        if(arg0.compareTo("ReviseItem") != 0)

            break MISSING_BLOCK_LABEL_3511;

        if(arg1.length != 16)

            return "-1";

        eBayCall eBay = new eBayCall();

        first = eBay.newCall((String)arg1[15]);

        retval = new ReviseItemRequestType();

        ItemType myItem = new ItemType();

        CategoryType cat = new CategoryType();

        cat.setCategoryID((String)arg1[9]);

        StorefrontType store = new StorefrontType();

        store.setStoreCategoryID((new Long((String)arg1[14])).longValue());

        ShippingDetailsType shipDetails = new ShippingDetailsType();

        shipDetails.setChangePaymentInstructions(new Boolean(true));

        String paymentInstruction = (String)arg1[10];

        shipDetails.setPaymentInstructions(paymentInstruction);

        if(((String)arg1[5]).compareTo("Y") == 0)

            shipDetails.setInsuranceOption(InsuranceOptionCodeType.Optional);

        else

        if(((String)arg1[5]).compareTo("N") == 0)

            shipDetails.setInsuranceOption(InsuranceOptionCodeType.Required);

        double adjustment = 0.0D;

        if(arg1[7] instanceof Double)

        {

            double insuranceCost = ((Double)arg1[7]).doubleValue();

            if(((String)arg1[5]).compareTo("Y") == 0)

                adjustment = insuranceCost;

            shipDetails.setInsuranceFee(new AmountType(insuranceCost));

        } else

        if(arg1[7] instanceof String)

        {

            String insuranceCost = (String)arg1[7];

            if(((String)arg1[5]).compareTo("Y") == 0)

                adjustment = (new Double(insuranceCost)).doubleValue();

            shipDetails.setInsuranceFee(new AmountType(insuranceCost));

        }

        String shipTo[] = new String[1];

        shipTo[0] = "Worldwide";

        myItem.setShipToLocations(shipTo);

        shipDetails.setShippingType(ShippingTypeCodeType.Flat);

        ShippingServiceOptionsType serviceOptions[] = new ShippingServiceOptionsType[1];

        serviceOptions[0] = new ShippingServiceOptionsType();

        serviceOptions[0].setShippingService(ShippingServiceCodeType.ShippingMethodStandard.getValue());

        if(arg1[8] instanceof Double)

        {

            double shippingCost = ((Double)arg1[8]).doubleValue() + adjustment;

            serviceOptions[0].setShippingServiceCost(new AmountType(shippingCost));

        } else

        if(arg1[8] instanceof String)

        {

            double shippingCost = (new Double((String)arg1[8])).doubleValue() + adjustment;

            serviceOptions[0].setShippingServiceCost(new AmountType(shippingCost));

        }

        if(arg1[7] instanceof Double)

        {

            double insuranceCost = ((Double)arg1[7]).doubleValue();

            serviceOptions[0].setShippingInsuranceCost(new AmountType(insuranceCost));

        } else

        if(arg1[7] instanceof String)

        {

            String insuranceCost = (String)arg1[7];

            serviceOptions[0].setShippingInsuranceCost(new AmountType(insuranceCost));

        }

        serviceOptions[0].setShippingInsuranceCost(new AmountType((new Double((String)arg1[7])).doubleValue()));

        serviceOptions[0].setShippingServiceAdditionalCost(new AmountType((new Double("0.00")).doubleValue()));

        shipDetails.setShippingServiceOptions(serviceOptions);

        BuyerPaymentMethodCodeType payments[] = new BuyerPaymentMethodCodeType[3];

        payments[0] = BuyerPaymentMethodCodeType.PayPal;

        payments[1] = BuyerPaymentMethodCodeType.VisaMC;

        payments[2] = BuyerPaymentMethodCodeType.AmEx;

        myItem.setSite(SiteCodeType.US);

        myItem.setPrimaryCategory(cat);

        myItem.setShippingDetails(shipDetails);

        myItem.setCountry(CountryCodeType.CA);

        myItem.setCurrency(CurrencyCodeType.USD);

        myItem.setPayPalEmailAddress((String)arg1[11]);

        BuyerProtectionDetailsType protDetails = new BuyerProtectionDetailsType();

        protDetails.setBuyerProtectionSource(BuyerProtectionSourceCodeType.PayPal);

        protDetails.setBuyerProtectionStatus(BuyerProtectionCodeType.ItemEligible);

        myItem.setApplyBuyerProtection(protDetails);

        myItem.setStorefront(store);

        myItem.setListingType(ListingTypeCodeType.FixedPriceItem);

        myItem.setListingDuration(ListingDurationCodeType._Days_7);

        myItem.setLocation((String)arg1[12]);

        myItem.setPaymentMethods(payments);

        myItem.setShippingDetails(shipDetails);

        myItem.setTitle((String)arg1[0]);

        if(arg1[1] instanceof Double)

        {

            double price = ((Double)arg1[1]).doubleValue();

            myItem.setStartPrice(new AmountType(price));

        } else

        if(arg1[1] instanceof String)

        {

            String price = (String)arg1[1];

            myItem.setStartPrice(new AmountType((new Double(price)).doubleValue()));

        }

        myItem.setQuantity(new Integer((String)arg1[2]));

        myItem.setDescription((String)arg1[3]);

        PictureDetailsType picture = new PictureDetailsType();

        URI pictureLocation[] = new URI[1];

        pictureLocation[0] = new URI((String)arg1[4]);

        picture.setPictureURL(pictureLocation);

        myItem.setPictureDetails(picture);

        ItemIDType item = new ItemIDType();

        item.setValue((String)arg1[13]);

        myItem.setItemID(item);

        retval.setItem(myItem);

        appPreference = first.executeByApiName("ReviseItem", retval);

        if(appPreference.getAck() == AckCodeType.Success)

            return "1";

        ErrorType error[] = ((GeteBayOfficialTimeResponseType)appPreference).getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        if(arg0.compareTo("GetItemID") != 0)

            break MISSING_BLOCK_LABEL_3570;

        int first = ((String)arg1[0]).indexOf("<ItemID>") + 8;

        int second = ((String)arg1[0]).indexOf("</ItemID>");

        retval = ((String)arg1[0]).substring(first, second);

        return retval;

        String retval;

        if(arg0.compareTo("GetFeedback") != 0)

            break MISSING_BLOCK_LABEL_3694;

        int first = ((String)arg1[0]).indexOf("<CommentText>") + 13;

        int second = ((String)arg1[0]).indexOf("</CommentText>");

        int score1 = ((String)arg1[0]).indexOf("<CommentType>") + 13;

        int score2 = ((String)arg1[0]).indexOf("</CommentType>");

        retval = ((String)arg1[0]).substring(score1, score2) + " / " + ((String)arg1[0]).substring(first, second);

        return retval;

        if(arg0.compareTo("CheckHardExpiry") != 0)

            break MISSING_BLOCK_LABEL_3773;

        if(arg1.length != 1)

            return "-1";

        eBayCall eBay = new eBayCall();

        first = eBay.newCall((String)arg1[0]);

        score1 = new GeteBayOfficialTimeRequestType();

        score2 = first.executeByApiName("GeteBayOfficialTime", score1);

        retval = score2.getHardExpirationWarning();

        if(retval == null)

            return "-1";

        return retval;

        String RuName;

        String SessID;

        if(arg0.compareTo("SetupFetch") != 0)

            break MISSING_BLOCK_LABEL_4182;

        eBayCall eBay = new eBayCall();

        first = eBay.newCall2();

        score1 = new GetRuNameRequestType();

        score1.setClientUseCase("ActionSportsOutlets");

        score2 = first.executeByApiName("GetRuName", score1);

        if(score2.getAck() != AckCodeType.Success)

            break MISSING_BLOCK_LABEL_4131;

        RuName = ((GetRuNameResponseType)score2).getRuName();

        first = eBay.newCall2();

        SetReturnURLRequestType requestURL = new SetReturnURLRequestType();

        AuthenticationEntryType authenticationEntry = new AuthenticationEntryType();

        authenticationEntry.setRuName(RuName);

        authenticationEntry.setTokenReturnMethod(TokenReturnMethodCodeType.FetchToken);

        requestURL.setApplicationDisplayName("Creative Interface - eBay iPort add-on");

        requestURL.setAuthenticationEntry(authenticationEntry);

        requestURL.setAction(ModifyActionCodeType.Add);

        AbstractResponseType responseURL = first.executeByApiName("SetReturnURL", requestURL);

        if(responseURL.getAck() != AckCodeType.Success)

            break MISSING_BLOCK_LABEL_4080;

        first = eBay.newCall2();

        GetSessionIDRequestType requestSess = new GetSessionIDRequestType();

        requestSess.setRuName(RuName);

        AbstractResponseType responseSess = first.executeByApiName("GetSessionID", requestSess);

        if(score2.getAck() != AckCodeType.Success)

            break MISSING_BLOCK_LABEL_4029;

        SessID = ((GetSessionIDResponseType)responseSess).getSessionID();

        return SessID + " / https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn&runame=" + RuName + "&SessID=" + SessID;

        ErrorType error[] = score2.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        ErrorType error[] = score2.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        ErrorType error[] = score2.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        if(arg0.compareTo("FetchToken") != 0)

            break MISSING_BLOCK_LABEL_4320;

        if(arg1.length != 1)

            return "-1";

        eBayCall eBay = new eBayCall();

        first = eBay.newCall2();

        score1 = new FetchTokenRequestType();

        score1.setSessionID((String)arg1[0]);

        score2 = first.executeByApiName("FetchToken", score1);

        if(score2.getAck() == AckCodeType.Success)

            return ((FetchTokenResponseType)score2).getEBayAuthToken();

        ErrorType error[] = score2.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        if(arg0.compareTo("CompleteSale") != 0)

            break MISSING_BLOCK_LABEL_4572;

        if(arg1.length != 4)

            return "-1";

        eBayCall eBay = new eBayCall();

        first = eBay.newCall((String)arg1[3]);

        score1 = new CompleteSaleRequestType();

        ItemIDType item = new ItemIDType((String)arg1[0]);

        score1.setItemID(item);

        if(((String)arg1[1]).compareTo("Paid") == 0)

            score1.setPaid(Boolean.TRUE);

        else

        if(((String)arg1[1]).compareTo("Shipped") == 0)

            score1.setShipped(Boolean.TRUE);

        else

        if(((String)arg1[1]).compareTo("Feedback") == 0)

        {

            FeedbackInfoType feedback = new FeedbackInfoType();

            feedback.setCommentType(CommentTypeCodeType.Positive);

            feedback.setCommentText((String)arg1[2]);

            score1.setFeedbackInfo(feedback);

        }

        score2 = first.executeByApiName("CompleteSale", score1);

        if(score2.getAck() == AckCodeType.Success)

            return "1";

        ErrorType error[] = score2.getErrors();

        for(int i = 0; i < error.length; i++)

        {

            ErrorClassificationCodeType code = error[i].getErrorClassification();

            System.out.println(code.getValue().toString());

        }

        return "-1";

        return "-2";

        ApiException ae;

        ae;

        System.out.println(ae);

        break MISSING_BLOCK_LABEL_4625;

        SdkSoapException sse;

        sse;

        System.out.println(sse);

        break MISSING_BLOCK_LABEL_4625;

        SdkException se;

        se;

        System.out.println(se);

        break MISSING_BLOCK_LABEL_4625;

        Exception e;

        e;

        System.out.println(e);

        return "-2";

    }

    public FunctionDescription[] getAvailableFunctions()

    {

        FunctionDescription description[] = new FunctionDescription[14];

        description[0] = new FunctionDescription("GetEbayTime", "Get current eBay time.\nParameters:\n- eBay User Token\nReturns: Timestamp");

        description[1] = new FunctionDescription("AddItem", "Add Item to eBay.\nParameters (All Strings):\n- Title\n- Price\n- Quantity\n- Description\n- Picture URL\n- Insurance Optional (\"Y\"/\"N\")\n- SalesTax\n- Insurance Fee\n- Shipping Service Cost\n- Category Number\n- Payment Instructions\n- Paypal Email\n- Location\n- eBay Store Category Number\n- eBay User Token\nReturns (String):\n- Success = Item ID\n- Failure = -1");

        description[2] = new FunctionDescription("RelistItem", "Relist item from given itemID.\nParameters (String):\n- ItemID number\n- eBay User Token\nReturns (String):\n- Success = ItemID Number\n- Failure = -1");

        description[3] = new FunctionDescription("EndItem", "End item from given itemID.\nParameters (String):\n- ItemID number\n- Reason:\n\t- Incorrect\n\t- LostOrBroken\n\t- NotAvailable\n\t- OtherListingError\n\t- SellToHighBidder\n- eBay User Token\nReturns (String):\n- Success = 1\n- Failure = -1");

        description[4] = new FunctionDescription("SetNotificationPreferences", "Sets e-mail address to be the designate of eBay notifications.\nParamenters (String):\n- E-mail address\n- eBay User Token\nReturns (String):\n- Success = 1\n- Failure = -1");

        description[5] = new FunctionDescription("GetBuyer", "Gets Buyer information based on a sold item.\nParameters (String):\n- ItemID number\n\n- eBay User TokenReturns (String):\n- Name\n- Email\n- Phone Number\n- Street1\n- Street2\n- City\n- State/Province\n- Country\n- PostalCode");

        description[6] = new FunctionDescription("ReviseItem", "Revising current listing, given by number.\nParameters (All Strings):\n- Title\n- Price\n- Quantity\n- Description\n- Picture URL\n- Insurance Optional (\"Y\"/\"N\")\n- SalesTax\n- Insurance Fee\n- Shipping Service Cost\n- Category Number\n- Payment Instructions\n- Paypal Email\n- Location\n- eBay Item Number\n- eBay Store Category\n- eBay User Token\nReturns (String):\n- Success = Item ID\n- Failure = -1");

        description[7] = new FunctionDescription("GetItemID", "Get ItemID from a string.\nParameters (String):\n- Message\nReturns (String):\n- ItemID");

        description[8] = new FunctionDescription("GetAmountPaid", "Get Price paid by customer.\nParameters (String):\n- Message\nReturns (String):\n- Price");

        description[9] = new FunctionDescription("CheckHardExpiry", "Check to see if user token is expiring.\nParameters (String):\n- eBay User Token\nReturns (String):\n- -1 (if no expiry)\n- Expiry Date (if expiring token)");

        description[10] = new FunctionDescription("SetupFetch", "Get URL for getting new user token\nParameters (String):\n- eBay User Token\nReturns (String):\n- Session ID \\ URL\n- Failure = -1");

        description[11] = new FunctionDescription("FetchToken", "Fetch User Token.\nParameters (String):\n- Session ID\n- eBay User Token\nReturns (String):\n- User Token\n- Failue = -1");

        description[12] = new FunctionDescription("CompleteSale", "\nParameters (String):\n- Item ID\n- Complete Sales Type:\n\to Paid\n\to Shipped\n\to Feedback\n- Feedback Message\n- Ebay Token\nReturns (String):\n- Success = 1\n- Failure = -1");

        description[13] = new FunctionDescription("GetFeedback", "\nParameters (String):\n- Message\nReturns (String):\n- Feedback Type / Feedback Comment");

        return description;

    }

    public String getName()

    {

        return "eBaySvc";

    }

    public Class getTypeClass(String arg0, Collection arg1)

    {

        if(arg0.compareTo("GetEbayTime") == 0)

            return org.openadaptor.util.DateTimeHolder.class;

        else

            return java.lang.String.class;

    }

    public boolean hasFunction(String arg0, int arg1)

    {

        if(arg0.compareTo("GetEbayTime") == 0)

            return true;

        if(arg0.compareTo("AddItem") == 0)

            return true;

        if(arg0.compareTo("RelistItem") == 0)

            return true;

        if(arg0.compareTo("EndItem") == 0)

            return true;

        if(arg0.compareTo("SetNotificationPreferences") == 0)

            return true;

        if(arg0.compareTo("GetBuyer") == 0)

            return true;

        if(arg0.compareTo("ReviseItem") == 0)

            return true;

        if(arg0.compareTo("GetItemID") == 0)

            return true;

        if(arg0.compareTo("GetAmountPaid") == 0)

            return true;

        if(arg0.compareTo("CheckHardExpiry") == 0)

            return true;

        if(arg0.compareTo("SetupFetch") == 0)

            return true;

        if(arg0.compareTo("FetchToken") == 0)

            return true;

        if(arg0.compareTo("CompleteSale") == 0)

            return true;

        return arg0.compareTo("GetFeedback") == 0;

    }

    public String toSQL(String arg0, Collection arg1, ISQLBuilderHelper arg2)

    {

        return null;

    }

    ShippingServiceDetailsType shippingServices[];

}