// WARNING: Please don't edit this file. It was generated by Python/WinRT v3.2.0

#include "py.Windows.ApplicationModel.Payments.Provider.h"

namespace py::cpp::Windows::ApplicationModel::Payments::Provider
{
    // ----- PaymentAppCanMakePaymentTriggerDetails class --------------------

    static PyObject* _new_PaymentAppCanMakePaymentTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_PaymentAppCanMakePaymentTriggerDetails(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PaymentAppCanMakePaymentTriggerDetails_ReportCanMakePaymentResult(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentAppCanMakePaymentTriggerDetails", L"ReportCanMakePaymentResult", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::ApplicationModel::Payments::PaymentCanMakePaymentResult>(args, 0);

                {
                    auto _gil = release_gil();
                    self->obj.ReportCanMakePaymentResult(param0);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentAppCanMakePaymentTriggerDetails_get_Request(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentAppCanMakePaymentTriggerDetails", L"Request");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Request();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_PaymentAppCanMakePaymentTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_PaymentAppCanMakePaymentTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PaymentAppCanMakePaymentTriggerDetails[] = {
        { "report_can_make_payment_result", reinterpret_cast<PyCFunction>(PaymentAppCanMakePaymentTriggerDetails_ReportCanMakePaymentResult), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_PaymentAppCanMakePaymentTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PaymentAppCanMakePaymentTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_PaymentAppCanMakePaymentTriggerDetails[] = {
        { "request", reinterpret_cast<getter>(PaymentAppCanMakePaymentTriggerDetails_get_Request), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_PaymentAppCanMakePaymentTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_PaymentAppCanMakePaymentTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PaymentAppCanMakePaymentTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PaymentAppCanMakePaymentTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PaymentAppCanMakePaymentTriggerDetails) },
        { }};

    static PyType_Spec type_spec_PaymentAppCanMakePaymentTriggerDetails = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentAppCanMakePaymentTriggerDetails",
        sizeof(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppCanMakePaymentTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PaymentAppCanMakePaymentTriggerDetails};

    // ----- PaymentAppManager class --------------------

    static PyObject* _new_PaymentAppManager(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager>::type_name);
        return nullptr;
    }

    static void _dealloc_PaymentAppManager(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PaymentAppManager_RegisterAsync(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentAppManager", L"RegisterAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.RegisterAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentAppManager_UnregisterAsync(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentAppManager", L"UnregisterAsync", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.UnregisterAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentAppManager_get_Current(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentAppManager", L"Current");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager::Current();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_PaymentAppManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_PaymentAppManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PaymentAppManager[] = {
        { "register_async", reinterpret_cast<PyCFunction>(PaymentAppManager_RegisterAsync), METH_VARARGS, nullptr },
        { "unregister_async", reinterpret_cast<PyCFunction>(PaymentAppManager_UnregisterAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_PaymentAppManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PaymentAppManager), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_PaymentAppManager[] = {
        { }};

    static PyType_Slot _type_slots_PaymentAppManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_PaymentAppManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PaymentAppManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PaymentAppManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PaymentAppManager) },
        { }};

    static PyType_Spec type_spec_PaymentAppManager = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentAppManager",
        sizeof(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentAppManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PaymentAppManager};

    static PyGetSetDef getset_PaymentAppManager_Static[] = {
        { "current", reinterpret_cast<getter>(PaymentAppManager_get_Current), nullptr, nullptr, nullptr },
        { }};

    static PyMethodDef methods_PaymentAppManager_Static[] = {
        { }};

    static PyType_Slot type_slots_PaymentAppManager_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_PaymentAppManager_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_PaymentAppManager_Static) },
        { }
    };

    static PyType_Spec type_spec_PaymentAppManager_Static = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentAppManager_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_PaymentAppManager_Static};

    // ----- PaymentTransaction class --------------------

    static PyObject* _new_PaymentTransaction(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransaction>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransaction>::type_name);
        return nullptr;
    }

    static void _dealloc_PaymentTransaction(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PaymentTransaction_AcceptAsync(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"AcceptAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::ApplicationModel::Payments::PaymentToken>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.AcceptAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentTransaction_FromIdAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"FromIdAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransaction::FromIdAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentTransaction_Reject(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"Reject", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Reject();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentTransaction_UpdateSelectedShippingOptionAsync(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"UpdateSelectedShippingOptionAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::ApplicationModel::Payments::PaymentShippingOption>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.UpdateSelectedShippingOptionAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentTransaction_UpdateShippingAddressAsync(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"UpdateShippingAddressAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::ApplicationModel::Payments::PaymentAddress>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.UpdateShippingAddressAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PaymentTransaction_get_PayerPhoneNumber(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerPhoneNumber");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.PayerPhoneNumber();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PaymentTransaction_put_PayerPhoneNumber(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerPhoneNumber");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::hstring>(arg);

            {
                auto _gil = release_gil();
                self->obj.PayerPhoneNumber(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PaymentTransaction_get_PayerName(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.PayerName();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PaymentTransaction_put_PayerName(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::hstring>(arg);

            {
                auto _gil = release_gil();
                self->obj.PayerName(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PaymentTransaction_get_PayerEmail(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerEmail");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.PayerEmail();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PaymentTransaction_put_PayerEmail(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PayerEmail");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::hstring>(arg);

            {
                auto _gil = release_gil();
                self->obj.PayerEmail(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PaymentTransaction_get_PaymentRequest(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransaction", L"PaymentRequest");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.PaymentRequest();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_PaymentTransaction(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransaction>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_PaymentTransaction(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransaction>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PaymentTransaction[] = {
        { "accept_async", reinterpret_cast<PyCFunction>(PaymentTransaction_AcceptAsync), METH_VARARGS, nullptr },
        { "reject", reinterpret_cast<PyCFunction>(PaymentTransaction_Reject), METH_VARARGS, nullptr },
        { "update_selected_shipping_option_async", reinterpret_cast<PyCFunction>(PaymentTransaction_UpdateSelectedShippingOptionAsync), METH_VARARGS, nullptr },
        { "update_shipping_address_async", reinterpret_cast<PyCFunction>(PaymentTransaction_UpdateShippingAddressAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_PaymentTransaction, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PaymentTransaction), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_PaymentTransaction[] = {
        { "payer_phone_number", reinterpret_cast<getter>(PaymentTransaction_get_PayerPhoneNumber), reinterpret_cast<setter>(PaymentTransaction_put_PayerPhoneNumber), nullptr, nullptr },
        { "payer_name", reinterpret_cast<getter>(PaymentTransaction_get_PayerName), reinterpret_cast<setter>(PaymentTransaction_put_PayerName), nullptr, nullptr },
        { "payer_email", reinterpret_cast<getter>(PaymentTransaction_get_PayerEmail), reinterpret_cast<setter>(PaymentTransaction_put_PayerEmail), nullptr, nullptr },
        { "payment_request", reinterpret_cast<getter>(PaymentTransaction_get_PaymentRequest), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_PaymentTransaction[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_PaymentTransaction) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PaymentTransaction) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PaymentTransaction) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PaymentTransaction) },
        { }};

    static PyType_Spec type_spec_PaymentTransaction = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentTransaction",
        sizeof(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransaction),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PaymentTransaction};

    static PyGetSetDef getset_PaymentTransaction_Static[] = {
        { }};

    static PyMethodDef methods_PaymentTransaction_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(PaymentTransaction_FromIdAsync), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_PaymentTransaction_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_PaymentTransaction_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_PaymentTransaction_Static) },
        { }
    };

    static PyType_Spec type_spec_PaymentTransaction_Static = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentTransaction_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_PaymentTransaction_Static};

    // ----- PaymentTransactionAcceptResult class --------------------

    static PyObject* _new_PaymentTransactionAcceptResult(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult>::type_name);
        return nullptr;
    }

    static void _dealloc_PaymentTransactionAcceptResult(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PaymentTransactionAcceptResult_get_Status(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Payments.Provider.PaymentTransactionAcceptResult", L"Status");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Status();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_PaymentTransactionAcceptResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_PaymentTransactionAcceptResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PaymentTransactionAcceptResult[] = {
        { "_assign_array_", _assign_array_PaymentTransactionAcceptResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PaymentTransactionAcceptResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_PaymentTransactionAcceptResult[] = {
        { "status", reinterpret_cast<getter>(PaymentTransactionAcceptResult_get_Status), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_PaymentTransactionAcceptResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_PaymentTransactionAcceptResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PaymentTransactionAcceptResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PaymentTransactionAcceptResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PaymentTransactionAcceptResult) },
        { }};

    static PyType_Spec type_spec_PaymentTransactionAcceptResult = {
        "winrt._winrt_windows_applicationmodel_payments_provider.PaymentTransactionAcceptResult",
        sizeof(py::wrapper::Windows::ApplicationModel::Payments::Provider::PaymentTransactionAcceptResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PaymentTransactionAcceptResult};

    // ----- Windows.ApplicationModel.Payments.Provider Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.ApplicationModel.Payments.Provider");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_applicationmodel_payments_provider",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::ApplicationModel::Payments::Provider

PyMODINIT_FUNC PyInit__winrt_windows_applicationmodel_payments_provider(void) noexcept
{
    using namespace py::cpp::Windows::ApplicationModel::Payments::Provider;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle object_bases{PyTuple_Pack(1, object_type)};

    if (!object_bases)
    {
        return nullptr;
    }

    py::pytype_handle PaymentAppCanMakePaymentTriggerDetails_type{py::register_python_type(module.get(), &type_spec_PaymentAppCanMakePaymentTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!PaymentAppCanMakePaymentTriggerDetails_type)
    {
        return nullptr;
    }

    py::pyobj_handle PaymentAppManager_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!PaymentAppManager_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_PaymentAppManager_Static{PyType_FromSpecWithBases(&type_spec_PaymentAppManager_Static, PaymentAppManager_Static_bases.get())};
    if (!type_PaymentAppManager_Static)
    {
        return nullptr;
    }

    py::pytype_handle PaymentAppManager_type{py::register_python_type(module.get(), &type_spec_PaymentAppManager, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_PaymentAppManager_Static.get()))};
    if (!PaymentAppManager_type)
    {
        return nullptr;
    }

    py::pyobj_handle PaymentTransaction_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!PaymentTransaction_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_PaymentTransaction_Static{PyType_FromSpecWithBases(&type_spec_PaymentTransaction_Static, PaymentTransaction_Static_bases.get())};
    if (!type_PaymentTransaction_Static)
    {
        return nullptr;
    }

    py::pytype_handle PaymentTransaction_type{py::register_python_type(module.get(), &type_spec_PaymentTransaction, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_PaymentTransaction_Static.get()))};
    if (!PaymentTransaction_type)
    {
        return nullptr;
    }

    py::pytype_handle PaymentTransactionAcceptResult_type{py::register_python_type(module.get(), &type_spec_PaymentTransactionAcceptResult, object_bases.get(), inspectable_meta_type)};
    if (!PaymentTransactionAcceptResult_type)
    {
        return nullptr;
    }


    return module.detach();
}
