<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="Url">
        <xs:restriction base="xs:anyURI">
            <xs:pattern value="(https://.+)|([*]{5})"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="PaymentMethodConfig">
        <xs:sequence>
            <xs:element name="merchant_account_id" type="xs:string"/>
            <xs:element name="secret" type="xs:string"/>
            <xs:element name="base_url" type="Url"/>
            <xs:element name="http_user" type="xs:string"/>
            <xs:element name="http_pass" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="CreditCardConfig">
        <xs:complexContent>
            <xs:extension base="PaymentMethodConfig">
                <xs:sequence>
                    <xs:element name="wpp_url" type="Url"/>
                    <xs:element name="three_d_merchant_account_id" type="xs:string"/>
                    <xs:element name="three_d_secret" type="xs:string"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element name="config">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="payment_methods">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="creditcard" type="CreditCardConfig" minOccurs="0"/>
                            <xs:element name="paypal" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="sofortbanking" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="alipay-xborder" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="ideal" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="wiretransfer" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="ratepay-invoice" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="eps" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="giropay" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="zapp" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="sepacredit" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="sepadirectdebit" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="masterpass" type="PaymentMethodConfig" minOccurs="0"/>
                            <xs:element name="p24" type="PaymentMethodConfig" minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
