Examples of PaypalMediator


Examples of org.wso2.carbon.business.messaging.paypal.mediator.PaypalMediator

        if (!(mediator instanceof PaypalMediator)) {
      handleException("Unsupported mediator passed in for serialization : "
          + mediator.getType());
    }

    PaypalMediator paypalMediator = (PaypalMediator) mediator;

    OMElement paypalElem = fac.createOMElement("paypal", synNS);
    saveTracingState(paypalElem, paypalMediator);

    if (paypalMediator.getClientRepository() != null
        || paypalMediator.getAxis2xml() != null) {
      OMElement config = fac.createOMElement("configuration", synNS);
      if (paypalMediator.getClientRepository() != null) {
        config.addAttribute(fac.createOMAttribute("repository", nullNS,
            paypalMediator.getClientRepository()));
      }
      if (paypalMediator.getAxis2xml() != null) {
        config.addAttribute(fac.createOMAttribute("axis2xml", nullNS,
            paypalMediator.getAxis2xml()));
      }
      paypalElem.addChild(config);
    }
    paypalElem.addChild(serializeRequestCredential(paypalMediator
        .getRequestCredential()));
    paypalElem.addChild(serializeOperation(paypalMediator.getOperation()));

    return paypalElem;
    }
View Full Code Here

Examples of org.wso2.carbon.business.messaging.paypal.mediator.PaypalMediator

        if (!PAYPAL_Q.equals(elem.getQName())) {
            handleException("Unable to create the Paypal mediator. "
                            + "Unexpected element as the Paypal mediator configuration");
        }

        PaypalMediator paypalMediator = new PaypalMediator();
        OMElement configElt = elem.getFirstChildWithName(Q_CONFIG);

        if (configElt != null) {

            OMAttribute axis2xmlAttr = configElt.getAttribute(ATT_AXIS2XML);
            OMAttribute repoAttr = configElt.getAttribute(ATT_REPOSITORY);

            if (axis2xmlAttr != null
                && axis2xmlAttr.getAttributeValue() != null) {
                paypalMediator.setAxis2xml(axis2xmlAttr.getAttributeValue());
            }

            if (repoAttr != null && repoAttr.getAttributeValue() != null) {
                paypalMediator
                        .setClientRepository(repoAttr.getAttributeValue());
            }
        }

        paypalMediator.setRequestCredential(createRequestCredential(
                elem.getFirstChildWithName(Q_CREDENTIALS)));
        Iterator paypalElements = elem.getChildElements();

        while (paypalElements.hasNext()) {
            OMElement element = (OMElement) paypalElements.next();
            if(element!=null && !element.getQName().equals(Q_CREDENTIALS)
               && !element.getQName().equals(Q_CONFIG)){
                paypalMediator.setOperation(createOperation(element));
                break;
            }
        }

        return paypalMediator;
View Full Code Here

Examples of org.wso2.carbon.business.messaging.paypal.mediator.PaypalMediator

        if (!PAYPAL_Q.equals(elem.getQName())) {
      handleException("Unable to create the Paypal mediator. "
          + "Unexpected element as the Paypal mediator configuration");
    }

    PaypalMediator paypalMediator = new PaypalMediator();
    OMElement configElt = elem.getFirstChildWithName(Q_CONFIG);

    if (configElt != null) {

      OMAttribute axis2xmlAttr = configElt.getAttribute(ATT_AXIS2XML);
      OMAttribute repoAttr = configElt.getAttribute(ATT_REPOSITORY);

      if (axis2xmlAttr != null
          && axis2xmlAttr.getAttributeValue() != null) {
        paypalMediator.setAxis2xml(axis2xmlAttr.getAttributeValue());
      }

      if (repoAttr != null && repoAttr.getAttributeValue() != null) {
        paypalMediator
            .setClientRepository(repoAttr.getAttributeValue());
      }
    }

    paypalMediator.setRequestCredential(createRequestCredential(elem
        .getFirstChildWithName(Q_CREDENTIALS)));
    paypalMediator.setOperation(createOperation(elem
        .getFirstChildWithName(Q_OPERATION)));

    return paypalMediator;
    }
View Full Code Here

Examples of org.wso2.carbon.business.messaging.paypal.mediator.ui.PaypalMediator

        return rootElem.getFirstChildWithName(new QName(XMLConfigConstants.SYNAPSE_OMNAMESPACE.getNamespaceURI(),
                                                        "paypal"));
    }

    public static PaypalMediator buildMediator(String builderType ,OMElement config) {
        PaypalMediator mediator = null;
        if ("compact".equals(builderType)) {
            mediator = new PaypalMediator();
            new PaypalCompactBuilder().buildMediator(config, mediator);
        }
        return mediator;
    }
View Full Code Here

Examples of org.wso2.carbon.business.messaging.paypal.mediator.ui.PaypalMediator

        OMElement testElement = PaypalTestUtil.getConfiguration("paypal_config3.xml");
        assertTrue(new XMLComparator().compare(serializedElement, testElement));
    }

    private OMElement serialize(String config) throws XMLStreamException {
        PaypalMediator mediator = PaypalTestUtil.buildMediator("compact", PaypalTestUtil.
                getConfiguration(config));
        PaypalCompactSerializer serializer = new PaypalCompactSerializer(OMAbstractFactory.getOMFactory(),
                                                                         XMLConfigConstants.SYNAPSE_OMNAMESPACE,
                                                                         new OMNamespaceImpl(XMLConfigConstants.NULL_NAMESPACE, "nns"));
        OMElement serializedElement = serializer.serializeMediator(null, mediator);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.