// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_ApplicationModel_Payments_Provider_H #define WINRT_Windows_ApplicationModel_Payments_Provider_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/Windows.ApplicationModel.Payments.h" #include "winrt/impl/Windows.ApplicationModel.Payments.2.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.ApplicationModel.Payments.Provider.2.h" namespace winrt::impl { template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentAppCanMakePaymentTriggerDetails::Request() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Request(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Request(&result)); } return winrt::Windows::ApplicationModel::Payments::PaymentRequest{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentAppCanMakePaymentTriggerDetails::ReportCanMakePaymentResult(winrt::Windows::ApplicationModel::Payments::PaymentCanMakePaymentResult const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->ReportCanMakePaymentResult(*(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ReportCanMakePaymentResult(*(void**)(&value))); } } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentAppManager::RegisterAsync(param::async_iterable const& supportedPaymentMethodIds) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->RegisterAsync(*(void**)(&supportedPaymentMethodIds), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->RegisterAsync(*(void**)(&supportedPaymentMethodIds), &result)); } return winrt::Windows::Foundation::IAsyncAction{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentAppManager::UnregisterAsync() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->UnregisterAsync(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->UnregisterAsync(&result)); } return winrt::Windows::Foundation::IAsyncAction{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentAppManagerStatics::Current() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Current(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Current(&value)); } return winrt::Windows::ApplicationModel::Payments::Provider::PaymentAppManager{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PaymentRequest() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_PaymentRequest(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PaymentRequest(&value)); } return winrt::Windows::ApplicationModel::Payments::PaymentRequest{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerEmail() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_PayerEmail(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PayerEmail(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerEmail(param::hstring const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_PayerEmail(*(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_PayerEmail(*(void**)(&value))); } } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerName() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_PayerName(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PayerName(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerName(param::hstring const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_PayerName(*(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_PayerName(*(void**)(&value))); } } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerPhoneNumber() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_PayerPhoneNumber(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PayerPhoneNumber(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::PayerPhoneNumber(param::hstring const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_PayerPhoneNumber(*(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_PayerPhoneNumber(*(void**)(&value))); } } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::UpdateShippingAddressAsync(winrt::Windows::ApplicationModel::Payments::PaymentAddress const& shippingAddress) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->UpdateShippingAddressAsync(*(void**)(&shippingAddress), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->UpdateShippingAddressAsync(*(void**)(&shippingAddress), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::UpdateSelectedShippingOptionAsync(winrt::Windows::ApplicationModel::Payments::PaymentShippingOption const& selectedShippingOption) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->UpdateSelectedShippingOptionAsync(*(void**)(&selectedShippingOption), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->UpdateSelectedShippingOptionAsync(*(void**)(&selectedShippingOption), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::AcceptAsync(winrt::Windows::ApplicationModel::Payments::PaymentToken const& paymentToken) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AcceptAsync(*(void**)(&paymentToken), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AcceptAsync(*(void**)(&paymentToken), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransaction::Reject() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Reject()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Reject()); } } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransactionAcceptResult::Status() const { winrt::Windows::ApplicationModel::Payments::PaymentRequestCompletionStatus value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } return value; } template auto consume_Windows_ApplicationModel_Payments_Provider_IPaymentTransactionStatics::FromIdAsync(param::hstring const& id) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->FromIdAsync(*(void**)(&id), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->FromIdAsync(*(void**)(&id), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Request(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Request()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ReportCanMakePaymentResult(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ReportCanMakePaymentResult(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall RegisterAsync(void* supportedPaymentMethodIds, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().RegisterAsync(*reinterpret_cast const*>(&supportedPaymentMethodIds))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall UnregisterAsync(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().UnregisterAsync()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Current(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Current()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_PaymentRequest(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PaymentRequest()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_PayerEmail(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PayerEmail()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_PayerEmail(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().PayerEmail(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_PayerName(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PayerName()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_PayerName(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().PayerName(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_PayerPhoneNumber(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PayerPhoneNumber()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_PayerPhoneNumber(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().PayerPhoneNumber(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall UpdateShippingAddressAsync(void* shippingAddress, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().UpdateShippingAddressAsync(*reinterpret_cast(&shippingAddress))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall UpdateSelectedShippingOptionAsync(void* selectedShippingOption, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().UpdateSelectedShippingOptionAsync(*reinterpret_cast(&selectedShippingOption))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AcceptAsync(void* paymentToken, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().AcceptAsync(*reinterpret_cast(&paymentToken))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Reject() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Reject(); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Status(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Status()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall FromIdAsync(void* id, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().FromIdAsync(*reinterpret_cast(&id))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::ApplicationModel::Payments::Provider { inline auto PaymentAppManager::Current() { return impl::call_factory_cast([](IPaymentAppManagerStatics const& f) { return f.Current(); }); } inline auto PaymentTransaction::FromIdAsync(param::hstring const& id) { return impl::call_factory([&](IPaymentTransactionStatics const& f) { return f.FromIdAsync(id); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif