From 9b3d76c9f5fefc6e1c7e7accbfda0ef3b3469b1f Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Tue, 8 Oct 2024 14:06:50 +0200 Subject: [PATCH 1/8] Switch to openapi-generator --- .gitignore | 17 +- README.md | 201 +- openapitools.json | 37 + src/.editorconfig | 6 + .../CheckoutServiceTests.cs | 17 +- .../EpaymentServiceTests.cs | 31 +- .../Vipps.net.IntegrationTests.csproj | 4 +- .../Controllers/CheckoutController.cs | 8 +- .../Controllers/EpaymentController.cs | 10 +- src/Vipps.net.AspCoreDemo/Program.cs | 1 + src/Vipps.net.AspCoreDemo/Startup.cs | 2 +- .../Vipps.net.AspCoreDemo.csproj | 4 +- .../Vipps.net.AspDemo.csproj | 3 +- src/Vipps.net.Codegen/CodegenSettings.cs | 40 - src/Vipps.net.Codegen/Program.cs | 67 - .../Vipps.net.Codegen.csproj | 15 - .../Controllers/CheckoutController.cs | 5 +- src/Vipps.net.Demo/Vipps.net.Demo.csproj | 4 +- .../Vipps.net.Models.Checkout.Test.csproj | 19 + .../Api/SessionApi.cs | 822 ++++++++ .../Client/ApiClient.cs | 815 ++++++++ .../Client/ApiException.cs | 68 + .../Client/ApiResponse.cs | 166 ++ .../Client/ClientUtils.cs | 247 +++ .../Client/Configuration.cs | 613 ++++++ .../Client/ExceptionFactory.cs | 22 + .../Client/GlobalConfiguration.cs | 67 + .../Client/HttpMethod.cs | 33 + .../Client/IApiAccessor.cs | 37 + .../Client/IAsynchronousClient.cs | 100 + .../Client/IReadableConfiguration.cs | 141 ++ .../Client/ISynchronousClient.cs | 93 + .../Client/Multimap.cs | 295 +++ .../Client/OpenAPIDateConverter.cs | 29 + .../Client/RequestOptions.cs | 84 + .../Client/RetryConfiguration.cs | 31 + .../Model/AbstractOpenAPISchema.cs | 76 + src/Vipps.net.Models.Checkout/Model/Amount.cs | 109 + .../Model/BillingDetails.cs | 178 ++ .../Model/CheckoutConfig.cs | 153 ++ .../Model/CheckoutProblemDetails.cs | 162 ++ ...koutSessionThirdPartyInformationHeaders.cs | 162 ++ .../CheckoutV3SessionPost200ResponseInner.cs | 536 +++++ .../Model/CheckoutV3SessionPostRequest.cs | 260 +++ .../Model/Countries.cs | 93 + .../Model/CustomConsent.cs | 103 + .../Model/CustomerInteraction.cs | 47 + .../Model/DaoLogisticsOption.cs | 215 ++ .../Model/Elements.cs | 53 + .../Model/EventSubscriptionCampaign.cs | 162 ++ .../Model/ExternalPaymentMethod.cs | 103 + .../Model/ExternalPaymentMethodType.cs | 42 + .../Model/ExternalSessionState.cs | 65 + .../Model/GlsLogisticsOption.cs | 215 ++ .../Model/GlsLogisticsType.cs | 41 + .../Model/Helthjem.cs | 130 ++ .../Model/HelthjemLogisticsOption.cs | 215 ++ .../Model/HelthjemLogisticsType.cs | 47 + .../Model/IdempotencyHeader.cs | 82 + .../Model/InitiatePaymentSessionRequest.cs | 157 ++ .../Model/InitiateSessionRequestBase.cs | 111 ++ .../Model/InitiateSessionResponse.cs | 123 ++ .../InitiateSubscriptionSessionRequest.cs | 169 ++ .../Model/Integrations.cs | 93 + .../Model/Interval.cs | 108 + .../Model/IntervalUnit.cs | 59 + .../Model/Logistics.cs | 103 + .../Model/LogisticsOptionBase.cs | 137 ++ .../Model/MerchantAuthInfoHeaders.cs | 162 ++ .../Model/MerchantInfo.cs | 139 ++ .../MerchantLogisticsCallbackRequestBody.cs | 138 ++ .../Model/OrderBottomLine.cs | 154 ++ .../Model/OrderLine.cs | 281 +++ .../Model/OrderSummary.cs | 108 + .../Model/OrderUnitInfo.cs | 119 ++ .../Model/OtherLogisticsOption.cs | 223 +++ .../Model/PaymentMethod.cs | 59 + .../Model/PaymentSources.cs | 113 ++ .../Model/PaymentState.cs | 53 + .../Model/PaymentTransaction.cs | 165 ++ .../Model/PeriodSubscriptionCampaign.cs | 130 ++ .../Model/PickupPoint.cs | 178 ++ .../Model/Porterbuddy.cs | 129 ++ .../Model/PorterbuddyLogisticsOption.cs | 210 ++ .../Model/PorterbuddyLogisticsType.cs | 41 + .../Model/PorterbuddyOrigin.cs | 138 ++ .../Model/PorterbuddyOriginAddress.cs | 138 ++ .../Model/PostenLogisticsOption.cs | 215 ++ .../Model/PostenLogisticsType.cs | 53 + .../Model/PostiLogisticsOption.cs | 215 ++ .../Model/PostiLogisticsType.cs | 47 + .../Model/PostnordLogisticsOption.cs | 215 ++ .../Model/PostnordLogisticsType.cs | 47 + .../Model/PrefillCustomer.cs | 153 ++ .../Model/PriceSubscriptionCampaign.cs | 136 ++ .../Model/QuantityUnit.cs | 65 + .../ResponseBankTransferPaymentDetails.cs | 115 ++ .../Model/ResponseCardPaymentDetails.cs | 133 ++ .../Model/ResponseSubscriptionDetails.cs | 93 + .../Model/ResponseWalletPaymentDetails.cs | 133 ++ .../Model/SessionResponse.cs | 191 ++ .../Model/SessionResponsePaymentDetails.cs | 315 +++ .../Model/ShippingDetails.cs | 182 ++ .../Model/Subscription.cs | 169 ++ .../Model/SubscriptionCampaign.cs | 315 +++ .../Model/SubscriptionState.cs | 59 + .../Model/TransactionAggregate.cs | 109 + .../Model/UserFlow.cs | 47 + .../Model/UserInfo.cs | 103 + .../Vipps.net.Models.Checkout.csproj | 37 + .../Vipps.net.Models.Epayment.Test.csproj | 19 + .../Api/AdjustPaymentsApi.cs | 1191 +++++++++++ .../Api/CreatePaymentsApi.cs | 495 +++++ .../Api/ForceApproveApi.cs | 413 ++++ .../Api/QueryPaymentsApi.cs | 651 ++++++ .../Client/ApiClient.cs | 815 ++++++++ .../Client/ApiException.cs | 68 + .../Client/ApiResponse.cs | 166 ++ .../Client/ClientUtils.cs | 247 +++ .../Client/Configuration.cs | 613 ++++++ .../Client/ExceptionFactory.cs | 22 + .../Client/GlobalConfiguration.cs | 67 + .../Client/HttpMethod.cs | 33 + .../Client/IApiAccessor.cs | 37 + .../Client/IAsynchronousClient.cs | 100 + .../Client/IReadableConfiguration.cs | 141 ++ .../Client/ISynchronousClient.cs | 93 + .../Client/Multimap.cs | 295 +++ .../Client/OpenAPIDateConverter.cs | 29 + .../Client/RequestOptions.cs | 84 + .../Client/RetryConfiguration.cs | 31 + .../Model/AbstractOpenAPISchema.cs | 76 + .../Model/Address.cs | 165 ++ .../Model/Aggregate.cs | 134 ++ .../Model/AirlineData.cs | 220 +++ src/Vipps.net.Models.Epayment/Model/Amount.cs | 112 ++ .../Model/Barcode.cs | 101 + .../Model/BarcodeFormatEnum.cs | 53 + .../Model/BottomLine.cs | 246 +++ .../Model/CancelModificationRequest.cs | 83 + .../Model/CaptureModificationRequest.cs | 92 + .../Model/CreatePaymentRequest.cs | 379 ++++ .../Model/CreatePaymentRequestQrFormat.cs | 142 ++ .../Model/CreatePaymentResponse.cs | 130 ++ .../Model/Currency.cs | 54 + .../Model/CurrencyEnum.cs | 54 + .../Model/Customer.cs | 306 +++ .../Model/CustomerPhoneNumber.cs | 107 + .../Model/CustomerToken.cs | 86 + .../Model/ExtraDetail.cs | 106 + .../Model/ForceApprove.cs | 92 + .../Model/GetPaymentResponse.cs | 223 +++ .../Model/IndustryData.cs | 82 + .../Model/ModificationResponse.cs | 169 ++ .../Model/OrderLine.cs | 271 +++ .../Model/PaymentAdjustment.cs | 131 ++ .../Model/PaymentEvent.cs | 196 ++ .../Model/PaymentEventName.cs | 83 + .../Model/PaymentMethod.cs | 87 + .../Model/PaymentMethodResponse.cs | 112 ++ .../Model/PaymentMethodType.cs | 48 + .../Model/PaymentSources.cs | 109 + .../Model/PersonalQrCode.cs | 98 + .../Model/Problem.cs | 152 ++ .../Model/ProfileRequest.cs | 86 + .../Model/ProfileResponse.cs | 83 + .../Model/QuantityUnitEnum.cs | 72 + .../Model/Receipt.cs | 107 + .../Model/RefundModificationRequest.cs | 92 + .../Model/ShippingInfo.cs | 180 ++ src/Vipps.net.Models.Epayment/Model/State.cs | 66 + .../Model/UnitInfo.cs | 141 ++ .../Model/WebhookEvent.cs | 223 +++ .../Vipps.net.Models.Epayment.csproj | 37 + src/Vipps.net.sln | 30 +- .../Infrastructure/BaseServiceClient.cs | 2 +- src/Vipps.net/Models/CheckoutModels.cs | 1749 ----------------- src/Vipps.net/Models/EpaymentModels.cs | 1386 ------------- src/Vipps.net/Services/CheckoutService.cs | 7 +- src/Vipps.net/Services/EpaymentService.cs | 2 +- src/Vipps.net/Vipps.net.csproj | 13 +- 181 files changed, 25354 insertions(+), 3319 deletions(-) create mode 100644 openapitools.json delete mode 100644 src/Vipps.net.Codegen/CodegenSettings.cs delete mode 100644 src/Vipps.net.Codegen/Program.cs delete mode 100644 src/Vipps.net.Codegen/Vipps.net.Codegen.csproj create mode 100644 src/Vipps.net.Models.Checkout.Test/Vipps.net.Models.Checkout.Test.csproj create mode 100644 src/Vipps.net.Models.Checkout/Api/SessionApi.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ApiClient.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ApiException.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ApiResponse.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ClientUtils.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/Configuration.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ExceptionFactory.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/GlobalConfiguration.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/HttpMethod.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/IApiAccessor.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/IAsynchronousClient.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/IReadableConfiguration.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/ISynchronousClient.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/Multimap.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/OpenAPIDateConverter.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/RequestOptions.cs create mode 100644 src/Vipps.net.Models.Checkout/Client/RetryConfiguration.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/AbstractOpenAPISchema.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Amount.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/BillingDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CheckoutConfig.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CheckoutProblemDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CheckoutSessionThirdPartyInformationHeaders.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPost200ResponseInner.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPostRequest.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Countries.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CustomConsent.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/CustomerInteraction.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/DaoLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Elements.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/EventSubscriptionCampaign.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethod.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethodType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ExternalSessionState.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/GlsLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/GlsLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Helthjem.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/IdempotencyHeader.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/InitiatePaymentSessionRequest.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/InitiateSessionRequestBase.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/InitiateSessionResponse.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/InitiateSubscriptionSessionRequest.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Integrations.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Interval.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/IntervalUnit.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Logistics.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/LogisticsOptionBase.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/MerchantAuthInfoHeaders.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/MerchantInfo.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/MerchantLogisticsCallbackRequestBody.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/OrderBottomLine.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/OrderLine.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/OrderSummary.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/OrderUnitInfo.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/OtherLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PaymentMethod.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PaymentSources.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PaymentState.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PaymentTransaction.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PeriodSubscriptionCampaign.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PickupPoint.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Porterbuddy.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PorterbuddyOrigin.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PorterbuddyOriginAddress.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostenLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostenLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostiLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostiLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostnordLogisticsOption.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PostnordLogisticsType.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PrefillCustomer.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/PriceSubscriptionCampaign.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/QuantityUnit.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ResponseBankTransferPaymentDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ResponseCardPaymentDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ResponseSubscriptionDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ResponseWalletPaymentDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/SessionResponse.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/SessionResponsePaymentDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/ShippingDetails.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/Subscription.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/SubscriptionCampaign.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/SubscriptionState.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/TransactionAggregate.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/UserFlow.cs create mode 100644 src/Vipps.net.Models.Checkout/Model/UserInfo.cs create mode 100644 src/Vipps.net.Models.Checkout/Vipps.net.Models.Checkout.csproj create mode 100644 src/Vipps.net.Models.Epayment.Test/Vipps.net.Models.Epayment.Test.csproj create mode 100644 src/Vipps.net.Models.Epayment/Api/AdjustPaymentsApi.cs create mode 100644 src/Vipps.net.Models.Epayment/Api/CreatePaymentsApi.cs create mode 100644 src/Vipps.net.Models.Epayment/Api/ForceApproveApi.cs create mode 100644 src/Vipps.net.Models.Epayment/Api/QueryPaymentsApi.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ApiClient.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ApiException.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ApiResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ClientUtils.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/Configuration.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ExceptionFactory.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/GlobalConfiguration.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/HttpMethod.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/IApiAccessor.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/IAsynchronousClient.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/IReadableConfiguration.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/ISynchronousClient.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/Multimap.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/OpenAPIDateConverter.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/RequestOptions.cs create mode 100644 src/Vipps.net.Models.Epayment/Client/RetryConfiguration.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/AbstractOpenAPISchema.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Address.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Aggregate.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/AirlineData.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Amount.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Barcode.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/BarcodeFormatEnum.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/BottomLine.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CancelModificationRequest.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CaptureModificationRequest.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CreatePaymentRequest.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CreatePaymentRequestQrFormat.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CreatePaymentResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Currency.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CurrencyEnum.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Customer.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CustomerPhoneNumber.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/CustomerToken.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ExtraDetail.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ForceApprove.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/GetPaymentResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/IndustryData.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ModificationResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/OrderLine.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentAdjustment.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentEvent.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentEventName.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentMethod.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentMethodResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentMethodType.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PaymentSources.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/PersonalQrCode.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Problem.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ProfileRequest.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ProfileResponse.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/QuantityUnitEnum.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/Receipt.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/RefundModificationRequest.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/ShippingInfo.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/State.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/UnitInfo.cs create mode 100644 src/Vipps.net.Models.Epayment/Model/WebhookEvent.cs create mode 100644 src/Vipps.net.Models.Epayment/Vipps.net.Models.Epayment.csproj delete mode 100644 src/Vipps.net/Models/CheckoutModels.cs delete mode 100644 src/Vipps.net/Models/EpaymentModels.cs diff --git a/.gitignore b/.gitignore index 238a2c3..1ee5385 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ mono_crash.* [Rr]eleases/ x64/ x86/ +[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ @@ -61,6 +62,9 @@ project.lock.json project.fragment.lock.json artifacts/ +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + # StyleCop StyleCopReport.xml @@ -137,6 +141,11 @@ _TeamCity* .axoCover/* !.axoCover/settings.json +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + # Visual Studio code coverage results *.coverage *.coveragexml @@ -349,9 +358,5 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ -# Husky should only be enabled manually per developer for now -/.husky/pre-commit - -# Do not include secrets from windows forms demo -/src/Vipps.net.WindowsFormsDemo/secrets.xml -/src/Vipps.net.AspDemo/secrets.xml +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/README.md b/README.md index a9d39a2..5646177 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,199 @@ -ℹ️ Documentation is available at: -[Vipps MobilePay SDK Documentation](https://developer.vippsmobilepay.com/docs/SDKs/). +# Vipps.net.Models.Checkout - the C# library for the checkout-backend-merchant-v3.API + +See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: v3 +- SDK version: 1.0.0 +- Generator version: 7.9.0 +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + + +## Frameworks supported +- .NET Core >=1.0 +- .NET Framework >=4.6 +- Mono/Xamarin >=vNext + + +## Dependencies + +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later + +The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +Install-Package JsonSubTypes +Install-Package System.ComponentModel.Annotations +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742). +NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406). + + +## Installation +Generate the DLL using your preferred tool (e.g. `dotnet build`) + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using Vipps.net.Models.Checkout.Api; +using Vipps.net.Models.Checkout.Client; +using Vipps.net.Models.Checkout.Model; +``` + +## Usage + +To use the API client with a HTTP proxy, setup a `System.Net.WebProxy` +```csharp +Configuration c = new Configuration(); +System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/"); +webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; +c.Proxy = webProxy; +``` + + +## Getting Started + +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Vipps.net.Models.Checkout.Api; +using Vipps.net.Models.Checkout.Client; +using Vipps.net.Models.Checkout.Model; + +namespace Example +{ + public class Example + { + public static void Main() + { + + Configuration config = new Configuration(); + config.BasePath = "https://apitest.vipps.no"; + var apiInstance = new SessionApi(config); + var vippsSystemName = Acme Commerce; // string | (optional) (default to "{{system_name}}") + var vippsSystemVersion = 3.1.2; // string | (optional) (default to "{{system_version}}") + var vippsSystemPluginName = acme-webshop; // string | (optional) (default to "{{system_plugin_name}}") + var vippsSystemPluginVersion = 4.5.6; // string | (optional) (default to "{{system_plugin_version}}") + var clientId = ; // string | (optional) (default to "{{client_id}}") + var clientSecret = ; // string | (optional) (default to "{{client_secret}}") + var ocpApimSubscriptionKey = ; // string | (optional) (default to "{{Ocp-Apim-Subscription-Key}}") + var merchantSerialNumber = ; // string | (optional) (default to "{{merchantSerialNumber}}") + var idempotencyKey = ; // string | (optional) (default to "{{Idempotency-Key}}") + var checkoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(); // CheckoutV3SessionPostRequest | (optional) + + try + { + // Create a Checkout session + InitiateSessionResponse result = apiInstance.CheckoutV3SessionPost(vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey, checkoutV3SessionPostRequest); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling SessionApi.CheckoutV3SessionPost: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *https://apitest.vipps.no* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*SessionApi* | [**CheckoutV3SessionPost**](docs/SessionApi.md#checkoutv3sessionpost) | **POST** /checkout/v3/session | Create a Checkout session +*SessionApi* | [**CheckoutV3SessionReferenceGet**](docs/SessionApi.md#checkoutv3sessionreferenceget) | **GET** /checkout/v3/session/{reference} | Get session info + + + +## Documentation for Models + + - [Model.Amount](docs/Amount.md) + - [Model.BillingDetails](docs/BillingDetails.md) + - [Model.CheckoutConfig](docs/CheckoutConfig.md) + - [Model.CheckoutProblemDetails](docs/CheckoutProblemDetails.md) + - [Model.CheckoutSessionThirdPartyInformationHeaders](docs/CheckoutSessionThirdPartyInformationHeaders.md) + - [Model.CheckoutV3SessionPost200ResponseInner](docs/CheckoutV3SessionPost200ResponseInner.md) + - [Model.CheckoutV3SessionPostRequest](docs/CheckoutV3SessionPostRequest.md) + - [Model.Countries](docs/Countries.md) + - [Model.CustomConsent](docs/CustomConsent.md) + - [Model.CustomerInteraction](docs/CustomerInteraction.md) + - [Model.DaoLogisticsOption](docs/DaoLogisticsOption.md) + - [Model.Elements](docs/Elements.md) + - [Model.EventSubscriptionCampaign](docs/EventSubscriptionCampaign.md) + - [Model.ExternalPaymentMethod](docs/ExternalPaymentMethod.md) + - [Model.ExternalPaymentMethodType](docs/ExternalPaymentMethodType.md) + - [Model.ExternalSessionState](docs/ExternalSessionState.md) + - [Model.GlsLogisticsOption](docs/GlsLogisticsOption.md) + - [Model.GlsLogisticsType](docs/GlsLogisticsType.md) + - [Model.Helthjem](docs/Helthjem.md) + - [Model.HelthjemLogisticsOption](docs/HelthjemLogisticsOption.md) + - [Model.HelthjemLogisticsType](docs/HelthjemLogisticsType.md) + - [Model.IdempotencyHeader](docs/IdempotencyHeader.md) + - [Model.InitiatePaymentSessionRequest](docs/InitiatePaymentSessionRequest.md) + - [Model.InitiateSessionRequestBase](docs/InitiateSessionRequestBase.md) + - [Model.InitiateSessionResponse](docs/InitiateSessionResponse.md) + - [Model.InitiateSubscriptionSessionRequest](docs/InitiateSubscriptionSessionRequest.md) + - [Model.Integrations](docs/Integrations.md) + - [Model.Interval](docs/Interval.md) + - [Model.IntervalUnit](docs/IntervalUnit.md) + - [Model.Logistics](docs/Logistics.md) + - [Model.LogisticsOptionBase](docs/LogisticsOptionBase.md) + - [Model.MerchantAuthInfoHeaders](docs/MerchantAuthInfoHeaders.md) + - [Model.MerchantInfo](docs/MerchantInfo.md) + - [Model.MerchantLogisticsCallbackRequestBody](docs/MerchantLogisticsCallbackRequestBody.md) + - [Model.OrderBottomLine](docs/OrderBottomLine.md) + - [Model.OrderLine](docs/OrderLine.md) + - [Model.OrderSummary](docs/OrderSummary.md) + - [Model.OrderUnitInfo](docs/OrderUnitInfo.md) + - [Model.OtherLogisticsOption](docs/OtherLogisticsOption.md) + - [Model.PaymentMethod](docs/PaymentMethod.md) + - [Model.PaymentSources](docs/PaymentSources.md) + - [Model.PaymentState](docs/PaymentState.md) + - [Model.PaymentTransaction](docs/PaymentTransaction.md) + - [Model.PeriodSubscriptionCampaign](docs/PeriodSubscriptionCampaign.md) + - [Model.PickupPoint](docs/PickupPoint.md) + - [Model.Porterbuddy](docs/Porterbuddy.md) + - [Model.PorterbuddyLogisticsOption](docs/PorterbuddyLogisticsOption.md) + - [Model.PorterbuddyLogisticsType](docs/PorterbuddyLogisticsType.md) + - [Model.PorterbuddyOrigin](docs/PorterbuddyOrigin.md) + - [Model.PorterbuddyOriginAddress](docs/PorterbuddyOriginAddress.md) + - [Model.PostenLogisticsOption](docs/PostenLogisticsOption.md) + - [Model.PostenLogisticsType](docs/PostenLogisticsType.md) + - [Model.PostiLogisticsOption](docs/PostiLogisticsOption.md) + - [Model.PostiLogisticsType](docs/PostiLogisticsType.md) + - [Model.PostnordLogisticsOption](docs/PostnordLogisticsOption.md) + - [Model.PostnordLogisticsType](docs/PostnordLogisticsType.md) + - [Model.PrefillCustomer](docs/PrefillCustomer.md) + - [Model.PriceSubscriptionCampaign](docs/PriceSubscriptionCampaign.md) + - [Model.QuantityUnit](docs/QuantityUnit.md) + - [Model.ResponseBankTransferPaymentDetails](docs/ResponseBankTransferPaymentDetails.md) + - [Model.ResponseCardPaymentDetails](docs/ResponseCardPaymentDetails.md) + - [Model.ResponseSubscriptionDetails](docs/ResponseSubscriptionDetails.md) + - [Model.ResponseWalletPaymentDetails](docs/ResponseWalletPaymentDetails.md) + - [Model.SessionResponse](docs/SessionResponse.md) + - [Model.SessionResponsePaymentDetails](docs/SessionResponsePaymentDetails.md) + - [Model.ShippingDetails](docs/ShippingDetails.md) + - [Model.Subscription](docs/Subscription.md) + - [Model.SubscriptionCampaign](docs/SubscriptionCampaign.md) + - [Model.SubscriptionState](docs/SubscriptionState.md) + - [Model.TransactionAggregate](docs/TransactionAggregate.md) + - [Model.UserFlow](docs/UserFlow.md) + - [Model.UserInfo](docs/UserInfo.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..790e0ee --- /dev/null +++ b/openapitools.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.9.0", + "generators": { + "vipps-checkout": { + "generatorName": "csharp", + "output": ".", + "inputSpec": "https://developer.vippsmobilepay.com/redocusaurus/checkout-swagger-id.yaml", + "additionalProperties": { + "packageName": "Vipps.net.Models.Checkout", + "isLibrary": "false", + "targetFramework": "netstandard2.0", + "useNewtonsoft": "false", + "generateApiTests": "false", + "generateApiDocs": "false", + "generateModelDocs": "false" + } + }, + "vipps-epayment": { + "generatorName": "csharp", + "output": ".", + "inputSpec": "https://developer.vippsmobilepay.com/redocusaurus/epayment-swagger-id.yaml", + "additionalProperties": { + "packageName": "Vipps.net.Models.Epayment", + "isLibrary": "false", + "targetFramework": "netstandard2.0", + "useNewtonsoft": "false", + "generateApiTests": "false", + "generateApiDocs": "false", + "generateModelDocs": "false" + } + } + } + } +} diff --git a/src/.editorconfig b/src/.editorconfig index 67360be..2fa84a3 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -18,6 +18,12 @@ dotnet_diagnostic.CS8618.severity = silent # Core EditorConfig Options # ############################### +[Vipps.net.Models.Epayment/**/*.{cs,csproj}] +generated_code = true + +[Vipps.net.Models.Checkout/**/*.{cs,csproj}] +generated_code = true + # All files [*] indent_style = space diff --git a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs index 9ea6be1..ecfdbdb 100644 --- a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs @@ -1,4 +1,7 @@ -namespace Vipps.net.IntegrationTests +using Vipps.net.Models.Checkout; +using Vipps.net.Models.Checkout.Model; + +namespace Vipps.net.IntegrationTests { [TestClass] public class CheckoutServiceTests @@ -8,15 +11,15 @@ public async Task Can_Create_And_Get_Session() { var vippsApi = TestSetup.CreateVippsAPI(); var reference = Guid.NewGuid().ToString(); - var sessionInitiationRequest = new Models.Checkout.InitiateSessionRequest + var sessionInitiationRequest = new InitiatePaymentSessionRequest { - Transaction = new Models.Checkout.PaymentTransaction + Transaction = new PaymentTransaction { - Amount = new Models.Checkout.Amount { Currency = "NOK", Value = 1000 }, + Amount = new Amount { Currency = "NOK", Value = 1000 }, Reference = reference, - PaymentDescription = nameof(CheckoutServiceTests.Can_Create_And_Get_Session), + PaymentDescription = nameof(Can_Create_And_Get_Session), }, - MerchantInfo = new Models.Checkout.PaymentMerchantInfo + MerchantInfo = new MerchantInfo { CallbackAuthorizationToken = Guid.NewGuid().ToString(), CallbackUrl = "https://no.where.com/callback", @@ -31,7 +34,7 @@ public async Task Can_Create_And_Get_Session() Assert.IsNotNull(sessionResponse); var sessionPolledResponse = await vippsApi.CheckoutService.GetSessionInfo(reference); Assert.AreEqual( - Models.Checkout.ExternalSessionState.SessionCreated, + ExternalSessionState.SessionCreated, sessionPolledResponse.SessionState ); } diff --git a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs index a873abd..b307b55 100644 --- a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs @@ -1,4 +1,5 @@ using Vipps.net.Models.Epayment; +using Vipps.net.Models.Epayment.Model; namespace Vipps.net.IntegrationTests { @@ -45,7 +46,7 @@ public async Task Can_Create_Approve_Capture_Refund_Payment() await vippsApi.EpaymentService.ForceApprovePayment( reference, - new ForceApprove { Customer = new Customer { PhoneNumber = CustomerPhoneNumber } } + new ForceApprove { Customer = new Customer(new CustomerPhoneNumber { PhoneNumber = CustomerPhoneNumber }) } ); var captureResponse = await vippsApi.EpaymentService.CapturePayment( @@ -82,20 +83,24 @@ PaymentEventName paymentEventName private static CreatePaymentRequest GetCreatePaymentRequest(string reference) { - return new CreatePaymentRequest - { - Amount = new Amount + return new CreatePaymentRequest( + new Amount { - Currency = Currency.NOK, - Value = 100 // 100 øre = 1 KR + Currency = Currency.NOK, Value = 100 // 100 øre = 1 KR }, - PaymentMethod = new PaymentMethod { Type = PaymentMethodType.WALLET }, - UserFlow = CreatePaymentRequestUserFlow.WEB_REDIRECT, - Reference = reference, - PaymentDescription = nameof(CheckoutServiceTests.Can_Create_And_Get_Session), - ReturnUrl = $"https://no.where.com/{reference}", - Customer = new Customer { } - }; + new Customer(new CustomerPhoneNumber { PhoneNumber = CustomerPhoneNumber }), + null, + null, + null, + new PaymentMethod { Type = PaymentMethodType.WALLET }, + null, + reference, + $"https://no.where.com/{reference}", + CreatePaymentRequest.UserFlowEnum.WEB_REDIRECT, + null, + null, + nameof(CheckoutServiceTests.Can_Create_And_Get_Session) + ); } } } diff --git a/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj b/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj index 5e6a285..d4e6b50 100644 --- a/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj +++ b/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable @@ -33,7 +33,7 @@ - + diff --git a/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs b/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs index 79397d7..070c888 100644 --- a/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs +++ b/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs @@ -2,10 +2,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Vipps.net.Models.Checkout; +using Vipps.net.Models.Checkout.Model; using Vipps.net.Services; -namespace Vipps.net.AspCore31Demo.Controllers +namespace Vipps.net.AspCoreDemo.Controllers { [ApiController] [Route("[controller]")] @@ -23,9 +23,9 @@ public CheckoutController(ILogger logger, IVippsApi vippsApi [HttpPost] public async Task> CreateSession() { - var request = new InitiateSessionRequest + var request = new InitiatePaymentSessionRequest { - MerchantInfo = new PaymentMerchantInfo + MerchantInfo = new MerchantInfo { CallbackAuthorizationToken = Guid.NewGuid().ToString(), CallbackUrl = "https://your-url-here.com:3000", diff --git a/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs b/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs index ddd4e73..702b8de 100644 --- a/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs +++ b/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs @@ -1,10 +1,12 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -using Vipps.net.Models.Epayment; +using Vipps.net.Models.Epayment.Model; using Vipps.net.Services; +using Amount = Vipps.net.Models.Epayment.Model.Amount; +using PaymentMethod = Vipps.net.Models.Epayment.Model.PaymentMethod; -namespace Vipps.net.AspCore31Demo.Controllers +namespace Vipps.net.AspCoreDemo.Controllers { [ApiController] [Route("[controller]")] @@ -24,9 +26,9 @@ public async Task CreatePayment() { Amount = new Amount { Value = 1000, Currency = Currency.NOK }, PaymentMethod = new PaymentMethod { Type = PaymentMethodType.WALLET }, - Customer = new Customer { PhoneNumber = "4747375750" }, + Customer = new Customer (new CustomerPhoneNumber{ PhoneNumber = "4747375750"}), Reference = Guid.NewGuid().ToString(), - UserFlow = CreatePaymentRequestUserFlow.WEB_REDIRECT, + UserFlow = CreatePaymentRequest.UserFlowEnum.WEB_REDIRECT, ReturnUrl = $"http://localhost:3000", PaymentDescription = "paymentDescription", Profile = new ProfileRequest { Scope = "name phoneNumber address birthDate email" }, diff --git a/src/Vipps.net.AspCoreDemo/Program.cs b/src/Vipps.net.AspCoreDemo/Program.cs index eebed7d..ccc4fed 100644 --- a/src/Vipps.net.AspCoreDemo/Program.cs +++ b/src/Vipps.net.AspCoreDemo/Program.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using Vipps.net.AspCoreDemo; namespace Vipps.net.AspCore31Demo { diff --git a/src/Vipps.net.AspCoreDemo/Startup.cs b/src/Vipps.net.AspCoreDemo/Startup.cs index 70df6b3..3e336e1 100644 --- a/src/Vipps.net.AspCoreDemo/Startup.cs +++ b/src/Vipps.net.AspCoreDemo/Startup.cs @@ -8,7 +8,7 @@ using Microsoft.OpenApi.Models; using Vipps.net.Infrastructure; -namespace Vipps.net.AspCore31Demo +namespace Vipps.net.AspCoreDemo { public class Startup { diff --git a/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj b/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj index 829541a..11d99f7 100644 --- a/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj +++ b/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj @@ -2,12 +2,12 @@ 5fcb55b3-f577-4b73-a82a-f13b33796367 - netcoreapp3.1 + net8.0 - + diff --git a/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj b/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj index cabdab2..078f523 100644 --- a/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj +++ b/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj @@ -14,7 +14,7 @@ Properties Vipps.net.AspDemo Vipps.net.AspDemo - v4.7.2 + netstandard2.0 false true @@ -169,7 +169,6 @@ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - diff --git a/src/Vipps.net.Codegen/CodegenSettings.cs b/src/Vipps.net.Codegen/CodegenSettings.cs deleted file mode 100644 index ba362f9..0000000 --- a/src/Vipps.net.Codegen/CodegenSettings.cs +++ /dev/null @@ -1,40 +0,0 @@ -using NSwag.CodeGeneration.CSharp; - -namespace Vipps.net.Codegen -{ - internal sealed class CodegenSettings - { - internal string OpenApiUrl { get; init; } - internal string RelativeFilePath { get; init; } - internal CSharpClientGeneratorSettings ClientGeneratorSettings { get; init; } - - internal CodegenSettings( - string openApiJsonPath, - string className, - string baseNamespace, - string relativeFilePath - ) - { - OpenApiUrl = openApiJsonPath; - RelativeFilePath = relativeFilePath; - ClientGeneratorSettings = new CSharpClientGeneratorSettings - { - ClassName = className, - GenerateClientClasses = false, - GeneratePrepareRequestAndProcessResponseAsAsyncMethods = false, - CSharpGeneratorSettings = - { - Namespace = baseNamespace, - TypeAccessModifier = "public", - GenerateDataAnnotations = true, - GenerateDefaultValues = true, - }, - GenerateExceptionClasses = false, - GenerateBaseUrlProperty = false, - GenerateUpdateJsonSerializerSettingsMethod = false, - GenerateDtoTypes = true, - GenerateOptionalParameters = true, - }; - } - } -} diff --git a/src/Vipps.net.Codegen/Program.cs b/src/Vipps.net.Codegen/Program.cs deleted file mode 100644 index 2b666be..0000000 --- a/src/Vipps.net.Codegen/Program.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Dynamic; -using Newtonsoft.Json; -using NSwag; -using NSwag.CodeGeneration.CSharp; -using Vipps.net.Codegen; - -internal sealed class Program -{ - private static async Task Main() - { - var httpClient = new HttpClient(); - var epaymentOptions = new CodegenSettings( - "https://developer.vippsmobilepay.com/redocusaurus/epayment-swagger-id.yaml", - "VippsEpayment", - "Vipps.net.Models.Epayment", - "../../../../Vipps.net/Models/EpaymentModels.cs" - ); - await GenerateCode(httpClient, epaymentOptions); - - var checkoutOptions = new CodegenSettings( - "https://developer.vippsmobilepay.com/redocusaurus/checkout-swagger-id.yaml", - "VippsCheckout", - "Vipps.net.Models.Checkout", - "../../../../Vipps.net/Models/CheckoutModels.cs" - ); - await GenerateCode(httpClient, checkoutOptions); - } - - private static async Task GenerateCode(HttpClient httpClient, CodegenSettings options) - { - Console.WriteLine($"Fetching from {options.OpenApiUrl}"); - var retrievedText = await httpClient.GetStringAsync(options.OpenApiUrl); - Console.WriteLine($"Retrieved from {options.OpenApiUrl}"); - var retrievedJson = options.OpenApiUrl.ToLower().EndsWith(".yaml") - ? ConvertToJson(retrievedText) - : EnrichJson(retrievedText); - var document = await OpenApiDocument.FromJsonAsync(retrievedJson); - Console.WriteLine( - $"Generated document from {options.OpenApiUrl}: Title: {document.Info.Title}, Version: {document.Info.Version}." - ); - - var generator = new CSharpClientGenerator(document, options.ClientGeneratorSettings); - var code = generator.GenerateFile(); - code = code.Replace( - " FixedOptions", - " FixedOptions" - ); - Console.WriteLine($"Generated code from {options.OpenApiUrl}"); - File.WriteAllText(options.RelativeFilePath, code); - Console.WriteLine($"Wrote file {options.RelativeFilePath}"); - } - - private static string ConvertToJson(string yaml) - { - var deserializer = new YamlDotNet.Serialization.Deserializer(); - dynamic deserializedObject = deserializer.Deserialize(yaml); - string json = JsonConvert.SerializeObject(deserializedObject); - return json; - } - - private static string EnrichJson(string jsonInput) - { - dynamic deserializedObject = JsonConvert.DeserializeObject(jsonInput); - string json = JsonConvert.SerializeObject(deserializedObject); - return json; - } -} diff --git a/src/Vipps.net.Codegen/Vipps.net.Codegen.csproj b/src/Vipps.net.Codegen/Vipps.net.Codegen.csproj deleted file mode 100644 index eb1f492..0000000 --- a/src/Vipps.net.Codegen/Vipps.net.Codegen.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - net7.0 - enable - enable - - - - - - - - diff --git a/src/Vipps.net.Demo/Controllers/CheckoutController.cs b/src/Vipps.net.Demo/Controllers/CheckoutController.cs index 6b3f59b..b415339 100644 --- a/src/Vipps.net.Demo/Controllers/CheckoutController.cs +++ b/src/Vipps.net.Demo/Controllers/CheckoutController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Vipps.net.Models.Checkout; +using Vipps.net.Models.Checkout.Model; using Vipps.net.Services; namespace Vipps.net.Demo.Controllers @@ -20,9 +21,9 @@ public CheckoutController(ILogger logger, IVippsApi vippsApi [HttpPost] public async Task> CreateSession() { - var request = new InitiateSessionRequest + var request = new InitiatePaymentSessionRequest { - MerchantInfo = new PaymentMerchantInfo + MerchantInfo = new MerchantInfo { CallbackAuthorizationToken = Guid.NewGuid().ToString(), CallbackUrl = "https://your-url-here.com:3000", diff --git a/src/Vipps.net.Demo/Vipps.net.Demo.csproj b/src/Vipps.net.Demo/Vipps.net.Demo.csproj index 9e64d53..dc29f82 100644 --- a/src/Vipps.net.Demo/Vipps.net.Demo.csproj +++ b/src/Vipps.net.Demo/Vipps.net.Demo.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable e1850619-4f06-4444-b271-437c887123f0 @@ -11,7 +11,7 @@ - + diff --git a/src/Vipps.net.Models.Checkout.Test/Vipps.net.Models.Checkout.Test.csproj b/src/Vipps.net.Models.Checkout.Test/Vipps.net.Models.Checkout.Test.csproj new file mode 100644 index 0000000..0503981 --- /dev/null +++ b/src/Vipps.net.Models.Checkout.Test/Vipps.net.Models.Checkout.Test.csproj @@ -0,0 +1,19 @@ + + + + Vipps.net.Models.Checkout.Test + Vipps.net.Models.Checkout.Test + net7.0 + false + + + + + + + + + + + + diff --git a/src/Vipps.net.Models.Checkout/Api/SessionApi.cs b/src/Vipps.net.Models.Checkout/Api/SessionApi.cs new file mode 100644 index 0000000..efafc28 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Api/SessionApi.cs @@ -0,0 +1,822 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Vipps.net.Models.Checkout.Client; +using Vipps.net.Models.Checkout.Model; + +namespace Vipps.net.Models.Checkout.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ISessionApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create a Checkout session + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// InitiateSessionResponse + InitiateSessionResponse CheckoutV3SessionPost(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0); + + /// + /// Create a Checkout session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// ApiResponse of InitiateSessionResponse + ApiResponse CheckoutV3SessionPostWithHttpInfo(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0); + /// + /// Get session info + /// + /// + /// Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// SessionResponse + SessionResponse CheckoutV3SessionReferenceGet(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0); + + /// + /// Get session info + /// + /// + /// Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// ApiResponse of SessionResponse + ApiResponse CheckoutV3SessionReferenceGetWithHttpInfo(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ISessionApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create a Checkout session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of InitiateSessionResponse + System.Threading.Tasks.Task CheckoutV3SessionPostAsync(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Create a Checkout session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InitiateSessionResponse) + System.Threading.Tasks.Task> CheckoutV3SessionPostWithHttpInfoAsync(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Get session info + /// + /// + /// Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of SessionResponse + System.Threading.Tasks.Task CheckoutV3SessionReferenceGetAsync(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Get session info + /// + /// + /// Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SessionResponse) + System.Threading.Tasks.Task> CheckoutV3SessionReferenceGetWithHttpInfoAsync(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ISessionApi : ISessionApiSync, ISessionApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class SessionApi : ISessionApi + { + private Vipps.net.Models.Checkout.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public SessionApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public SessionApi(string basePath) + { + this.Configuration = Vipps.net.Models.Checkout.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Checkout.Client.GlobalConfiguration.Instance, + new Vipps.net.Models.Checkout.Client.Configuration { BasePath = basePath } + ); + this.Client = new Vipps.net.Models.Checkout.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Checkout.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Vipps.net.Models.Checkout.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public SessionApi(Vipps.net.Models.Checkout.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Vipps.net.Models.Checkout.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Checkout.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Vipps.net.Models.Checkout.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Checkout.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Vipps.net.Models.Checkout.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public SessionApi(Vipps.net.Models.Checkout.Client.ISynchronousClient client, Vipps.net.Models.Checkout.Client.IAsynchronousClient asyncClient, Vipps.net.Models.Checkout.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Vipps.net.Models.Checkout.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Vipps.net.Models.Checkout.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Vipps.net.Models.Checkout.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Vipps.net.Models.Checkout.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Vipps.net.Models.Checkout.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create a Checkout session + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// InitiateSessionResponse + public InitiateSessionResponse CheckoutV3SessionPost(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0) + { + Vipps.net.Models.Checkout.Client.ApiResponse localVarResponse = CheckoutV3SessionPostWithHttpInfo(vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey, checkoutV3SessionPostRequest); + return localVarResponse.Data; + } + + /// + /// Create a Checkout session + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// ApiResponse of InitiateSessionResponse + public Vipps.net.Models.Checkout.Client.ApiResponse CheckoutV3SessionPostWithHttpInfo(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0) + { + Vipps.net.Models.Checkout.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Checkout.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "text/json", + "application/*+json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + if (clientId != null) + { + localVarRequestOptions.HeaderParameters.Add("client_id", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientId)); // header parameter + } + if (clientSecret != null) + { + localVarRequestOptions.HeaderParameters.Add("client_secret", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientSecret)); // header parameter + } + if (ocpApimSubscriptionKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + } + if (merchantSerialNumber != null) + { + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + } + if (idempotencyKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + } + localVarRequestOptions.Data = checkoutV3SessionPostRequest; + + localVarRequestOptions.Operation = "SessionApi.CheckoutV3SessionPost"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/checkout/v3/session", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CheckoutV3SessionPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Create a Checkout session + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of InitiateSessionResponse + public async System.Threading.Tasks.Task CheckoutV3SessionPostAsync(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Checkout.Client.ApiResponse localVarResponse = await CheckoutV3SessionPostWithHttpInfoAsync(vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey, checkoutV3SessionPostRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a Checkout session + /// + /// Thrown when fails to make API call + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InitiateSessionResponse) + public async System.Threading.Tasks.Task> CheckoutV3SessionPostWithHttpInfoAsync(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), CheckoutV3SessionPostRequest checkoutV3SessionPostRequest = default(CheckoutV3SessionPostRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Vipps.net.Models.Checkout.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Checkout.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "text/json", + "application/*+json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + if (clientId != null) + { + localVarRequestOptions.HeaderParameters.Add("client_id", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientId)); // header parameter + } + if (clientSecret != null) + { + localVarRequestOptions.HeaderParameters.Add("client_secret", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientSecret)); // header parameter + } + if (ocpApimSubscriptionKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + } + if (merchantSerialNumber != null) + { + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + } + if (idempotencyKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + } + localVarRequestOptions.Data = checkoutV3SessionPostRequest; + + localVarRequestOptions.Operation = "SessionApi.CheckoutV3SessionPost"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/checkout/v3/session", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CheckoutV3SessionPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get session info Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// SessionResponse + public SessionResponse CheckoutV3SessionReferenceGet(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0) + { + Vipps.net.Models.Checkout.Client.ApiResponse localVarResponse = CheckoutV3SessionReferenceGetWithHttpInfo(reference, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey); + return localVarResponse.Data; + } + + /// + /// Get session info Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// ApiResponse of SessionResponse + public Vipps.net.Models.Checkout.Client.ApiResponse CheckoutV3SessionReferenceGetWithHttpInfo(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Checkout.Client.ApiException(400, "Missing required parameter 'reference' when calling SessionApi->CheckoutV3SessionReferenceGet"); + } + + Vipps.net.Models.Checkout.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Checkout.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("reference", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(reference)); // path parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + if (clientId != null) + { + localVarRequestOptions.HeaderParameters.Add("client_id", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientId)); // header parameter + } + if (clientSecret != null) + { + localVarRequestOptions.HeaderParameters.Add("client_secret", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientSecret)); // header parameter + } + if (ocpApimSubscriptionKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + } + if (merchantSerialNumber != null) + { + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + } + if (idempotencyKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + } + + localVarRequestOptions.Operation = "SessionApi.CheckoutV3SessionReferenceGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/checkout/v3/session/{reference}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CheckoutV3SessionReferenceGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get session info Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of SessionResponse + public async System.Threading.Tasks.Task CheckoutV3SessionReferenceGetAsync(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Checkout.Client.ApiResponse localVarResponse = await CheckoutV3SessionReferenceGetWithHttpInfoAsync(reference, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get session info Transaction information, user information and shipping information are included in the response if the SessionState is PaymentInitiated + /// + /// Thrown when fails to make API call + /// The reference of the session. Example: \"123123\". + /// (optional, default to "{{system_name}}") + /// (optional, default to "{{system_version}}") + /// (optional, default to "{{system_plugin_name}}") + /// (optional, default to "{{system_plugin_version}}") + /// (optional, default to "{{client_id}}") + /// (optional, default to "{{client_secret}}") + /// (optional, default to "{{Ocp-Apim-Subscription-Key}}") + /// (optional, default to "{{merchantSerialNumber}}") + /// (optional, default to "{{Idempotency-Key}}") + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SessionResponse) + public async System.Threading.Tasks.Task> CheckoutV3SessionReferenceGetWithHttpInfoAsync(string reference, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string), string idempotencyKey = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Checkout.Client.ApiException(400, "Missing required parameter 'reference' when calling SessionApi->CheckoutV3SessionReferenceGet"); + } + + + Vipps.net.Models.Checkout.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Checkout.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Checkout.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("reference", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(reference)); // path parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + if (clientId != null) + { + localVarRequestOptions.HeaderParameters.Add("client_id", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientId)); // header parameter + } + if (clientSecret != null) + { + localVarRequestOptions.HeaderParameters.Add("client_secret", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(clientSecret)); // header parameter + } + if (ocpApimSubscriptionKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + } + if (merchantSerialNumber != null) + { + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + } + if (idempotencyKey != null) + { + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Checkout.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + } + + localVarRequestOptions.Operation = "SessionApi.CheckoutV3SessionReferenceGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/checkout/v3/session/{reference}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CheckoutV3SessionReferenceGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/ApiClient.cs b/src/Vipps.net.Models.Checkout/Client/ApiClient.cs new file mode 100644 index 0000000..9d147b5 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ApiClient.cs @@ -0,0 +1,815 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Web; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Vipps.net.Models.Checkout.Model; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + MaxTimeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private RestResponse DeserializeRestResponseFromPolicy(RestClient client, RestRequest request, PolicyResult policyResult) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return client.Deserialize(policyResult.Result); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return Task.FromResult(DeserializeRestResponseFromPolicy(client, request, policyResult)); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return DeserializeRestResponseFromPolicy(client, request, policyResult); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/ApiException.cs b/src/Vipps.net.Models.Checkout/Client/ApiException.cs new file mode 100644 index 0000000..4ab969d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ApiException.cs @@ -0,0 +1,68 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Client/ApiResponse.cs b/src/Vipps.net.Models.Checkout/Client/ApiResponse.cs new file mode 100644 index 0000000..4c67087 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ApiResponse.cs @@ -0,0 +1,166 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/ClientUtils.cs b/src/Vipps.net.Models.Checkout/Client/ClientUtils.cs new file mode 100644 index 0000000..4538d9c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ClientUtils.cs @@ -0,0 +1,247 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if(collectionFormat == "deepObject") { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/Configuration.cs b/src/Vipps.net.Models.Checkout/Client/Configuration.cs new file mode 100644 index 0000000..49233b4 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/Configuration.cs @@ -0,0 +1,613 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://apitest.vipps.no"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://apitest.vipps.no"}, + {"description", "No description provided"}, + } + }, + { + new Dictionary { + {"url", "https://api.vipps.no"}, + {"description", "No description provided"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://apitest.vipps.no") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + public X509CertificateCollection ClientCertificates { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Vipps.net.Models.Checkout) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: v3\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/ExceptionFactory.cs b/src/Vipps.net.Models.Checkout/Client/ExceptionFactory.cs new file mode 100644 index 0000000..23cea86 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ExceptionFactory.cs @@ -0,0 +1,22 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/src/Vipps.net.Models.Checkout/Client/GlobalConfiguration.cs b/src/Vipps.net.Models.Checkout/Client/GlobalConfiguration.cs new file mode 100644 index 0000000..c3bec0d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/GlobalConfiguration.cs @@ -0,0 +1,67 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System.Collections.Generic; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/HttpMethod.cs b/src/Vipps.net.Models.Checkout/Client/HttpMethod.cs new file mode 100644 index 0000000..a69210a --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/HttpMethod.cs @@ -0,0 +1,33 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Http methods supported by swagger + /// + public enum HttpMethod + { + /// HTTP GET request. + Get, + /// HTTP POST request. + Post, + /// HTTP PUT request. + Put, + /// HTTP DELETE request. + Delete, + /// HTTP HEAD request. + Head, + /// HTTP OPTIONS request. + Options, + /// HTTP PATCH request. + Patch + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/IApiAccessor.cs b/src/Vipps.net.Models.Checkout/Client/IApiAccessor.cs new file mode 100644 index 0000000..7e5ba69 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/IApiAccessor.cs @@ -0,0 +1,37 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + IReadableConfiguration Configuration { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + string GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/IAsynchronousClient.cs b/src/Vipps.net.Models.Checkout/Client/IAsynchronousClient.cs new file mode 100644 index 0000000..fa310a6 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/IAsynchronousClient.cs @@ -0,0 +1,100 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Threading.Tasks; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/IReadableConfiguration.cs b/src/Vipps.net.Models.Checkout/Client/IReadableConfiguration.cs new file mode 100644 index 0000000..7b1bb6f --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/IReadableConfiguration.cs @@ -0,0 +1,141 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the access token. + /// + /// Access token. + string AccessToken { get; } + + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Gets the username. + /// + /// Username. + string Username { get; } + + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Gets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + X509CertificateCollection ClientCertificates { get; } + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/ISynchronousClient.cs b/src/Vipps.net.Models.Checkout/Client/ISynchronousClient.cs new file mode 100644 index 0000000..76c320c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/ISynchronousClient.cs @@ -0,0 +1,93 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.IO; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/Multimap.cs b/src/Vipps.net.Models.Checkout/Client/Multimap.cs new file mode 100644 index 0000000..8a2d4ad --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/Multimap.cs @@ -0,0 +1,295 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/OpenAPIDateConverter.cs b/src/Vipps.net.Models.Checkout/Client/OpenAPIDateConverter.cs new file mode 100644 index 0000000..81d210c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/OpenAPIDateConverter.cs @@ -0,0 +1,29 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using Newtonsoft.Json.Converters; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/RequestOptions.cs b/src/Vipps.net.Models.Checkout/Client/RequestOptions.cs new file mode 100644 index 0000000..1490b36 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/RequestOptions.cs @@ -0,0 +1,84 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Operation associated with the request path. + /// + public string Operation { get; set; } + + /// + /// Index associated with the operation. + /// + public int OperationIndex { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/src/Vipps.net.Models.Checkout/Client/RetryConfiguration.cs b/src/Vipps.net.Models.Checkout/Client/RetryConfiguration.cs new file mode 100644 index 0000000..336462c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Client/RetryConfiguration.cs @@ -0,0 +1,31 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Polly; +using RestSharp; + +namespace Vipps.net.Models.Checkout.Client +{ + /// + /// Configuration class to set the polly retry policies to be applied to the requests. + /// + public static class RetryConfiguration + { + /// + /// Retry policy + /// + public static Policy RetryPolicy { get; set; } + + /// + /// Async retry policy + /// + public static AsyncPolicy AsyncRetryPolicy { get; set; } + } +} diff --git a/src/Vipps.net.Models.Checkout/Model/AbstractOpenAPISchema.cs b/src/Vipps.net.Models.Checkout/Model/AbstractOpenAPISchema.cs new file mode 100644 index 0000000..6d732f7 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/AbstractOpenAPISchema.cs @@ -0,0 +1,76 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/src/Vipps.net.Models.Checkout/Model/Amount.cs b/src/Vipps.net.Models.Checkout/Model/Amount.cs new file mode 100644 index 0000000..f1619af --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Amount.cs @@ -0,0 +1,109 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + [DataContract(Name = "Amount")] + public partial class Amount : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Amount() { } + /// + /// Initializes a new instance of the class. + /// + /// Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. (required). + /// The currency identifier according to ISO 4217. Example: \"NOK\" (required). + public Amount(int value = default(int), string currency = default(string)) + { + this.Value = value; + // to ensure "currency" is required (not null) + if (currency == null) + { + throw new ArgumentNullException("currency is a required property for Amount and cannot be null"); + } + this.Currency = currency; + } + + /// + /// Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public int Value { get; set; } + + /// + /// The currency identifier according to ISO 4217. Example: \"NOK\" + /// + /// The currency identifier according to ISO 4217. Example: \"NOK\" + [DataMember(Name = "currency", IsRequired = true, EmitDefaultValue = true)] + public string Currency { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Amount {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Value (int) minimum + if (this.Value < (int)0) + { + yield return new ValidationResult("Invalid value for Value, must be a value greater than or equal to 0.", new [] { "Value" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/BillingDetails.cs b/src/Vipps.net.Models.Checkout/Model/BillingDetails.cs new file mode 100644 index 0000000..91d3d3c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/BillingDetails.cs @@ -0,0 +1,178 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of the billing + /// + [DataContract(Name = "BillingDetails")] + public partial class BillingDetails : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BillingDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// Example: \"Ada\" (required). + /// Example: \"Lovelace\" (required). + /// Example: \"user@example.com\" (required). + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\" (required). + /// Example: \"Robert Levins gate 5\". + /// Example: \"0154\". + /// Example: \"Oslo\". + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\". + public BillingDetails(string firstName = default(string), string lastName = default(string), string email = default(string), string phoneNumber = default(string), string streetAddress = default(string), string postalCode = default(string), string city = default(string), string country = default(string)) + { + // to ensure "firstName" is required (not null) + if (firstName == null) + { + throw new ArgumentNullException("firstName is a required property for BillingDetails and cannot be null"); + } + this.FirstName = firstName; + // to ensure "lastName" is required (not null) + if (lastName == null) + { + throw new ArgumentNullException("lastName is a required property for BillingDetails and cannot be null"); + } + this.LastName = lastName; + // to ensure "email" is required (not null) + if (email == null) + { + throw new ArgumentNullException("email is a required property for BillingDetails and cannot be null"); + } + this.Email = email; + // to ensure "phoneNumber" is required (not null) + if (phoneNumber == null) + { + throw new ArgumentNullException("phoneNumber is a required property for BillingDetails and cannot be null"); + } + this.PhoneNumber = phoneNumber; + this.StreetAddress = streetAddress; + this.PostalCode = postalCode; + this.City = city; + this.Country = country; + } + + /// + /// Example: \"Ada\" + /// + /// Example: \"Ada\" + [DataMember(Name = "firstName", IsRequired = true, EmitDefaultValue = true)] + public string FirstName { get; set; } + + /// + /// Example: \"Lovelace\" + /// + /// Example: \"Lovelace\" + [DataMember(Name = "lastName", IsRequired = true, EmitDefaultValue = true)] + public string LastName { get; set; } + + /// + /// Example: \"user@example.com\" + /// + /// Example: \"user@example.com\" + [DataMember(Name = "email", IsRequired = true, EmitDefaultValue = true)] + public string Email { get; set; } + + /// + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\" + /// + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\" + [DataMember(Name = "phoneNumber", IsRequired = true, EmitDefaultValue = true)] + public string PhoneNumber { get; set; } + + /// + /// Example: \"Robert Levins gate 5\" + /// + /// Example: \"Robert Levins gate 5\" + [DataMember(Name = "streetAddress", EmitDefaultValue = true)] + public string StreetAddress { get; set; } + + /// + /// Example: \"0154\" + /// + /// Example: \"0154\" + [DataMember(Name = "postalCode", EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// Example: \"Oslo\" + /// + /// Example: \"Oslo\" + [DataMember(Name = "city", EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + [DataMember(Name = "country", EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BillingDetails {\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" PhoneNumber: ").Append(PhoneNumber).Append("\n"); + sb.Append(" StreetAddress: ").Append(StreetAddress).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CheckoutConfig.cs b/src/Vipps.net.Models.Checkout/Model/CheckoutConfig.cs new file mode 100644 index 0000000..614d6ba --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CheckoutConfig.cs @@ -0,0 +1,153 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// CheckoutConfig + /// + [DataContract(Name = "CheckoutConfig")] + public partial class CheckoutConfig : IValidatableObject + { + + /// + /// If customer is physically present: \"customer_present\", otherwise: \"customer_not_present\". + /// + /// If customer is physically present: \"customer_present\", otherwise: \"customer_not_present\". + [DataMember(Name = "customerInteraction", EmitDefaultValue = true)] + public CustomerInteraction? CustomerInteraction { get; set; } + + /// + /// Adjust the fields and values present in the Checkout. + /// + /// Adjust the fields and values present in the Checkout. + [DataMember(Name = "elements", EmitDefaultValue = true)] + public Elements? Elements { get; set; } + + /// + /// One of the following: \"WEB_REDIRECT\", \"NATIVE_REDIRECT\". To ensure having a return URL based on an app URL, use \"NATIVE_REDIRECT\". + /// + /// One of the following: \"WEB_REDIRECT\", \"NATIVE_REDIRECT\". To ensure having a return URL based on an app URL, use \"NATIVE_REDIRECT\". + [DataMember(Name = "userFlow", EmitDefaultValue = true)] + public UserFlow? UserFlow { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// If customer is physically present: \"customer_present\", otherwise: \"customer_not_present\".. + /// Adjust the fields and values present in the Checkout.. + /// Countries to allow during session. + /// One of the following: \"WEB_REDIRECT\", \"NATIVE_REDIRECT\". To ensure having a return URL based on an app URL, use \"NATIVE_REDIRECT\".. + /// Requires the customer to consent to share their email and openid sub with the merchant to be able to make a wallet payment (default: false).. + /// If used, displays a checkbox that can be used to ask for extra consent.. + /// Decides whether the order lines are displayed as a shopping cart context in the checkout.. + /// External payment methods to be enabled in the checkout.. + public CheckoutConfig(CustomerInteraction? customerInteraction = default(CustomerInteraction?), Elements? elements = default(Elements?), Countries countries = default(Countries), UserFlow? userFlow = default(UserFlow?), bool? requireUserInfo = default(bool?), CustomConsent customConsent = default(CustomConsent), bool? showOrderSummary = default(bool?), List externalPaymentMethods = default(List)) + { + this.CustomerInteraction = customerInteraction; + this.Elements = elements; + this.Countries = countries; + this.UserFlow = userFlow; + this.RequireUserInfo = requireUserInfo; + this.CustomConsent = customConsent; + this.ShowOrderSummary = showOrderSummary; + this.ExternalPaymentMethods = externalPaymentMethods; + } + + /// + /// Countries to allow during session + /// + /// Countries to allow during session + [DataMember(Name = "countries", EmitDefaultValue = true)] + public Countries Countries { get; set; } + + /// + /// Requires the customer to consent to share their email and openid sub with the merchant to be able to make a wallet payment (default: false). + /// + /// Requires the customer to consent to share their email and openid sub with the merchant to be able to make a wallet payment (default: false). + [DataMember(Name = "requireUserInfo", EmitDefaultValue = true)] + public bool? RequireUserInfo { get; set; } + + /// + /// If used, displays a checkbox that can be used to ask for extra consent. + /// + /// If used, displays a checkbox that can be used to ask for extra consent. + [DataMember(Name = "customConsent", EmitDefaultValue = true)] + public CustomConsent CustomConsent { get; set; } + + /// + /// Decides whether the order lines are displayed as a shopping cart context in the checkout. + /// + /// Decides whether the order lines are displayed as a shopping cart context in the checkout. + [DataMember(Name = "showOrderSummary", EmitDefaultValue = true)] + public bool? ShowOrderSummary { get; set; } + + /// + /// External payment methods to be enabled in the checkout. + /// + /// External payment methods to be enabled in the checkout. + [DataMember(Name = "externalPaymentMethods", EmitDefaultValue = true)] + public List ExternalPaymentMethods { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CheckoutConfig {\n"); + sb.Append(" CustomerInteraction: ").Append(CustomerInteraction).Append("\n"); + sb.Append(" Elements: ").Append(Elements).Append("\n"); + sb.Append(" Countries: ").Append(Countries).Append("\n"); + sb.Append(" UserFlow: ").Append(UserFlow).Append("\n"); + sb.Append(" RequireUserInfo: ").Append(RequireUserInfo).Append("\n"); + sb.Append(" CustomConsent: ").Append(CustomConsent).Append("\n"); + sb.Append(" ShowOrderSummary: ").Append(ShowOrderSummary).Append("\n"); + sb.Append(" ExternalPaymentMethods: ").Append(ExternalPaymentMethods).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CheckoutProblemDetails.cs b/src/Vipps.net.Models.Checkout/Model/CheckoutProblemDetails.cs new file mode 100644 index 0000000..5eaeee9 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CheckoutProblemDetails.cs @@ -0,0 +1,162 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// A machine-readable format for specifying errors in HTTP API responses based on <see href=\"https://tools.ietf.org/html/rfc7807\" />. + /// + [DataContract(Name = "CheckoutProblemDetails")] + public partial class CheckoutProblemDetails : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CheckoutProblemDetails() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// type. + /// title. + /// status. + /// detail. + /// instance. + /// errorCode (required). + /// errors (required). + public CheckoutProblemDetails(string type = default(string), string title = default(string), int? status = default(int?), string detail = default(string), string instance = default(string), string errorCode = default(string), Dictionary> errors = default(Dictionary>)) + { + // to ensure "errorCode" is required (not null) + if (errorCode == null) + { + throw new ArgumentNullException("errorCode is a required property for CheckoutProblemDetails and cannot be null"); + } + this.ErrorCode = errorCode; + // to ensure "errors" is required (not null) + if (errors == null) + { + throw new ArgumentNullException("errors is a required property for CheckoutProblemDetails and cannot be null"); + } + this.Errors = errors; + this.Type = type; + this.Title = title; + this.Status = status; + this.Detail = detail; + this.Instance = instance; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Gets or Sets Title + /// + [DataMember(Name = "title", EmitDefaultValue = true)] + public string Title { get; set; } + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", EmitDefaultValue = true)] + public int? Status { get; set; } + + /// + /// Gets or Sets Detail + /// + [DataMember(Name = "detail", EmitDefaultValue = true)] + public string Detail { get; set; } + + /// + /// Gets or Sets Instance + /// + [DataMember(Name = "instance", EmitDefaultValue = true)] + public string Instance { get; set; } + + /// + /// Gets or Sets ErrorCode + /// + [DataMember(Name = "errorCode", IsRequired = true, EmitDefaultValue = true)] + public string ErrorCode { get; set; } + + /// + /// Gets or Sets Errors + /// + [DataMember(Name = "errors", IsRequired = true, EmitDefaultValue = true)] + public Dictionary> Errors { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CheckoutProblemDetails {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Detail: ").Append(Detail).Append("\n"); + sb.Append(" Instance: ").Append(Instance).Append("\n"); + sb.Append(" ErrorCode: ").Append(ErrorCode).Append("\n"); + sb.Append(" Errors: ").Append(Errors).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CheckoutSessionThirdPartyInformationHeaders.cs b/src/Vipps.net.Models.Checkout/Model/CheckoutSessionThirdPartyInformationHeaders.cs new file mode 100644 index 0000000..17466ad --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CheckoutSessionThirdPartyInformationHeaders.cs @@ -0,0 +1,162 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Information about the merchant system. + /// + [DataContract(Name = "CheckoutSessionThirdPartyInformationHeaders")] + public partial class CheckoutSessionThirdPartyInformationHeaders : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CheckoutSessionThirdPartyInformationHeaders() { } + /// + /// Initializes a new instance of the class. + /// + /// The name of the ecommerce solution. Example: \"Acme Commerce\". (required). + /// The version number of the ecommerce solution. Example: \"3.1.2\". (required). + /// The name of the ecommerce plugin. Example: \"acme-webshop\". (required). + /// The version number of the ecommerce plugin. Example: \"4.5.6\". (required). + public CheckoutSessionThirdPartyInformationHeaders(string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string)) + { + // to ensure "vippsSystemName" is required (not null) + if (vippsSystemName == null) + { + throw new ArgumentNullException("vippsSystemName is a required property for CheckoutSessionThirdPartyInformationHeaders and cannot be null"); + } + this.VippsSystemName = vippsSystemName; + // to ensure "vippsSystemVersion" is required (not null) + if (vippsSystemVersion == null) + { + throw new ArgumentNullException("vippsSystemVersion is a required property for CheckoutSessionThirdPartyInformationHeaders and cannot be null"); + } + this.VippsSystemVersion = vippsSystemVersion; + // to ensure "vippsSystemPluginName" is required (not null) + if (vippsSystemPluginName == null) + { + throw new ArgumentNullException("vippsSystemPluginName is a required property for CheckoutSessionThirdPartyInformationHeaders and cannot be null"); + } + this.VippsSystemPluginName = vippsSystemPluginName; + // to ensure "vippsSystemPluginVersion" is required (not null) + if (vippsSystemPluginVersion == null) + { + throw new ArgumentNullException("vippsSystemPluginVersion is a required property for CheckoutSessionThirdPartyInformationHeaders and cannot be null"); + } + this.VippsSystemPluginVersion = vippsSystemPluginVersion; + } + + /// + /// The name of the ecommerce solution. Example: \"Acme Commerce\". + /// + /// The name of the ecommerce solution. Example: \"Acme Commerce\". + [DataMember(Name = "vipps-System-Name", IsRequired = true, EmitDefaultValue = true)] + public string VippsSystemName { get; set; } + + /// + /// The version number of the ecommerce solution. Example: \"3.1.2\". + /// + /// The version number of the ecommerce solution. Example: \"3.1.2\". + [DataMember(Name = "vipps-System-Version", IsRequired = true, EmitDefaultValue = true)] + public string VippsSystemVersion { get; set; } + + /// + /// The name of the ecommerce plugin. Example: \"acme-webshop\". + /// + /// The name of the ecommerce plugin. Example: \"acme-webshop\". + [DataMember(Name = "vipps-System-Plugin-Name", IsRequired = true, EmitDefaultValue = true)] + public string VippsSystemPluginName { get; set; } + + /// + /// The version number of the ecommerce plugin. Example: \"4.5.6\". + /// + /// The version number of the ecommerce plugin. Example: \"4.5.6\". + [DataMember(Name = "vipps-System-Plugin-Version", IsRequired = true, EmitDefaultValue = true)] + public string VippsSystemPluginVersion { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CheckoutSessionThirdPartyInformationHeaders {\n"); + sb.Append(" VippsSystemName: ").Append(VippsSystemName).Append("\n"); + sb.Append(" VippsSystemVersion: ").Append(VippsSystemVersion).Append("\n"); + sb.Append(" VippsSystemPluginName: ").Append(VippsSystemPluginName).Append("\n"); + sb.Append(" VippsSystemPluginVersion: ").Append(VippsSystemPluginVersion).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // VippsSystemName (string) maxLength + if (this.VippsSystemName != null && this.VippsSystemName.Length > 30) + { + yield return new ValidationResult("Invalid value for VippsSystemName, length must be less than 30.", new [] { "VippsSystemName" }); + } + + // VippsSystemVersion (string) maxLength + if (this.VippsSystemVersion != null && this.VippsSystemVersion.Length > 30) + { + yield return new ValidationResult("Invalid value for VippsSystemVersion, length must be less than 30.", new [] { "VippsSystemVersion" }); + } + + // VippsSystemPluginName (string) maxLength + if (this.VippsSystemPluginName != null && this.VippsSystemPluginName.Length > 30) + { + yield return new ValidationResult("Invalid value for VippsSystemPluginName, length must be less than 30.", new [] { "VippsSystemPluginName" }); + } + + // VippsSystemPluginVersion (string) maxLength + if (this.VippsSystemPluginVersion != null && this.VippsSystemPluginVersion.Length > 30) + { + yield return new ValidationResult("Invalid value for VippsSystemPluginVersion, length must be less than 30.", new [] { "VippsSystemPluginVersion" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPost200ResponseInner.cs b/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPost200ResponseInner.cs new file mode 100644 index 0000000..a8adde3 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPost200ResponseInner.cs @@ -0,0 +1,536 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// CheckoutV3SessionPost200ResponseInner + /// + [JsonConverter(typeof(CheckoutV3SessionPost200ResponseInnerJsonConverter))] + [DataContract(Name = "_checkout_v3_session_post_200_response_inner")] + public partial class CheckoutV3SessionPost200ResponseInner : AbstractOpenAPISchema, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PostenLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(PostenLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PostnordLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(PostnordLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PorterbuddyLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(PorterbuddyLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of HelthjemLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(HelthjemLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PostiLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(PostiLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of GlsLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(GlsLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of DaoLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(DaoLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of OtherLogisticsOption. + public CheckoutV3SessionPost200ResponseInner(OtherLogisticsOption actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(DaoLogisticsOption) || value is DaoLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(GlsLogisticsOption) || value is GlsLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(HelthjemLogisticsOption) || value is HelthjemLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(OtherLogisticsOption) || value is OtherLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PorterbuddyLogisticsOption) || value is PorterbuddyLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PostenLogisticsOption) || value is PostenLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PostiLogisticsOption) || value is PostiLogisticsOption) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PostnordLogisticsOption) || value is PostnordLogisticsOption) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: DaoLogisticsOption, GlsLogisticsOption, HelthjemLogisticsOption, OtherLogisticsOption, PorterbuddyLogisticsOption, PostenLogisticsOption, PostiLogisticsOption, PostnordLogisticsOption"); + } + } + } + + /// + /// Get the actual instance of `PostenLogisticsOption`. If the actual instance is not `PostenLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of PostenLogisticsOption + public PostenLogisticsOption GetPostenLogisticsOption() + { + return (PostenLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `PostnordLogisticsOption`. If the actual instance is not `PostnordLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of PostnordLogisticsOption + public PostnordLogisticsOption GetPostnordLogisticsOption() + { + return (PostnordLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `PorterbuddyLogisticsOption`. If the actual instance is not `PorterbuddyLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of PorterbuddyLogisticsOption + public PorterbuddyLogisticsOption GetPorterbuddyLogisticsOption() + { + return (PorterbuddyLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `HelthjemLogisticsOption`. If the actual instance is not `HelthjemLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of HelthjemLogisticsOption + public HelthjemLogisticsOption GetHelthjemLogisticsOption() + { + return (HelthjemLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `PostiLogisticsOption`. If the actual instance is not `PostiLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of PostiLogisticsOption + public PostiLogisticsOption GetPostiLogisticsOption() + { + return (PostiLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `GlsLogisticsOption`. If the actual instance is not `GlsLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of GlsLogisticsOption + public GlsLogisticsOption GetGlsLogisticsOption() + { + return (GlsLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `DaoLogisticsOption`. If the actual instance is not `DaoLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of DaoLogisticsOption + public DaoLogisticsOption GetDaoLogisticsOption() + { + return (DaoLogisticsOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `OtherLogisticsOption`. If the actual instance is not `OtherLogisticsOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of OtherLogisticsOption + public OtherLogisticsOption GetOtherLogisticsOption() + { + return (OtherLogisticsOption)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class CheckoutV3SessionPost200ResponseInner {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, CheckoutV3SessionPost200ResponseInner.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of CheckoutV3SessionPost200ResponseInner + /// + /// JSON string + /// An instance of CheckoutV3SessionPost200ResponseInner + public static CheckoutV3SessionPost200ResponseInner FromJson(string jsonString) + { + CheckoutV3SessionPost200ResponseInner newCheckoutV3SessionPost200ResponseInner = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newCheckoutV3SessionPost200ResponseInner; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(DaoLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("DaoLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into DaoLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(GlsLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("GlsLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into GlsLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(HelthjemLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("HelthjemLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into HelthjemLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(OtherLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("OtherLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into OtherLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PorterbuddyLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PorterbuddyLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PorterbuddyLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PostenLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PostenLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PostenLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PostiLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PostiLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PostiLogisticsOption: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PostnordLogisticsOption).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.SerializerSettings)); + } + else + { + newCheckoutV3SessionPost200ResponseInner = new CheckoutV3SessionPost200ResponseInner(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPost200ResponseInner.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PostnordLogisticsOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PostnordLogisticsOption: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newCheckoutV3SessionPost200ResponseInner; + } + + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for CheckoutV3SessionPost200ResponseInner + /// + public class CheckoutV3SessionPost200ResponseInnerJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(CheckoutV3SessionPost200ResponseInner).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return CheckoutV3SessionPost200ResponseInner.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return CheckoutV3SessionPost200ResponseInner.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPostRequest.cs b/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPostRequest.cs new file mode 100644 index 0000000..6dd28f9 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CheckoutV3SessionPostRequest.cs @@ -0,0 +1,260 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// CheckoutV3SessionPostRequest + /// + [JsonConverter(typeof(CheckoutV3SessionPostRequestJsonConverter))] + [DataContract(Name = "_checkout_v3_session_post_request")] + public partial class CheckoutV3SessionPostRequest : AbstractOpenAPISchema, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of InitiatePaymentSessionRequest. + public CheckoutV3SessionPostRequest(InitiatePaymentSessionRequest actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of InitiateSubscriptionSessionRequest. + public CheckoutV3SessionPostRequest(InitiateSubscriptionSessionRequest actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(InitiatePaymentSessionRequest) || value is InitiatePaymentSessionRequest) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(InitiateSubscriptionSessionRequest) || value is InitiateSubscriptionSessionRequest) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: InitiatePaymentSessionRequest, InitiateSubscriptionSessionRequest"); + } + } + } + + /// + /// Get the actual instance of `InitiatePaymentSessionRequest`. If the actual instance is not `InitiatePaymentSessionRequest`, + /// the InvalidClassException will be thrown + /// + /// An instance of InitiatePaymentSessionRequest + public InitiatePaymentSessionRequest GetInitiatePaymentSessionRequest() + { + return (InitiatePaymentSessionRequest)this.ActualInstance; + } + + /// + /// Get the actual instance of `InitiateSubscriptionSessionRequest`. If the actual instance is not `InitiateSubscriptionSessionRequest`, + /// the InvalidClassException will be thrown + /// + /// An instance of InitiateSubscriptionSessionRequest + public InitiateSubscriptionSessionRequest GetInitiateSubscriptionSessionRequest() + { + return (InitiateSubscriptionSessionRequest)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class CheckoutV3SessionPostRequest {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, CheckoutV3SessionPostRequest.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of CheckoutV3SessionPostRequest + /// + /// JSON string + /// An instance of CheckoutV3SessionPostRequest + public static CheckoutV3SessionPostRequest FromJson(string jsonString) + { + CheckoutV3SessionPostRequest newCheckoutV3SessionPostRequest = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newCheckoutV3SessionPostRequest; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(InitiatePaymentSessionRequest).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPostRequest.SerializerSettings)); + } + else + { + newCheckoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPostRequest.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("InitiatePaymentSessionRequest"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into InitiatePaymentSessionRequest: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(InitiateSubscriptionSessionRequest).GetProperty("AdditionalProperties") == null) + { + newCheckoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPostRequest.SerializerSettings)); + } + else + { + newCheckoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(JsonConvert.DeserializeObject(jsonString, CheckoutV3SessionPostRequest.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("InitiateSubscriptionSessionRequest"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into InitiateSubscriptionSessionRequest: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newCheckoutV3SessionPostRequest; + } + + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for CheckoutV3SessionPostRequest + /// + public class CheckoutV3SessionPostRequestJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(CheckoutV3SessionPostRequest).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return CheckoutV3SessionPostRequest.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return CheckoutV3SessionPostRequest.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Countries.cs b/src/Vipps.net.Models.Checkout/Model/Countries.cs new file mode 100644 index 0000000..c1b3ff5 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Countries.cs @@ -0,0 +1,93 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Countries + /// + [DataContract(Name = "Countries")] + public partial class Countries : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Countries() { } + /// + /// Initializes a new instance of the class. + /// + /// List of allowed countries in ISO-3166 Alpha 2. If specified, the customer will only be able to select these countries. Example [\"NO\", \"SE\", \"DK\"] (required). + public Countries(List supported = default(List)) + { + // to ensure "supported" is required (not null) + if (supported == null) + { + throw new ArgumentNullException("supported is a required property for Countries and cannot be null"); + } + this.Supported = supported; + } + + /// + /// List of allowed countries in ISO-3166 Alpha 2. If specified, the customer will only be able to select these countries. Example [\"NO\", \"SE\", \"DK\"] + /// + /// List of allowed countries in ISO-3166 Alpha 2. If specified, the customer will only be able to select these countries. Example [\"NO\", \"SE\", \"DK\"] + [DataMember(Name = "supported", IsRequired = true, EmitDefaultValue = true)] + public List Supported { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Countries {\n"); + sb.Append(" Supported: ").Append(Supported).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CustomConsent.cs b/src/Vipps.net.Models.Checkout/Model/CustomConsent.cs new file mode 100644 index 0000000..726dd77 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CustomConsent.cs @@ -0,0 +1,103 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// If used, displays a checkbox that can be used to ask for extra consent. + /// + [DataContract(Name = "CustomConsent")] + public partial class CustomConsent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CustomConsent() { } + /// + /// Initializes a new instance of the class. + /// + /// Text displayed next to the checkbox. This text can contain up to one link in markdown format like this: [linkText](https://example.com) (required). + /// Whether box has to be checked to complete the checkout. (required). + public CustomConsent(string text = default(string), bool required = default(bool)) + { + // to ensure "text" is required (not null) + if (text == null) + { + throw new ArgumentNullException("text is a required property for CustomConsent and cannot be null"); + } + this.Text = text; + this.Required = required; + } + + /// + /// Text displayed next to the checkbox. This text can contain up to one link in markdown format like this: [linkText](https://example.com) + /// + /// Text displayed next to the checkbox. This text can contain up to one link in markdown format like this: [linkText](https://example.com) + [DataMember(Name = "text", IsRequired = true, EmitDefaultValue = true)] + public string Text { get; set; } + + /// + /// Whether box has to be checked to complete the checkout. + /// + /// Whether box has to be checked to complete the checkout. + [DataMember(Name = "required", IsRequired = true, EmitDefaultValue = true)] + public bool Required { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CustomConsent {\n"); + sb.Append(" Text: ").Append(Text).Append("\n"); + sb.Append(" Required: ").Append(Required).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/CustomerInteraction.cs b/src/Vipps.net.Models.Checkout/Model/CustomerInteraction.cs new file mode 100644 index 0000000..fc59dc9 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/CustomerInteraction.cs @@ -0,0 +1,47 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines CustomerInteraction + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CustomerInteraction + { + /// + /// Enum PRESENT for value: CUSTOMER_PRESENT + /// + [EnumMember(Value = "CUSTOMER_PRESENT")] + PRESENT = 1, + + /// + /// Enum NOTPRESENT for value: CUSTOMER_NOT_PRESENT + /// + [EnumMember(Value = "CUSTOMER_NOT_PRESENT")] + NOTPRESENT = 2 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/DaoLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/DaoLogisticsOption.cs new file mode 100644 index 0000000..b52f314 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/DaoLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// DaoLogisticsOption + /// + [DataContract(Name = "DaoLogisticsOption")] + public partial class DaoLogisticsOption : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DaoLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "DAO"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public DaoLogisticsOption(Amount amount = default(Amount), int type = default(int), string customType = default(string), int? taxRate = default(int?), string brand = @"DAO", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for DaoLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for DaoLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for DaoLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public int Type { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DaoLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"DAO", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Elements.cs b/src/Vipps.net.Models.Checkout/Model/Elements.cs new file mode 100644 index 0000000..4d4d463 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Elements.cs @@ -0,0 +1,53 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines Elements + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Elements + { + /// + /// Enum Full for value: Full + /// + [EnumMember(Value = "Full")] + Full = 1, + + /// + /// Enum PaymentAndContactInfo for value: PaymentAndContactInfo + /// + [EnumMember(Value = "PaymentAndContactInfo")] + PaymentAndContactInfo = 2, + + /// + /// Enum PaymentOnly for value: PaymentOnly + /// + [EnumMember(Value = "PaymentOnly")] + PaymentOnly = 3 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/EventSubscriptionCampaign.cs b/src/Vipps.net.Models.Checkout/Model/EventSubscriptionCampaign.cs new file mode 100644 index 0000000..f735a60 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/EventSubscriptionCampaign.cs @@ -0,0 +1,162 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// EventSubscriptionCampaign + /// + [DataContract(Name = "EventSubscriptionCampaign")] + public partial class EventSubscriptionCampaign : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EventSubscriptionCampaign() { } + /// + /// Initializes a new instance of the class. + /// + /// eventDate (required). + /// eventText (required). + /// type (required) (default to "EVENT_CAMPAIGN"). + /// price (required). + public EventSubscriptionCampaign(string eventDate = default(string), string eventText = default(string), string type = @"EVENT_CAMPAIGN", int price = default(int)) + { + // to ensure "eventDate" is required (not null) + if (eventDate == null) + { + throw new ArgumentNullException("eventDate is a required property for EventSubscriptionCampaign and cannot be null"); + } + this.EventDate = eventDate; + // to ensure "eventText" is required (not null) + if (eventText == null) + { + throw new ArgumentNullException("eventText is a required property for EventSubscriptionCampaign and cannot be null"); + } + this.EventText = eventText; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for EventSubscriptionCampaign and cannot be null"); + } + this.Type = type; + this.Price = price; + } + + /// + /// Gets or Sets EventDate + /// + [DataMember(Name = "eventDate", IsRequired = true, EmitDefaultValue = true)] + public string EventDate { get; set; } + + /// + /// Gets or Sets EventText + /// + [DataMember(Name = "eventText", IsRequired = true, EmitDefaultValue = true)] + public string EventText { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Gets or Sets Price + /// + [DataMember(Name = "price", IsRequired = true, EmitDefaultValue = true)] + public int Price { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EventSubscriptionCampaign {\n"); + sb.Append(" EventDate: ").Append(EventDate).Append("\n"); + sb.Append(" EventText: ").Append(EventText).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Price: ").Append(Price).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventDate (string) minLength + if (this.EventDate != null && this.EventDate.Length < 1) + { + yield return new ValidationResult("Invalid value for EventDate, length must be greater than 1.", new [] { "EventDate" }); + } + + // EventText (string) maxLength + if (this.EventText != null && this.EventText.Length > 15) + { + yield return new ValidationResult("Invalid value for EventText, length must be less than 15.", new [] { "EventText" }); + } + + // EventText (string) minLength + if (this.EventText != null && this.EventText.Length < 1) + { + yield return new ValidationResult("Invalid value for EventText, length must be greater than 1.", new [] { "EventText" }); + } + + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"EVENT_CAMPAIGN", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + // Price (int) minimum + if (this.Price < (int)0) + { + yield return new ValidationResult("Invalid value for Price, must be a value greater than or equal to 0.", new [] { "Price" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethod.cs b/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethod.cs new file mode 100644 index 0000000..62ab4de --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethod.cs @@ -0,0 +1,103 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Configuration for showing and enabling external payment methods in the checkout. + /// + [DataContract(Name = "ExternalPaymentMethod")] + public partial class ExternalPaymentMethod : IValidatableObject + { + + /// + /// Identifier for the payment method, needs to match that of the allowed list defined in the docs + /// + /// Identifier for the payment method, needs to match that of the allowed list defined in the docs + [DataMember(Name = "paymentMethod", IsRequired = true, EmitDefaultValue = true)] + public ExternalPaymentMethodType PaymentMethod { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ExternalPaymentMethod() { } + /// + /// Initializes a new instance of the class. + /// + /// Identifier for the payment method, needs to match that of the allowed list defined in the docs (required). + /// URL to redirect the customer to finish the payment (required). + public ExternalPaymentMethod(ExternalPaymentMethodType paymentMethod = default(ExternalPaymentMethodType), string redirectUrl = default(string)) + { + this.PaymentMethod = paymentMethod; + // to ensure "redirectUrl" is required (not null) + if (redirectUrl == null) + { + throw new ArgumentNullException("redirectUrl is a required property for ExternalPaymentMethod and cannot be null"); + } + this.RedirectUrl = redirectUrl; + } + + /// + /// URL to redirect the customer to finish the payment + /// + /// URL to redirect the customer to finish the payment + [DataMember(Name = "redirectUrl", IsRequired = true, EmitDefaultValue = true)] + public string RedirectUrl { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ExternalPaymentMethod {\n"); + sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n"); + sb.Append(" RedirectUrl: ").Append(RedirectUrl).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethodType.cs b/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethodType.cs new file mode 100644 index 0000000..3000acb --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ExternalPaymentMethodType.cs @@ -0,0 +1,42 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Valid types of external payment methods + /// + /// Valid types of external payment methods + [JsonConverter(typeof(StringEnumConverter))] + public enum ExternalPaymentMethodType + { + /// + /// Enum Klarna for value: Klarna + /// + [EnumMember(Value = "Klarna")] + Klarna = 1 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ExternalSessionState.cs b/src/Vipps.net.Models.Checkout/Model/ExternalSessionState.cs new file mode 100644 index 0000000..cdf98f2 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ExternalSessionState.cs @@ -0,0 +1,65 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines ExternalSessionState + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ExternalSessionState + { + /// + /// Enum SessionCreated for value: SessionCreated + /// + [EnumMember(Value = "SessionCreated")] + SessionCreated = 1, + + /// + /// Enum PaymentInitiated for value: PaymentInitiated + /// + [EnumMember(Value = "PaymentInitiated")] + PaymentInitiated = 2, + + /// + /// Enum SessionExpired for value: SessionExpired + /// + [EnumMember(Value = "SessionExpired")] + SessionExpired = 3, + + /// + /// Enum PaymentSuccessful for value: PaymentSuccessful + /// + [EnumMember(Value = "PaymentSuccessful")] + PaymentSuccessful = 4, + + /// + /// Enum PaymentTerminated for value: PaymentTerminated + /// + [EnumMember(Value = "PaymentTerminated")] + PaymentTerminated = 5 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/GlsLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/GlsLogisticsOption.cs new file mode 100644 index 0000000..9f68aee --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/GlsLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// GlsLogisticsOption + /// + [DataContract(Name = "GlsLogisticsOption")] + public partial class GlsLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public GlsLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GlsLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "GLS"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public GlsLogisticsOption(Amount amount = default(Amount), GlsLogisticsType? type = default(GlsLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"GLS", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for GlsLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for GlsLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for GlsLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GlsLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"GLS", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/GlsLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/GlsLogisticsType.cs new file mode 100644 index 0000000..6eec10e --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/GlsLogisticsType.cs @@ -0,0 +1,41 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines GlsLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum GlsLogisticsType + { + /// + /// Enum PICKUPPOINT for value: PICKUP_POINT + /// + [EnumMember(Value = "PICKUP_POINT")] + PICKUPPOINT = 1 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Helthjem.cs b/src/Vipps.net.Models.Checkout/Model/Helthjem.cs new file mode 100644 index 0000000..ed73d33 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Helthjem.cs @@ -0,0 +1,130 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Configuration required to enable Helthjem logistics options + /// + [DataContract(Name = "Helthjem")] + public partial class Helthjem : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Helthjem() { } + /// + /// Initializes a new instance of the class. + /// + /// The Username provided to you by Helthjem (required). + /// The Password provided to you by Helthjem (required). + /// The ShopId provided to you by Helthjem (required). + public Helthjem(string username = default(string), string password = default(string), int shopId = default(int)) + { + // to ensure "username" is required (not null) + if (username == null) + { + throw new ArgumentNullException("username is a required property for Helthjem and cannot be null"); + } + this.Username = username; + // to ensure "password" is required (not null) + if (password == null) + { + throw new ArgumentNullException("password is a required property for Helthjem and cannot be null"); + } + this.Password = password; + this.ShopId = shopId; + } + + /// + /// The Username provided to you by Helthjem + /// + /// The Username provided to you by Helthjem + [DataMember(Name = "username", IsRequired = true, EmitDefaultValue = true)] + public string Username { get; set; } + + /// + /// The Password provided to you by Helthjem + /// + /// The Password provided to you by Helthjem + [DataMember(Name = "password", IsRequired = true, EmitDefaultValue = true)] + public string Password { get; set; } + + /// + /// The ShopId provided to you by Helthjem + /// + /// The ShopId provided to you by Helthjem + [DataMember(Name = "shopId", IsRequired = true, EmitDefaultValue = true)] + public int ShopId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Helthjem {\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" ShopId: ").Append(ShopId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Username (string) minLength + if (this.Username != null && this.Username.Length < 1) + { + yield return new ValidationResult("Invalid value for Username, length must be greater than 1.", new [] { "Username" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 1) + { + yield return new ValidationResult("Invalid value for Password, length must be greater than 1.", new [] { "Password" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsOption.cs new file mode 100644 index 0000000..d0482f3 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// HelthjemLogisticsOption + /// + [DataContract(Name = "HelthjemLogisticsOption")] + public partial class HelthjemLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public HelthjemLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected HelthjemLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "HELTHJEM"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public HelthjemLogisticsOption(Amount amount = default(Amount), HelthjemLogisticsType? type = default(HelthjemLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"HELTHJEM", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for HelthjemLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for HelthjemLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for HelthjemLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HelthjemLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"HELTHJEM", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsType.cs new file mode 100644 index 0000000..fc5fd25 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/HelthjemLogisticsType.cs @@ -0,0 +1,47 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines HelthjemLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum HelthjemLogisticsType + { + /// + /// Enum HOMEDELIVERY for value: HOME_DELIVERY + /// + [EnumMember(Value = "HOME_DELIVERY")] + HOMEDELIVERY = 1, + + /// + /// Enum PICKUPPOINT for value: PICKUP_POINT + /// + [EnumMember(Value = "PICKUP_POINT")] + PICKUPPOINT = 2 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/IdempotencyHeader.cs b/src/Vipps.net.Models.Checkout/Model/IdempotencyHeader.cs new file mode 100644 index 0000000..efd30bd --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/IdempotencyHeader.cs @@ -0,0 +1,82 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// IdempotencyHeader + /// + [DataContract(Name = "IdempotencyHeader")] + public partial class IdempotencyHeader : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// idempotencyKey. + public IdempotencyHeader(string idempotencyKey = default(string)) + { + this.IdempotencyKey = idempotencyKey; + } + + /// + /// Gets or Sets IdempotencyKey + /// + [DataMember(Name = "idempotency-Key", EmitDefaultValue = true)] + public string IdempotencyKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IdempotencyHeader {\n"); + sb.Append(" IdempotencyKey: ").Append(IdempotencyKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/InitiatePaymentSessionRequest.cs b/src/Vipps.net.Models.Checkout/Model/InitiatePaymentSessionRequest.cs new file mode 100644 index 0000000..c49168c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/InitiatePaymentSessionRequest.cs @@ -0,0 +1,157 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Request to set up a Checkout session + /// + [DataContract(Name = "InitiatePaymentSessionRequest")] + public partial class InitiatePaymentSessionRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InitiatePaymentSessionRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// transaction (required). + /// logistics. + /// type (required) (default to "PAYMENT"). + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information.. + /// merchantInfo (required). + /// varConfiguration. + public InitiatePaymentSessionRequest(PaymentTransaction transaction = default(PaymentTransaction), Logistics logistics = default(Logistics), string type = @"PAYMENT", PrefillCustomer prefillCustomer = default(PrefillCustomer), MerchantInfo merchantInfo = default(MerchantInfo), CheckoutConfig varConfiguration = default(CheckoutConfig)) + { + // to ensure "transaction" is required (not null) + if (transaction == null) + { + throw new ArgumentNullException("transaction is a required property for InitiatePaymentSessionRequest and cannot be null"); + } + this.Transaction = transaction; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for InitiatePaymentSessionRequest and cannot be null"); + } + this.Type = type; + // to ensure "merchantInfo" is required (not null) + if (merchantInfo == null) + { + throw new ArgumentNullException("merchantInfo is a required property for InitiatePaymentSessionRequest and cannot be null"); + } + this.MerchantInfo = merchantInfo; + this.Logistics = logistics; + this.PrefillCustomer = prefillCustomer; + this.VarConfiguration = varConfiguration; + } + + /// + /// Gets or Sets Transaction + /// + [DataMember(Name = "transaction", IsRequired = true, EmitDefaultValue = true)] + public PaymentTransaction Transaction { get; set; } + + /// + /// Gets or Sets Logistics + /// + [DataMember(Name = "logistics", EmitDefaultValue = true)] + public Logistics Logistics { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + [DataMember(Name = "prefillCustomer", EmitDefaultValue = true)] + public PrefillCustomer PrefillCustomer { get; set; } + + /// + /// Gets or Sets MerchantInfo + /// + [DataMember(Name = "merchantInfo", IsRequired = true, EmitDefaultValue = true)] + public MerchantInfo MerchantInfo { get; set; } + + /// + /// Gets or Sets VarConfiguration + /// + [DataMember(Name = "configuration", EmitDefaultValue = true)] + public CheckoutConfig VarConfiguration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InitiatePaymentSessionRequest {\n"); + sb.Append(" Transaction: ").Append(Transaction).Append("\n"); + sb.Append(" Logistics: ").Append(Logistics).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" PrefillCustomer: ").Append(PrefillCustomer).Append("\n"); + sb.Append(" MerchantInfo: ").Append(MerchantInfo).Append("\n"); + sb.Append(" VarConfiguration: ").Append(VarConfiguration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"PAYMENT", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/InitiateSessionRequestBase.cs b/src/Vipps.net.Models.Checkout/Model/InitiateSessionRequestBase.cs new file mode 100644 index 0000000..48d250d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/InitiateSessionRequestBase.cs @@ -0,0 +1,111 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// InitiateSessionRequestBase + /// + [DataContract(Name = "InitiateSessionRequestBase")] + public partial class InitiateSessionRequestBase : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InitiateSessionRequestBase() { } + /// + /// Initializes a new instance of the class. + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information.. + /// merchantInfo (required). + /// varConfiguration. + public InitiateSessionRequestBase(PrefillCustomer prefillCustomer = default(PrefillCustomer), MerchantInfo merchantInfo = default(MerchantInfo), CheckoutConfig varConfiguration = default(CheckoutConfig)) + { + // to ensure "merchantInfo" is required (not null) + if (merchantInfo == null) + { + throw new ArgumentNullException("merchantInfo is a required property for InitiateSessionRequestBase and cannot be null"); + } + this.MerchantInfo = merchantInfo; + this.PrefillCustomer = prefillCustomer; + this.VarConfiguration = varConfiguration; + } + + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + [DataMember(Name = "prefillCustomer", EmitDefaultValue = true)] + public PrefillCustomer PrefillCustomer { get; set; } + + /// + /// Gets or Sets MerchantInfo + /// + [DataMember(Name = "merchantInfo", IsRequired = true, EmitDefaultValue = true)] + public MerchantInfo MerchantInfo { get; set; } + + /// + /// Gets or Sets VarConfiguration + /// + [DataMember(Name = "configuration", EmitDefaultValue = true)] + public CheckoutConfig VarConfiguration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InitiateSessionRequestBase {\n"); + sb.Append(" PrefillCustomer: ").Append(PrefillCustomer).Append("\n"); + sb.Append(" MerchantInfo: ").Append(MerchantInfo).Append("\n"); + sb.Append(" VarConfiguration: ").Append(VarConfiguration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/InitiateSessionResponse.cs b/src/Vipps.net.Models.Checkout/Model/InitiateSessionResponse.cs new file mode 100644 index 0000000..c7e234d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/InitiateSessionResponse.cs @@ -0,0 +1,123 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Response from initiating a session. + /// + [DataContract(Name = "InitiateSessionResponse")] + public partial class InitiateSessionResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InitiateSessionResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The token to be provided to Checkout. Example: \"eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJUdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIiwic2Vzc2lvblBvbGxpbmdVUkwiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAvY2hlY2tvdXQvc2Vzc2lvbi9UdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIn0.ln7VzZkNvUGu0HhyA_a8IbXQN35WhDBmCYC9IvyYL-I\" (required). + /// The URL of the checkout frontend. Example: \"https://vippscheckout.vipps.no/v1/\". (required). + /// The URL to poll for session information. Example: \"https://api.vipps.no/checkout/v1/session/31gf1g413121\". (required). + public InitiateSessionResponse(string token = default(string), string checkoutFrontendUrl = default(string), string pollingUrl = default(string)) + { + // to ensure "token" is required (not null) + if (token == null) + { + throw new ArgumentNullException("token is a required property for InitiateSessionResponse and cannot be null"); + } + this.Token = token; + // to ensure "checkoutFrontendUrl" is required (not null) + if (checkoutFrontendUrl == null) + { + throw new ArgumentNullException("checkoutFrontendUrl is a required property for InitiateSessionResponse and cannot be null"); + } + this.CheckoutFrontendUrl = checkoutFrontendUrl; + // to ensure "pollingUrl" is required (not null) + if (pollingUrl == null) + { + throw new ArgumentNullException("pollingUrl is a required property for InitiateSessionResponse and cannot be null"); + } + this.PollingUrl = pollingUrl; + } + + /// + /// The token to be provided to Checkout. Example: \"eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJUdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIiwic2Vzc2lvblBvbGxpbmdVUkwiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAvY2hlY2tvdXQvc2Vzc2lvbi9UdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIn0.ln7VzZkNvUGu0HhyA_a8IbXQN35WhDBmCYC9IvyYL-I\" + /// + /// The token to be provided to Checkout. Example: \"eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJUdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIiwic2Vzc2lvblBvbGxpbmdVUkwiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAvY2hlY2tvdXQvc2Vzc2lvbi9UdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIn0.ln7VzZkNvUGu0HhyA_a8IbXQN35WhDBmCYC9IvyYL-I\" + [DataMember(Name = "token", IsRequired = true, EmitDefaultValue = true)] + public string Token { get; set; } + + /// + /// The URL of the checkout frontend. Example: \"https://vippscheckout.vipps.no/v1/\". + /// + /// The URL of the checkout frontend. Example: \"https://vippscheckout.vipps.no/v1/\". + [DataMember(Name = "checkoutFrontendUrl", IsRequired = true, EmitDefaultValue = true)] + public string CheckoutFrontendUrl { get; set; } + + /// + /// The URL to poll for session information. Example: \"https://api.vipps.no/checkout/v1/session/31gf1g413121\". + /// + /// The URL to poll for session information. Example: \"https://api.vipps.no/checkout/v1/session/31gf1g413121\". + [DataMember(Name = "pollingUrl", IsRequired = true, EmitDefaultValue = true)] + public string PollingUrl { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InitiateSessionResponse {\n"); + sb.Append(" Token: ").Append(Token).Append("\n"); + sb.Append(" CheckoutFrontendUrl: ").Append(CheckoutFrontendUrl).Append("\n"); + sb.Append(" PollingUrl: ").Append(PollingUrl).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/InitiateSubscriptionSessionRequest.cs b/src/Vipps.net.Models.Checkout/Model/InitiateSubscriptionSessionRequest.cs new file mode 100644 index 0000000..d514e6d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/InitiateSubscriptionSessionRequest.cs @@ -0,0 +1,169 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Request to set up a Recurring Checkout session + /// + [DataContract(Name = "InitiateSubscriptionSessionRequest")] + public partial class InitiateSubscriptionSessionRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InitiateSubscriptionSessionRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// Required when no Transaction is present. This is the merchant's unique reference to the Checkout Session (as well as the optional payment transaction). + /// Defines a one-time-payment. + /// Defines a subscription. Used for future payments. (required). + /// type (required) (default to "SUBSCRIPTION"). + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information.. + /// merchantInfo (required). + /// varConfiguration. + public InitiateSubscriptionSessionRequest(string reference = default(string), PaymentTransaction transaction = default(PaymentTransaction), Subscription subscription = default(Subscription), string type = @"SUBSCRIPTION", PrefillCustomer prefillCustomer = default(PrefillCustomer), MerchantInfo merchantInfo = default(MerchantInfo), CheckoutConfig varConfiguration = default(CheckoutConfig)) + { + // to ensure "subscription" is required (not null) + if (subscription == null) + { + throw new ArgumentNullException("subscription is a required property for InitiateSubscriptionSessionRequest and cannot be null"); + } + this.Subscription = subscription; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for InitiateSubscriptionSessionRequest and cannot be null"); + } + this.Type = type; + // to ensure "merchantInfo" is required (not null) + if (merchantInfo == null) + { + throw new ArgumentNullException("merchantInfo is a required property for InitiateSubscriptionSessionRequest and cannot be null"); + } + this.MerchantInfo = merchantInfo; + this.Reference = reference; + this.Transaction = transaction; + this.PrefillCustomer = prefillCustomer; + this.VarConfiguration = varConfiguration; + } + + /// + /// Required when no Transaction is present. This is the merchant's unique reference to the Checkout Session (as well as the optional payment transaction) + /// + /// Required when no Transaction is present. This is the merchant's unique reference to the Checkout Session (as well as the optional payment transaction) + [DataMember(Name = "reference", EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Defines a one-time-payment + /// + /// Defines a one-time-payment + [DataMember(Name = "transaction", EmitDefaultValue = true)] + public PaymentTransaction Transaction { get; set; } + + /// + /// Defines a subscription. Used for future payments. + /// + /// Defines a subscription. Used for future payments. + [DataMember(Name = "subscription", IsRequired = true, EmitDefaultValue = true)] + public Subscription Subscription { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + [DataMember(Name = "prefillCustomer", EmitDefaultValue = true)] + public PrefillCustomer PrefillCustomer { get; set; } + + /// + /// Gets or Sets MerchantInfo + /// + [DataMember(Name = "merchantInfo", IsRequired = true, EmitDefaultValue = true)] + public MerchantInfo MerchantInfo { get; set; } + + /// + /// Gets or Sets VarConfiguration + /// + [DataMember(Name = "configuration", EmitDefaultValue = true)] + public CheckoutConfig VarConfiguration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InitiateSubscriptionSessionRequest {\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" Transaction: ").Append(Transaction).Append("\n"); + sb.Append(" Subscription: ").Append(Subscription).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" PrefillCustomer: ").Append(PrefillCustomer).Append("\n"); + sb.Append(" MerchantInfo: ").Append(MerchantInfo).Append("\n"); + sb.Append(" VarConfiguration: ").Append(VarConfiguration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"SUBSCRIPTION", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Integrations.cs b/src/Vipps.net.Models.Checkout/Model/Integrations.cs new file mode 100644 index 0000000..7acbfb7 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Integrations.cs @@ -0,0 +1,93 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Integrations + /// + [DataContract(Name = "Integrations")] + public partial class Integrations : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Configuration required to enable Porterbuddy logistics options. + /// Configuration required to enable Helthjem logistics options. + public Integrations(Porterbuddy porterbuddy = default(Porterbuddy), Helthjem helthjem = default(Helthjem)) + { + this.Porterbuddy = porterbuddy; + this.Helthjem = helthjem; + } + + /// + /// Configuration required to enable Porterbuddy logistics options + /// + /// Configuration required to enable Porterbuddy logistics options + [DataMember(Name = "porterbuddy", EmitDefaultValue = true)] + public Porterbuddy Porterbuddy { get; set; } + + /// + /// Configuration required to enable Helthjem logistics options + /// + /// Configuration required to enable Helthjem logistics options + [DataMember(Name = "helthjem", EmitDefaultValue = true)] + public Helthjem Helthjem { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Integrations {\n"); + sb.Append(" Porterbuddy: ").Append(Porterbuddy).Append("\n"); + sb.Append(" Helthjem: ").Append(Helthjem).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Interval.cs b/src/Vipps.net.Models.Checkout/Model/Interval.cs new file mode 100644 index 0000000..ec74e7d --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Interval.cs @@ -0,0 +1,108 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Interval + /// + [DataContract(Name = "Interval")] + public partial class Interval : IValidatableObject + { + + /// + /// Gets or Sets Unit + /// + [DataMember(Name = "unit", IsRequired = true, EmitDefaultValue = true)] + public IntervalUnit Unit { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Interval() { } + /// + /// Initializes a new instance of the class. + /// + /// unit (required). + /// count (required). + public Interval(IntervalUnit unit = default(IntervalUnit), int count = default(int)) + { + this.Unit = unit; + this.Count = count; + } + + /// + /// Gets or Sets Count + /// + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Interval {\n"); + sb.Append(" Unit: ").Append(Unit).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Count (int) maximum + if (this.Count > (int)31) + { + yield return new ValidationResult("Invalid value for Count, must be a value less than or equal to 31.", new [] { "Count" }); + } + + // Count (int) minimum + if (this.Count < (int)1) + { + yield return new ValidationResult("Invalid value for Count, must be a value greater than or equal to 1.", new [] { "Count" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/IntervalUnit.cs b/src/Vipps.net.Models.Checkout/Model/IntervalUnit.cs new file mode 100644 index 0000000..1514b49 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/IntervalUnit.cs @@ -0,0 +1,59 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines IntervalUnit + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IntervalUnit + { + /// + /// Enum YEAR for value: YEAR + /// + [EnumMember(Value = "YEAR")] + YEAR = 1, + + /// + /// Enum MONTH for value: MONTH + /// + [EnumMember(Value = "MONTH")] + MONTH = 2, + + /// + /// Enum WEEK for value: WEEK + /// + [EnumMember(Value = "WEEK")] + WEEK = 3, + + /// + /// Enum DAY for value: DAY + /// + [EnumMember(Value = "DAY")] + DAY = 4 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Logistics.cs b/src/Vipps.net.Models.Checkout/Model/Logistics.cs new file mode 100644 index 0000000..c2915d1 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Logistics.cs @@ -0,0 +1,103 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// If both dynamic and fixed options are specified, dynamic options is provided to the user. If no DynamicOptionsCallback is provided, only fixed logistics options will be used. When using dynamic shipping we recommend that you define logistics.fixedOptions as a backup. If the callback does not resolve successfully within 8 seconds, returns null or an empty list the system will fall back to static options. If no fallback options are provided, the user will be presented with an error and will not be able to continue with the checkout. + /// + [DataContract(Name = "Logistics")] + public partial class Logistics : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Merchant's Callback URL for providing dynamic logistics options based on customer address. Example: \"https://example.com/vipps/dynamiclogisticsoption\". Can not be used with AddressFields set to false.. + /// Fixed list of logistics options.. + /// Some optional checkout features require carrier-specific configuration. Can not be used with AddressFields set to false.. + public Logistics(string dynamicOptionsCallback = default(string), List fixedOptions = default(List), Integrations integrations = default(Integrations)) + { + this.DynamicOptionsCallback = dynamicOptionsCallback; + this.FixedOptions = fixedOptions; + this.Integrations = integrations; + } + + /// + /// Merchant's Callback URL for providing dynamic logistics options based on customer address. Example: \"https://example.com/vipps/dynamiclogisticsoption\". Can not be used with AddressFields set to false. + /// + /// Merchant's Callback URL for providing dynamic logistics options based on customer address. Example: \"https://example.com/vipps/dynamiclogisticsoption\". Can not be used with AddressFields set to false. + [DataMember(Name = "dynamicOptionsCallback", EmitDefaultValue = true)] + public string DynamicOptionsCallback { get; set; } + + /// + /// Fixed list of logistics options. + /// + /// Fixed list of logistics options. + [DataMember(Name = "fixedOptions", EmitDefaultValue = true)] + public List FixedOptions { get; set; } + + /// + /// Some optional checkout features require carrier-specific configuration. Can not be used with AddressFields set to false. + /// + /// Some optional checkout features require carrier-specific configuration. Can not be used with AddressFields set to false. + [DataMember(Name = "integrations", EmitDefaultValue = true)] + public Integrations Integrations { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Logistics {\n"); + sb.Append(" DynamicOptionsCallback: ").Append(DynamicOptionsCallback).Append("\n"); + sb.Append(" FixedOptions: ").Append(FixedOptions).Append("\n"); + sb.Append(" Integrations: ").Append(Integrations).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/LogisticsOptionBase.cs b/src/Vipps.net.Models.Checkout/Model/LogisticsOptionBase.cs new file mode 100644 index 0000000..1b616dd --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/LogisticsOptionBase.cs @@ -0,0 +1,137 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// LogisticsOptionBase + /// + [DataContract(Name = "LogisticsOptionBase")] + public partial class LogisticsOptionBase : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected LogisticsOptionBase() { } + /// + /// Initializes a new instance of the class. + /// + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public LogisticsOptionBase(string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for LogisticsOptionBase and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Description = description; + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LogisticsOptionBase {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/MerchantAuthInfoHeaders.cs b/src/Vipps.net.Models.Checkout/Model/MerchantAuthInfoHeaders.cs new file mode 100644 index 0000000..e9f9615 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/MerchantAuthInfoHeaders.cs @@ -0,0 +1,162 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Headers required to retrieve an access token. + /// + [DataContract(Name = "MerchantAuthInfoHeaders")] + public partial class MerchantAuthInfoHeaders : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected MerchantAuthInfoHeaders() { } + /// + /// Initializes a new instance of the class. + /// + /// Client ID for the merchant (the \"username\"). See [API keys](/docs/knowledge-base/api-keys/). (required). + /// Client Secret for the merchant (the \"password\"). See [API keys](/docs/knowledge-base/api-keys/). (required). + /// Subscription key for the API product. See [API keys](/docs/knowledge-base/api-keys/). (required). + /// Assigned unique number for a merchant. See [API keys](/docs/knowledge-base/api-keys/). (required). + public MerchantAuthInfoHeaders(string clientId = default(string), string clientSecret = default(string), string ocpApimSubscriptionKey = default(string), string merchantSerialNumber = default(string)) + { + // to ensure "clientId" is required (not null) + if (clientId == null) + { + throw new ArgumentNullException("clientId is a required property for MerchantAuthInfoHeaders and cannot be null"); + } + this.ClientId = clientId; + // to ensure "clientSecret" is required (not null) + if (clientSecret == null) + { + throw new ArgumentNullException("clientSecret is a required property for MerchantAuthInfoHeaders and cannot be null"); + } + this.ClientSecret = clientSecret; + // to ensure "ocpApimSubscriptionKey" is required (not null) + if (ocpApimSubscriptionKey == null) + { + throw new ArgumentNullException("ocpApimSubscriptionKey is a required property for MerchantAuthInfoHeaders and cannot be null"); + } + this.OcpApimSubscriptionKey = ocpApimSubscriptionKey; + // to ensure "merchantSerialNumber" is required (not null) + if (merchantSerialNumber == null) + { + throw new ArgumentNullException("merchantSerialNumber is a required property for MerchantAuthInfoHeaders and cannot be null"); + } + this.MerchantSerialNumber = merchantSerialNumber; + } + + /// + /// Client ID for the merchant (the \"username\"). See [API keys](/docs/knowledge-base/api-keys/). + /// + /// Client ID for the merchant (the \"username\"). See [API keys](/docs/knowledge-base/api-keys/). + [DataMember(Name = "client_id", IsRequired = true, EmitDefaultValue = true)] + public string ClientId { get; set; } + + /// + /// Client Secret for the merchant (the \"password\"). See [API keys](/docs/knowledge-base/api-keys/). + /// + /// Client Secret for the merchant (the \"password\"). See [API keys](/docs/knowledge-base/api-keys/). + [DataMember(Name = "client_secret", IsRequired = true, EmitDefaultValue = true)] + public string ClientSecret { get; set; } + + /// + /// Subscription key for the API product. See [API keys](/docs/knowledge-base/api-keys/). + /// + /// Subscription key for the API product. See [API keys](/docs/knowledge-base/api-keys/). + [DataMember(Name = "ocp-Apim-Subscription-Key", IsRequired = true, EmitDefaultValue = true)] + public string OcpApimSubscriptionKey { get; set; } + + /// + /// Assigned unique number for a merchant. See [API keys](/docs/knowledge-base/api-keys/). + /// + /// Assigned unique number for a merchant. See [API keys](/docs/knowledge-base/api-keys/). + [DataMember(Name = "merchant-Serial-Number", IsRequired = true, EmitDefaultValue = true)] + public string MerchantSerialNumber { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MerchantAuthInfoHeaders {\n"); + sb.Append(" ClientId: ").Append(ClientId).Append("\n"); + sb.Append(" ClientSecret: ").Append(ClientSecret).Append("\n"); + sb.Append(" OcpApimSubscriptionKey: ").Append(OcpApimSubscriptionKey).Append("\n"); + sb.Append(" MerchantSerialNumber: ").Append(MerchantSerialNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ClientId (string) minLength + if (this.ClientId != null && this.ClientId.Length < 1) + { + yield return new ValidationResult("Invalid value for ClientId, length must be greater than 1.", new [] { "ClientId" }); + } + + // ClientSecret (string) minLength + if (this.ClientSecret != null && this.ClientSecret.Length < 1) + { + yield return new ValidationResult("Invalid value for ClientSecret, length must be greater than 1.", new [] { "ClientSecret" }); + } + + // OcpApimSubscriptionKey (string) minLength + if (this.OcpApimSubscriptionKey != null && this.OcpApimSubscriptionKey.Length < 1) + { + yield return new ValidationResult("Invalid value for OcpApimSubscriptionKey, length must be greater than 1.", new [] { "OcpApimSubscriptionKey" }); + } + + // MerchantSerialNumber (string) minLength + if (this.MerchantSerialNumber != null && this.MerchantSerialNumber.Length < 1) + { + yield return new ValidationResult("Invalid value for MerchantSerialNumber, length must be greater than 1.", new [] { "MerchantSerialNumber" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/MerchantInfo.cs b/src/Vipps.net.Models.Checkout/Model/MerchantInfo.cs new file mode 100644 index 0000000..f63c978 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/MerchantInfo.cs @@ -0,0 +1,139 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// MerchantInfo + /// + [DataContract(Name = "MerchantInfo")] + public partial class MerchantInfo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected MerchantInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// Complete URL for receiving callback after payment is completed. Example: \"https://exmaple.com/vipps/payment-callback/oS1d5f9abD (required). + /// Complete URL for redirecting customers to when the checkout is finished. Example: \"https://example.com/vipps\". (required). + /// The token will be supplied by the callback to the merchant as a header. Example: \"iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJ\". (required). + /// Complete URL to the merchant's terms and conditions. Example: \"https://example.com/vipps/termsAndConditions\".. + public MerchantInfo(string callbackUrl = default(string), string returnUrl = default(string), string callbackAuthorizationToken = default(string), string termsAndConditionsUrl = default(string)) + { + // to ensure "callbackUrl" is required (not null) + if (callbackUrl == null) + { + throw new ArgumentNullException("callbackUrl is a required property for MerchantInfo and cannot be null"); + } + this.CallbackUrl = callbackUrl; + // to ensure "returnUrl" is required (not null) + if (returnUrl == null) + { + throw new ArgumentNullException("returnUrl is a required property for MerchantInfo and cannot be null"); + } + this.ReturnUrl = returnUrl; + // to ensure "callbackAuthorizationToken" is required (not null) + if (callbackAuthorizationToken == null) + { + throw new ArgumentNullException("callbackAuthorizationToken is a required property for MerchantInfo and cannot be null"); + } + this.CallbackAuthorizationToken = callbackAuthorizationToken; + this.TermsAndConditionsUrl = termsAndConditionsUrl; + } + + /// + /// Complete URL for receiving callback after payment is completed. Example: \"https://exmaple.com/vipps/payment-callback/oS1d5f9abD + /// + /// Complete URL for receiving callback after payment is completed. Example: \"https://exmaple.com/vipps/payment-callback/oS1d5f9abD + [DataMember(Name = "callbackUrl", IsRequired = true, EmitDefaultValue = true)] + public string CallbackUrl { get; set; } + + /// + /// Complete URL for redirecting customers to when the checkout is finished. Example: \"https://example.com/vipps\". + /// + /// Complete URL for redirecting customers to when the checkout is finished. Example: \"https://example.com/vipps\". + [DataMember(Name = "returnUrl", IsRequired = true, EmitDefaultValue = true)] + public string ReturnUrl { get; set; } + + /// + /// The token will be supplied by the callback to the merchant as a header. Example: \"iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJ\". + /// + /// The token will be supplied by the callback to the merchant as a header. Example: \"iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJ\". + [DataMember(Name = "callbackAuthorizationToken", IsRequired = true, EmitDefaultValue = true)] + public string CallbackAuthorizationToken { get; set; } + + /// + /// Complete URL to the merchant's terms and conditions. Example: \"https://example.com/vipps/termsAndConditions\". + /// + /// Complete URL to the merchant's terms and conditions. Example: \"https://example.com/vipps/termsAndConditions\". + [DataMember(Name = "termsAndConditionsUrl", EmitDefaultValue = true)] + public string TermsAndConditionsUrl { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MerchantInfo {\n"); + sb.Append(" CallbackUrl: ").Append(CallbackUrl).Append("\n"); + sb.Append(" ReturnUrl: ").Append(ReturnUrl).Append("\n"); + sb.Append(" CallbackAuthorizationToken: ").Append(CallbackAuthorizationToken).Append("\n"); + sb.Append(" TermsAndConditionsUrl: ").Append(TermsAndConditionsUrl).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ReturnUrl (string) minLength + if (this.ReturnUrl != null && this.ReturnUrl.Length < 1) + { + yield return new ValidationResult("Invalid value for ReturnUrl, length must be greater than 1.", new [] { "ReturnUrl" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/MerchantLogisticsCallbackRequestBody.cs b/src/Vipps.net.Models.Checkout/Model/MerchantLogisticsCallbackRequestBody.cs new file mode 100644 index 0000000..0a8caea --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/MerchantLogisticsCallbackRequestBody.cs @@ -0,0 +1,138 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Information about the customer address used when retrieving dynamic logistics options. + /// + [DataContract(Name = "MerchantLogisticsCallbackRequestBody")] + public partial class MerchantLogisticsCallbackRequestBody : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected MerchantLogisticsCallbackRequestBody() { } + /// + /// Initializes a new instance of the class. + /// + /// Example: \"Robert Levins gate 5\" (required). + /// Example: \"0154\" (required). + /// Example: \"Oslo\" (required). + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" (required). + public MerchantLogisticsCallbackRequestBody(string streetAddress = default(string), string postalCode = default(string), string region = default(string), string country = default(string)) + { + // to ensure "streetAddress" is required (not null) + if (streetAddress == null) + { + throw new ArgumentNullException("streetAddress is a required property for MerchantLogisticsCallbackRequestBody and cannot be null"); + } + this.StreetAddress = streetAddress; + // to ensure "postalCode" is required (not null) + if (postalCode == null) + { + throw new ArgumentNullException("postalCode is a required property for MerchantLogisticsCallbackRequestBody and cannot be null"); + } + this.PostalCode = postalCode; + // to ensure "region" is required (not null) + if (region == null) + { + throw new ArgumentNullException("region is a required property for MerchantLogisticsCallbackRequestBody and cannot be null"); + } + this.Region = region; + // to ensure "country" is required (not null) + if (country == null) + { + throw new ArgumentNullException("country is a required property for MerchantLogisticsCallbackRequestBody and cannot be null"); + } + this.Country = country; + } + + /// + /// Example: \"Robert Levins gate 5\" + /// + /// Example: \"Robert Levins gate 5\" + [DataMember(Name = "streetAddress", IsRequired = true, EmitDefaultValue = true)] + public string StreetAddress { get; set; } + + /// + /// Example: \"0154\" + /// + /// Example: \"0154\" + [DataMember(Name = "postalCode", IsRequired = true, EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// Example: \"Oslo\" + /// + /// Example: \"Oslo\" + [DataMember(Name = "region", IsRequired = true, EmitDefaultValue = true)] + public string Region { get; set; } + + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + [DataMember(Name = "country", IsRequired = true, EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MerchantLogisticsCallbackRequestBody {\n"); + sb.Append(" StreetAddress: ").Append(StreetAddress).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" Region: ").Append(Region).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/OrderBottomLine.cs b/src/Vipps.net.Models.Checkout/Model/OrderBottomLine.cs new file mode 100644 index 0000000..a90dd37 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/OrderBottomLine.cs @@ -0,0 +1,154 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// OrderBottomLine + /// + [DataContract(Name = "OrderBottomLine")] + public partial class OrderBottomLine : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OrderBottomLine() { } + /// + /// Initializes a new instance of the class. + /// + /// The currency identifier according to ISO 4217. Example: \"NOK\". (required). + /// Tip amount for the order. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000.. + /// Amount paid by gift card or coupon. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000.. + /// Identifier of the terminal / point of sale.. + /// May be used to indicate that the payment comes from multiple sources. Example: giftcard + card. + /// receiptNumber. + public OrderBottomLine(string currency = default(string), long? tipAmount = default(long?), long? giftCardAmount = default(long?), string terminalId = default(string), PaymentSources paymentSources = default(PaymentSources), string receiptNumber = default(string)) + { + // to ensure "currency" is required (not null) + if (currency == null) + { + throw new ArgumentNullException("currency is a required property for OrderBottomLine and cannot be null"); + } + this.Currency = currency; + this.TipAmount = tipAmount; + this.GiftCardAmount = giftCardAmount; + this.TerminalId = terminalId; + this.PaymentSources = paymentSources; + this.ReceiptNumber = receiptNumber; + } + + /// + /// The currency identifier according to ISO 4217. Example: \"NOK\". + /// + /// The currency identifier according to ISO 4217. Example: \"NOK\". + [DataMember(Name = "currency", IsRequired = true, EmitDefaultValue = true)] + public string Currency { get; set; } + + /// + /// Tip amount for the order. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Tip amount for the order. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "tipAmount", EmitDefaultValue = true)] + public long? TipAmount { get; set; } + + /// + /// Amount paid by gift card or coupon. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Amount paid by gift card or coupon. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "giftCardAmount", EmitDefaultValue = true)] + public long? GiftCardAmount { get; set; } + + /// + /// Identifier of the terminal / point of sale. + /// + /// Identifier of the terminal / point of sale. + [DataMember(Name = "terminalId", EmitDefaultValue = true)] + public string TerminalId { get; set; } + + /// + /// May be used to indicate that the payment comes from multiple sources. Example: giftcard + card + /// + /// May be used to indicate that the payment comes from multiple sources. Example: giftcard + card + [DataMember(Name = "paymentSources", EmitDefaultValue = true)] + public PaymentSources PaymentSources { get; set; } + + /// + /// Gets or Sets ReceiptNumber + /// + [DataMember(Name = "receiptNumber", EmitDefaultValue = true)] + public string ReceiptNumber { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OrderBottomLine {\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" TipAmount: ").Append(TipAmount).Append("\n"); + sb.Append(" GiftCardAmount: ").Append(GiftCardAmount).Append("\n"); + sb.Append(" TerminalId: ").Append(TerminalId).Append("\n"); + sb.Append(" PaymentSources: ").Append(PaymentSources).Append("\n"); + sb.Append(" ReceiptNumber: ").Append(ReceiptNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Currency (string) maxLength + if (this.Currency != null && this.Currency.Length > 3) + { + yield return new ValidationResult("Invalid value for Currency, length must be less than 3.", new [] { "Currency" }); + } + + // Currency (string) minLength + if (this.Currency != null && this.Currency.Length < 3) + { + yield return new ValidationResult("Invalid value for Currency, length must be greater than 3.", new [] { "Currency" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/OrderLine.cs b/src/Vipps.net.Models.Checkout/Model/OrderLine.cs new file mode 100644 index 0000000..28ff844 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/OrderLine.cs @@ -0,0 +1,281 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// OrderLine + /// + [DataContract(Name = "OrderLine")] + public partial class OrderLine : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OrderLine() { } + /// + /// Initializes a new instance of the class. + /// + /// The name of the product in the order line. (required). + /// The product ID. (required). + /// Total amount of the order line, including tax and discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. (required). + /// Total amount of order line with discount excluding tax. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. (required). + /// Total tax amount paid for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. (required). + /// Use TaxRate property instead. + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 (required). + /// If no quantity info is provided the order line will default to 1 pcs.. + /// Total discount for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000.. + /// URL linking back to the product at the merchant.. + /// Flag for marking the orderline as returned. This will make it count negative towards all the sums in BottomLine.. + /// Flag for marking the orderline as a shipping line. This will be shown differently in the app.. + public OrderLine(string name = default(string), string id = default(string), long totalAmount = default(long), long totalAmountExcludingTax = default(long), long totalTaxAmount = default(long), int? taxPercentage = default(int?), int taxRate = default(int), OrderUnitInfo unitInfo = default(OrderUnitInfo), long? discount = default(long?), string productUrl = default(string), bool? isReturn = default(bool?), bool? isShipping = default(bool?)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for OrderLine and cannot be null"); + } + this.Name = name; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for OrderLine and cannot be null"); + } + this.Id = id; + this.TotalAmount = totalAmount; + this.TotalAmountExcludingTax = totalAmountExcludingTax; + this.TotalTaxAmount = totalTaxAmount; + this.TaxRate = taxRate; + this.TaxPercentage = taxPercentage; + this.UnitInfo = unitInfo; + this.Discount = discount; + this.ProductUrl = productUrl; + this.IsReturn = isReturn; + this.IsShipping = isShipping; + } + + /// + /// The name of the product in the order line. + /// + /// The name of the product in the order line. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// The product ID. + /// + /// The product ID. + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Total amount of the order line, including tax and discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Total amount of the order line, including tax and discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "totalAmount", IsRequired = true, EmitDefaultValue = true)] + public long TotalAmount { get; set; } + + /// + /// Total amount of order line with discount excluding tax. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Total amount of order line with discount excluding tax. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "totalAmountExcludingTax", IsRequired = true, EmitDefaultValue = true)] + public long TotalAmountExcludingTax { get; set; } + + /// + /// Total tax amount paid for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Total tax amount paid for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "totalTaxAmount", IsRequired = true, EmitDefaultValue = true)] + public long TotalTaxAmount { get; set; } + + /// + /// Use TaxRate property instead + /// + /// Use TaxRate property instead + [DataMember(Name = "taxPercentage", EmitDefaultValue = true)] + [Obsolete] + public int? TaxPercentage { get; set; } + + /// + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", IsRequired = true, EmitDefaultValue = true)] + public int TaxRate { get; set; } + + /// + /// If no quantity info is provided the order line will default to 1 pcs. + /// + /// If no quantity info is provided the order line will default to 1 pcs. + [DataMember(Name = "unitInfo", EmitDefaultValue = true)] + public OrderUnitInfo UnitInfo { get; set; } + + /// + /// Total discount for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Total discount for the order line. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "discount", EmitDefaultValue = true)] + public long? Discount { get; set; } + + /// + /// URL linking back to the product at the merchant. + /// + /// URL linking back to the product at the merchant. + [DataMember(Name = "productUrl", EmitDefaultValue = true)] + public string ProductUrl { get; set; } + + /// + /// Flag for marking the orderline as returned. This will make it count negative towards all the sums in BottomLine. + /// + /// Flag for marking the orderline as returned. This will make it count negative towards all the sums in BottomLine. + [DataMember(Name = "isReturn", EmitDefaultValue = true)] + public bool? IsReturn { get; set; } + + /// + /// Flag for marking the orderline as a shipping line. This will be shown differently in the app. + /// + /// Flag for marking the orderline as a shipping line. This will be shown differently in the app. + [DataMember(Name = "isShipping", EmitDefaultValue = true)] + public bool? IsShipping { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OrderLine {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" TotalAmount: ").Append(TotalAmount).Append("\n"); + sb.Append(" TotalAmountExcludingTax: ").Append(TotalAmountExcludingTax).Append("\n"); + sb.Append(" TotalTaxAmount: ").Append(TotalTaxAmount).Append("\n"); + sb.Append(" TaxPercentage: ").Append(TaxPercentage).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" UnitInfo: ").Append(UnitInfo).Append("\n"); + sb.Append(" Discount: ").Append(Discount).Append("\n"); + sb.Append(" ProductUrl: ").Append(ProductUrl).Append("\n"); + sb.Append(" IsReturn: ").Append(IsReturn).Append("\n"); + sb.Append(" IsShipping: ").Append(IsShipping).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Name (string) maxLength + if (this.Name != null && this.Name.Length > 2048) + { + yield return new ValidationResult("Invalid value for Name, length must be less than 2048.", new [] { "Name" }); + } + + // Name (string) minLength + if (this.Name != null && this.Name.Length < 1) + { + yield return new ValidationResult("Invalid value for Name, length must be greater than 1.", new [] { "Name" }); + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 255) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 255.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // TotalAmount (long) minimum + if (this.TotalAmount < (long)0) + { + yield return new ValidationResult("Invalid value for TotalAmount, must be a value greater than or equal to 0.", new [] { "TotalAmount" }); + } + + // TotalAmountExcludingTax (long) minimum + if (this.TotalAmountExcludingTax < (long)0) + { + yield return new ValidationResult("Invalid value for TotalAmountExcludingTax, must be a value greater than or equal to 0.", new [] { "TotalAmountExcludingTax" }); + } + + // TotalTaxAmount (long) minimum + if (this.TotalTaxAmount < (long)0) + { + yield return new ValidationResult("Invalid value for TotalTaxAmount, must be a value greater than or equal to 0.", new [] { "TotalTaxAmount" }); + } + + // TaxPercentage (int?) maximum + if (this.TaxPercentage > (int?)100) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value less than or equal to 100.", new [] { "TaxPercentage" }); + } + + // TaxPercentage (int?) minimum + if (this.TaxPercentage < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value greater than or equal to 0.", new [] { "TaxPercentage" }); + } + + // TaxRate (int) maximum + if (this.TaxRate > (int)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int) minimum + if (this.TaxRate < (int)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + // Discount (long?) minimum + if (this.Discount < (long?)0) + { + yield return new ValidationResult("Invalid value for Discount, must be a value greater than or equal to 0.", new [] { "Discount" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/OrderSummary.cs b/src/Vipps.net.Models.Checkout/Model/OrderSummary.cs new file mode 100644 index 0000000..618a9e3 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/OrderSummary.cs @@ -0,0 +1,108 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// OrderSummary + /// + [DataContract(Name = "OrderSummary")] + public partial class OrderSummary : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OrderSummary() { } + /// + /// Initializes a new instance of the class. + /// + /// The order lines contain descriptions of each item present in the order. (required). + /// Contains information regarding the order as a whole. (required). + public OrderSummary(List orderLines = default(List), OrderBottomLine orderBottomLine = default(OrderBottomLine)) + { + // to ensure "orderLines" is required (not null) + if (orderLines == null) + { + throw new ArgumentNullException("orderLines is a required property for OrderSummary and cannot be null"); + } + this.OrderLines = orderLines; + // to ensure "orderBottomLine" is required (not null) + if (orderBottomLine == null) + { + throw new ArgumentNullException("orderBottomLine is a required property for OrderSummary and cannot be null"); + } + this.OrderBottomLine = orderBottomLine; + } + + /// + /// The order lines contain descriptions of each item present in the order. + /// + /// The order lines contain descriptions of each item present in the order. + [DataMember(Name = "orderLines", IsRequired = true, EmitDefaultValue = true)] + public List OrderLines { get; set; } + + /// + /// Contains information regarding the order as a whole. + /// + /// Contains information regarding the order as a whole. + [DataMember(Name = "orderBottomLine", IsRequired = true, EmitDefaultValue = true)] + public OrderBottomLine OrderBottomLine { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OrderSummary {\n"); + sb.Append(" OrderLines: ").Append(OrderLines).Append("\n"); + sb.Append(" OrderBottomLine: ").Append(OrderBottomLine).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/OrderUnitInfo.cs b/src/Vipps.net.Models.Checkout/Model/OrderUnitInfo.cs new file mode 100644 index 0000000..bd05683 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/OrderUnitInfo.cs @@ -0,0 +1,119 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// OrderUnitInfo + /// + [DataContract(Name = "OrderUnitInfo")] + public partial class OrderUnitInfo : IValidatableObject + { + + /// + /// Available units for quantity. Will default to PCS if not set. + /// + /// Available units for quantity. Will default to PCS if not set. + [DataMember(Name = "quantityUnit", IsRequired = true, EmitDefaultValue = true)] + public QuantityUnit QuantityUnit { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OrderUnitInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// Total price per unit, including tax and excluding discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. (required). + /// Quantity given as a integer or fraction (only for cosmetics). (required). + /// Available units for quantity. Will default to PCS if not set. (required). + public OrderUnitInfo(long unitPrice = default(long), string quantity = default(string), QuantityUnit quantityUnit = default(QuantityUnit)) + { + this.UnitPrice = unitPrice; + // to ensure "quantity" is required (not null) + if (quantity == null) + { + throw new ArgumentNullException("quantity is a required property for OrderUnitInfo and cannot be null"); + } + this.Quantity = quantity; + this.QuantityUnit = quantityUnit; + } + + /// + /// Total price per unit, including tax and excluding discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + /// + /// Total price per unit, including tax and excluding discount. Must be in minor units. The smallest unit of a currency. Example 100 NOK = 10000. + [DataMember(Name = "unitPrice", IsRequired = true, EmitDefaultValue = true)] + public long UnitPrice { get; set; } + + /// + /// Quantity given as a integer or fraction (only for cosmetics). + /// + /// Quantity given as a integer or fraction (only for cosmetics). + [DataMember(Name = "quantity", IsRequired = true, EmitDefaultValue = true)] + public string Quantity { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OrderUnitInfo {\n"); + sb.Append(" UnitPrice: ").Append(UnitPrice).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" QuantityUnit: ").Append(QuantityUnit).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UnitPrice (long) minimum + if (this.UnitPrice < (long)0) + { + yield return new ValidationResult("Invalid value for UnitPrice, must be a value greater than or equal to 0.", new [] { "UnitPrice" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/OtherLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/OtherLogisticsOption.cs new file mode 100644 index 0000000..160cd4c --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/OtherLogisticsOption.cs @@ -0,0 +1,223 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// OtherLogisticsOption + /// + [DataContract(Name = "OtherLogisticsOption")] + public partial class OtherLogisticsOption : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OtherLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// title (required). + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "OTHER"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public OtherLogisticsOption(string title = default(string), Amount amount = default(Amount), int? taxRate = default(int?), string brand = @"OTHER", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "title" is required (not null) + if (title == null) + { + throw new ArgumentNullException("title is a required property for OtherLogisticsOption and cannot be null"); + } + this.Title = title; + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for OtherLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for OtherLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for OtherLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Gets or Sets Title + /// + [DataMember(Name = "title", IsRequired = true, EmitDefaultValue = true)] + public string Title { get; set; } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OtherLogisticsOption {\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Title (string) maxLength + if (this.Title != null && this.Title.Length > 200) + { + yield return new ValidationResult("Invalid value for Title, length must be less than 200.", new [] { "Title" }); + } + + // Title (string) minLength + if (this.Title != null && this.Title.Length < 1) + { + yield return new ValidationResult("Invalid value for Title, length must be greater than 1.", new [] { "Title" }); + } + + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"OTHER", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PaymentMethod.cs b/src/Vipps.net.Models.Checkout/Model/PaymentMethod.cs new file mode 100644 index 0000000..beeaa95 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PaymentMethod.cs @@ -0,0 +1,59 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PaymentMethod + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PaymentMethod + { + /// + /// Enum Wallet for value: Wallet + /// + [EnumMember(Value = "Wallet")] + Wallet = 1, + + /// + /// Enum Card for value: Card + /// + [EnumMember(Value = "Card")] + Card = 2, + + /// + /// Enum BankTransfer for value: BankTransfer + /// + [EnumMember(Value = "BankTransfer")] + BankTransfer = 3, + + /// + /// Enum Klarna for value: Klarna + /// + [EnumMember(Value = "Klarna")] + Klarna = 4 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PaymentSources.cs b/src/Vipps.net.Models.Checkout/Model/PaymentSources.cs new file mode 100644 index 0000000..cbcd154 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PaymentSources.cs @@ -0,0 +1,113 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PaymentSources + /// + [DataContract(Name = "PaymentSources")] + public partial class PaymentSources : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Amount from gift card. + /// Amount from card. + /// Amount from voucher. + /// Amount from cash. + public PaymentSources(long? giftCard = default(long?), long? card = default(long?), long? voucher = default(long?), long? cash = default(long?)) + { + this.GiftCard = giftCard; + this.Card = card; + this.Voucher = voucher; + this.Cash = cash; + } + + /// + /// Amount from gift card + /// + /// Amount from gift card + [DataMember(Name = "giftCard", EmitDefaultValue = true)] + public long? GiftCard { get; set; } + + /// + /// Amount from card + /// + /// Amount from card + [DataMember(Name = "card", EmitDefaultValue = true)] + public long? Card { get; set; } + + /// + /// Amount from voucher + /// + /// Amount from voucher + [DataMember(Name = "voucher", EmitDefaultValue = true)] + public long? Voucher { get; set; } + + /// + /// Amount from cash + /// + /// Amount from cash + [DataMember(Name = "cash", EmitDefaultValue = true)] + public long? Cash { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentSources {\n"); + sb.Append(" GiftCard: ").Append(GiftCard).Append("\n"); + sb.Append(" Card: ").Append(Card).Append("\n"); + sb.Append(" Voucher: ").Append(Voucher).Append("\n"); + sb.Append(" Cash: ").Append(Cash).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PaymentState.cs b/src/Vipps.net.Models.Checkout/Model/PaymentState.cs new file mode 100644 index 0000000..708113a --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PaymentState.cs @@ -0,0 +1,53 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PaymentState + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PaymentState + { + /// + /// Enum CREATED for value: CREATED + /// + [EnumMember(Value = "CREATED")] + CREATED = 1, + + /// + /// Enum AUTHORIZED for value: AUTHORIZED + /// + [EnumMember(Value = "AUTHORIZED")] + AUTHORIZED = 2, + + /// + /// Enum TERMINATED for value: TERMINATED + /// + [EnumMember(Value = "TERMINATED")] + TERMINATED = 3 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PaymentTransaction.cs b/src/Vipps.net.Models.Checkout/Model/PaymentTransaction.cs new file mode 100644 index 0000000..25e0c66 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PaymentTransaction.cs @@ -0,0 +1,165 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PaymentTransaction + /// + [DataContract(Name = "PaymentTransaction")] + public partial class PaymentTransaction : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentTransaction() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ (required). + /// Description visible to the customer during payment. Example: \"One pair of socks\". (required). + /// Contain descriptions of each item present in the order, and an order bottom line for information regarding the order as a whole.. + public PaymentTransaction(Amount amount = default(Amount), string reference = default(string), string paymentDescription = default(string), OrderSummary orderSummary = default(OrderSummary)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for PaymentTransaction and cannot be null"); + } + this.Amount = amount; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for PaymentTransaction and cannot be null"); + } + this.Reference = reference; + // to ensure "paymentDescription" is required (not null) + if (paymentDescription == null) + { + throw new ArgumentNullException("paymentDescription is a required property for PaymentTransaction and cannot be null"); + } + this.PaymentDescription = paymentDescription; + this.OrderSummary = orderSummary; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ + /// + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Description visible to the customer during payment. Example: \"One pair of socks\". + /// + /// Description visible to the customer during payment. Example: \"One pair of socks\". + [DataMember(Name = "paymentDescription", IsRequired = true, EmitDefaultValue = true)] + public string PaymentDescription { get; set; } + + /// + /// Contain descriptions of each item present in the order, and an order bottom line for information regarding the order as a whole. + /// + /// Contain descriptions of each item present in the order, and an order bottom line for information regarding the order as a whole. + [DataMember(Name = "orderSummary", EmitDefaultValue = true)] + public OrderSummary OrderSummary { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentTransaction {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" PaymentDescription: ").Append(PaymentDescription).Append("\n"); + sb.Append(" OrderSummary: ").Append(OrderSummary).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[-a-zA-Z0-9]*$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + // PaymentDescription (string) maxLength + if (this.PaymentDescription != null && this.PaymentDescription.Length > 100) + { + yield return new ValidationResult("Invalid value for PaymentDescription, length must be less than 100.", new [] { "PaymentDescription" }); + } + + // PaymentDescription (string) minLength + if (this.PaymentDescription != null && this.PaymentDescription.Length < 3) + { + yield return new ValidationResult("Invalid value for PaymentDescription, length must be greater than 3.", new [] { "PaymentDescription" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PeriodSubscriptionCampaign.cs b/src/Vipps.net.Models.Checkout/Model/PeriodSubscriptionCampaign.cs new file mode 100644 index 0000000..6650c77 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PeriodSubscriptionCampaign.cs @@ -0,0 +1,130 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PeriodSubscriptionCampaign + /// + [DataContract(Name = "PeriodSubscriptionCampaign")] + public partial class PeriodSubscriptionCampaign : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PeriodSubscriptionCampaign() { } + /// + /// Initializes a new instance of the class. + /// + /// period (required). + /// type (required) (default to "PERIOD_CAMPAIGN"). + /// price (required). + public PeriodSubscriptionCampaign(Interval period = default(Interval), string type = @"PERIOD_CAMPAIGN", int price = default(int)) + { + // to ensure "period" is required (not null) + if (period == null) + { + throw new ArgumentNullException("period is a required property for PeriodSubscriptionCampaign and cannot be null"); + } + this.Period = period; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for PeriodSubscriptionCampaign and cannot be null"); + } + this.Type = type; + this.Price = price; + } + + /// + /// Gets or Sets Period + /// + [DataMember(Name = "period", IsRequired = true, EmitDefaultValue = true)] + public Interval Period { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Gets or Sets Price + /// + [DataMember(Name = "price", IsRequired = true, EmitDefaultValue = true)] + public int Price { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PeriodSubscriptionCampaign {\n"); + sb.Append(" Period: ").Append(Period).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Price: ").Append(Price).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"PERIOD_CAMPAIGN", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + // Price (int) minimum + if (this.Price < (int)0) + { + yield return new ValidationResult("Invalid value for Price, must be a value greater than or equal to 0.", new [] { "Price" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PickupPoint.cs b/src/Vipps.net.Models.Checkout/Model/PickupPoint.cs new file mode 100644 index 0000000..3834665 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PickupPoint.cs @@ -0,0 +1,178 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// The pickup point the customer selected . + /// + [DataContract(Name = "PickupPoint")] + public partial class PickupPoint : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PickupPoint() { } + /// + /// Initializes a new instance of the class. + /// + /// Pickup point id provided by the carrier. Example: 121648 (required). + /// Pickup point name. Example: Extra Eiganes (required). + /// Pickup point's street address. Example: VITAMINVEIEN 7 (required). + /// Pickup point's postal code. Example: 0485 (required). + /// Pickup point's city. Example: OSLO (required). + /// Pickup point's country. Example: NO (required). + /// Pickup point's opening hours. Example: Man-Søn: 1000-2000. + public PickupPoint(string id = default(string), string name = default(string), string address = default(string), string postalCode = default(string), string city = default(string), string country = default(string), List openingHours = default(List)) + { + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for PickupPoint and cannot be null"); + } + this.Id = id; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for PickupPoint and cannot be null"); + } + this.Name = name; + // to ensure "address" is required (not null) + if (address == null) + { + throw new ArgumentNullException("address is a required property for PickupPoint and cannot be null"); + } + this.Address = address; + // to ensure "postalCode" is required (not null) + if (postalCode == null) + { + throw new ArgumentNullException("postalCode is a required property for PickupPoint and cannot be null"); + } + this.PostalCode = postalCode; + // to ensure "city" is required (not null) + if (city == null) + { + throw new ArgumentNullException("city is a required property for PickupPoint and cannot be null"); + } + this.City = city; + // to ensure "country" is required (not null) + if (country == null) + { + throw new ArgumentNullException("country is a required property for PickupPoint and cannot be null"); + } + this.Country = country; + this.OpeningHours = openingHours; + } + + /// + /// Pickup point id provided by the carrier. Example: 121648 + /// + /// Pickup point id provided by the carrier. Example: 121648 + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Pickup point name. Example: Extra Eiganes + /// + /// Pickup point name. Example: Extra Eiganes + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Pickup point's street address. Example: VITAMINVEIEN 7 + /// + /// Pickup point's street address. Example: VITAMINVEIEN 7 + [DataMember(Name = "address", IsRequired = true, EmitDefaultValue = true)] + public string Address { get; set; } + + /// + /// Pickup point's postal code. Example: 0485 + /// + /// Pickup point's postal code. Example: 0485 + [DataMember(Name = "postalCode", IsRequired = true, EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// Pickup point's city. Example: OSLO + /// + /// Pickup point's city. Example: OSLO + [DataMember(Name = "city", IsRequired = true, EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// Pickup point's country. Example: NO + /// + /// Pickup point's country. Example: NO + [DataMember(Name = "country", IsRequired = true, EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Pickup point's opening hours. Example: Man-Søn: 1000-2000 + /// + /// Pickup point's opening hours. Example: Man-Søn: 1000-2000 + [DataMember(Name = "openingHours", EmitDefaultValue = true)] + public List OpeningHours { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PickupPoint {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Address: ").Append(Address).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" OpeningHours: ").Append(OpeningHours).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Porterbuddy.cs b/src/Vipps.net.Models.Checkout/Model/Porterbuddy.cs new file mode 100644 index 0000000..f747f41 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Porterbuddy.cs @@ -0,0 +1,129 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Configuration required to enable Porterbuddy logistics options + /// + [DataContract(Name = "Porterbuddy")] + public partial class Porterbuddy : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Porterbuddy() { } + /// + /// Initializes a new instance of the class. + /// + /// The public key provided to you by Porterbuddy (required). + /// The API key provided to you by Porterbuddy (required). + /// Information about the sender (required). + public Porterbuddy(string publicToken = default(string), string apiKey = default(string), PorterbuddyOrigin origin = default(PorterbuddyOrigin)) + { + // to ensure "publicToken" is required (not null) + if (publicToken == null) + { + throw new ArgumentNullException("publicToken is a required property for Porterbuddy and cannot be null"); + } + this.PublicToken = publicToken; + // to ensure "apiKey" is required (not null) + if (apiKey == null) + { + throw new ArgumentNullException("apiKey is a required property for Porterbuddy and cannot be null"); + } + this.ApiKey = apiKey; + // to ensure "origin" is required (not null) + if (origin == null) + { + throw new ArgumentNullException("origin is a required property for Porterbuddy and cannot be null"); + } + this.Origin = origin; + } + + /// + /// The public key provided to you by Porterbuddy + /// + /// The public key provided to you by Porterbuddy + [DataMember(Name = "publicToken", IsRequired = true, EmitDefaultValue = true)] + public string PublicToken { get; set; } + + /// + /// The API key provided to you by Porterbuddy + /// + /// The API key provided to you by Porterbuddy + [DataMember(Name = "apiKey", IsRequired = true, EmitDefaultValue = true)] + public string ApiKey { get; set; } + + /// + /// Information about the sender + /// + /// Information about the sender + [DataMember(Name = "origin", IsRequired = true, EmitDefaultValue = true)] + public PorterbuddyOrigin Origin { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Porterbuddy {\n"); + sb.Append(" PublicToken: ").Append(PublicToken).Append("\n"); + sb.Append(" ApiKey: ").Append(ApiKey).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ApiKey (string) minLength + if (this.ApiKey != null && this.ApiKey.Length < 1) + { + yield return new ValidationResult("Invalid value for ApiKey, length must be greater than 1.", new [] { "ApiKey" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsOption.cs new file mode 100644 index 0000000..890b5df --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsOption.cs @@ -0,0 +1,210 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PorterbuddyLogisticsOption + /// + [DataContract(Name = "PorterbuddyLogisticsOption")] + public partial class PorterbuddyLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public PorterbuddyLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PorterbuddyLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050.. + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "PORTERBUDDY"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public PorterbuddyLogisticsOption(Amount amount = default(Amount), PorterbuddyLogisticsType? type = default(PorterbuddyLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"PORTERBUDDY", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for PorterbuddyLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for PorterbuddyLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Amount = amount; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PorterbuddyLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"PORTERBUDDY", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsType.cs new file mode 100644 index 0000000..a47996b --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PorterbuddyLogisticsType.cs @@ -0,0 +1,41 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PorterbuddyLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PorterbuddyLogisticsType + { + /// + /// Enum HOMEDELIVERY for value: HOME_DELIVERY + /// + [EnumMember(Value = "HOME_DELIVERY")] + HOMEDELIVERY = 1 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PorterbuddyOrigin.cs b/src/Vipps.net.Models.Checkout/Model/PorterbuddyOrigin.cs new file mode 100644 index 0000000..e256147 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PorterbuddyOrigin.cs @@ -0,0 +1,138 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Details about the sender of the Porterbuddy parcels + /// + [DataContract(Name = "PorterbuddyOrigin")] + public partial class PorterbuddyOrigin : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PorterbuddyOrigin() { } + /// + /// Initializes a new instance of the class. + /// + /// The name of your store (required). + /// Your email address where Porterbuddy booking confirmation will be sent (required). + /// Your phone number where Porterbuddy may send you important messages. Format must be MSISDN (including country code). Example: \"4712345678\" (required). + /// Your address where Porterbuddy will pick up the parcels (required). + public PorterbuddyOrigin(string name = default(string), string email = default(string), string phoneNumber = default(string), PorterbuddyOriginAddress address = default(PorterbuddyOriginAddress)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for PorterbuddyOrigin and cannot be null"); + } + this.Name = name; + // to ensure "email" is required (not null) + if (email == null) + { + throw new ArgumentNullException("email is a required property for PorterbuddyOrigin and cannot be null"); + } + this.Email = email; + // to ensure "phoneNumber" is required (not null) + if (phoneNumber == null) + { + throw new ArgumentNullException("phoneNumber is a required property for PorterbuddyOrigin and cannot be null"); + } + this.PhoneNumber = phoneNumber; + // to ensure "address" is required (not null) + if (address == null) + { + throw new ArgumentNullException("address is a required property for PorterbuddyOrigin and cannot be null"); + } + this.Address = address; + } + + /// + /// The name of your store + /// + /// The name of your store + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Your email address where Porterbuddy booking confirmation will be sent + /// + /// Your email address where Porterbuddy booking confirmation will be sent + [DataMember(Name = "email", IsRequired = true, EmitDefaultValue = true)] + public string Email { get; set; } + + /// + /// Your phone number where Porterbuddy may send you important messages. Format must be MSISDN (including country code). Example: \"4712345678\" + /// + /// Your phone number where Porterbuddy may send you important messages. Format must be MSISDN (including country code). Example: \"4712345678\" + [DataMember(Name = "phoneNumber", IsRequired = true, EmitDefaultValue = true)] + public string PhoneNumber { get; set; } + + /// + /// Your address where Porterbuddy will pick up the parcels + /// + /// Your address where Porterbuddy will pick up the parcels + [DataMember(Name = "address", IsRequired = true, EmitDefaultValue = true)] + public PorterbuddyOriginAddress Address { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PorterbuddyOrigin {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" PhoneNumber: ").Append(PhoneNumber).Append("\n"); + sb.Append(" Address: ").Append(Address).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PorterbuddyOriginAddress.cs b/src/Vipps.net.Models.Checkout/Model/PorterbuddyOriginAddress.cs new file mode 100644 index 0000000..9b023bb --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PorterbuddyOriginAddress.cs @@ -0,0 +1,138 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PorterbuddyOriginAddress + /// + [DataContract(Name = "PorterbuddyOriginAddress")] + public partial class PorterbuddyOriginAddress : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PorterbuddyOriginAddress() { } + /// + /// Initializes a new instance of the class. + /// + /// Example: \"Robert Levins gate 5\" (required). + /// Example: \"0154\" (required). + /// Example: \"Oslo\" (required). + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" (required). + public PorterbuddyOriginAddress(string streetAddress = default(string), string postalCode = default(string), string city = default(string), string country = default(string)) + { + // to ensure "streetAddress" is required (not null) + if (streetAddress == null) + { + throw new ArgumentNullException("streetAddress is a required property for PorterbuddyOriginAddress and cannot be null"); + } + this.StreetAddress = streetAddress; + // to ensure "postalCode" is required (not null) + if (postalCode == null) + { + throw new ArgumentNullException("postalCode is a required property for PorterbuddyOriginAddress and cannot be null"); + } + this.PostalCode = postalCode; + // to ensure "city" is required (not null) + if (city == null) + { + throw new ArgumentNullException("city is a required property for PorterbuddyOriginAddress and cannot be null"); + } + this.City = city; + // to ensure "country" is required (not null) + if (country == null) + { + throw new ArgumentNullException("country is a required property for PorterbuddyOriginAddress and cannot be null"); + } + this.Country = country; + } + + /// + /// Example: \"Robert Levins gate 5\" + /// + /// Example: \"Robert Levins gate 5\" + [DataMember(Name = "streetAddress", IsRequired = true, EmitDefaultValue = true)] + public string StreetAddress { get; set; } + + /// + /// Example: \"0154\" + /// + /// Example: \"0154\" + [DataMember(Name = "postalCode", IsRequired = true, EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// Example: \"Oslo\" + /// + /// Example: \"Oslo\" + [DataMember(Name = "city", IsRequired = true, EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + [DataMember(Name = "country", IsRequired = true, EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PorterbuddyOriginAddress {\n"); + sb.Append(" StreetAddress: ").Append(StreetAddress).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostenLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/PostenLogisticsOption.cs new file mode 100644 index 0000000..5d71aac --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostenLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PostenLogisticsOption + /// + [DataContract(Name = "PostenLogisticsOption")] + public partial class PostenLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public PostenLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostenLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "POSTEN"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public PostenLogisticsOption(Amount amount = default(Amount), PostenLogisticsType? type = default(PostenLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"POSTEN", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for PostenLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for PostenLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for PostenLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PostenLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"POSTEN", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostenLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/PostenLogisticsType.cs new file mode 100644 index 0000000..cbf7fcc --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostenLogisticsType.cs @@ -0,0 +1,53 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PostenLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PostenLogisticsType + { + /// + /// Enum MAILBOX for value: MAILBOX + /// + [EnumMember(Value = "MAILBOX")] + MAILBOX = 1, + + /// + /// Enum PICKUPPOINT for value: PICKUP_POINT + /// + [EnumMember(Value = "PICKUP_POINT")] + PICKUPPOINT = 2, + + /// + /// Enum HOMEDELIVERY for value: HOME_DELIVERY + /// + [EnumMember(Value = "HOME_DELIVERY")] + HOMEDELIVERY = 3 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostiLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/PostiLogisticsOption.cs new file mode 100644 index 0000000..4617743 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostiLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PostiLogisticsOption + /// + [DataContract(Name = "PostiLogisticsOption")] + public partial class PostiLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public PostiLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostiLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "POSTI"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public PostiLogisticsOption(Amount amount = default(Amount), PostiLogisticsType? type = default(PostiLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"POSTI", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for PostiLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for PostiLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for PostiLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PostiLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"POSTI", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostiLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/PostiLogisticsType.cs new file mode 100644 index 0000000..500a4f6 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostiLogisticsType.cs @@ -0,0 +1,47 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PostiLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PostiLogisticsType + { + /// + /// Enum MAILBOX for value: MAILBOX + /// + [EnumMember(Value = "MAILBOX")] + MAILBOX = 1, + + /// + /// Enum PICKUPPOINT for value: PICKUP_POINT + /// + [EnumMember(Value = "PICKUP_POINT")] + PICKUPPOINT = 2 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsOption.cs b/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsOption.cs new file mode 100644 index 0000000..58d0459 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsOption.cs @@ -0,0 +1,215 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PostnordLogisticsOption + /// + [DataContract(Name = "PostnordLogisticsOption")] + public partial class PostnordLogisticsOption : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = true)] + public PostnordLogisticsType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostnordLogisticsOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. (required). + /// type. + /// customType. + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. + /// brand (required) (default to "POSTNORD"). + /// id (required). + /// priority (required). + /// isDefault (required). + /// description. + public PostnordLogisticsOption(Amount amount = default(Amount), PostnordLogisticsType? type = default(PostnordLogisticsType?), string customType = default(string), int? taxRate = default(int?), string brand = @"POSTNORD", string id = default(string), int priority = default(int), bool isDefault = default(bool), string description = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for PostnordLogisticsOption and cannot be null"); + } + this.Amount = amount; + // to ensure "brand" is required (not null) + if (brand == null) + { + throw new ArgumentNullException("brand is a required property for PostnordLogisticsOption and cannot be null"); + } + this.Brand = brand; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for PostnordLogisticsOption and cannot be null"); + } + this.Id = id; + this.Priority = priority; + this.IsDefault = isDefault; + this.Type = type; + this.CustomType = customType; + this.TaxRate = taxRate; + this.Description = description; + } + + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + /// + /// Amounts are specified in minor units. For example: 10.00 NOK should be written as 1000; 20.50 EUR should be written as 2050. + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets CustomType + /// + [DataMember(Name = "customType", EmitDefaultValue = true)] + public string CustomType { get; set; } + + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + /// + /// Tax percentage, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000 + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets Brand + /// + [DataMember(Name = "brand", IsRequired = true, EmitDefaultValue = true)] + public string Brand { get; set; } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Gets or Sets Priority + /// + [DataMember(Name = "priority", IsRequired = true, EmitDefaultValue = true)] + public int Priority { get; set; } + + /// + /// Gets or Sets IsDefault + /// + [DataMember(Name = "isDefault", IsRequired = true, EmitDefaultValue = true)] + public bool IsDefault { get; set; } + + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PostnordLogisticsOption {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CustomType: ").Append(CustomType).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" Brand: ").Append(Brand).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Priority: ").Append(Priority).Append("\n"); + sb.Append(" IsDefault: ").Append(IsDefault).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + if (this.Brand != null) { + // Brand (string) pattern + Regex regexBrand = new Regex(@"POSTNORD", RegexOptions.CultureInvariant); + if (!regexBrand.Match(this.Brand).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Brand, must match a pattern of " + regexBrand, new [] { "Brand" }); + } + } + + // Id (string) maxLength + if (this.Id != null && this.Id.Length > 200) + { + yield return new ValidationResult("Invalid value for Id, length must be less than 200.", new [] { "Id" }); + } + + // Id (string) minLength + if (this.Id != null && this.Id.Length < 1) + { + yield return new ValidationResult("Invalid value for Id, length must be greater than 1.", new [] { "Id" }); + } + + // Priority (int) minimum + if (this.Priority < (int)0) + { + yield return new ValidationResult("Invalid value for Priority, must be a value greater than or equal to 0.", new [] { "Priority" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsType.cs b/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsType.cs new file mode 100644 index 0000000..c21e6a8 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PostnordLogisticsType.cs @@ -0,0 +1,47 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines PostnordLogisticsType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PostnordLogisticsType + { + /// + /// Enum PICKUPPOINT for value: PICKUP_POINT + /// + [EnumMember(Value = "PICKUP_POINT")] + PICKUPPOINT = 1, + + /// + /// Enum HOMEDELIVERY for value: HOME_DELIVERY + /// + [EnumMember(Value = "HOME_DELIVERY")] + HOMEDELIVERY = 2 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PrefillCustomer.cs b/src/Vipps.net.Models.Checkout/Model/PrefillCustomer.cs new file mode 100644 index 0000000..cea325a --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PrefillCustomer.cs @@ -0,0 +1,153 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Information about the customer to be prefilled If any of the customer information is invalid such as the phone number, the customer will be prompted to input new user information. + /// + [DataContract(Name = "PrefillCustomer")] + public partial class PrefillCustomer : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Example: \"Ada\". + /// Example: \"Lovelace\". + /// Example: \"user@example.com\". + /// Format must be MSISDN (including country code). Example: \"4712345678\". + /// Example: \"Robert Levins gate 5\". + /// Example: \"Oslo\". + /// Example: \"0154\". + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\". + public PrefillCustomer(string firstName = default(string), string lastName = default(string), string email = default(string), string phoneNumber = default(string), string streetAddress = default(string), string city = default(string), string postalCode = default(string), string country = default(string)) + { + this.FirstName = firstName; + this.LastName = lastName; + this.Email = email; + this.PhoneNumber = phoneNumber; + this.StreetAddress = streetAddress; + this.City = city; + this.PostalCode = postalCode; + this.Country = country; + } + + /// + /// Example: \"Ada\" + /// + /// Example: \"Ada\" + [DataMember(Name = "firstName", EmitDefaultValue = true)] + public string FirstName { get; set; } + + /// + /// Example: \"Lovelace\" + /// + /// Example: \"Lovelace\" + [DataMember(Name = "lastName", EmitDefaultValue = true)] + public string LastName { get; set; } + + /// + /// Example: \"user@example.com\" + /// + /// Example: \"user@example.com\" + [DataMember(Name = "email", EmitDefaultValue = true)] + public string Email { get; set; } + + /// + /// Format must be MSISDN (including country code). Example: \"4712345678\" + /// + /// Format must be MSISDN (including country code). Example: \"4712345678\" + [DataMember(Name = "phoneNumber", EmitDefaultValue = true)] + public string PhoneNumber { get; set; } + + /// + /// Example: \"Robert Levins gate 5\" + /// + /// Example: \"Robert Levins gate 5\" + [DataMember(Name = "streetAddress", EmitDefaultValue = true)] + public string StreetAddress { get; set; } + + /// + /// Example: \"Oslo\" + /// + /// Example: \"Oslo\" + [DataMember(Name = "city", EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// Example: \"0154\" + /// + /// Example: \"0154\" + [DataMember(Name = "postalCode", EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + [DataMember(Name = "country", EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PrefillCustomer {\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" PhoneNumber: ").Append(PhoneNumber).Append("\n"); + sb.Append(" StreetAddress: ").Append(StreetAddress).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/PriceSubscriptionCampaign.cs b/src/Vipps.net.Models.Checkout/Model/PriceSubscriptionCampaign.cs new file mode 100644 index 0000000..6fddce5 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/PriceSubscriptionCampaign.cs @@ -0,0 +1,136 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// PriceSubscriptionCampaign + /// + [DataContract(Name = "PriceSubscriptionCampaign")] + public partial class PriceSubscriptionCampaign : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PriceSubscriptionCampaign() { } + /// + /// Initializes a new instance of the class. + /// + /// end (required). + /// type (required) (default to "PRICE_CAMPAIGN"). + /// price (required). + public PriceSubscriptionCampaign(string end = default(string), string type = @"PRICE_CAMPAIGN", int price = default(int)) + { + // to ensure "end" is required (not null) + if (end == null) + { + throw new ArgumentNullException("end is a required property for PriceSubscriptionCampaign and cannot be null"); + } + this.End = end; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for PriceSubscriptionCampaign and cannot be null"); + } + this.Type = type; + this.Price = price; + } + + /// + /// Gets or Sets End + /// + [DataMember(Name = "end", IsRequired = true, EmitDefaultValue = true)] + public string End { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Gets or Sets Price + /// + [DataMember(Name = "price", IsRequired = true, EmitDefaultValue = true)] + public int Price { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PriceSubscriptionCampaign {\n"); + sb.Append(" End: ").Append(End).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Price: ").Append(Price).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // End (string) minLength + if (this.End != null && this.End.Length < 1) + { + yield return new ValidationResult("Invalid value for End, length must be greater than 1.", new [] { "End" }); + } + + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"PRICE_CAMPAIGN", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + // Price (int) minimum + if (this.Price < (int)0) + { + yield return new ValidationResult("Invalid value for Price, must be a value greater than or equal to 0.", new [] { "Price" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/QuantityUnit.cs b/src/Vipps.net.Models.Checkout/Model/QuantityUnit.cs new file mode 100644 index 0000000..ef7d75e --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/QuantityUnit.cs @@ -0,0 +1,65 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines QuantityUnit + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum QuantityUnit + { + /// + /// Enum PCS for value: PCS + /// + [EnumMember(Value = "PCS")] + PCS = 1, + + /// + /// Enum KG for value: KG + /// + [EnumMember(Value = "KG")] + KG = 2, + + /// + /// Enum KM for value: KM + /// + [EnumMember(Value = "KM")] + KM = 3, + + /// + /// Enum MINUTE for value: MINUTE + /// + [EnumMember(Value = "MINUTE")] + MINUTE = 4, + + /// + /// Enum LITRE for value: LITRE + /// + [EnumMember(Value = "LITRE")] + LITRE = 5 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ResponseBankTransferPaymentDetails.cs b/src/Vipps.net.Models.Checkout/Model/ResponseBankTransferPaymentDetails.cs new file mode 100644 index 0000000..1776d0a --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ResponseBankTransferPaymentDetails.cs @@ -0,0 +1,115 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of a bank transfer payment. + /// + [DataContract(Name = "ResponseBankTransferPaymentDetails")] + public partial class ResponseBankTransferPaymentDetails : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResponseBankTransferPaymentDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// type (required) (default to "BankTransfer"). + public ResponseBankTransferPaymentDetails(Amount amount = default(Amount), string type = @"BankTransfer") + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for ResponseBankTransferPaymentDetails and cannot be null"); + } + this.Amount = amount; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for ResponseBankTransferPaymentDetails and cannot be null"); + } + this.Type = type; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResponseBankTransferPaymentDetails {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"BankTransfer", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ResponseCardPaymentDetails.cs b/src/Vipps.net.Models.Checkout/Model/ResponseCardPaymentDetails.cs new file mode 100644 index 0000000..65f91ba --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ResponseCardPaymentDetails.cs @@ -0,0 +1,133 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of a card payment. + /// + [DataContract(Name = "ResponseCardPaymentDetails")] + public partial class ResponseCardPaymentDetails : IValidatableObject + { + + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", IsRequired = true, EmitDefaultValue = true)] + public PaymentState State { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResponseCardPaymentDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// state (required). + /// aggregate. + /// type (required) (default to "Card"). + public ResponseCardPaymentDetails(Amount amount = default(Amount), PaymentState state = default(PaymentState), TransactionAggregate aggregate = default(TransactionAggregate), string type = @"Card") + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for ResponseCardPaymentDetails and cannot be null"); + } + this.Amount = amount; + this.State = state; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for ResponseCardPaymentDetails and cannot be null"); + } + this.Type = type; + this.Aggregate = aggregate; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Aggregate + /// + [DataMember(Name = "aggregate", EmitDefaultValue = true)] + public TransactionAggregate Aggregate { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResponseCardPaymentDetails {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" Aggregate: ").Append(Aggregate).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"Card", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ResponseSubscriptionDetails.cs b/src/Vipps.net.Models.Checkout/Model/ResponseSubscriptionDetails.cs new file mode 100644 index 0000000..6d03d98 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ResponseSubscriptionDetails.cs @@ -0,0 +1,93 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of the transaction + /// + [DataContract(Name = "ResponseSubscriptionDetails")] + public partial class ResponseSubscriptionDetails : IValidatableObject + { + + /// + /// The state of the recurring agreement. + /// + /// The state of the recurring agreement. + [DataMember(Name = "state", EmitDefaultValue = true)] + public SubscriptionState? State { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The state of the recurring agreement.. + /// The reference for the agreement. Used to create future charges, as well as updates to the agreement.. + public ResponseSubscriptionDetails(SubscriptionState? state = default(SubscriptionState?), string agreementId = default(string)) + { + this.State = state; + this.AgreementId = agreementId; + } + + /// + /// The reference for the agreement. Used to create future charges, as well as updates to the agreement. + /// + /// The reference for the agreement. Used to create future charges, as well as updates to the agreement. + [DataMember(Name = "agreementId", EmitDefaultValue = true)] + public string AgreementId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResponseSubscriptionDetails {\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" AgreementId: ").Append(AgreementId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ResponseWalletPaymentDetails.cs b/src/Vipps.net.Models.Checkout/Model/ResponseWalletPaymentDetails.cs new file mode 100644 index 0000000..ba841c2 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ResponseWalletPaymentDetails.cs @@ -0,0 +1,133 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of a wallet payment. + /// + [DataContract(Name = "ResponseWalletPaymentDetails")] + public partial class ResponseWalletPaymentDetails : IValidatableObject + { + + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", IsRequired = true, EmitDefaultValue = true)] + public PaymentState State { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResponseWalletPaymentDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// state (required). + /// aggregate. + /// type (required) (default to "Wallet"). + public ResponseWalletPaymentDetails(Amount amount = default(Amount), PaymentState state = default(PaymentState), TransactionAggregate aggregate = default(TransactionAggregate), string type = @"Wallet") + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for ResponseWalletPaymentDetails and cannot be null"); + } + this.Amount = amount; + this.State = state; + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for ResponseWalletPaymentDetails and cannot be null"); + } + this.Type = type; + this.Aggregate = aggregate; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Aggregate + /// + [DataMember(Name = "aggregate", EmitDefaultValue = true)] + public TransactionAggregate Aggregate { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResponseWalletPaymentDetails {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" Aggregate: ").Append(Aggregate).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Type != null) { + // Type (string) pattern + Regex regexType = new Regex(@"Wallet", RegexOptions.CultureInvariant); + if (!regexType.Match(this.Type).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Type, must match a pattern of " + regexType, new [] { "Type" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/SessionResponse.cs b/src/Vipps.net.Models.Checkout/Model/SessionResponse.cs new file mode 100644 index 0000000..9ce7efd --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/SessionResponse.cs @@ -0,0 +1,191 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Session information + /// + [DataContract(Name = "SessionResponse")] + public partial class SessionResponse : IValidatableObject + { + + /// + /// The state of the session. Example: \"SessionStarted\". The state of the payment is in PaymentDetails.State. + /// + /// The state of the session. Example: \"SessionStarted\". The state of the payment is in PaymentDetails.State. + [DataMember(Name = "sessionState", IsRequired = true, EmitDefaultValue = true)] + public ExternalSessionState SessionState { get; set; } + + /// + /// Gets or Sets PaymentMethod + /// + [DataMember(Name = "paymentMethod", EmitDefaultValue = true)] + public PaymentMethod? PaymentMethod { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SessionResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The Id of the session. Example: \"v52EtjZriRmGiKiAKHByK2\". (required). + /// The merchant's serial number. Example: \"123456\". + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ (required). + /// The state of the session. Example: \"SessionStarted\". The state of the payment is in PaymentDetails.State. (required). + /// paymentMethod. + /// subscriptionDetails. + /// paymentDetails. + /// userInfo. + /// shippingDetails. + /// billingDetails. + /// customConsentProvided. + public SessionResponse(string sessionId = default(string), string merchantSerialNumber = default(string), string reference = default(string), ExternalSessionState sessionState = default(ExternalSessionState), PaymentMethod? paymentMethod = default(PaymentMethod?), ResponseSubscriptionDetails subscriptionDetails = default(ResponseSubscriptionDetails), SessionResponsePaymentDetails paymentDetails = default(SessionResponsePaymentDetails), UserInfo userInfo = default(UserInfo), ShippingDetails shippingDetails = default(ShippingDetails), BillingDetails billingDetails = default(BillingDetails), bool? customConsentProvided = default(bool?)) + { + // to ensure "sessionId" is required (not null) + if (sessionId == null) + { + throw new ArgumentNullException("sessionId is a required property for SessionResponse and cannot be null"); + } + this.SessionId = sessionId; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for SessionResponse and cannot be null"); + } + this.Reference = reference; + this.SessionState = sessionState; + this.MerchantSerialNumber = merchantSerialNumber; + this.PaymentMethod = paymentMethod; + this.SubscriptionDetails = subscriptionDetails; + this.PaymentDetails = paymentDetails; + this.UserInfo = userInfo; + this.ShippingDetails = shippingDetails; + this.BillingDetails = billingDetails; + this.CustomConsentProvided = customConsentProvided; + } + + /// + /// The Id of the session. Example: \"v52EtjZriRmGiKiAKHByK2\". + /// + /// The Id of the session. Example: \"v52EtjZriRmGiKiAKHByK2\". + [DataMember(Name = "sessionId", IsRequired = true, EmitDefaultValue = true)] + public string SessionId { get; set; } + + /// + /// The merchant's serial number. Example: \"123456\" + /// + /// The merchant's serial number. Example: \"123456\" + [DataMember(Name = "merchantSerialNumber", EmitDefaultValue = true)] + public string MerchantSerialNumber { get; set; } + + /// + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ + /// + /// The merchant's unique reference for the transaction. Also known as OrderId. Example: \"acme-shop-123-order123abc\". See https://developer.vippsmobilepay.com/docs/knowledge-base/orderid/ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Gets or Sets SubscriptionDetails + /// + [DataMember(Name = "subscriptionDetails", EmitDefaultValue = true)] + public ResponseSubscriptionDetails SubscriptionDetails { get; set; } + + /// + /// Gets or Sets PaymentDetails + /// + [DataMember(Name = "paymentDetails", EmitDefaultValue = true)] + public SessionResponsePaymentDetails PaymentDetails { get; set; } + + /// + /// Gets or Sets UserInfo + /// + [DataMember(Name = "userInfo", EmitDefaultValue = true)] + public UserInfo UserInfo { get; set; } + + /// + /// Gets or Sets ShippingDetails + /// + [DataMember(Name = "shippingDetails", EmitDefaultValue = true)] + public ShippingDetails ShippingDetails { get; set; } + + /// + /// Gets or Sets BillingDetails + /// + [DataMember(Name = "billingDetails", EmitDefaultValue = true)] + public BillingDetails BillingDetails { get; set; } + + /// + /// Gets or Sets CustomConsentProvided + /// + [DataMember(Name = "customConsentProvided", EmitDefaultValue = true)] + public bool? CustomConsentProvided { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SessionResponse {\n"); + sb.Append(" SessionId: ").Append(SessionId).Append("\n"); + sb.Append(" MerchantSerialNumber: ").Append(MerchantSerialNumber).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" SessionState: ").Append(SessionState).Append("\n"); + sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n"); + sb.Append(" SubscriptionDetails: ").Append(SubscriptionDetails).Append("\n"); + sb.Append(" PaymentDetails: ").Append(PaymentDetails).Append("\n"); + sb.Append(" UserInfo: ").Append(UserInfo).Append("\n"); + sb.Append(" ShippingDetails: ").Append(ShippingDetails).Append("\n"); + sb.Append(" BillingDetails: ").Append(BillingDetails).Append("\n"); + sb.Append(" CustomConsentProvided: ").Append(CustomConsentProvided).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/SessionResponsePaymentDetails.cs b/src/Vipps.net.Models.Checkout/Model/SessionResponsePaymentDetails.cs new file mode 100644 index 0000000..592d01b --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/SessionResponsePaymentDetails.cs @@ -0,0 +1,315 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// SessionResponsePaymentDetails + /// + [JsonConverter(typeof(SessionResponsePaymentDetailsJsonConverter))] + [DataContract(Name = "SessionResponse_paymentDetails")] + public partial class SessionResponsePaymentDetails : AbstractOpenAPISchema, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + public SessionResponsePaymentDetails() + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ResponseWalletPaymentDetails. + public SessionResponsePaymentDetails(ResponseWalletPaymentDetails actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ResponseCardPaymentDetails. + public SessionResponsePaymentDetails(ResponseCardPaymentDetails actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ResponseBankTransferPaymentDetails. + public SessionResponsePaymentDetails(ResponseBankTransferPaymentDetails actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(ResponseBankTransferPaymentDetails) || value is ResponseBankTransferPaymentDetails) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ResponseCardPaymentDetails) || value is ResponseCardPaymentDetails) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ResponseWalletPaymentDetails) || value is ResponseWalletPaymentDetails) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: ResponseBankTransferPaymentDetails, ResponseCardPaymentDetails, ResponseWalletPaymentDetails"); + } + } + } + + /// + /// Get the actual instance of `ResponseWalletPaymentDetails`. If the actual instance is not `ResponseWalletPaymentDetails`, + /// the InvalidClassException will be thrown + /// + /// An instance of ResponseWalletPaymentDetails + public ResponseWalletPaymentDetails GetResponseWalletPaymentDetails() + { + return (ResponseWalletPaymentDetails)this.ActualInstance; + } + + /// + /// Get the actual instance of `ResponseCardPaymentDetails`. If the actual instance is not `ResponseCardPaymentDetails`, + /// the InvalidClassException will be thrown + /// + /// An instance of ResponseCardPaymentDetails + public ResponseCardPaymentDetails GetResponseCardPaymentDetails() + { + return (ResponseCardPaymentDetails)this.ActualInstance; + } + + /// + /// Get the actual instance of `ResponseBankTransferPaymentDetails`. If the actual instance is not `ResponseBankTransferPaymentDetails`, + /// the InvalidClassException will be thrown + /// + /// An instance of ResponseBankTransferPaymentDetails + public ResponseBankTransferPaymentDetails GetResponseBankTransferPaymentDetails() + { + return (ResponseBankTransferPaymentDetails)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SessionResponsePaymentDetails {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SessionResponsePaymentDetails.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SessionResponsePaymentDetails + /// + /// JSON string + /// An instance of SessionResponsePaymentDetails + public static SessionResponsePaymentDetails FromJson(string jsonString) + { + SessionResponsePaymentDetails newSessionResponsePaymentDetails = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSessionResponsePaymentDetails; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ResponseBankTransferPaymentDetails).GetProperty("AdditionalProperties") == null) + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.SerializerSettings)); + } + else + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ResponseBankTransferPaymentDetails"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ResponseBankTransferPaymentDetails: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ResponseCardPaymentDetails).GetProperty("AdditionalProperties") == null) + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.SerializerSettings)); + } + else + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ResponseCardPaymentDetails"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ResponseCardPaymentDetails: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ResponseWalletPaymentDetails).GetProperty("AdditionalProperties") == null) + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.SerializerSettings)); + } + else + { + newSessionResponsePaymentDetails = new SessionResponsePaymentDetails(JsonConvert.DeserializeObject(jsonString, SessionResponsePaymentDetails.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ResponseWalletPaymentDetails"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ResponseWalletPaymentDetails: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSessionResponsePaymentDetails; + } + + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SessionResponsePaymentDetails + /// + public class SessionResponsePaymentDetailsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SessionResponsePaymentDetails).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return SessionResponsePaymentDetails.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return SessionResponsePaymentDetails.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/ShippingDetails.cs b/src/Vipps.net.Models.Checkout/Model/ShippingDetails.cs new file mode 100644 index 0000000..37d35d2 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/ShippingDetails.cs @@ -0,0 +1,182 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of the shipping + /// + [DataContract(Name = "ShippingDetails")] + public partial class ShippingDetails : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Example: \"Ada\". + /// Example: \"Lovelace\". + /// Example: \"user@example.com\". + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\". + /// Example: \"Robert Levins gate 5\". + /// Example: \"0154\". + /// Example: \"Oslo\". + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\". + /// Id of the shipping method. Example: \"123abc\". + /// Shipping method amount. + /// pickupPoint. + public ShippingDetails(string firstName = default(string), string lastName = default(string), string email = default(string), string phoneNumber = default(string), string streetAddress = default(string), string postalCode = default(string), string city = default(string), string country = default(string), string shippingMethodId = default(string), Amount amount = default(Amount), PickupPoint pickupPoint = default(PickupPoint)) + { + this.FirstName = firstName; + this.LastName = lastName; + this.Email = email; + this.PhoneNumber = phoneNumber; + this.StreetAddress = streetAddress; + this.PostalCode = postalCode; + this.City = city; + this.Country = country; + this.ShippingMethodId = shippingMethodId; + this.Amount = amount; + this.PickupPoint = pickupPoint; + } + + /// + /// Example: \"Ada\" + /// + /// Example: \"Ada\" + [DataMember(Name = "firstName", EmitDefaultValue = true)] + public string FirstName { get; set; } + + /// + /// Example: \"Lovelace\" + /// + /// Example: \"Lovelace\" + [DataMember(Name = "lastName", EmitDefaultValue = true)] + public string LastName { get; set; } + + /// + /// Example: \"user@example.com\" + /// + /// Example: \"user@example.com\" + [DataMember(Name = "email", EmitDefaultValue = true)] + public string Email { get; set; } + + /// + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\" + /// + /// If no country code is provided, defaults to Norway (47). Example: \"4712345678\" + [DataMember(Name = "phoneNumber", EmitDefaultValue = true)] + public string PhoneNumber { get; set; } + + /// + /// Example: \"Robert Levins gate 5\" + /// + /// Example: \"Robert Levins gate 5\" + [DataMember(Name = "streetAddress", EmitDefaultValue = true)] + public string StreetAddress { get; set; } + + /// + /// Example: \"0154\" + /// + /// Example: \"0154\" + [DataMember(Name = "postalCode", EmitDefaultValue = true)] + public string PostalCode { get; set; } + + /// + /// Example: \"Oslo\" + /// + /// Example: \"Oslo\" + [DataMember(Name = "city", EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + /// + /// The ISO-3166-1 Alpha-2 representation of the country. Example: \"NO\" + [DataMember(Name = "country", EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Id of the shipping method. Example: \"123abc\" + /// + /// Id of the shipping method. Example: \"123abc\" + [DataMember(Name = "shippingMethodId", EmitDefaultValue = true)] + public string ShippingMethodId { get; set; } + + /// + /// Shipping method amount + /// + /// Shipping method amount + [DataMember(Name = "amount", EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets PickupPoint + /// + [DataMember(Name = "pickupPoint", EmitDefaultValue = true)] + public PickupPoint PickupPoint { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShippingDetails {\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" PhoneNumber: ").Append(PhoneNumber).Append("\n"); + sb.Append(" StreetAddress: ").Append(StreetAddress).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" ShippingMethodId: ").Append(ShippingMethodId).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" PickupPoint: ").Append(PickupPoint).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/Subscription.cs b/src/Vipps.net.Models.Checkout/Model/Subscription.cs new file mode 100644 index 0000000..a29881b --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/Subscription.cs @@ -0,0 +1,169 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Subscription + /// + [DataContract(Name = "Subscription")] + public partial class Subscription : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Subscription() { } + /// + /// Initializes a new instance of the class. + /// + /// Name of the subscription, visible to the customer during payment. Example: \"Bi-Weekly Socks\". (required). + /// The amount to be charged by the given interval (required). + /// How often the amount is to be charged. For example every 2 weeks. (required). + /// Complete URL to the merchant's page regarding the subscription. Example: \"https://example.com/vipps/subscription/socks\". (required). + /// Description visible to the customer during subscribing. Example: \"Bi-Weekly Subscription of 1 pair of socks\".. + /// campaign. + public Subscription(string productName = default(string), Amount amount = default(Amount), Interval interval = default(Interval), string merchantAgreementUrl = default(string), string productDescription = default(string), SubscriptionCampaign campaign = default(SubscriptionCampaign)) + { + // to ensure "productName" is required (not null) + if (productName == null) + { + throw new ArgumentNullException("productName is a required property for Subscription and cannot be null"); + } + this.ProductName = productName; + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for Subscription and cannot be null"); + } + this.Amount = amount; + // to ensure "interval" is required (not null) + if (interval == null) + { + throw new ArgumentNullException("interval is a required property for Subscription and cannot be null"); + } + this.Interval = interval; + // to ensure "merchantAgreementUrl" is required (not null) + if (merchantAgreementUrl == null) + { + throw new ArgumentNullException("merchantAgreementUrl is a required property for Subscription and cannot be null"); + } + this.MerchantAgreementUrl = merchantAgreementUrl; + this.ProductDescription = productDescription; + this.Campaign = campaign; + } + + /// + /// Name of the subscription, visible to the customer during payment. Example: \"Bi-Weekly Socks\". + /// + /// Name of the subscription, visible to the customer during payment. Example: \"Bi-Weekly Socks\". + [DataMember(Name = "productName", IsRequired = true, EmitDefaultValue = true)] + public string ProductName { get; set; } + + /// + /// The amount to be charged by the given interval + /// + /// The amount to be charged by the given interval + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// How often the amount is to be charged. For example every 2 weeks. + /// + /// How often the amount is to be charged. For example every 2 weeks. + [DataMember(Name = "interval", IsRequired = true, EmitDefaultValue = true)] + public Interval Interval { get; set; } + + /// + /// Complete URL to the merchant's page regarding the subscription. Example: \"https://example.com/vipps/subscription/socks\". + /// + /// Complete URL to the merchant's page regarding the subscription. Example: \"https://example.com/vipps/subscription/socks\". + [DataMember(Name = "merchantAgreementUrl", IsRequired = true, EmitDefaultValue = true)] + public string MerchantAgreementUrl { get; set; } + + /// + /// Description visible to the customer during subscribing. Example: \"Bi-Weekly Subscription of 1 pair of socks\". + /// + /// Description visible to the customer during subscribing. Example: \"Bi-Weekly Subscription of 1 pair of socks\". + [DataMember(Name = "productDescription", EmitDefaultValue = true)] + public string ProductDescription { get; set; } + + /// + /// Gets or Sets Campaign + /// + [DataMember(Name = "campaign", EmitDefaultValue = true)] + public SubscriptionCampaign Campaign { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Subscription {\n"); + sb.Append(" ProductName: ").Append(ProductName).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Interval: ").Append(Interval).Append("\n"); + sb.Append(" MerchantAgreementUrl: ").Append(MerchantAgreementUrl).Append("\n"); + sb.Append(" ProductDescription: ").Append(ProductDescription).Append("\n"); + sb.Append(" Campaign: ").Append(Campaign).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ProductName (string) maxLength + if (this.ProductName != null && this.ProductName.Length > 45) + { + yield return new ValidationResult("Invalid value for ProductName, length must be less than 45.", new [] { "ProductName" }); + } + + // ProductName (string) minLength + if (this.ProductName != null && this.ProductName.Length < 3) + { + yield return new ValidationResult("Invalid value for ProductName, length must be greater than 3.", new [] { "ProductName" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/SubscriptionCampaign.cs b/src/Vipps.net.Models.Checkout/Model/SubscriptionCampaign.cs new file mode 100644 index 0000000..240fa99 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/SubscriptionCampaign.cs @@ -0,0 +1,315 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// A discount period that ends in a specified date and time. + /// + [JsonConverter(typeof(SubscriptionCampaignJsonConverter))] + [DataContract(Name = "Subscription_campaign")] + public partial class SubscriptionCampaign : AbstractOpenAPISchema, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + public SubscriptionCampaign() + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of EventSubscriptionCampaign. + public SubscriptionCampaign(EventSubscriptionCampaign actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PeriodSubscriptionCampaign. + public SubscriptionCampaign(PeriodSubscriptionCampaign actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PriceSubscriptionCampaign. + public SubscriptionCampaign(PriceSubscriptionCampaign actualInstance) + { + this.IsNullable = true; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(EventSubscriptionCampaign) || value is EventSubscriptionCampaign) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PeriodSubscriptionCampaign) || value is PeriodSubscriptionCampaign) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PriceSubscriptionCampaign) || value is PriceSubscriptionCampaign) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: EventSubscriptionCampaign, PeriodSubscriptionCampaign, PriceSubscriptionCampaign"); + } + } + } + + /// + /// Get the actual instance of `EventSubscriptionCampaign`. If the actual instance is not `EventSubscriptionCampaign`, + /// the InvalidClassException will be thrown + /// + /// An instance of EventSubscriptionCampaign + public EventSubscriptionCampaign GetEventSubscriptionCampaign() + { + return (EventSubscriptionCampaign)this.ActualInstance; + } + + /// + /// Get the actual instance of `PeriodSubscriptionCampaign`. If the actual instance is not `PeriodSubscriptionCampaign`, + /// the InvalidClassException will be thrown + /// + /// An instance of PeriodSubscriptionCampaign + public PeriodSubscriptionCampaign GetPeriodSubscriptionCampaign() + { + return (PeriodSubscriptionCampaign)this.ActualInstance; + } + + /// + /// Get the actual instance of `PriceSubscriptionCampaign`. If the actual instance is not `PriceSubscriptionCampaign`, + /// the InvalidClassException will be thrown + /// + /// An instance of PriceSubscriptionCampaign + public PriceSubscriptionCampaign GetPriceSubscriptionCampaign() + { + return (PriceSubscriptionCampaign)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SubscriptionCampaign {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SubscriptionCampaign.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SubscriptionCampaign + /// + /// JSON string + /// An instance of SubscriptionCampaign + public static SubscriptionCampaign FromJson(string jsonString) + { + SubscriptionCampaign newSubscriptionCampaign = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSubscriptionCampaign; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(EventSubscriptionCampaign).GetProperty("AdditionalProperties") == null) + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.SerializerSettings)); + } + else + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("EventSubscriptionCampaign"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EventSubscriptionCampaign: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PeriodSubscriptionCampaign).GetProperty("AdditionalProperties") == null) + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.SerializerSettings)); + } + else + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PeriodSubscriptionCampaign"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PeriodSubscriptionCampaign: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PriceSubscriptionCampaign).GetProperty("AdditionalProperties") == null) + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.SerializerSettings)); + } + else + { + newSubscriptionCampaign = new SubscriptionCampaign(JsonConvert.DeserializeObject(jsonString, SubscriptionCampaign.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PriceSubscriptionCampaign"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PriceSubscriptionCampaign: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSubscriptionCampaign; + } + + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SubscriptionCampaign + /// + public class SubscriptionCampaignJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SubscriptionCampaign).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return SubscriptionCampaign.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return SubscriptionCampaign.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/SubscriptionState.cs b/src/Vipps.net.Models.Checkout/Model/SubscriptionState.cs new file mode 100644 index 0000000..719c403 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/SubscriptionState.cs @@ -0,0 +1,59 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines SubscriptionState + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SubscriptionState + { + /// + /// Enum PENDING for value: PENDING + /// + [EnumMember(Value = "PENDING")] + PENDING = 1, + + /// + /// Enum ACTIVE for value: ACTIVE + /// + [EnumMember(Value = "ACTIVE")] + ACTIVE = 2, + + /// + /// Enum STOPPED for value: STOPPED + /// + [EnumMember(Value = "STOPPED")] + STOPPED = 3, + + /// + /// Enum EXPIRED for value: EXPIRED + /// + [EnumMember(Value = "EXPIRED")] + EXPIRED = 4 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/TransactionAggregate.cs b/src/Vipps.net.Models.Checkout/Model/TransactionAggregate.cs new file mode 100644 index 0000000..f81b867 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/TransactionAggregate.cs @@ -0,0 +1,109 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines the details of the transaction + /// + [DataContract(Name = "TransactionAggregate")] + public partial class TransactionAggregate : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// cancelledAmount. + /// capturedAmount. + /// refundedAmount. + /// authorizedAmount. + public TransactionAggregate(Amount cancelledAmount = default(Amount), Amount capturedAmount = default(Amount), Amount refundedAmount = default(Amount), Amount authorizedAmount = default(Amount)) + { + this.CancelledAmount = cancelledAmount; + this.CapturedAmount = capturedAmount; + this.RefundedAmount = refundedAmount; + this.AuthorizedAmount = authorizedAmount; + } + + /// + /// Gets or Sets CancelledAmount + /// + [DataMember(Name = "cancelledAmount", EmitDefaultValue = true)] + public Amount CancelledAmount { get; set; } + + /// + /// Gets or Sets CapturedAmount + /// + [DataMember(Name = "capturedAmount", EmitDefaultValue = true)] + public Amount CapturedAmount { get; set; } + + /// + /// Gets or Sets RefundedAmount + /// + [DataMember(Name = "refundedAmount", EmitDefaultValue = true)] + public Amount RefundedAmount { get; set; } + + /// + /// Gets or Sets AuthorizedAmount + /// + [DataMember(Name = "authorizedAmount", EmitDefaultValue = true)] + public Amount AuthorizedAmount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TransactionAggregate {\n"); + sb.Append(" CancelledAmount: ").Append(CancelledAmount).Append("\n"); + sb.Append(" CapturedAmount: ").Append(CapturedAmount).Append("\n"); + sb.Append(" RefundedAmount: ").Append(RefundedAmount).Append("\n"); + sb.Append(" AuthorizedAmount: ").Append(AuthorizedAmount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/UserFlow.cs b/src/Vipps.net.Models.Checkout/Model/UserFlow.cs new file mode 100644 index 0000000..fa20a5e --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/UserFlow.cs @@ -0,0 +1,47 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Defines UserFlow + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UserFlow + { + /// + /// Enum WEBREDIRECT for value: WEB_REDIRECT + /// + [EnumMember(Value = "WEB_REDIRECT")] + WEBREDIRECT = 1, + + /// + /// Enum NATIVEREDIRECT for value: NATIVE_REDIRECT + /// + [EnumMember(Value = "NATIVE_REDIRECT")] + NATIVEREDIRECT = 2 + } + +} diff --git a/src/Vipps.net.Models.Checkout/Model/UserInfo.cs b/src/Vipps.net.Models.Checkout/Model/UserInfo.cs new file mode 100644 index 0000000..e4d5e02 --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Model/UserInfo.cs @@ -0,0 +1,103 @@ +/* + * checkout-backend-merchant-v3.API + * + * See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). + * + * The version of the OpenAPI document: v3 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Checkout.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Checkout.Model +{ + /// + /// Data from the UserInfo endpoint. Will only be present if UserInfo flow is used. + /// + [DataContract(Name = "UserInfo")] + public partial class UserInfo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UserInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// The openid sub that uniquely identifies a user. (required). + /// Example: \"user@example.com\". + public UserInfo(string sub = default(string), string email = default(string)) + { + // to ensure "sub" is required (not null) + if (sub == null) + { + throw new ArgumentNullException("sub is a required property for UserInfo and cannot be null"); + } + this.Sub = sub; + this.Email = email; + } + + /// + /// The openid sub that uniquely identifies a user. + /// + /// The openid sub that uniquely identifies a user. + [DataMember(Name = "sub", IsRequired = true, EmitDefaultValue = true)] + public string Sub { get; set; } + + /// + /// Example: \"user@example.com\" + /// + /// Example: \"user@example.com\" + [DataMember(Name = "email", EmitDefaultValue = true)] + public string Email { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UserInfo {\n"); + sb.Append(" Sub: ").Append(Sub).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Checkout/Vipps.net.Models.Checkout.csproj b/src/Vipps.net.Models.Checkout/Vipps.net.Models.Checkout.csproj new file mode 100644 index 0000000..184cfaf --- /dev/null +++ b/src/Vipps.net.Models.Checkout/Vipps.net.Models.Checkout.csproj @@ -0,0 +1,37 @@ + + + + false + netstandard2.0 + Vipps.net.Models.Checkout + Vipps.net.Models.Checkout + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Vipps.net.Models.Checkout + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Vipps.net.Models.Checkout.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + false + + + + + + + + + + + + + + + + + diff --git a/src/Vipps.net.Models.Epayment.Test/Vipps.net.Models.Epayment.Test.csproj b/src/Vipps.net.Models.Epayment.Test/Vipps.net.Models.Epayment.Test.csproj new file mode 100644 index 0000000..465b101 --- /dev/null +++ b/src/Vipps.net.Models.Epayment.Test/Vipps.net.Models.Epayment.Test.csproj @@ -0,0 +1,19 @@ + + + + Vipps.net.Models.Epayment.Test + Vipps.net.Models.Epayment.Test + net7.0 + false + + + + + + + + + + + + diff --git a/src/Vipps.net.Models.Epayment/Api/AdjustPaymentsApi.cs b/src/Vipps.net.Models.Epayment/Api/AdjustPaymentsApi.cs new file mode 100644 index 0000000..4f35f10 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Api/AdjustPaymentsApi.cs @@ -0,0 +1,1191 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Vipps.net.Models.Epayment.Client; +using Vipps.net.Models.Epayment.Model; + +namespace Vipps.net.Models.Epayment.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAdjustPaymentsApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Cancel a payment + /// + /// + /// Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// ModificationResponse + ModificationResponse CancelPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0); + + /// + /// Cancel a payment + /// + /// + /// Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + ApiResponse CancelPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0); + /// + /// Capture a payment + /// + /// + /// Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// ModificationResponse + ModificationResponse CapturePayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0); + + /// + /// Capture a payment + /// + /// + /// Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + ApiResponse CapturePaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0); + /// + /// Refund a payment + /// + /// + /// Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// ModificationResponse + ModificationResponse RefundPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0); + + /// + /// Refund a payment + /// + /// + /// Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + ApiResponse RefundPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAdjustPaymentsApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Cancel a payment + /// + /// + /// Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + System.Threading.Tasks.Task CancelPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Cancel a payment + /// + /// + /// Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + System.Threading.Tasks.Task> CancelPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Capture a payment + /// + /// + /// Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + System.Threading.Tasks.Task CapturePaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Capture a payment + /// + /// + /// Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + System.Threading.Tasks.Task> CapturePaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Refund a payment + /// + /// + /// Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + System.Threading.Tasks.Task RefundPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Refund a payment + /// + /// + /// Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + System.Threading.Tasks.Task> RefundPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAdjustPaymentsApi : IAdjustPaymentsApiSync, IAdjustPaymentsApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AdjustPaymentsApi : IAdjustPaymentsApi + { + private Vipps.net.Models.Epayment.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public AdjustPaymentsApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public AdjustPaymentsApi(string basePath) + { + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + new Vipps.net.Models.Epayment.Client.Configuration { BasePath = basePath } + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public AdjustPaymentsApi(Vipps.net.Models.Epayment.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public AdjustPaymentsApi(Vipps.net.Models.Epayment.Client.ISynchronousClient client, Vipps.net.Models.Epayment.Client.IAsynchronousClient asyncClient, Vipps.net.Models.Epayment.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Vipps.net.Models.Epayment.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Vipps.net.Models.Epayment.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Vipps.net.Models.Epayment.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Vipps.net.Models.Epayment.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Cancel a payment Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// ModificationResponse + public ModificationResponse CancelPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = CancelPaymentWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, cancelModificationRequest); + return localVarResponse.Data; + } + + /// + /// Cancel a payment Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + public Vipps.net.Models.Epayment.Client.ApiResponse CancelPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->CancelPayment"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = cancelModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.CancelPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/v1/payments/{Reference}/cancel", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CancelPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Cancel a payment Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + public async System.Threading.Tasks.Task CancelPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = await CancelPaymentWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, cancelModificationRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Cancel a payment Cancel the payment with the specified `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// New `CancelModificationRequest` body. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + public async System.Threading.Tasks.Task> CancelPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CancelModificationRequest cancelModificationRequest = default(CancelModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->CancelPayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->CancelPayment"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = cancelModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.CancelPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/v1/payments/{Reference}/cancel", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CancelPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Capture a payment Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// ModificationResponse + public ModificationResponse CapturePayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = CapturePaymentWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, captureModificationRequest); + return localVarResponse.Data; + } + + /// + /// Capture a payment Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + public Vipps.net.Models.Epayment.Client.ApiResponse CapturePaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->CapturePayment"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = captureModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.CapturePayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/v1/payments/{Reference}/capture", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CapturePayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Capture a payment Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + public async System.Threading.Tasks.Task CapturePaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = await CapturePaymentWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, captureModificationRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Capture a payment Capture the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested capture modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + public async System.Threading.Tasks.Task> CapturePaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), CaptureModificationRequest captureModificationRequest = default(CaptureModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->CapturePayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->CapturePayment"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = captureModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.CapturePayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/v1/payments/{Reference}/capture", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CapturePayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Refund a payment Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// ModificationResponse + public ModificationResponse RefundPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = RefundPaymentWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, refundModificationRequest); + return localVarResponse.Data; + } + + /// + /// Refund a payment Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// ApiResponse of ModificationResponse + public Vipps.net.Models.Epayment.Client.ApiResponse RefundPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->RefundPayment"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = refundModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.RefundPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/v1/payments/{Reference}/refund", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RefundPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Refund a payment Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModificationResponse + public async System.Threading.Tasks.Task RefundPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = await RefundPaymentWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, idempotencyKey, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, refundModificationRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Refund a payment Refund the given payment + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Requested refund modification (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModificationResponse) + public async System.Threading.Tasks.Task> RefundPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, string idempotencyKey, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), RefundModificationRequest refundModificationRequest = default(RefundModificationRequest), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling AdjustPaymentsApi->RefundPayment"); + } + + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling AdjustPaymentsApi->RefundPayment"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = refundModificationRequest; + + localVarRequestOptions.Operation = "AdjustPaymentsApi.RefundPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/v1/payments/{Reference}/refund", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RefundPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/src/Vipps.net.Models.Epayment/Api/CreatePaymentsApi.cs b/src/Vipps.net.Models.Epayment/Api/CreatePaymentsApi.cs new file mode 100644 index 0000000..c02cd4c --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Api/CreatePaymentsApi.cs @@ -0,0 +1,495 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Vipps.net.Models.Epayment.Client; +using Vipps.net.Models.Epayment.Model; + +namespace Vipps.net.Models.Epayment.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ICreatePaymentsApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create a payment + /// + /// + /// Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// CreatePaymentResponse + CreatePaymentResponse CreatePayment(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0); + + /// + /// Create a payment + /// + /// + /// Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// ApiResponse of CreatePaymentResponse + ApiResponse CreatePaymentWithHttpInfo(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ICreatePaymentsApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create a payment + /// + /// + /// Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of CreatePaymentResponse + System.Threading.Tasks.Task CreatePaymentAsync(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Create a payment + /// + /// + /// Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatePaymentResponse) + System.Threading.Tasks.Task> CreatePaymentWithHttpInfoAsync(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ICreatePaymentsApi : ICreatePaymentsApiSync, ICreatePaymentsApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class CreatePaymentsApi : ICreatePaymentsApi + { + private Vipps.net.Models.Epayment.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public CreatePaymentsApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public CreatePaymentsApi(string basePath) + { + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + new Vipps.net.Models.Epayment.Client.Configuration { BasePath = basePath } + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public CreatePaymentsApi(Vipps.net.Models.Epayment.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public CreatePaymentsApi(Vipps.net.Models.Epayment.Client.ISynchronousClient client, Vipps.net.Models.Epayment.Client.IAsynchronousClient asyncClient, Vipps.net.Models.Epayment.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Vipps.net.Models.Epayment.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Vipps.net.Models.Epayment.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Vipps.net.Models.Epayment.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Vipps.net.Models.Epayment.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create a payment Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// CreatePaymentResponse + public CreatePaymentResponse CreatePayment(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = CreatePaymentWithHttpInfo(idempotencyKey, ocpApimSubscriptionKey, merchantSerialNumber, createPaymentRequest, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion); + return localVarResponse.Data; + } + + /// + /// Create a payment Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// ApiResponse of CreatePaymentResponse + public Vipps.net.Models.Epayment.Client.ApiResponse CreatePaymentWithHttpInfo(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0) + { + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'createPaymentRequest' is set + if (createPaymentRequest == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'createPaymentRequest' when calling CreatePaymentsApi->CreatePayment"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = createPaymentRequest; + + localVarRequestOptions.Operation = "CreatePaymentsApi.CreatePayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/v1/payments", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreatePayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Create a payment Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of CreatePaymentResponse + public async System.Threading.Tasks.Task CreatePaymentAsync(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = await CreatePaymentWithHttpInfoAsync(idempotencyKey, ocpApimSubscriptionKey, merchantSerialNumber, createPaymentRequest, vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a payment Create a new payment + /// + /// Thrown when fails to make API call + /// Idempotency key for the request, ensures idempotent actions. See [idempotency](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers#idempotency) + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// + /// New `CreatePaymentRequest` body. + /// The name of the ecommerce solution. One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce solution. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// The version number of the ecommerce plugin (if applicable). See [http-headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers). (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatePaymentResponse) + public async System.Threading.Tasks.Task> CreatePaymentWithHttpInfoAsync(string idempotencyKey, string ocpApimSubscriptionKey, string merchantSerialNumber, CreatePaymentRequest createPaymentRequest, string vippsSystemName = default(string), string vippsSystemVersion = default(string), string vippsSystemPluginName = default(string), string vippsSystemPluginVersion = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'idempotencyKey' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling CreatePaymentsApi->CreatePayment"); + } + + // verify the required parameter 'createPaymentRequest' is set + if (createPaymentRequest == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'createPaymentRequest' when calling CreatePaymentsApi->CreatePayment"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/problem+json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.HeaderParameters.Add("Idempotency-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(idempotencyKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + if (vippsSystemName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemName)); // header parameter + } + if (vippsSystemVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemVersion)); // header parameter + } + if (vippsSystemPluginName != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Name", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginName)); // header parameter + } + if (vippsSystemPluginVersion != null) + { + localVarRequestOptions.HeaderParameters.Add("Vipps-System-Plugin-Version", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(vippsSystemPluginVersion)); // header parameter + } + localVarRequestOptions.Data = createPaymentRequest; + + localVarRequestOptions.Operation = "CreatePaymentsApi.CreatePayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/v1/payments", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreatePayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/src/Vipps.net.Models.Epayment/Api/ForceApproveApi.cs b/src/Vipps.net.Models.Epayment/Api/ForceApproveApi.cs new file mode 100644 index 0000000..1d46c43 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Api/ForceApproveApi.cs @@ -0,0 +1,413 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Vipps.net.Models.Epayment.Client; +using Vipps.net.Models.Epayment.Model; + +namespace Vipps.net.Models.Epayment.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IForceApproveApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Force approve a payment + /// + /// + /// This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// + void ForceApprove(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0); + + /// + /// Force approve a payment + /// + /// + /// This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse ForceApproveWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IForceApproveApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Force approve a payment + /// + /// + /// This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task ForceApproveAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Force approve a payment + /// + /// + /// This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> ForceApproveWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IForceApproveApi : IForceApproveApiSync, IForceApproveApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class ForceApproveApi : IForceApproveApi + { + private Vipps.net.Models.Epayment.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public ForceApproveApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public ForceApproveApi(string basePath) + { + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + new Vipps.net.Models.Epayment.Client.Configuration { BasePath = basePath } + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public ForceApproveApi(Vipps.net.Models.Epayment.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public ForceApproveApi(Vipps.net.Models.Epayment.Client.ISynchronousClient client, Vipps.net.Models.Epayment.Client.IAsynchronousClient asyncClient, Vipps.net.Models.Epayment.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Vipps.net.Models.Epayment.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Vipps.net.Models.Epayment.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Vipps.net.Models.Epayment.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Vipps.net.Models.Epayment.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Force approve a payment This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// + public void ForceApprove(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0) + { + ForceApproveWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey, forceApprove); + } + + /// + /// Force approve a payment This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Vipps.net.Models.Epayment.Client.ApiResponse ForceApproveWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling ForceApproveApi->ForceApprove"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling ForceApproveApi->ForceApprove"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling ForceApproveApi->ForceApprove"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.Data = forceApprove; + + localVarRequestOptions.Operation = "ForceApproveApi.ForceApprove"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/v1/test/payments/{Reference}/approve", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ForceApprove", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Force approve a payment This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task ForceApproveAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await ForceApproveWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, forceApprove, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Force approve a payment This endpoint is only available in the test environment. It allows developers to approve a payment through the ePayment API without the use of the Vipps or MobilePay app. This is useful for automated testing. Express checkout is not supported for this endpoint. Attempted use in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in the Vipps or MobilePay app before this endpoint can be used for that user. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Force approve request body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> ForceApproveWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, ForceApprove forceApprove = default(ForceApprove), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling ForceApproveApi->ForceApprove"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling ForceApproveApi->ForceApprove"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling ForceApproveApi->ForceApprove"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + localVarRequestOptions.Data = forceApprove; + + localVarRequestOptions.Operation = "ForceApproveApi.ForceApprove"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/v1/test/payments/{Reference}/approve", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ForceApprove", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/src/Vipps.net.Models.Epayment/Api/QueryPaymentsApi.cs b/src/Vipps.net.Models.Epayment/Api/QueryPaymentsApi.cs new file mode 100644 index 0000000..849983a --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Api/QueryPaymentsApi.cs @@ -0,0 +1,651 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Vipps.net.Models.Epayment.Client; +using Vipps.net.Models.Epayment.Model; + +namespace Vipps.net.Models.Epayment.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IQueryPaymentsApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Get a payment + /// + /// + /// Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// GetPaymentResponse + GetPaymentResponse GetPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0); + + /// + /// Get a payment + /// + /// + /// Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// ApiResponse of GetPaymentResponse + ApiResponse GetPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0); + /// + /// Get a payment's event log + /// + /// + /// Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// List<PaymentEvent> + List GetPaymentEventLog(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0); + + /// + /// Get a payment's event log + /// + /// + /// Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// ApiResponse of List<PaymentEvent> + ApiResponse> GetPaymentEventLogWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IQueryPaymentsApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Get a payment + /// + /// + /// Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of GetPaymentResponse + System.Threading.Tasks.Task GetPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Get a payment + /// + /// + /// Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetPaymentResponse) + System.Threading.Tasks.Task> GetPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Get a payment's event log + /// + /// + /// Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<PaymentEvent> + System.Threading.Tasks.Task> GetPaymentEventLogAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Get a payment's event log + /// + /// + /// Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<PaymentEvent>) + System.Threading.Tasks.Task>> GetPaymentEventLogWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IQueryPaymentsApi : IQueryPaymentsApiSync, IQueryPaymentsApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class QueryPaymentsApi : IQueryPaymentsApi + { + private Vipps.net.Models.Epayment.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public QueryPaymentsApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public QueryPaymentsApi(string basePath) + { + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + new Vipps.net.Models.Epayment.Client.Configuration { BasePath = basePath } + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public QueryPaymentsApi(Vipps.net.Models.Epayment.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Vipps.net.Models.Epayment.Client.Configuration.MergeConfigurations( + Vipps.net.Models.Epayment.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Vipps.net.Models.Epayment.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public QueryPaymentsApi(Vipps.net.Models.Epayment.Client.ISynchronousClient client, Vipps.net.Models.Epayment.Client.IAsynchronousClient asyncClient, Vipps.net.Models.Epayment.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Vipps.net.Models.Epayment.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Vipps.net.Models.Epayment.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Vipps.net.Models.Epayment.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Vipps.net.Models.Epayment.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Vipps.net.Models.Epayment.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Get a payment Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// GetPaymentResponse + public GetPaymentResponse GetPayment(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = GetPaymentWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey); + return localVarResponse.Data; + } + + /// + /// Get a payment Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// ApiResponse of GetPaymentResponse + public Vipps.net.Models.Epayment.Client.ApiResponse GetPaymentWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling QueryPaymentsApi->GetPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling QueryPaymentsApi->GetPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling QueryPaymentsApi->GetPayment"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + + localVarRequestOptions.Operation = "QueryPaymentsApi.GetPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get("/v1/payments/{Reference}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get a payment Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of GetPaymentResponse + public async System.Threading.Tasks.Task GetPaymentAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse localVarResponse = await GetPaymentWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a payment Get a payment object by its `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetPaymentResponse) + public async System.Threading.Tasks.Task> GetPaymentWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling QueryPaymentsApi->GetPayment"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling QueryPaymentsApi->GetPayment"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling QueryPaymentsApi->GetPayment"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + + localVarRequestOptions.Operation = "QueryPaymentsApi.GetPayment"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/v1/payments/{Reference}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPayment", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get a payment's event log Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// List<PaymentEvent> + public List GetPaymentEventLog(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0) + { + Vipps.net.Models.Epayment.Client.ApiResponse> localVarResponse = GetPaymentEventLogWithHttpInfo(reference, merchantSerialNumber, ocpApimSubscriptionKey); + return localVarResponse.Data; + } + + /// + /// Get a payment's event log Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// ApiResponse of List<PaymentEvent> + public Vipps.net.Models.Epayment.Client.ApiResponse> GetPaymentEventLogWithHttpInfo(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + + localVarRequestOptions.Operation = "QueryPaymentsApi.GetPaymentEventLog"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/v1/payments/{Reference}/events", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPaymentEventLog", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get a payment's event log Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<PaymentEvent> + public async System.Threading.Tasks.Task> GetPaymentEventLogAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Vipps.net.Models.Epayment.Client.ApiResponse> localVarResponse = await GetPaymentEventLogWithHttpInfoAsync(reference, merchantSerialNumber, ocpApimSubscriptionKey, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a payment's event log Get event log for the specified payment's `reference` id. + /// + /// Thrown when fails to make API call + /// + /// + /// The subscription key for a sales unit. See [API keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys/). + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<PaymentEvent>) + public async System.Threading.Tasks.Task>> GetPaymentEventLogWithHttpInfoAsync(string reference, string merchantSerialNumber, string ocpApimSubscriptionKey, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'reference' is set + if (reference == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'reference' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + // verify the required parameter 'merchantSerialNumber' is set + if (merchantSerialNumber == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'merchantSerialNumber' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + // verify the required parameter 'ocpApimSubscriptionKey' is set + if (ocpApimSubscriptionKey == null) + { + throw new Vipps.net.Models.Epayment.Client.ApiException(400, "Missing required parameter 'ocpApimSubscriptionKey' when calling QueryPaymentsApi->GetPaymentEventLog"); + } + + + Vipps.net.Models.Epayment.Client.RequestOptions localVarRequestOptions = new Vipps.net.Models.Epayment.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Vipps.net.Models.Epayment.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("Reference", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(reference)); // path parameter + localVarRequestOptions.HeaderParameters.Add("Merchant-Serial-Number", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(merchantSerialNumber)); // header parameter + localVarRequestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", Vipps.net.Models.Epayment.Client.ClientUtils.ParameterToString(ocpApimSubscriptionKey)); // header parameter + + localVarRequestOptions.Operation = "QueryPaymentsApi.GetPaymentEventLog"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (Bearer-Authorization) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/v1/payments/{Reference}/events", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPaymentEventLog", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/ApiClient.cs b/src/Vipps.net.Models.Epayment/Client/ApiClient.cs new file mode 100644 index 0000000..1fbd860 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ApiClient.cs @@ -0,0 +1,815 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Web; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Vipps.net.Models.Epayment.Model; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + MaxTimeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private RestResponse DeserializeRestResponseFromPolicy(RestClient client, RestRequest request, PolicyResult policyResult) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return client.Deserialize(policyResult.Result); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return Task.FromResult(DeserializeRestResponseFromPolicy(client, request, policyResult)); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return DeserializeRestResponseFromPolicy(client, request, policyResult); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/ApiException.cs b/src/Vipps.net.Models.Epayment/Client/ApiException.cs new file mode 100644 index 0000000..cac4131 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ApiException.cs @@ -0,0 +1,68 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Client/ApiResponse.cs b/src/Vipps.net.Models.Epayment/Client/ApiResponse.cs new file mode 100644 index 0000000..142affa --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ApiResponse.cs @@ -0,0 +1,166 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/ClientUtils.cs b/src/Vipps.net.Models.Epayment/Client/ClientUtils.cs new file mode 100644 index 0000000..06253c6 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ClientUtils.cs @@ -0,0 +1,247 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if(collectionFormat == "deepObject") { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/Configuration.cs b/src/Vipps.net.Models.Epayment/Client/Configuration.cs new file mode 100644 index 0000000..73565fa --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/Configuration.cs @@ -0,0 +1,613 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://api.vipps.no/epayment"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://api.vipps.no/epayment"}, + {"description", "Production environment (uses the production API keys, the official app and live data)"}, + } + }, + { + new Dictionary { + {"url", "https://apitest.vipps.no/epayment"}, + {"description", "Test environment (uses the test API keys, the test app and test data)"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://api.vipps.no/epayment") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + public X509CertificateCollection ClientCertificates { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Vipps.net.Models.Epayment) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.6.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/ExceptionFactory.cs b/src/Vipps.net.Models.Epayment/Client/ExceptionFactory.cs new file mode 100644 index 0000000..aae155f --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ExceptionFactory.cs @@ -0,0 +1,22 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/src/Vipps.net.Models.Epayment/Client/GlobalConfiguration.cs b/src/Vipps.net.Models.Epayment/Client/GlobalConfiguration.cs new file mode 100644 index 0000000..03b50b0 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/GlobalConfiguration.cs @@ -0,0 +1,67 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System.Collections.Generic; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/HttpMethod.cs b/src/Vipps.net.Models.Epayment/Client/HttpMethod.cs new file mode 100644 index 0000000..c284c01 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/HttpMethod.cs @@ -0,0 +1,33 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Http methods supported by swagger + /// + public enum HttpMethod + { + /// HTTP GET request. + Get, + /// HTTP POST request. + Post, + /// HTTP PUT request. + Put, + /// HTTP DELETE request. + Delete, + /// HTTP HEAD request. + Head, + /// HTTP OPTIONS request. + Options, + /// HTTP PATCH request. + Patch + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/IApiAccessor.cs b/src/Vipps.net.Models.Epayment/Client/IApiAccessor.cs new file mode 100644 index 0000000..4df72d0 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/IApiAccessor.cs @@ -0,0 +1,37 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + IReadableConfiguration Configuration { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + string GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/IAsynchronousClient.cs b/src/Vipps.net.Models.Epayment/Client/IAsynchronousClient.cs new file mode 100644 index 0000000..a77accc --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/IAsynchronousClient.cs @@ -0,0 +1,100 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Threading.Tasks; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/IReadableConfiguration.cs b/src/Vipps.net.Models.Epayment/Client/IReadableConfiguration.cs new file mode 100644 index 0000000..d6f1b9c --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/IReadableConfiguration.cs @@ -0,0 +1,141 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the access token. + /// + /// Access token. + string AccessToken { get; } + + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Gets the username. + /// + /// Username. + string Username { get; } + + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Gets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + X509CertificateCollection ClientCertificates { get; } + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/ISynchronousClient.cs b/src/Vipps.net.Models.Epayment/Client/ISynchronousClient.cs new file mode 100644 index 0000000..800fdc8 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/ISynchronousClient.cs @@ -0,0 +1,93 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.IO; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/Multimap.cs b/src/Vipps.net.Models.Epayment/Client/Multimap.cs new file mode 100644 index 0000000..815a694 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/Multimap.cs @@ -0,0 +1,295 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/OpenAPIDateConverter.cs b/src/Vipps.net.Models.Epayment/Client/OpenAPIDateConverter.cs new file mode 100644 index 0000000..13413fd --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/OpenAPIDateConverter.cs @@ -0,0 +1,29 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using Newtonsoft.Json.Converters; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/RequestOptions.cs b/src/Vipps.net.Models.Epayment/Client/RequestOptions.cs new file mode 100644 index 0000000..c2c4c82 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/RequestOptions.cs @@ -0,0 +1,84 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Operation associated with the request path. + /// + public string Operation { get; set; } + + /// + /// Index associated with the operation. + /// + public int OperationIndex { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/src/Vipps.net.Models.Epayment/Client/RetryConfiguration.cs b/src/Vipps.net.Models.Epayment/Client/RetryConfiguration.cs new file mode 100644 index 0000000..6ca7780 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Client/RetryConfiguration.cs @@ -0,0 +1,31 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Polly; +using RestSharp; + +namespace Vipps.net.Models.Epayment.Client +{ + /// + /// Configuration class to set the polly retry policies to be applied to the requests. + /// + public static class RetryConfiguration + { + /// + /// Retry policy + /// + public static Policy RetryPolicy { get; set; } + + /// + /// Async retry policy + /// + public static AsyncPolicy AsyncRetryPolicy { get; set; } + } +} diff --git a/src/Vipps.net.Models.Epayment/Model/AbstractOpenAPISchema.cs b/src/Vipps.net.Models.Epayment/Model/AbstractOpenAPISchema.cs new file mode 100644 index 0000000..e288afd --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/AbstractOpenAPISchema.cs @@ -0,0 +1,76 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/src/Vipps.net.Models.Epayment/Model/Address.cs b/src/Vipps.net.Models.Epayment/Model/Address.cs new file mode 100644 index 0000000..8222389 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Address.cs @@ -0,0 +1,165 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Address + /// + [DataContract(Name = "Address")] + public partial class Address : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Address() { } + /// + /// Initializes a new instance of the class. + /// + /// city (required). + /// Country code according to ISO 3166-2 (two capital letters). (required). + /// Unique ID of the address, always provided in response from Vipps MobilePay.. + /// Array of addressLines, for example street name, number, etc. (required). + /// Postcode of the address in local country format. (required). + public Address(string city = default(string), string country = default(string), Guid id = default(Guid), List lines = default(List), string postCode = default(string)) + { + // to ensure "city" is required (not null) + if (city == null) + { + throw new ArgumentNullException("city is a required property for Address and cannot be null"); + } + this.City = city; + // to ensure "country" is required (not null) + if (country == null) + { + throw new ArgumentNullException("country is a required property for Address and cannot be null"); + } + this.Country = country; + // to ensure "lines" is required (not null) + if (lines == null) + { + throw new ArgumentNullException("lines is a required property for Address and cannot be null"); + } + this.Lines = lines; + // to ensure "postCode" is required (not null) + if (postCode == null) + { + throw new ArgumentNullException("postCode is a required property for Address and cannot be null"); + } + this.PostCode = postCode; + this.Id = id; + } + + /// + /// Gets or Sets City + /// + /* + Oslo + */ + [DataMember(Name = "city", IsRequired = true, EmitDefaultValue = true)] + public string City { get; set; } + + /// + /// Country code according to ISO 3166-2 (two capital letters). + /// + /// Country code according to ISO 3166-2 (two capital letters). + /* + NO + */ + [DataMember(Name = "country", IsRequired = true, EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Unique ID of the address, always provided in response from Vipps MobilePay. + /// + /// Unique ID of the address, always provided in response from Vipps MobilePay. + [DataMember(Name = "id", EmitDefaultValue = false)] + public Guid Id { get; set; } + + /// + /// Array of addressLines, for example street name, number, etc. + /// + /// Array of addressLines, for example street name, number, etc. + [DataMember(Name = "lines", IsRequired = true, EmitDefaultValue = true)] + public List Lines { get; set; } + + /// + /// Postcode of the address in local country format. + /// + /// Postcode of the address in local country format. + /* + 0154 + */ + [DataMember(Name = "postCode", IsRequired = true, EmitDefaultValue = true)] + public string PostCode { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Address {\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Lines: ").Append(Lines).Append("\n"); + sb.Append(" PostCode: ").Append(PostCode).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.Country != null) { + // Country (string) pattern + Regex regexCountry = new Regex(@"^[A-Z]{2}$", RegexOptions.CultureInvariant); + if (!regexCountry.Match(this.Country).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Country, must match a pattern of " + regexCountry, new [] { "Country" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Aggregate.cs b/src/Vipps.net.Models.Epayment/Model/Aggregate.cs new file mode 100644 index 0000000..6271cff --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Aggregate.cs @@ -0,0 +1,134 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Aggregate + /// + [DataContract(Name = "Aggregate")] + public partial class Aggregate : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Aggregate() { } + /// + /// Initializes a new instance of the class. + /// + /// authorizedAmount (required). + /// cancelledAmount (required). + /// capturedAmount (required). + /// refundedAmount (required). + public Aggregate(Amount authorizedAmount = default(Amount), Amount cancelledAmount = default(Amount), Amount capturedAmount = default(Amount), Amount refundedAmount = default(Amount)) + { + // to ensure "authorizedAmount" is required (not null) + if (authorizedAmount == null) + { + throw new ArgumentNullException("authorizedAmount is a required property for Aggregate and cannot be null"); + } + this.AuthorizedAmount = authorizedAmount; + // to ensure "cancelledAmount" is required (not null) + if (cancelledAmount == null) + { + throw new ArgumentNullException("cancelledAmount is a required property for Aggregate and cannot be null"); + } + this.CancelledAmount = cancelledAmount; + // to ensure "capturedAmount" is required (not null) + if (capturedAmount == null) + { + throw new ArgumentNullException("capturedAmount is a required property for Aggregate and cannot be null"); + } + this.CapturedAmount = capturedAmount; + // to ensure "refundedAmount" is required (not null) + if (refundedAmount == null) + { + throw new ArgumentNullException("refundedAmount is a required property for Aggregate and cannot be null"); + } + this.RefundedAmount = refundedAmount; + } + + /// + /// Gets or Sets AuthorizedAmount + /// + [DataMember(Name = "authorizedAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount AuthorizedAmount { get; set; } + + /// + /// Gets or Sets CancelledAmount + /// + [DataMember(Name = "cancelledAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount CancelledAmount { get; set; } + + /// + /// Gets or Sets CapturedAmount + /// + [DataMember(Name = "capturedAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount CapturedAmount { get; set; } + + /// + /// Gets or Sets RefundedAmount + /// + [DataMember(Name = "refundedAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount RefundedAmount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Aggregate {\n"); + sb.Append(" AuthorizedAmount: ").Append(AuthorizedAmount).Append("\n"); + sb.Append(" CancelledAmount: ").Append(CancelledAmount).Append("\n"); + sb.Append(" CapturedAmount: ").Append(CapturedAmount).Append("\n"); + sb.Append(" RefundedAmount: ").Append(RefundedAmount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/AirlineData.cs b/src/Vipps.net.Models.Epayment/Model/AirlineData.cs new file mode 100644 index 0000000..d4405a0 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/AirlineData.cs @@ -0,0 +1,220 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Airline related data. If present, `passengerName`, `airlineCode`, `airlineDesignatorCode`, and `agencyInvoiceNumber` are all required. + /// + [DataContract(Name = "AirlineData")] + public partial class AirlineData : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AirlineData() { } + /// + /// Initializes a new instance of the class. + /// + /// Reference number for the invoice, issued by the agency. (required). + /// IATA 3-digit accounting code (PAX); numeric. It identifies the carrier. eg KLM = 074. (required). + /// IATA 2-letter accounting code (PAX); alphabetical. It identifies the carrier. Eg KLM = KL. (required). + /// Passenger name, initials, and a title. (required). + /// The ticket's unique identifier.. + public AirlineData(string agencyInvoiceNumber = default(string), string airlineCode = default(string), string airlineDesignatorCode = default(string), string passengerName = default(string), string ticketNumber = default(string)) + { + // to ensure "agencyInvoiceNumber" is required (not null) + if (agencyInvoiceNumber == null) + { + throw new ArgumentNullException("agencyInvoiceNumber is a required property for AirlineData and cannot be null"); + } + this.AgencyInvoiceNumber = agencyInvoiceNumber; + // to ensure "airlineCode" is required (not null) + if (airlineCode == null) + { + throw new ArgumentNullException("airlineCode is a required property for AirlineData and cannot be null"); + } + this.AirlineCode = airlineCode; + // to ensure "airlineDesignatorCode" is required (not null) + if (airlineDesignatorCode == null) + { + throw new ArgumentNullException("airlineDesignatorCode is a required property for AirlineData and cannot be null"); + } + this.AirlineDesignatorCode = airlineDesignatorCode; + // to ensure "passengerName" is required (not null) + if (passengerName == null) + { + throw new ArgumentNullException("passengerName is a required property for AirlineData and cannot be null"); + } + this.PassengerName = passengerName; + this.TicketNumber = ticketNumber; + } + + /// + /// Reference number for the invoice, issued by the agency. + /// + /// Reference number for the invoice, issued by the agency. + [DataMember(Name = "agencyInvoiceNumber", IsRequired = true, EmitDefaultValue = true)] + public string AgencyInvoiceNumber { get; set; } + + /// + /// IATA 3-digit accounting code (PAX); numeric. It identifies the carrier. eg KLM = 074. + /// + /// IATA 3-digit accounting code (PAX); numeric. It identifies the carrier. eg KLM = 074. + /* + 074 + */ + [DataMember(Name = "airlineCode", IsRequired = true, EmitDefaultValue = true)] + public string AirlineCode { get; set; } + + /// + /// IATA 2-letter accounting code (PAX); alphabetical. It identifies the carrier. Eg KLM = KL. + /// + /// IATA 2-letter accounting code (PAX); alphabetical. It identifies the carrier. Eg KLM = KL. + /* + KL + */ + [DataMember(Name = "airlineDesignatorCode", IsRequired = true, EmitDefaultValue = true)] + public string AirlineDesignatorCode { get; set; } + + /// + /// Passenger name, initials, and a title. + /// + /// Passenger name, initials, and a title. + /* + FLYER / MARY MS. + */ + [DataMember(Name = "passengerName", IsRequired = true, EmitDefaultValue = true)] + public string PassengerName { get; set; } + + /// + /// The ticket's unique identifier. + /// + /// The ticket's unique identifier. + /* + 123-1234567890 + */ + [DataMember(Name = "ticketNumber", EmitDefaultValue = false)] + public string TicketNumber { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AirlineData {\n"); + sb.Append(" AgencyInvoiceNumber: ").Append(AgencyInvoiceNumber).Append("\n"); + sb.Append(" AirlineCode: ").Append(AirlineCode).Append("\n"); + sb.Append(" AirlineDesignatorCode: ").Append(AirlineDesignatorCode).Append("\n"); + sb.Append(" PassengerName: ").Append(PassengerName).Append("\n"); + sb.Append(" TicketNumber: ").Append(TicketNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // AgencyInvoiceNumber (string) maxLength + if (this.AgencyInvoiceNumber != null && this.AgencyInvoiceNumber.Length > 6) + { + yield return new ValidationResult("Invalid value for AgencyInvoiceNumber, length must be less than 6.", new [] { "AgencyInvoiceNumber" }); + } + + // AgencyInvoiceNumber (string) minLength + if (this.AgencyInvoiceNumber != null && this.AgencyInvoiceNumber.Length < 1) + { + yield return new ValidationResult("Invalid value for AgencyInvoiceNumber, length must be greater than 1.", new [] { "AgencyInvoiceNumber" }); + } + + // AirlineCode (string) maxLength + if (this.AirlineCode != null && this.AirlineCode.Length > 3) + { + yield return new ValidationResult("Invalid value for AirlineCode, length must be less than 3.", new [] { "AirlineCode" }); + } + + // AirlineCode (string) minLength + if (this.AirlineCode != null && this.AirlineCode.Length < 3) + { + yield return new ValidationResult("Invalid value for AirlineCode, length must be greater than 3.", new [] { "AirlineCode" }); + } + + // AirlineDesignatorCode (string) maxLength + if (this.AirlineDesignatorCode != null && this.AirlineDesignatorCode.Length > 2) + { + yield return new ValidationResult("Invalid value for AirlineDesignatorCode, length must be less than 2.", new [] { "AirlineDesignatorCode" }); + } + + // AirlineDesignatorCode (string) minLength + if (this.AirlineDesignatorCode != null && this.AirlineDesignatorCode.Length < 2) + { + yield return new ValidationResult("Invalid value for AirlineDesignatorCode, length must be greater than 2.", new [] { "AirlineDesignatorCode" }); + } + + // PassengerName (string) maxLength + if (this.PassengerName != null && this.PassengerName.Length > 49) + { + yield return new ValidationResult("Invalid value for PassengerName, length must be less than 49.", new [] { "PassengerName" }); + } + + // PassengerName (string) minLength + if (this.PassengerName != null && this.PassengerName.Length < 1) + { + yield return new ValidationResult("Invalid value for PassengerName, length must be greater than 1.", new [] { "PassengerName" }); + } + + // TicketNumber (string) maxLength + if (this.TicketNumber != null && this.TicketNumber.Length > 150) + { + yield return new ValidationResult("Invalid value for TicketNumber, length must be less than 150.", new [] { "TicketNumber" }); + } + + // TicketNumber (string) minLength + if (this.TicketNumber != null && this.TicketNumber.Length < 1) + { + yield return new ValidationResult("Invalid value for TicketNumber, length must be greater than 1.", new [] { "TicketNumber" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Amount.cs b/src/Vipps.net.Models.Epayment/Model/Amount.cs new file mode 100644 index 0000000..effb46f --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Amount.cs @@ -0,0 +1,112 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Amount object, containing a `value` and a `currency`. + /// + [DataContract(Name = "Amount")] + public partial class Amount : IValidatableObject + { + + /// + /// Gets or Sets Currency + /// + [DataMember(Name = "currency", IsRequired = true, EmitDefaultValue = true)] + public Currency Currency { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Amount() { } + /// + /// Initializes a new instance of the class. + /// + /// currency (required). + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 NOK should be written as 1000. The minimum amounts allowed are NOK 100 øre, DKK 1 øre, EUR 1 cent. (required). + public Amount(Currency currency = default(Currency), long value = default(long)) + { + this.Currency = currency; + this.Value = value; + } + + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 NOK should be written as 1000. The minimum amounts allowed are NOK 100 øre, DKK 1 øre, EUR 1 cent. + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 NOK should be written as 1000. The minimum amounts allowed are NOK 100 øre, DKK 1 øre, EUR 1 cent. + /* + 49900 + */ + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public long Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Amount {\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Value (long) maximum + if (this.Value > (long)65000000) + { + yield return new ValidationResult("Invalid value for Value, must be a value less than or equal to 65000000.", new [] { "Value" }); + } + + // Value (long) minimum + if (this.Value < (long)0) + { + yield return new ValidationResult("Invalid value for Value, must be a value greater than or equal to 0.", new [] { "Value" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Barcode.cs b/src/Vipps.net.Models.Epayment/Model/Barcode.cs new file mode 100644 index 0000000..151af20 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Barcode.cs @@ -0,0 +1,101 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Barcode + /// + [DataContract(Name = "Barcode")] + public partial class Barcode : IValidatableObject + { + + /// + /// Gets or Sets Format + /// + [DataMember(Name = "format", IsRequired = true, EmitDefaultValue = true)] + public BarcodeFormatEnum Format { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Barcode() { } + /// + /// Initializes a new instance of the class. + /// + /// format (required). + /// data (required). + public Barcode(BarcodeFormatEnum format = default(BarcodeFormatEnum), string data = default(string)) + { + this.Format = format; + // to ensure "data" is required (not null) + if (data == null) + { + throw new ArgumentNullException("data is a required property for Barcode and cannot be null"); + } + this.Data = data; + } + + /// + /// Gets or Sets Data + /// + [DataMember(Name = "data", IsRequired = true, EmitDefaultValue = true)] + public string Data { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Barcode {\n"); + sb.Append(" Format: ").Append(Format).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/BarcodeFormatEnum.cs b/src/Vipps.net.Models.Epayment/Model/BarcodeFormatEnum.cs new file mode 100644 index 0000000..17db72e --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/BarcodeFormatEnum.cs @@ -0,0 +1,53 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Defines BarcodeFormatEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BarcodeFormatEnum + { + /// + /// Enum EAN13 for value: EAN-13 + /// + [EnumMember(Value = "EAN-13")] + EAN13 = 1, + + /// + /// Enum CODE39 for value: CODE 39 + /// + [EnumMember(Value = "CODE 39")] + CODE39 = 2, + + /// + /// Enum CODE128 for value: CODE 128 + /// + [EnumMember(Value = "CODE 128")] + CODE128 = 3 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/BottomLine.cs b/src/Vipps.net.Models.Epayment/Model/BottomLine.cs new file mode 100644 index 0000000..5b5da85 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/BottomLine.cs @@ -0,0 +1,246 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Summary of the order. Total amount and total. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + [DataContract(Name = "BottomLine")] + public partial class BottomLine : IValidatableObject + { + + /// + /// Gets or Sets Currency + /// + [DataMember(Name = "currency", IsRequired = true, EmitDefaultValue = true)] + public CurrencyEnum Currency { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BottomLine() { } + /// + /// Initializes a new instance of the class. + /// + /// currency (required). + /// Tip amount for the order. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000.. + /// Amount paid by gift card or coupon.. + /// POS ID is the device number of the POS terminal. + /// Deprecated, sum will be calculated based on the sum of the orderLines. + /// Deprecated, tax will be calculated based on the sum of the totalTaxAmount field on each orderLine. + /// Deprecated, discount will be calculated based on the sum of the discount field on each orderLine. + /// Deprecated, use a regular orderLine with \"isShipping\" flag. Using this will result in faulty calculation of sum and tax.. + /// shippingInfo. + /// paymentSources. + /// barcode. + /// receiptNumber. + /// Deprecated, use \"posId\" instead.. + public BottomLine(CurrencyEnum currency = default(CurrencyEnum), long? tipAmount = default(long?), long? giftCardAmount = default(long?), string posId = default(string), long? totalAmount = default(long?), long? totalTax = default(long?), long? totalDiscount = default(long?), long? shippingAmount = default(long?), ShippingInfo shippingInfo = default(ShippingInfo), PaymentSources paymentSources = default(PaymentSources), Barcode barcode = default(Barcode), string receiptNumber = default(string), string terminalId = default(string)) + { + this.Currency = currency; + this.TipAmount = tipAmount; + this.GiftCardAmount = giftCardAmount; + this.PosId = posId; + this.TotalAmount = totalAmount; + this.TotalTax = totalTax; + this.TotalDiscount = totalDiscount; + this.ShippingAmount = shippingAmount; + this.ShippingInfo = shippingInfo; + this.PaymentSources = paymentSources; + this.Barcode = barcode; + this.ReceiptNumber = receiptNumber; + this.TerminalId = terminalId; + } + + /// + /// Tip amount for the order. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + /// Tip amount for the order. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /* + 2000 + */ + [DataMember(Name = "tipAmount", EmitDefaultValue = true)] + public long? TipAmount { get; set; } + + /// + /// Amount paid by gift card or coupon. + /// + /// Amount paid by gift card or coupon. + /* + 20000 + */ + [DataMember(Name = "giftCardAmount", EmitDefaultValue = true)] + [Obsolete] + public long? GiftCardAmount { get; set; } + + /// + /// POS ID is the device number of the POS terminal + /// + /// POS ID is the device number of the POS terminal + [DataMember(Name = "posId", EmitDefaultValue = true)] + public string PosId { get; set; } + + /// + /// Deprecated, sum will be calculated based on the sum of the orderLines + /// + /// Deprecated, sum will be calculated based on the sum of the orderLines + [DataMember(Name = "totalAmount", EmitDefaultValue = true)] + [Obsolete] + public long? TotalAmount { get; set; } + + /// + /// Deprecated, tax will be calculated based on the sum of the totalTaxAmount field on each orderLine + /// + /// Deprecated, tax will be calculated based on the sum of the totalTaxAmount field on each orderLine + [DataMember(Name = "totalTax", EmitDefaultValue = true)] + [Obsolete] + public long? TotalTax { get; set; } + + /// + /// Deprecated, discount will be calculated based on the sum of the discount field on each orderLine + /// + /// Deprecated, discount will be calculated based on the sum of the discount field on each orderLine + [DataMember(Name = "totalDiscount", EmitDefaultValue = true)] + [Obsolete] + public long? TotalDiscount { get; set; } + + /// + /// Deprecated, use a regular orderLine with \"isShipping\" flag. Using this will result in faulty calculation of sum and tax. + /// + /// Deprecated, use a regular orderLine with \"isShipping\" flag. Using this will result in faulty calculation of sum and tax. + [DataMember(Name = "shippingAmount", EmitDefaultValue = true)] + [Obsolete] + public long? ShippingAmount { get; set; } + + /// + /// Gets or Sets ShippingInfo + /// + [DataMember(Name = "shippingInfo", EmitDefaultValue = false)] + [Obsolete] + public ShippingInfo ShippingInfo { get; set; } + + /// + /// Gets or Sets PaymentSources + /// + [DataMember(Name = "paymentSources", EmitDefaultValue = false)] + public PaymentSources PaymentSources { get; set; } + + /// + /// Gets or Sets Barcode + /// + [DataMember(Name = "barcode", EmitDefaultValue = false)] + public Barcode Barcode { get; set; } + + /// + /// Gets or Sets ReceiptNumber + /// + [DataMember(Name = "receiptNumber", EmitDefaultValue = true)] + public string ReceiptNumber { get; set; } + + /// + /// Deprecated, use \"posId\" instead. + /// + /// Deprecated, use \"posId\" instead. + [DataMember(Name = "terminalId", EmitDefaultValue = true)] + [Obsolete] + public string TerminalId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BottomLine {\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" TipAmount: ").Append(TipAmount).Append("\n"); + sb.Append(" GiftCardAmount: ").Append(GiftCardAmount).Append("\n"); + sb.Append(" PosId: ").Append(PosId).Append("\n"); + sb.Append(" TotalAmount: ").Append(TotalAmount).Append("\n"); + sb.Append(" TotalTax: ").Append(TotalTax).Append("\n"); + sb.Append(" TotalDiscount: ").Append(TotalDiscount).Append("\n"); + sb.Append(" ShippingAmount: ").Append(ShippingAmount).Append("\n"); + sb.Append(" ShippingInfo: ").Append(ShippingInfo).Append("\n"); + sb.Append(" PaymentSources: ").Append(PaymentSources).Append("\n"); + sb.Append(" Barcode: ").Append(Barcode).Append("\n"); + sb.Append(" ReceiptNumber: ").Append(ReceiptNumber).Append("\n"); + sb.Append(" TerminalId: ").Append(TerminalId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TipAmount (long?) minimum + if (this.TipAmount < (long?)0) + { + yield return new ValidationResult("Invalid value for TipAmount, must be a value greater than or equal to 0.", new [] { "TipAmount" }); + } + + // GiftCardAmount (long?) minimum + if (this.GiftCardAmount < (long?)0) + { + yield return new ValidationResult("Invalid value for GiftCardAmount, must be a value greater than or equal to 0.", new [] { "GiftCardAmount" }); + } + + // TotalTax (long?) minimum + if (this.TotalTax < (long?)0) + { + yield return new ValidationResult("Invalid value for TotalTax, must be a value greater than or equal to 0.", new [] { "TotalTax" }); + } + + // TotalDiscount (long?) minimum + if (this.TotalDiscount < (long?)0) + { + yield return new ValidationResult("Invalid value for TotalDiscount, must be a value greater than or equal to 0.", new [] { "TotalDiscount" }); + } + + // ShippingAmount (long?) minimum + if (this.ShippingAmount < (long?)0) + { + yield return new ValidationResult("Invalid value for ShippingAmount, must be a value greater than or equal to 0.", new [] { "ShippingAmount" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CancelModificationRequest.cs b/src/Vipps.net.Models.Epayment/Model/CancelModificationRequest.cs new file mode 100644 index 0000000..dcea9a2 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CancelModificationRequest.cs @@ -0,0 +1,83 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// CancelModificationRequest + /// + [DataContract(Name = "CancelModificationRequest")] + public partial class CancelModificationRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Only cancel transaction if it has not been authorized. If this flag is set and the transaction has been authorized, the reserved amount will not be canceled.. + public CancelModificationRequest(bool cancelTransactionOnly = default(bool)) + { + this.CancelTransactionOnly = cancelTransactionOnly; + } + + /// + /// Only cancel transaction if it has not been authorized. If this flag is set and the transaction has been authorized, the reserved amount will not be canceled. + /// + /// Only cancel transaction if it has not been authorized. If this flag is set and the transaction has been authorized, the reserved amount will not be canceled. + [DataMember(Name = "cancelTransactionOnly", EmitDefaultValue = true)] + public bool CancelTransactionOnly { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CancelModificationRequest {\n"); + sb.Append(" CancelTransactionOnly: ").Append(CancelTransactionOnly).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CaptureModificationRequest.cs b/src/Vipps.net.Models.Epayment/Model/CaptureModificationRequest.cs new file mode 100644 index 0000000..d786180 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CaptureModificationRequest.cs @@ -0,0 +1,92 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// CaptureModificationRequest + /// + [DataContract(Name = "CaptureModificationRequest")] + public partial class CaptureModificationRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CaptureModificationRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// modificationAmount (required). + public CaptureModificationRequest(Amount modificationAmount = default(Amount)) + { + // to ensure "modificationAmount" is required (not null) + if (modificationAmount == null) + { + throw new ArgumentNullException("modificationAmount is a required property for CaptureModificationRequest and cannot be null"); + } + this.ModificationAmount = modificationAmount; + } + + /// + /// Gets or Sets ModificationAmount + /// + [DataMember(Name = "modificationAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount ModificationAmount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CaptureModificationRequest {\n"); + sb.Append(" ModificationAmount: ").Append(ModificationAmount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequest.cs b/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequest.cs new file mode 100644 index 0000000..ba50e40 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequest.cs @@ -0,0 +1,379 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The `CreatePaymentRequest` object. + /// + [DataContract(Name = "CreatePaymentRequest")] + public partial class CreatePaymentRequest : IValidatableObject + { + /// + /// The type of customer interaction that triggers the purchase. `CUSTOMER_PRESENT` means that the customer is physically present at the point of sale when the payment is made, typically in a store. + /// + /// The type of customer interaction that triggers the purchase. `CUSTOMER_PRESENT` means that the customer is physically present at the point of sale when the payment is made, typically in a store. + [JsonConverter(typeof(StringEnumConverter))] + public enum CustomerInteractionEnum + { + /// + /// Enum CUSTOMER_PRESENT for value: CUSTOMER_PRESENT + /// + [EnumMember(Value = "CUSTOMER_PRESENT")] + CUSTOMER_PRESENT = 1, + + /// + /// Enum CUSTOMER_NOT_PRESENT for value: CUSTOMER_NOT_PRESENT + /// + [EnumMember(Value = "CUSTOMER_NOT_PRESENT")] + CUSTOMER_NOT_PRESENT = 2 + } + + + /// + /// The type of customer interaction that triggers the purchase. `CUSTOMER_PRESENT` means that the customer is physically present at the point of sale when the payment is made, typically in a store. + /// + /// The type of customer interaction that triggers the purchase. `CUSTOMER_PRESENT` means that the customer is physically present at the point of sale when the payment is made, typically in a store. + /* + CUSTOMER_NOT_PRESENT + */ + [DataMember(Name = "customerInteraction", EmitDefaultValue = false)] + public CustomerInteractionEnum? CustomerInteraction { get; set; } + /// + /// The flow for bringing the user to the Vipps or MobilePay app's payment confirmation screen. If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer` is required. If `userFlow` is `WEB_REDIRECT`, a valid value for `returnUrl` is required. `WEB_REDIRECT` is the normal flow for browser-based payment flows. If on a mobile device, the Vipps or MobilePay app will open. A valid value for `returnUrl` is required. Otherwise, the [landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/) will open. `NATIVE_REDIRECT` is for automatic app-switch between the merchant's native app and the Vipps or MobilePay app. `PUSH_MESSAGE` is to skip the landing page for payments initiated on a device other than the user's phone. The user gets a push message that opens the payment in the app. This requires a valid `customer` field. `QR` returns a QR code that can be scanned to complete the payment. + /// + /// The flow for bringing the user to the Vipps or MobilePay app's payment confirmation screen. If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer` is required. If `userFlow` is `WEB_REDIRECT`, a valid value for `returnUrl` is required. `WEB_REDIRECT` is the normal flow for browser-based payment flows. If on a mobile device, the Vipps or MobilePay app will open. A valid value for `returnUrl` is required. Otherwise, the [landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/) will open. `NATIVE_REDIRECT` is for automatic app-switch between the merchant's native app and the Vipps or MobilePay app. `PUSH_MESSAGE` is to skip the landing page for payments initiated on a device other than the user's phone. The user gets a push message that opens the payment in the app. This requires a valid `customer` field. `QR` returns a QR code that can be scanned to complete the payment. + [JsonConverter(typeof(StringEnumConverter))] + public enum UserFlowEnum + { + /// + /// Enum PUSH_MESSAGE for value: PUSH_MESSAGE + /// + [EnumMember(Value = "PUSH_MESSAGE")] + PUSH_MESSAGE = 1, + + /// + /// Enum NATIVE_REDIRECT for value: NATIVE_REDIRECT + /// + [EnumMember(Value = "NATIVE_REDIRECT")] + NATIVE_REDIRECT = 2, + + /// + /// Enum WEB_REDIRECT for value: WEB_REDIRECT + /// + [EnumMember(Value = "WEB_REDIRECT")] + WEB_REDIRECT = 3, + + /// + /// Enum QR for value: QR + /// + [EnumMember(Value = "QR")] + QR = 4 + } + + + /// + /// The flow for bringing the user to the Vipps or MobilePay app's payment confirmation screen. If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer` is required. If `userFlow` is `WEB_REDIRECT`, a valid value for `returnUrl` is required. `WEB_REDIRECT` is the normal flow for browser-based payment flows. If on a mobile device, the Vipps or MobilePay app will open. A valid value for `returnUrl` is required. Otherwise, the [landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/) will open. `NATIVE_REDIRECT` is for automatic app-switch between the merchant's native app and the Vipps or MobilePay app. `PUSH_MESSAGE` is to skip the landing page for payments initiated on a device other than the user's phone. The user gets a push message that opens the payment in the app. This requires a valid `customer` field. `QR` returns a QR code that can be scanned to complete the payment. + /// + /// The flow for bringing the user to the Vipps or MobilePay app's payment confirmation screen. If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer` is required. If `userFlow` is `WEB_REDIRECT`, a valid value for `returnUrl` is required. `WEB_REDIRECT` is the normal flow for browser-based payment flows. If on a mobile device, the Vipps or MobilePay app will open. A valid value for `returnUrl` is required. Otherwise, the [landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/) will open. `NATIVE_REDIRECT` is for automatic app-switch between the merchant's native app and the Vipps or MobilePay app. `PUSH_MESSAGE` is to skip the landing page for payments initiated on a device other than the user's phone. The user gets a push message that opens the payment in the app. This requires a valid `customer` field. `QR` returns a QR code that can be scanned to complete the payment. + /* + NATIVE_REDIRECT + */ + [DataMember(Name = "userFlow", IsRequired = true, EmitDefaultValue = true)] + public UserFlowEnum UserFlow { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CreatePaymentRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// customer. + /// Minimum age in years required for the customer to make the purchase.. + /// The type of customer interaction that triggers the purchase. `CUSTOMER_PRESENT` means that the customer is physically present at the point of sale when the payment is made, typically in a store. (default to CustomerInteractionEnum.CUSTOMER_NOT_PRESENT). + /// industryData. + /// paymentMethod (required). + /// profile. + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + /// The URL the user is returned to after the payment session. The URL must use the `https://` scheme or a custom URL scheme.. + /// The flow for bringing the user to the Vipps or MobilePay app's payment confirmation screen. If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer` is required. If `userFlow` is `WEB_REDIRECT`, a valid value for `returnUrl` is required. `WEB_REDIRECT` is the normal flow for browser-based payment flows. If on a mobile device, the Vipps or MobilePay app will open. A valid value for `returnUrl` is required. Otherwise, the [landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/) will open. `NATIVE_REDIRECT` is for automatic app-switch between the merchant's native app and the Vipps or MobilePay app. `PUSH_MESSAGE` is to skip the landing page for payments initiated on a device other than the user's phone. The user gets a push message that opens the payment in the app. This requires a valid `customer` field. `QR` returns a QR code that can be scanned to complete the payment. (required). + /// The payment will expire at the given date and time. The format must adhere to RFC 3339. The value must be more than 10 minutes and less than 60 days in the future. Can only be combined with `userFlow: PUSH_MESSAGE` or `userFlow: QR`. If `ExpiresAt` is set, `receipt` also must be set.. + /// qrFormat. + /// The payment description summary that will be provided to the user through the app, the merchant portal, and the settlement files. See the [recommendations](/docs/knowledge-base/transactiontext/).. + /// receipt. + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs.. + /// The URL where a receipt can be viewed or downloaded. The URL must use the `https://` scheme or a custom URL scheme.. + public CreatePaymentRequest(Amount amount = default(Amount), Customer customer = default(Customer), int? minimumUserAge = default(int?), CustomerInteractionEnum? customerInteraction = CustomerInteractionEnum.CUSTOMER_NOT_PRESENT, IndustryData industryData = default(IndustryData), PaymentMethod paymentMethod = default(PaymentMethod), ProfileRequest profile = default(ProfileRequest), string reference = default(string), string returnUrl = default(string), UserFlowEnum userFlow = default(UserFlowEnum), string expiresAt = default(string), CreatePaymentRequestQrFormat qrFormat = default(CreatePaymentRequestQrFormat), string paymentDescription = default(string), Receipt receipt = default(Receipt), Dictionary metadata = default(Dictionary), string receiptUrl = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for CreatePaymentRequest and cannot be null"); + } + this.Amount = amount; + // to ensure "paymentMethod" is required (not null) + if (paymentMethod == null) + { + throw new ArgumentNullException("paymentMethod is a required property for CreatePaymentRequest and cannot be null"); + } + this.PaymentMethod = paymentMethod; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for CreatePaymentRequest and cannot be null"); + } + this.Reference = reference; + this.UserFlow = userFlow; + this.Customer = customer; + this.MinimumUserAge = minimumUserAge; + this.CustomerInteraction = customerInteraction; + this.IndustryData = industryData; + this.Profile = profile; + this.ReturnUrl = returnUrl; + this.ExpiresAt = expiresAt; + this.QrFormat = qrFormat; + this.PaymentDescription = paymentDescription; + this.Receipt = receipt; + this.Metadata = metadata; + this.ReceiptUrl = receiptUrl; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Customer + /// + [DataMember(Name = "customer", EmitDefaultValue = false)] + public Customer Customer { get; set; } + + /// + /// Minimum age in years required for the customer to make the purchase. + /// + /// Minimum age in years required for the customer to make the purchase. + /* + 16 + */ + [DataMember(Name = "minimumUserAge", EmitDefaultValue = true)] + public int? MinimumUserAge { get; set; } + + /// + /// Gets or Sets IndustryData + /// + [DataMember(Name = "industryData", EmitDefaultValue = false)] + public IndustryData IndustryData { get; set; } + + /// + /// Gets or Sets PaymentMethod + /// + [DataMember(Name = "paymentMethod", IsRequired = true, EmitDefaultValue = true)] + public PaymentMethod PaymentMethod { get; set; } + + /// + /// Gets or Sets Profile + /// + [DataMember(Name = "profile", EmitDefaultValue = false)] + public ProfileRequest Profile { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// The URL the user is returned to after the payment session. The URL must use the `https://` scheme or a custom URL scheme. + /// + /// The URL the user is returned to after the payment session. The URL must use the `https://` scheme or a custom URL scheme. + /* + https://example.com/redirect?orderId=acme-shop-123-order123abc + */ + [DataMember(Name = "returnUrl", EmitDefaultValue = false)] + public string ReturnUrl { get; set; } + + /// + /// The payment will expire at the given date and time. The format must adhere to RFC 3339. The value must be more than 10 minutes and less than 60 days in the future. Can only be combined with `userFlow: PUSH_MESSAGE` or `userFlow: QR`. If `ExpiresAt` is set, `receipt` also must be set. + /// + /// The payment will expire at the given date and time. The format must adhere to RFC 3339. The value must be more than 10 minutes and less than 60 days in the future. Can only be combined with `userFlow: PUSH_MESSAGE` or `userFlow: QR`. If `ExpiresAt` is set, `receipt` also must be set. + /* + 2023-02-26T17:32:28Z + */ + [DataMember(Name = "expiresAt", EmitDefaultValue = true)] + public string ExpiresAt { get; set; } + + /// + /// Gets or Sets QrFormat + /// + [DataMember(Name = "qrFormat", EmitDefaultValue = true)] + public CreatePaymentRequestQrFormat QrFormat { get; set; } + + /// + /// The payment description summary that will be provided to the user through the app, the merchant portal, and the settlement files. See the [recommendations](/docs/knowledge-base/transactiontext/). + /// + /// The payment description summary that will be provided to the user through the app, the merchant portal, and the settlement files. See the [recommendations](/docs/knowledge-base/transactiontext/). + /* + Temporary reservation of maximum amount. You will only be charged for the actual use. + */ + [DataMember(Name = "paymentDescription", EmitDefaultValue = false)] + public string PaymentDescription { get; set; } + + /// + /// Gets or Sets Receipt + /// + [DataMember(Name = "receipt", EmitDefaultValue = false)] + public Receipt Receipt { get; set; } + + /// + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs. + /// + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs. + /* + {"key1":"value1","key2":"value2","key3":"value3"} + */ + [DataMember(Name = "metadata", EmitDefaultValue = true)] + public Dictionary Metadata { get; set; } + + /// + /// The URL where a receipt can be viewed or downloaded. The URL must use the `https://` scheme or a custom URL scheme. + /// + /// The URL where a receipt can be viewed or downloaded. The URL must use the `https://` scheme or a custom URL scheme. + /* + https://example.com/receipt/9876543210 + */ + [DataMember(Name = "receiptUrl", EmitDefaultValue = true)] + public string ReceiptUrl { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CreatePaymentRequest {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Customer: ").Append(Customer).Append("\n"); + sb.Append(" MinimumUserAge: ").Append(MinimumUserAge).Append("\n"); + sb.Append(" CustomerInteraction: ").Append(CustomerInteraction).Append("\n"); + sb.Append(" IndustryData: ").Append(IndustryData).Append("\n"); + sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n"); + sb.Append(" Profile: ").Append(Profile).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" ReturnUrl: ").Append(ReturnUrl).Append("\n"); + sb.Append(" UserFlow: ").Append(UserFlow).Append("\n"); + sb.Append(" ExpiresAt: ").Append(ExpiresAt).Append("\n"); + sb.Append(" QrFormat: ").Append(QrFormat).Append("\n"); + sb.Append(" PaymentDescription: ").Append(PaymentDescription).Append("\n"); + sb.Append(" Receipt: ").Append(Receipt).Append("\n"); + sb.Append(" Metadata: ").Append(Metadata).Append("\n"); + sb.Append(" ReceiptUrl: ").Append(ReceiptUrl).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // MinimumUserAge (int?) maximum + if (this.MinimumUserAge > (int?)100) + { + yield return new ValidationResult("Invalid value for MinimumUserAge, must be a value less than or equal to 100.", new [] { "MinimumUserAge" }); + } + + // MinimumUserAge (int?) minimum + if (this.MinimumUserAge < (int?)0) + { + yield return new ValidationResult("Invalid value for MinimumUserAge, must be a value greater than or equal to 0.", new [] { "MinimumUserAge" }); + } + + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + if (this.ExpiresAt != null) { + // ExpiresAt (string) pattern + Regex regexExpiresAt = new Regex(@"^((?:(\d{4}-\d{2}-\d{2})(T|t)(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|z|([+-](?:2[0-3]|[01][0-9]):[0-5][0-9])))$", RegexOptions.CultureInvariant); + if (!regexExpiresAt.Match(this.ExpiresAt).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ExpiresAt, must match a pattern of " + regexExpiresAt, new [] { "ExpiresAt" }); + } + } + + // PaymentDescription (string) maxLength + if (this.PaymentDescription != null && this.PaymentDescription.Length > 100) + { + yield return new ValidationResult("Invalid value for PaymentDescription, length must be less than 100.", new [] { "PaymentDescription" }); + } + + // PaymentDescription (string) minLength + if (this.PaymentDescription != null && this.PaymentDescription.Length < 3) + { + yield return new ValidationResult("Invalid value for PaymentDescription, length must be greater than 3.", new [] { "PaymentDescription" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequestQrFormat.cs b/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequestQrFormat.cs new file mode 100644 index 0000000..12279f5 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CreatePaymentRequestQrFormat.cs @@ -0,0 +1,142 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Optional setting that is only applicable when `userFlow` is set to `QR`. This is used to set the format for the QR code. + /// + [DataContract(Name = "CreatePaymentRequest_qrFormat")] + public partial class CreatePaymentRequestQrFormat : IValidatableObject + { + /// + /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. + /// + /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. + [JsonConverter(typeof(StringEnumConverter))] + public enum FormatEnum + { + /// + /// Enum TEXTTARGETURL for value: TEXT/TARGETURL + /// + [EnumMember(Value = "TEXT/TARGETURL")] + TEXTTARGETURL = 1, + + /// + /// Enum IMAGESVGXML for value: IMAGE/SVG+XML + /// + [EnumMember(Value = "IMAGE/SVG+XML")] + IMAGESVGXML = 2, + + /// + /// Enum IMAGEPNG for value: IMAGE/PNG + /// + [EnumMember(Value = "IMAGE/PNG")] + IMAGEPNG = 3 + } + + + /// + /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. + /// + /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. + /* + IMAGE/SVG+XML + */ + [DataMember(Name = "format", IsRequired = true, EmitDefaultValue = true)] + public FormatEnum Format { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CreatePaymentRequestQrFormat() { } + /// + /// Initializes a new instance of the class. + /// + /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. (required) (default to FormatEnum.IMAGESVGXML). + /// For example, if the value is 200, then 200x200 px is set as the dimension for the QR code. This is only applicable when the format is set to `PNG`. If not set, the default is 1024.. + public CreatePaymentRequestQrFormat(FormatEnum format = FormatEnum.IMAGESVGXML, int? size = default(int?)) + { + this.Format = format; + this.Size = size; + } + + /// + /// For example, if the value is 200, then 200x200 px is set as the dimension for the QR code. This is only applicable when the format is set to `PNG`. If not set, the default is 1024. + /// + /// For example, if the value is 200, then 200x200 px is set as the dimension for the QR code. This is only applicable when the format is set to `PNG`. If not set, the default is 1024. + /* + 1024 + */ + [DataMember(Name = "size", EmitDefaultValue = true)] + public int? Size { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CreatePaymentRequestQrFormat {\n"); + sb.Append(" Format: ").Append(Format).Append("\n"); + sb.Append(" Size: ").Append(Size).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Size (int?) maximum + if (this.Size > (int?)2000) + { + yield return new ValidationResult("Invalid value for Size, must be a value less than or equal to 2000.", new [] { "Size" }); + } + + // Size (int?) minimum + if (this.Size < (int?)100) + { + yield return new ValidationResult("Invalid value for Size, must be a value greater than or equal to 100.", new [] { "Size" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CreatePaymentResponse.cs b/src/Vipps.net.Models.Epayment/Model/CreatePaymentResponse.cs new file mode 100644 index 0000000..af77944 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CreatePaymentResponse.cs @@ -0,0 +1,130 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The `CreatePaymentResponse` object. + /// + [DataContract(Name = "CreatePaymentResponse")] + public partial class CreatePaymentResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CreatePaymentResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The URL to which the user is redirected when continuing the payment for `NATIVE_REDIRECT` and `WEB_REDIRECT`. When `userFlow` is `QR`, a link to the QR image (or the target URL) will be returned. Nothing will be returned when `userFlow` is `PUSH_MESSAGE`.. + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + public CreatePaymentResponse(string redirectUrl = default(string), string reference = default(string)) + { + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for CreatePaymentResponse and cannot be null"); + } + this.Reference = reference; + this.RedirectUrl = redirectUrl; + } + + /// + /// The URL to which the user is redirected when continuing the payment for `NATIVE_REDIRECT` and `WEB_REDIRECT`. When `userFlow` is `QR`, a link to the QR image (or the target URL) will be returned. Nothing will be returned when `userFlow` is `PUSH_MESSAGE`. + /// + /// The URL to which the user is redirected when continuing the payment for `NATIVE_REDIRECT` and `WEB_REDIRECT`. When `userFlow` is `QR`, a link to the QR image (or the target URL) will be returned. Nothing will be returned when `userFlow` is `PUSH_MESSAGE`. + /* + https://landing.vipps.no?token=abc123 + */ + [DataMember(Name = "redirectUrl", EmitDefaultValue = false)] + public string RedirectUrl { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CreatePaymentResponse {\n"); + sb.Append(" RedirectUrl: ").Append(RedirectUrl).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Currency.cs b/src/Vipps.net.Models.Epayment/Model/Currency.cs new file mode 100644 index 0000000..886c29a --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Currency.cs @@ -0,0 +1,54 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Available types of currency are NOK, DKK, and EUR. + /// + /// Available types of currency are NOK, DKK, and EUR. + [JsonConverter(typeof(StringEnumConverter))] + public enum Currency + { + /// + /// Enum NOK for value: NOK + /// + [EnumMember(Value = "NOK")] + NOK = 1, + + /// + /// Enum DKK for value: DKK + /// + [EnumMember(Value = "DKK")] + DKK = 2, + + /// + /// Enum EUR for value: EUR + /// + [EnumMember(Value = "EUR")] + EUR = 3 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CurrencyEnum.cs b/src/Vipps.net.Models.Epayment/Model/CurrencyEnum.cs new file mode 100644 index 0000000..0802401 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CurrencyEnum.cs @@ -0,0 +1,54 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Currency information + /// + /// Currency information + [JsonConverter(typeof(StringEnumConverter))] + public enum CurrencyEnum + { + /// + /// Enum NOK for value: NOK + /// + [EnumMember(Value = "NOK")] + NOK = 1, + + /// + /// Enum DKK for value: DKK + /// + [EnumMember(Value = "DKK")] + DKK = 2, + + /// + /// Enum EUR for value: EUR + /// + [EnumMember(Value = "EUR")] + EUR = 3 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Customer.cs b/src/Vipps.net.Models.Epayment/Model/Customer.cs new file mode 100644 index 0000000..0d044b5 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Customer.cs @@ -0,0 +1,306 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The target customer if the identity is known. The customer can be specified either with phone number, the customer token or with the user's personal QR code Specifying more than one of these will result in an error. + /// + [JsonConverter(typeof(CustomerJsonConverter))] + [DataContract(Name = "Customer")] + public partial class Customer : AbstractOpenAPISchema, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of CustomerPhoneNumber. + public Customer(CustomerPhoneNumber actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PersonalQrCode. + public Customer(PersonalQrCode actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of CustomerToken. + public Customer(CustomerToken actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(CustomerPhoneNumber) || value is CustomerPhoneNumber) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(CustomerToken) || value is CustomerToken) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PersonalQrCode) || value is PersonalQrCode) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: CustomerPhoneNumber, CustomerToken, PersonalQrCode"); + } + } + } + + /// + /// Get the actual instance of `CustomerPhoneNumber`. If the actual instance is not `CustomerPhoneNumber`, + /// the InvalidClassException will be thrown + /// + /// An instance of CustomerPhoneNumber + public CustomerPhoneNumber GetCustomerPhoneNumber() + { + return (CustomerPhoneNumber)this.ActualInstance; + } + + /// + /// Get the actual instance of `PersonalQrCode`. If the actual instance is not `PersonalQrCode`, + /// the InvalidClassException will be thrown + /// + /// An instance of PersonalQrCode + public PersonalQrCode GetPersonalQrCode() + { + return (PersonalQrCode)this.ActualInstance; + } + + /// + /// Get the actual instance of `CustomerToken`. If the actual instance is not `CustomerToken`, + /// the InvalidClassException will be thrown + /// + /// An instance of CustomerToken + public CustomerToken GetCustomerToken() + { + return (CustomerToken)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Customer {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Customer.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Customer + /// + /// JSON string + /// An instance of Customer + public static Customer FromJson(string jsonString) + { + Customer newCustomer = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newCustomer; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(CustomerPhoneNumber).GetProperty("AdditionalProperties") == null) + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.SerializerSettings)); + } + else + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("CustomerPhoneNumber"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into CustomerPhoneNumber: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(CustomerToken).GetProperty("AdditionalProperties") == null) + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.SerializerSettings)); + } + else + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("CustomerToken"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into CustomerToken: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PersonalQrCode).GetProperty("AdditionalProperties") == null) + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.SerializerSettings)); + } + else + { + newCustomer = new Customer(JsonConvert.DeserializeObject(jsonString, Customer.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PersonalQrCode"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PersonalQrCode: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newCustomer; + } + + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Customer + /// + public class CustomerJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Customer).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return Customer.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return Customer.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CustomerPhoneNumber.cs b/src/Vipps.net.Models.Epayment/Model/CustomerPhoneNumber.cs new file mode 100644 index 0000000..99cea9b --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CustomerPhoneNumber.cs @@ -0,0 +1,107 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The customer's phone number, if available. **Please note:** The phone number (and QR code) is optional and should only be sent if it is already known. Users should never be asked for the phone number, as they will either be automatically app-switched to the Vipps or MobilePay app, or they will be presented with the landing page. The exception for this is \"manual POS\" integration, where the cashier asks the customer for the number, and then enters it manually on the POS. If the customer's phone number is needed by the merchant, use `scope` and the [Userinfo API](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/). See also [Landing page](https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/). + /// + [DataContract(Name = "CustomerPhoneNumber")] + public partial class CustomerPhoneNumber : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The phone number of the user paying the transaction with Vipps MobilePay. The format is MSISDN: Digits only: Country code and subscriber number, but no prefix. If the phone number is a Norwegian phone number `(+47) 91 23 45 67`, the MSISDN representation is `4712345678`. See: https://en.wikipedia.org/wiki/MSISDN. + public CustomerPhoneNumber(string phoneNumber = default(string)) + { + this.PhoneNumber = phoneNumber; + } + + /// + /// The phone number of the user paying the transaction with Vipps MobilePay. The format is MSISDN: Digits only: Country code and subscriber number, but no prefix. If the phone number is a Norwegian phone number `(+47) 91 23 45 67`, the MSISDN representation is `4712345678`. See: https://en.wikipedia.org/wiki/MSISDN + /// + /// The phone number of the user paying the transaction with Vipps MobilePay. The format is MSISDN: Digits only: Country code and subscriber number, but no prefix. If the phone number is a Norwegian phone number `(+47) 91 23 45 67`, the MSISDN representation is `4712345678`. See: https://en.wikipedia.org/wiki/MSISDN + /* + 4712345678 + */ + [DataMember(Name = "phoneNumber", EmitDefaultValue = false)] + public string PhoneNumber { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CustomerPhoneNumber {\n"); + sb.Append(" PhoneNumber: ").Append(PhoneNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // PhoneNumber (string) maxLength + if (this.PhoneNumber != null && this.PhoneNumber.Length > 15) + { + yield return new ValidationResult("Invalid value for PhoneNumber, length must be less than 15.", new [] { "PhoneNumber" }); + } + + // PhoneNumber (string) minLength + if (this.PhoneNumber != null && this.PhoneNumber.Length < 10) + { + yield return new ValidationResult("Invalid value for PhoneNumber, length must be greater than 10.", new [] { "PhoneNumber" }); + } + + if (this.PhoneNumber != null) { + // PhoneNumber (string) pattern + Regex regexPhoneNumber = new Regex(@"^\d{10,15}$", RegexOptions.CultureInvariant); + if (!regexPhoneNumber.Match(this.PhoneNumber).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PhoneNumber, must match a pattern of " + regexPhoneNumber, new [] { "PhoneNumber" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/CustomerToken.cs b/src/Vipps.net.Models.Epayment/Model/CustomerToken.cs new file mode 100644 index 0000000..42f6496 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/CustomerToken.cs @@ -0,0 +1,86 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The customer's token, if it is available. This token will be sent as part of the user.checked-in.v1 webhook event when a user scans a merchant callback QR + /// + [DataContract(Name = "CustomerToken")] + public partial class CustomerToken : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// A distinct token per customer.. + public CustomerToken(string varCustomerToken = default(string)) + { + this.VarCustomerToken = varCustomerToken; + } + + /// + /// A distinct token per customer. + /// + /// A distinct token per customer. + /* + ey%382jf8+qk3nnfdsao0i5jlalidugujnakgo9t8ghn + */ + [DataMember(Name = "customerToken", EmitDefaultValue = false)] + public string VarCustomerToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CustomerToken {\n"); + sb.Append(" VarCustomerToken: ").Append(VarCustomerToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ExtraDetail.cs b/src/Vipps.net.Models.Epayment/Model/ExtraDetail.cs new file mode 100644 index 0000000..7a5d5f2 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ExtraDetail.cs @@ -0,0 +1,106 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// ExtraDetail + /// + [DataContract(Name = "ExtraDetail")] + public partial class ExtraDetail : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ExtraDetail() { } + /// + /// Initializes a new instance of the class. + /// + /// name (required). + /// reason (required). + public ExtraDetail(string name = default(string), string reason = default(string)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for ExtraDetail and cannot be null"); + } + this.Name = name; + // to ensure "reason" is required (not null) + if (reason == null) + { + throw new ArgumentNullException("reason is a required property for ExtraDetail and cannot be null"); + } + this.Reason = reason; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Reason + /// + [DataMember(Name = "reason", IsRequired = true, EmitDefaultValue = true)] + public string Reason { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ExtraDetail {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Reason: ").Append(Reason).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ForceApprove.cs b/src/Vipps.net.Models.Epayment/Model/ForceApprove.cs new file mode 100644 index 0000000..ddd9c42 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ForceApprove.cs @@ -0,0 +1,92 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// ForceApprove + /// + [DataContract(Name = "ForceApprove")] + public partial class ForceApprove : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// customer. + /// The token value received in the `redirectUrl` property in the Create payment response. + public ForceApprove(Customer customer = default(Customer), string token = default(string)) + { + this.Customer = customer; + this.Token = token; + } + + /// + /// Gets or Sets Customer + /// + [DataMember(Name = "customer", EmitDefaultValue = false)] + public Customer Customer { get; set; } + + /// + /// The token value received in the `redirectUrl` property in the Create payment response + /// + /// The token value received in the `redirectUrl` property in the Create payment response + [DataMember(Name = "token", EmitDefaultValue = false)] + public string Token { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ForceApprove {\n"); + sb.Append(" Customer: ").Append(Customer).Append("\n"); + sb.Append(" Token: ").Append(Token).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/GetPaymentResponse.cs b/src/Vipps.net.Models.Epayment/Model/GetPaymentResponse.cs new file mode 100644 index 0000000..e988e14 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/GetPaymentResponse.cs @@ -0,0 +1,223 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The `GetPaymentResponse` object. + /// + [DataContract(Name = "GetPaymentResponse")] + public partial class GetPaymentResponse : IValidatableObject + { + + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", IsRequired = true, EmitDefaultValue = true)] + public State State { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetPaymentResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// aggregate (required). + /// amount (required). + /// state (required). + /// paymentMethod (required). + /// profile (required). + /// Reference value for a payment, defined by Vipps MobilePay. (required). + /// The URL you should redirect the user to to continue with the payment. This is the URL to the Vipps MobilePay landing page. See: https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/. + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs.. + public GetPaymentResponse(Aggregate aggregate = default(Aggregate), Amount amount = default(Amount), State state = default(State), PaymentMethodResponse paymentMethod = default(PaymentMethodResponse), ProfileResponse profile = default(ProfileResponse), string pspReference = default(string), string redirectUrl = default(string), string reference = default(string), Dictionary metadata = default(Dictionary)) + { + // to ensure "aggregate" is required (not null) + if (aggregate == null) + { + throw new ArgumentNullException("aggregate is a required property for GetPaymentResponse and cannot be null"); + } + this.Aggregate = aggregate; + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for GetPaymentResponse and cannot be null"); + } + this.Amount = amount; + this.State = state; + // to ensure "paymentMethod" is required (not null) + if (paymentMethod == null) + { + throw new ArgumentNullException("paymentMethod is a required property for GetPaymentResponse and cannot be null"); + } + this.PaymentMethod = paymentMethod; + // to ensure "profile" is required (not null) + if (profile == null) + { + throw new ArgumentNullException("profile is a required property for GetPaymentResponse and cannot be null"); + } + this.Profile = profile; + // to ensure "pspReference" is required (not null) + if (pspReference == null) + { + throw new ArgumentNullException("pspReference is a required property for GetPaymentResponse and cannot be null"); + } + this.PspReference = pspReference; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for GetPaymentResponse and cannot be null"); + } + this.Reference = reference; + this.RedirectUrl = redirectUrl; + this.Metadata = metadata; + } + + /// + /// Gets or Sets Aggregate + /// + [DataMember(Name = "aggregate", IsRequired = true, EmitDefaultValue = true)] + public Aggregate Aggregate { get; set; } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets PaymentMethod + /// + [DataMember(Name = "paymentMethod", IsRequired = true, EmitDefaultValue = true)] + public PaymentMethodResponse PaymentMethod { get; set; } + + /// + /// Gets or Sets Profile + /// + [DataMember(Name = "profile", IsRequired = true, EmitDefaultValue = true)] + public ProfileResponse Profile { get; set; } + + /// + /// Reference value for a payment, defined by Vipps MobilePay. + /// + /// Reference value for a payment, defined by Vipps MobilePay. + [DataMember(Name = "pspReference", IsRequired = true, EmitDefaultValue = true)] + public string PspReference { get; set; } + + /// + /// The URL you should redirect the user to to continue with the payment. This is the URL to the Vipps MobilePay landing page. See: https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/ + /// + /// The URL you should redirect the user to to continue with the payment. This is the URL to the Vipps MobilePay landing page. See: https://developer.vippsmobilepay.com/docs/knowledge-base/landing-page/ + /* + https://landing.vipps.no?token=abc123 + */ + [DataMember(Name = "redirectUrl", EmitDefaultValue = false)] + public string RedirectUrl { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs. + /// + /// Metadata is a key-value map that can be used to store additional information about the payment. The metadata is not used by Vipps MobilePay, but is passed through in the `GetPaymentResponse` object. Key length is limited to 100 characters, and value length is limited to 500 characters. Max capacity is 5 key-value pairs. + /* + {"key1":"value1","key2":"value2","key3":"value3"} + */ + [DataMember(Name = "metadata", EmitDefaultValue = true)] + public Dictionary Metadata { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetPaymentResponse {\n"); + sb.Append(" Aggregate: ").Append(Aggregate).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n"); + sb.Append(" Profile: ").Append(Profile).Append("\n"); + sb.Append(" PspReference: ").Append(PspReference).Append("\n"); + sb.Append(" RedirectUrl: ").Append(RedirectUrl).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" Metadata: ").Append(Metadata).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/IndustryData.cs b/src/Vipps.net.Models.Epayment/Model/IndustryData.cs new file mode 100644 index 0000000..a4fc35a --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/IndustryData.cs @@ -0,0 +1,82 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Additional compliance data related to the transaction. + /// + [DataContract(Name = "IndustryData")] + public partial class IndustryData : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// airlineData. + public IndustryData(AirlineData airlineData = default(AirlineData)) + { + this.AirlineData = airlineData; + } + + /// + /// Gets or Sets AirlineData + /// + [DataMember(Name = "airlineData", EmitDefaultValue = false)] + public AirlineData AirlineData { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndustryData {\n"); + sb.Append(" AirlineData: ").Append(AirlineData).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ModificationResponse.cs b/src/Vipps.net.Models.Epayment/Model/ModificationResponse.cs new file mode 100644 index 0000000..9fa2176 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ModificationResponse.cs @@ -0,0 +1,169 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// ModificationResponse + /// + [DataContract(Name = "ModificationResponse")] + public partial class ModificationResponse : IValidatableObject + { + + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", IsRequired = true, EmitDefaultValue = true)] + public State State { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ModificationResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// amount (required). + /// state (required). + /// aggregate (required). + /// Reference value for a payment, defined by Vipps MobilePay. (required). + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + public ModificationResponse(Amount amount = default(Amount), State state = default(State), Aggregate aggregate = default(Aggregate), string pspReference = default(string), string reference = default(string)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for ModificationResponse and cannot be null"); + } + this.Amount = amount; + this.State = state; + // to ensure "aggregate" is required (not null) + if (aggregate == null) + { + throw new ArgumentNullException("aggregate is a required property for ModificationResponse and cannot be null"); + } + this.Aggregate = aggregate; + // to ensure "pspReference" is required (not null) + if (pspReference == null) + { + throw new ArgumentNullException("pspReference is a required property for ModificationResponse and cannot be null"); + } + this.PspReference = pspReference; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for ModificationResponse and cannot be null"); + } + this.Reference = reference; + } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Aggregate + /// + [DataMember(Name = "aggregate", IsRequired = true, EmitDefaultValue = true)] + public Aggregate Aggregate { get; set; } + + /// + /// Reference value for a payment, defined by Vipps MobilePay. + /// + /// Reference value for a payment, defined by Vipps MobilePay. + [DataMember(Name = "pspReference", IsRequired = true, EmitDefaultValue = true)] + public string PspReference { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ModificationResponse {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" Aggregate: ").Append(Aggregate).Append("\n"); + sb.Append(" PspReference: ").Append(PspReference).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/OrderLine.cs b/src/Vipps.net.Models.Epayment/Model/OrderLine.cs new file mode 100644 index 0000000..3ebac3d --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/OrderLine.cs @@ -0,0 +1,271 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + [DataContract(Name = "OrderLine")] + public partial class OrderLine : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OrderLine() { } + /// + /// Initializes a new instance of the class. + /// + /// Name of the product in the order line. (required). + /// The product ID (required). + /// Total amount of the order line, including tax and discount. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. (required). + /// Total amount of order line with discount excluding tax. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. (required). + /// Total tax amount paid for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. (required). + /// Tax percentage for the order line. Between 0-100. Either this or taxRate must be set.. + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. Either this or taxPercentage must be set.. + /// unitInfo. + /// Total discount for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 1.00 EUR/NOK/DKK should be written as 100.. + /// Optional URL linking back to the product at the merchant.. + /// Flag for marking the order line as returned. This will make it count negative towards all the sums in bottomLine.. + /// Flag for marking the order line as a shipping line. This will be shown differently in the app.. + public OrderLine(string name = default(string), string id = default(string), long totalAmount = default(long), long totalAmountExcludingTax = default(long), long totalTaxAmount = default(long), int? taxPercentage = default(int?), int? taxRate = default(int?), UnitInfo unitInfo = default(UnitInfo), long? discount = default(long?), string productUrl = default(string), bool? isReturn = default(bool?), bool? isShipping = default(bool?)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for OrderLine and cannot be null"); + } + this.Name = name; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for OrderLine and cannot be null"); + } + this.Id = id; + this.TotalAmount = totalAmount; + this.TotalAmountExcludingTax = totalAmountExcludingTax; + this.TotalTaxAmount = totalTaxAmount; + this.TaxPercentage = taxPercentage; + this.TaxRate = taxRate; + this.UnitInfo = unitInfo; + this.Discount = discount; + this.ProductUrl = productUrl; + this.IsReturn = isReturn; + this.IsShipping = isShipping; + } + + /// + /// Name of the product in the order line. + /// + /// Name of the product in the order line. + /* + socks + */ + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// The product ID + /// + /// The product ID + /* + 1234567890 + */ + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Total amount of the order line, including tax and discount. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + /// Total amount of the order line, including tax and discount. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /* + 1000 + */ + [DataMember(Name = "totalAmount", IsRequired = true, EmitDefaultValue = true)] + public long TotalAmount { get; set; } + + /// + /// Total amount of order line with discount excluding tax. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + /// Total amount of order line with discount excluding tax. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /* + 800 + */ + [DataMember(Name = "totalAmountExcludingTax", IsRequired = true, EmitDefaultValue = true)] + public long TotalAmountExcludingTax { get; set; } + + /// + /// Total tax amount paid for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + /// Total tax amount paid for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /* + 250 + */ + [DataMember(Name = "totalTaxAmount", IsRequired = true, EmitDefaultValue = true)] + public long TotalTaxAmount { get; set; } + + /// + /// Tax percentage for the order line. Between 0-100. Either this or taxRate must be set. + /// + /// Tax percentage for the order line. Between 0-100. Either this or taxRate must be set. + /* + 25 + */ + [DataMember(Name = "taxPercentage", EmitDefaultValue = true)] + [Obsolete] + public int? TaxPercentage { get; set; } + + /// + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. Either this or taxPercentage must be set. + /// + /// Tax percentage for the order line, represented with 0.01 decimal points. 5000 equals 50% . Between 0-10000. Either this or taxPercentage must be set. + /* + 2500 + */ + [DataMember(Name = "taxRate", EmitDefaultValue = true)] + public int? TaxRate { get; set; } + + /// + /// Gets or Sets UnitInfo + /// + [DataMember(Name = "unitInfo", EmitDefaultValue = false)] + public UnitInfo UnitInfo { get; set; } + + /// + /// Total discount for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 1.00 EUR/NOK/DKK should be written as 100. + /// + /// Total discount for the order line. Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 1.00 EUR/NOK/DKK should be written as 100. + /* + 2000 + */ + [DataMember(Name = "discount", EmitDefaultValue = true)] + public long? Discount { get; set; } + + /// + /// Optional URL linking back to the product at the merchant. + /// + /// Optional URL linking back to the product at the merchant. + /* + https://example.com/store/socks + */ + [DataMember(Name = "productUrl", EmitDefaultValue = true)] + public string ProductUrl { get; set; } + + /// + /// Flag for marking the order line as returned. This will make it count negative towards all the sums in bottomLine. + /// + /// Flag for marking the order line as returned. This will make it count negative towards all the sums in bottomLine. + /* + false + */ + [DataMember(Name = "isReturn", EmitDefaultValue = true)] + public bool? IsReturn { get; set; } + + /// + /// Flag for marking the order line as a shipping line. This will be shown differently in the app. + /// + /// Flag for marking the order line as a shipping line. This will be shown differently in the app. + /* + false + */ + [DataMember(Name = "isShipping", EmitDefaultValue = true)] + public bool? IsShipping { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OrderLine {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" TotalAmount: ").Append(TotalAmount).Append("\n"); + sb.Append(" TotalAmountExcludingTax: ").Append(TotalAmountExcludingTax).Append("\n"); + sb.Append(" TotalTaxAmount: ").Append(TotalTaxAmount).Append("\n"); + sb.Append(" TaxPercentage: ").Append(TaxPercentage).Append("\n"); + sb.Append(" TaxRate: ").Append(TaxRate).Append("\n"); + sb.Append(" UnitInfo: ").Append(UnitInfo).Append("\n"); + sb.Append(" Discount: ").Append(Discount).Append("\n"); + sb.Append(" ProductUrl: ").Append(ProductUrl).Append("\n"); + sb.Append(" IsReturn: ").Append(IsReturn).Append("\n"); + sb.Append(" IsShipping: ").Append(IsShipping).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // TaxPercentage (int?) maximum + if (this.TaxPercentage > (int?)100) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value less than or equal to 100.", new [] { "TaxPercentage" }); + } + + // TaxPercentage (int?) minimum + if (this.TaxPercentage < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value greater than or equal to 0.", new [] { "TaxPercentage" }); + } + + // TaxRate (int?) maximum + if (this.TaxRate > (int?)10000) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value less than or equal to 10000.", new [] { "TaxRate" }); + } + + // TaxRate (int?) minimum + if (this.TaxRate < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxRate, must be a value greater than or equal to 0.", new [] { "TaxRate" }); + } + + // Discount (long?) minimum + if (this.Discount < (long?)0) + { + yield return new ValidationResult("Invalid value for Discount, must be a value greater than or equal to 0.", new [] { "Discount" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentAdjustment.cs b/src/Vipps.net.Models.Epayment/Model/PaymentAdjustment.cs new file mode 100644 index 0000000..5214e4e --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentAdjustment.cs @@ -0,0 +1,131 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// PaymentAdjustment + /// + [DataContract(Name = "PaymentAdjustment")] + public partial class PaymentAdjustment : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentAdjustment() { } + /// + /// Initializes a new instance of the class. + /// + /// modificationAmount (required). + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + public PaymentAdjustment(Amount modificationAmount = default(Amount), string modificationReference = default(string)) + { + // to ensure "modificationAmount" is required (not null) + if (modificationAmount == null) + { + throw new ArgumentNullException("modificationAmount is a required property for PaymentAdjustment and cannot be null"); + } + this.ModificationAmount = modificationAmount; + // to ensure "modificationReference" is required (not null) + if (modificationReference == null) + { + throw new ArgumentNullException("modificationReference is a required property for PaymentAdjustment and cannot be null"); + } + this.ModificationReference = modificationReference; + } + + /// + /// Gets or Sets ModificationAmount + /// + [DataMember(Name = "modificationAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount ModificationAmount { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "modificationReference", IsRequired = true, EmitDefaultValue = true)] + public string ModificationReference { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentAdjustment {\n"); + sb.Append(" ModificationAmount: ").Append(ModificationAmount).Append("\n"); + sb.Append(" ModificationReference: ").Append(ModificationReference).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ModificationReference (string) maxLength + if (this.ModificationReference != null && this.ModificationReference.Length > 50) + { + yield return new ValidationResult("Invalid value for ModificationReference, length must be less than 50.", new [] { "ModificationReference" }); + } + + // ModificationReference (string) minLength + if (this.ModificationReference != null && this.ModificationReference.Length < 8) + { + yield return new ValidationResult("Invalid value for ModificationReference, length must be greater than 8.", new [] { "ModificationReference" }); + } + + if (this.ModificationReference != null) { + // ModificationReference (string) pattern + Regex regexModificationReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexModificationReference.Match(this.ModificationReference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ModificationReference, must match a pattern of " + regexModificationReference, new [] { "ModificationReference" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentEvent.cs b/src/Vipps.net.Models.Epayment/Model/PaymentEvent.cs new file mode 100644 index 0000000..3af894f --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentEvent.cs @@ -0,0 +1,196 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// PaymentEvent + /// + [DataContract(Name = "PaymentEvent")] + public partial class PaymentEvent : IValidatableObject + { + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public PaymentEventName? Name { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + /// Reference value for a payment, defined by Vipps MobilePay. (required). + /// name. + /// amount (required). + /// timestamp (required). + /// The idempotency key of the request. Specified by the merchant/partner making the API request.. + /// The outcome of the event (required). + public PaymentEvent(string reference = default(string), string pspReference = default(string), PaymentEventName? name = default(PaymentEventName?), Amount amount = default(Amount), DateTime timestamp = default(DateTime), string idempotencyKey = default(string), bool success = default(bool)) + { + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for PaymentEvent and cannot be null"); + } + this.Reference = reference; + // to ensure "pspReference" is required (not null) + if (pspReference == null) + { + throw new ArgumentNullException("pspReference is a required property for PaymentEvent and cannot be null"); + } + this.PspReference = pspReference; + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for PaymentEvent and cannot be null"); + } + this.Amount = amount; + this.Timestamp = timestamp; + this.Success = success; + this.Name = name; + this.IdempotencyKey = idempotencyKey; + } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Reference value for a payment, defined by Vipps MobilePay. + /// + /// Reference value for a payment, defined by Vipps MobilePay. + [DataMember(Name = "pspReference", IsRequired = true, EmitDefaultValue = true)] + public string PspReference { get; set; } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Timestamp + /// + /* + 2022-12-31T00:00Z + */ + [DataMember(Name = "timestamp", IsRequired = true, EmitDefaultValue = true)] + public DateTime Timestamp { get; set; } + + /// + /// The idempotency key of the request. Specified by the merchant/partner making the API request. + /// + /// The idempotency key of the request. Specified by the merchant/partner making the API request. + /* + fb492b5e-7907-4d83-ba20-c7fb60ca35de + */ + [DataMember(Name = "idempotencyKey", EmitDefaultValue = true)] + public string IdempotencyKey { get; set; } + + /// + /// The outcome of the event + /// + /// The outcome of the event + [DataMember(Name = "success", IsRequired = true, EmitDefaultValue = true)] + public bool Success { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentEvent {\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" PspReference: ").Append(PspReference).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" IdempotencyKey: ").Append(IdempotencyKey).Append("\n"); + sb.Append(" Success: ").Append(Success).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + // IdempotencyKey (string) maxLength + if (this.IdempotencyKey != null && this.IdempotencyKey.Length > 50) + { + yield return new ValidationResult("Invalid value for IdempotencyKey, length must be less than 50.", new [] { "IdempotencyKey" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentEventName.cs b/src/Vipps.net.Models.Epayment/Model/PaymentEventName.cs new file mode 100644 index 0000000..c6cba8f --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentEventName.cs @@ -0,0 +1,83 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Defines PaymentEventName + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PaymentEventName + { + /// + /// Enum CREATED for value: CREATED + /// + [EnumMember(Value = "CREATED")] + CREATED = 1, + + /// + /// Enum ABORTED for value: ABORTED + /// + [EnumMember(Value = "ABORTED")] + ABORTED = 2, + + /// + /// Enum EXPIRED for value: EXPIRED + /// + [EnumMember(Value = "EXPIRED")] + EXPIRED = 3, + + /// + /// Enum CANCELLED for value: CANCELLED + /// + [EnumMember(Value = "CANCELLED")] + CANCELLED = 4, + + /// + /// Enum CAPTURED for value: CAPTURED + /// + [EnumMember(Value = "CAPTURED")] + CAPTURED = 5, + + /// + /// Enum REFUNDED for value: REFUNDED + /// + [EnumMember(Value = "REFUNDED")] + REFUNDED = 6, + + /// + /// Enum AUTHORIZED for value: AUTHORIZED + /// + [EnumMember(Value = "AUTHORIZED")] + AUTHORIZED = 7, + + /// + /// Enum TERMINATED for value: TERMINATED + /// + [EnumMember(Value = "TERMINATED")] + TERMINATED = 8 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentMethod.cs b/src/Vipps.net.Models.Epayment/Model/PaymentMethod.cs new file mode 100644 index 0000000..a231ba5 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentMethod.cs @@ -0,0 +1,87 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// PaymentMethod + /// + [DataContract(Name = "PaymentMethod")] + public partial class PaymentMethod : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public PaymentMethodType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentMethod() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + public PaymentMethod(PaymentMethodType type = default(PaymentMethodType)) + { + this.Type = type; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentMethod {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentMethodResponse.cs b/src/Vipps.net.Models.Epayment/Model/PaymentMethodResponse.cs new file mode 100644 index 0000000..0b21f30 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentMethodResponse.cs @@ -0,0 +1,112 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// PaymentMethodResponse + /// + [DataContract(Name = "PaymentMethodResponse")] + public partial class PaymentMethodResponse : IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public PaymentMethodType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentMethodResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// The payment card's Bank Identification Number (BIN), that identifies which bank has issued the card.. + public PaymentMethodResponse(PaymentMethodType type = default(PaymentMethodType), string cardBin = default(string)) + { + this.Type = type; + this.CardBin = cardBin; + } + + /// + /// The payment card's Bank Identification Number (BIN), that identifies which bank has issued the card. + /// + /// The payment card's Bank Identification Number (BIN), that identifies which bank has issued the card. + /* + 540185 + */ + [DataMember(Name = "cardBin", EmitDefaultValue = false)] + public string CardBin { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentMethodResponse {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CardBin: ").Append(CardBin).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // CardBin (string) maxLength + if (this.CardBin != null && this.CardBin.Length > 6) + { + yield return new ValidationResult("Invalid value for CardBin, length must be less than 6.", new [] { "CardBin" }); + } + + // CardBin (string) minLength + if (this.CardBin != null && this.CardBin.Length < 6) + { + yield return new ValidationResult("Invalid value for CardBin, length must be greater than 6.", new [] { "CardBin" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentMethodType.cs b/src/Vipps.net.Models.Epayment/Model/PaymentMethodType.cs new file mode 100644 index 0000000..ee665ae --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentMethodType.cs @@ -0,0 +1,48 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The paymentMethod type to be performed. `WALLET` is a card used in the Vipps or MobilePay app. `CARD` is free-standing card payments, outside of the Vipps or MobilePay app. `CARD` has to be combined with a `userFlow` of `WEB_REDIRECT`, as the card payment can not be completed in the Vipps or MobilePay app. + /// + /// The paymentMethod type to be performed. `WALLET` is a card used in the Vipps or MobilePay app. `CARD` is free-standing card payments, outside of the Vipps or MobilePay app. `CARD` has to be combined with a `userFlow` of `WEB_REDIRECT`, as the card payment can not be completed in the Vipps or MobilePay app. + [JsonConverter(typeof(StringEnumConverter))] + public enum PaymentMethodType + { + /// + /// Enum WALLET for value: WALLET + /// + [EnumMember(Value = "WALLET")] + WALLET = 1, + + /// + /// Enum CARD for value: CARD + /// + [EnumMember(Value = "CARD")] + CARD = 2 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PaymentSources.cs b/src/Vipps.net.Models.Epayment/Model/PaymentSources.cs new file mode 100644 index 0000000..2bd99f9 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PaymentSources.cs @@ -0,0 +1,109 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// PaymentSources + /// + [DataContract(Name = "PaymentSources")] + public partial class PaymentSources : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// giftCard. + /// card. + /// voucher. + /// cash. + public PaymentSources(int? giftCard = default(int?), int? card = default(int?), int? voucher = default(int?), int? cash = default(int?)) + { + this.GiftCard = giftCard; + this.Card = card; + this.Voucher = voucher; + this.Cash = cash; + } + + /// + /// Gets or Sets GiftCard + /// + [DataMember(Name = "giftCard", EmitDefaultValue = true)] + public int? GiftCard { get; set; } + + /// + /// Gets or Sets Card + /// + [DataMember(Name = "card", EmitDefaultValue = true)] + public int? Card { get; set; } + + /// + /// Gets or Sets Voucher + /// + [DataMember(Name = "voucher", EmitDefaultValue = true)] + public int? Voucher { get; set; } + + /// + /// Gets or Sets Cash + /// + [DataMember(Name = "cash", EmitDefaultValue = true)] + public int? Cash { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentSources {\n"); + sb.Append(" GiftCard: ").Append(GiftCard).Append("\n"); + sb.Append(" Card: ").Append(Card).Append("\n"); + sb.Append(" Voucher: ").Append(Voucher).Append("\n"); + sb.Append(" Cash: ").Append(Cash).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/PersonalQrCode.cs b/src/Vipps.net.Models.Epayment/Model/PersonalQrCode.cs new file mode 100644 index 0000000..833c015 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/PersonalQrCode.cs @@ -0,0 +1,98 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The full content of the user's personal QR code in the app, used in 'merchant scan' scenarios. After the personal QR code has been scanned in a physical context, send the complete QR code content in this field to initiate a payment from the user (and do not send `phoneNumber`). **Important:** The content of the QR code can change at any time, without warning. It is very important to send the _complete content of the QR code_, like the complete URL in the example below. While the personal QR code does reveal the user's phone number in this example, that may change. The [Userinfo API](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/) should be used if you need the user to share personal information, such as phone number, email address, etc. + /// + [DataContract(Name = "PersonalQrCode")] + public partial class PersonalQrCode : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The full content of the user's personal QR code in the app.. + public PersonalQrCode(string personalQr = default(string)) + { + this.PersonalQr = personalQr; + } + + /// + /// The full content of the user's personal QR code in the app. + /// + /// The full content of the user's personal QR code in the app. + /* + https://qr.vipps.no/28/2/01/031/4712345678?v=1 + */ + [DataMember(Name = "personalQr", EmitDefaultValue = false)] + public string PersonalQr { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PersonalQrCode {\n"); + sb.Append(" PersonalQr: ").Append(PersonalQr).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // PersonalQr (string) maxLength + if (this.PersonalQr != null && this.PersonalQr.Length > 255) + { + yield return new ValidationResult("Invalid value for PersonalQr, length must be less than 255.", new [] { "PersonalQr" }); + } + + // PersonalQr (string) minLength + if (this.PersonalQr != null && this.PersonalQr.Length < 5) + { + yield return new ValidationResult("Invalid value for PersonalQr, length must be greater than 5.", new [] { "PersonalQr" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Problem.cs b/src/Vipps.net.Models.Epayment/Model/Problem.cs new file mode 100644 index 0000000..72a71a0 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Problem.cs @@ -0,0 +1,152 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The standard error object, based on RFC 7808. See https://developer.vippsmobilepay.com/docs/knowledge-base/errors + /// + [DataContract(Name = "Problem")] + public partial class Problem : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Problem() { } + /// + /// Initializes a new instance of the class. + /// + /// A URI reference that identifies the problem type. (required). + /// A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem. (required). + /// A human-readable explanation specific to this occurrence of the problem.. + /// The HTTP response code. (required). + /// An id that can be used to facilitate in tracing the error. (required). + /// extraDetails. + public Problem(string type = default(string), string title = default(string), string detail = default(string), int status = default(int), string traceId = default(string), List extraDetails = default(List)) + { + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for Problem and cannot be null"); + } + this.Type = type; + // to ensure "title" is required (not null) + if (title == null) + { + throw new ArgumentNullException("title is a required property for Problem and cannot be null"); + } + this.Title = title; + this.Status = status; + // to ensure "traceId" is required (not null) + if (traceId == null) + { + throw new ArgumentNullException("traceId is a required property for Problem and cannot be null"); + } + this.TraceId = traceId; + this.Detail = detail; + this.ExtraDetails = extraDetails; + } + + /// + /// A URI reference that identifies the problem type. + /// + /// A URI reference that identifies the problem type. + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem. + /// + /// A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem. + [DataMember(Name = "title", IsRequired = true, EmitDefaultValue = true)] + public string Title { get; set; } + + /// + /// A human-readable explanation specific to this occurrence of the problem. + /// + /// A human-readable explanation specific to this occurrence of the problem. + [DataMember(Name = "detail", EmitDefaultValue = false)] + public string Detail { get; set; } + + /// + /// The HTTP response code. + /// + /// The HTTP response code. + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public int Status { get; set; } + + /// + /// An id that can be used to facilitate in tracing the error. + /// + /// An id that can be used to facilitate in tracing the error. + [DataMember(Name = "traceId", IsRequired = true, EmitDefaultValue = true)] + public string TraceId { get; set; } + + /// + /// Gets or Sets ExtraDetails + /// + [DataMember(Name = "extraDetails", EmitDefaultValue = true)] + public List ExtraDetails { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Problem {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Detail: ").Append(Detail).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" TraceId: ").Append(TraceId).Append("\n"); + sb.Append(" ExtraDetails: ").Append(ExtraDetails).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ProfileRequest.cs b/src/Vipps.net.Models.Epayment/Model/ProfileRequest.cs new file mode 100644 index 0000000..a779031 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ProfileRequest.cs @@ -0,0 +1,86 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// ProfileRequest + /// + [DataContract(Name = "ProfileRequest")] + public partial class ProfileRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// A space-separated string list of the required user information (e.g., \"name phoneNumber\") for the payment, in accordance with the OpenID Connect specification. See the [Userinfo user guide](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/userinfo-api-guide#scope) for details. Possible values are: - name - address - email - phoneNumber - birthDate - nin. + public ProfileRequest(string scope = default(string)) + { + this.Scope = scope; + } + + /// + /// A space-separated string list of the required user information (e.g., \"name phoneNumber\") for the payment, in accordance with the OpenID Connect specification. See the [Userinfo user guide](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/userinfo-api-guide#scope) for details. Possible values are: - name - address - email - phoneNumber - birthDate - nin + /// + /// A space-separated string list of the required user information (e.g., \"name phoneNumber\") for the payment, in accordance with the OpenID Connect specification. See the [Userinfo user guide](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/userinfo-api-guide#scope) for details. Possible values are: - name - address - email - phoneNumber - birthDate - nin + /* + name phoneNumber + */ + [DataMember(Name = "scope", EmitDefaultValue = false)] + public string Scope { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ProfileRequest {\n"); + sb.Append(" Scope: ").Append(Scope).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ProfileResponse.cs b/src/Vipps.net.Models.Epayment/Model/ProfileResponse.cs new file mode 100644 index 0000000..ea60e9b --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ProfileResponse.cs @@ -0,0 +1,83 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// ProfileResponse + /// + [DataContract(Name = "ProfileResponse")] + public partial class ProfileResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// If `profile.scope` was requested in `createPayment`, this value will be populated once `state` is `AUTHORIZED`. This can be used towards the [Userinfo endpoint](https://developer.vippsmobilepay.com/api/userinfo#operation/getUserinfo) to fetch required user data.. + public ProfileResponse(string sub = default(string)) + { + this.Sub = sub; + } + + /// + /// If `profile.scope` was requested in `createPayment`, this value will be populated once `state` is `AUTHORIZED`. This can be used towards the [Userinfo endpoint](https://developer.vippsmobilepay.com/api/userinfo#operation/getUserinfo) to fetch required user data. + /// + /// If `profile.scope` was requested in `createPayment`, this value will be populated once `state` is `AUTHORIZED`. This can be used towards the [Userinfo endpoint](https://developer.vippsmobilepay.com/api/userinfo#operation/getUserinfo) to fetch required user data. + [DataMember(Name = "sub", EmitDefaultValue = false)] + public string Sub { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ProfileResponse {\n"); + sb.Append(" Sub: ").Append(Sub).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/QuantityUnitEnum.cs b/src/Vipps.net.Models.Epayment/Model/QuantityUnitEnum.cs new file mode 100644 index 0000000..7b987fd --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/QuantityUnitEnum.cs @@ -0,0 +1,72 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Available units for quantity. Will default to PCS if not set + /// + /// Available units for quantity. Will default to PCS if not set + [JsonConverter(typeof(StringEnumConverter))] + public enum QuantityUnitEnum + { + /// + /// Enum PCS for value: PCS + /// + [EnumMember(Value = "PCS")] + PCS = 1, + + /// + /// Enum KG for value: KG + /// + [EnumMember(Value = "KG")] + KG = 2, + + /// + /// Enum KM for value: KM + /// + [EnumMember(Value = "KM")] + KM = 3, + + /// + /// Enum MINUTE for value: MINUTE + /// + [EnumMember(Value = "MINUTE")] + MINUTE = 4, + + /// + /// Enum LITRE for value: LITRE + /// + [EnumMember(Value = "LITRE")] + LITRE = 5, + + /// + /// Enum KWH for value: KWH + /// + [EnumMember(Value = "KWH")] + KWH = 6 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/Receipt.cs b/src/Vipps.net.Models.Epayment/Model/Receipt.cs new file mode 100644 index 0000000..d59029a --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/Receipt.cs @@ -0,0 +1,107 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Receipt + /// + [DataContract(Name = "Receipt")] + public partial class Receipt : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Receipt() { } + /// + /// Initializes a new instance of the class. + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. (required). + /// bottomLine (required). + public Receipt(List orderLines = default(List), BottomLine bottomLine = default(BottomLine)) + { + // to ensure "orderLines" is required (not null) + if (orderLines == null) + { + throw new ArgumentNullException("orderLines is a required property for Receipt and cannot be null"); + } + this.OrderLines = orderLines; + // to ensure "bottomLine" is required (not null) + if (bottomLine == null) + { + throw new ArgumentNullException("bottomLine is a required property for Receipt and cannot be null"); + } + this.BottomLine = bottomLine; + } + + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + /// + /// Amounts are specified in minor units (i.e., integers with two trailing zeros). For example: 10.00 EUR/NOK/DKK should be written as 1000. + [DataMember(Name = "orderLines", IsRequired = true, EmitDefaultValue = true)] + public List OrderLines { get; set; } + + /// + /// Gets or Sets BottomLine + /// + [DataMember(Name = "bottomLine", IsRequired = true, EmitDefaultValue = true)] + public BottomLine BottomLine { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Receipt {\n"); + sb.Append(" OrderLines: ").Append(OrderLines).Append("\n"); + sb.Append(" BottomLine: ").Append(BottomLine).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/RefundModificationRequest.cs b/src/Vipps.net.Models.Epayment/Model/RefundModificationRequest.cs new file mode 100644 index 0000000..0620f74 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/RefundModificationRequest.cs @@ -0,0 +1,92 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// RefundModificationRequest + /// + [DataContract(Name = "RefundModificationRequest")] + public partial class RefundModificationRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RefundModificationRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// modificationAmount (required). + public RefundModificationRequest(Amount modificationAmount = default(Amount)) + { + // to ensure "modificationAmount" is required (not null) + if (modificationAmount == null) + { + throw new ArgumentNullException("modificationAmount is a required property for RefundModificationRequest and cannot be null"); + } + this.ModificationAmount = modificationAmount; + } + + /// + /// Gets or Sets ModificationAmount + /// + [DataMember(Name = "modificationAmount", IsRequired = true, EmitDefaultValue = true)] + public Amount ModificationAmount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RefundModificationRequest {\n"); + sb.Append(" ModificationAmount: ").Append(ModificationAmount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/ShippingInfo.cs b/src/Vipps.net.Models.Epayment/Model/ShippingInfo.cs new file mode 100644 index 0000000..5fd79a8 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/ShippingInfo.cs @@ -0,0 +1,180 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Deprecated, use a regular orderLine with \"isShipping\" flag. Using this will result in faulty calculation of sum and tax. + /// + [DataContract(Name = "ShippingInfo")] + public partial class ShippingInfo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ShippingInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// Total amount for the shipping, including tax and discount (required). + /// Total amount for shipping excluding tax (required). + /// Total tax amount paid for the shipping (required). + /// Tax-percentage for the Shipping (required). + public ShippingInfo(long? amount = default(long?), long? amountExcludingTax = default(long?), long? taxAmount = default(long?), int? taxPercentage = default(int?)) + { + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for ShippingInfo and cannot be null"); + } + this.Amount = amount; + // to ensure "amountExcludingTax" is required (not null) + if (amountExcludingTax == null) + { + throw new ArgumentNullException("amountExcludingTax is a required property for ShippingInfo and cannot be null"); + } + this.AmountExcludingTax = amountExcludingTax; + // to ensure "taxAmount" is required (not null) + if (taxAmount == null) + { + throw new ArgumentNullException("taxAmount is a required property for ShippingInfo and cannot be null"); + } + this.TaxAmount = taxAmount; + // to ensure "taxPercentage" is required (not null) + if (taxPercentage == null) + { + throw new ArgumentNullException("taxPercentage is a required property for ShippingInfo and cannot be null"); + } + this.TaxPercentage = taxPercentage; + } + + /// + /// Total amount for the shipping, including tax and discount + /// + /// Total amount for the shipping, including tax and discount + /* + 1000 + */ + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public long? Amount { get; set; } + + /// + /// Total amount for shipping excluding tax + /// + /// Total amount for shipping excluding tax + /* + 1000 + */ + [DataMember(Name = "amountExcludingTax", IsRequired = true, EmitDefaultValue = true)] + public long? AmountExcludingTax { get; set; } + + /// + /// Total tax amount paid for the shipping + /// + /// Total tax amount paid for the shipping + /* + 250 + */ + [DataMember(Name = "taxAmount", IsRequired = true, EmitDefaultValue = true)] + public long? TaxAmount { get; set; } + + /// + /// Tax-percentage for the Shipping + /// + /// Tax-percentage for the Shipping + /* + 25 + */ + [DataMember(Name = "taxPercentage", IsRequired = true, EmitDefaultValue = true)] + public int? TaxPercentage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShippingInfo {\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" AmountExcludingTax: ").Append(AmountExcludingTax).Append("\n"); + sb.Append(" TaxAmount: ").Append(TaxAmount).Append("\n"); + sb.Append(" TaxPercentage: ").Append(TaxPercentage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Amount (long?) minimum + if (this.Amount < (long?)0) + { + yield return new ValidationResult("Invalid value for Amount, must be a value greater than or equal to 0.", new [] { "Amount" }); + } + + // AmountExcludingTax (long?) minimum + if (this.AmountExcludingTax < (long?)0) + { + yield return new ValidationResult("Invalid value for AmountExcludingTax, must be a value greater than or equal to 0.", new [] { "AmountExcludingTax" }); + } + + // TaxAmount (long?) minimum + if (this.TaxAmount < (long?)0) + { + yield return new ValidationResult("Invalid value for TaxAmount, must be a value greater than or equal to 0.", new [] { "TaxAmount" }); + } + + // TaxPercentage (int?) maximum + if (this.TaxPercentage > (int?)100) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value less than or equal to 100.", new [] { "TaxPercentage" }); + } + + // TaxPercentage (int?) minimum + if (this.TaxPercentage < (int?)0) + { + yield return new ValidationResult("Invalid value for TaxPercentage, must be a value greater than or equal to 0.", new [] { "TaxPercentage" }); + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/State.cs b/src/Vipps.net.Models.Epayment/Model/State.cs new file mode 100644 index 0000000..8fc699b --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/State.cs @@ -0,0 +1,66 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// The state of the Payment. One of: - `CREATED`: The user has not yet acted upon the payment. Example: The user has received a push message, but not yet opened it. - `ABORTED`: The user has aborted the payment before authorization. This is a final state. Example: The user cancelled instead of accepting the payment. - `EXPIRED`: The user did not act on the payment within the payment expiration time. This is a final state. Example: The user received a push message, but did nothing before the payment request timed out. - `AUTHORIZED`: The user has approved the payment. This is a final state. Example: A payment that has been refunded may have one or more refund events, but the state would be `AUTHORIZED`. - `TERMINATED`: The merchant has terminated the payment via the cancelPayment endpoint. This is a final state. Example: The merchant was not able to provide the product or service, and has cancelled the payment. + /// + /// The state of the Payment. One of: - `CREATED`: The user has not yet acted upon the payment. Example: The user has received a push message, but not yet opened it. - `ABORTED`: The user has aborted the payment before authorization. This is a final state. Example: The user cancelled instead of accepting the payment. - `EXPIRED`: The user did not act on the payment within the payment expiration time. This is a final state. Example: The user received a push message, but did nothing before the payment request timed out. - `AUTHORIZED`: The user has approved the payment. This is a final state. Example: A payment that has been refunded may have one or more refund events, but the state would be `AUTHORIZED`. - `TERMINATED`: The merchant has terminated the payment via the cancelPayment endpoint. This is a final state. Example: The merchant was not able to provide the product or service, and has cancelled the payment. + [JsonConverter(typeof(StringEnumConverter))] + public enum State + { + /// + /// Enum CREATED for value: CREATED + /// + [EnumMember(Value = "CREATED")] + CREATED = 1, + + /// + /// Enum ABORTED for value: ABORTED + /// + [EnumMember(Value = "ABORTED")] + ABORTED = 2, + + /// + /// Enum EXPIRED for value: EXPIRED + /// + [EnumMember(Value = "EXPIRED")] + EXPIRED = 3, + + /// + /// Enum AUTHORIZED for value: AUTHORIZED + /// + [EnumMember(Value = "AUTHORIZED")] + AUTHORIZED = 4, + + /// + /// Enum TERMINATED for value: TERMINATED + /// + [EnumMember(Value = "TERMINATED")] + TERMINATED = 5 + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/UnitInfo.cs b/src/Vipps.net.Models.Epayment/Model/UnitInfo.cs new file mode 100644 index 0000000..185e99b --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/UnitInfo.cs @@ -0,0 +1,141 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// Optional. If no quantity info is provided the order line will default to 1 pcs + /// + [DataContract(Name = "UnitInfo")] + public partial class UnitInfo : IValidatableObject + { + + /// + /// Gets or Sets QuantityUnit + /// + [DataMember(Name = "quantityUnit", EmitDefaultValue = true)] + public QuantityUnitEnum? QuantityUnit { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UnitInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// Total price per unit, including tax and excluding discount (required). + /// Quantity given as a integer or fraction (only for cosmetics) (required). + /// quantityUnit. + public UnitInfo(long? unitPrice = default(long?), string quantity = default(string), QuantityUnitEnum? quantityUnit = default(QuantityUnitEnum?)) + { + // to ensure "unitPrice" is required (not null) + if (unitPrice == null) + { + throw new ArgumentNullException("unitPrice is a required property for UnitInfo and cannot be null"); + } + this.UnitPrice = unitPrice; + // to ensure "quantity" is required (not null) + if (quantity == null) + { + throw new ArgumentNullException("quantity is a required property for UnitInfo and cannot be null"); + } + this.Quantity = quantity; + this.QuantityUnit = quantityUnit; + } + + /// + /// Total price per unit, including tax and excluding discount + /// + /// Total price per unit, including tax and excluding discount + [DataMember(Name = "unitPrice", IsRequired = true, EmitDefaultValue = true)] + public long? UnitPrice { get; set; } + + /// + /// Quantity given as a integer or fraction (only for cosmetics) + /// + /// Quantity given as a integer or fraction (only for cosmetics) + /* + 0.822 + */ + [DataMember(Name = "quantity", IsRequired = true, EmitDefaultValue = true)] + public string Quantity { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UnitInfo {\n"); + sb.Append(" UnitPrice: ").Append(UnitPrice).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" QuantityUnit: ").Append(QuantityUnit).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UnitPrice (long?) minimum + if (this.UnitPrice < (long?)0) + { + yield return new ValidationResult("Invalid value for UnitPrice, must be a value greater than or equal to 0.", new [] { "UnitPrice" }); + } + + // Quantity (string) maxLength + if (this.Quantity != null && this.Quantity.Length > 10) + { + yield return new ValidationResult("Invalid value for Quantity, length must be less than 10.", new [] { "Quantity" }); + } + + if (this.Quantity != null) { + // Quantity (string) pattern + Regex regexQuantity = new Regex(@"^\d+([\.]\d{1,8})?$", RegexOptions.CultureInvariant); + if (!regexQuantity.Match(this.Quantity).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Quantity, must match a pattern of " + regexQuantity, new [] { "Quantity" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Model/WebhookEvent.cs b/src/Vipps.net.Models.Epayment/Model/WebhookEvent.cs new file mode 100644 index 0000000..13185fc --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Model/WebhookEvent.cs @@ -0,0 +1,223 @@ +/* + * ePayment API + * + * The ePayment API enables you to create Vipps MobilePay payments for online and in-person payments. See the [ePayment API Guide](https://developer.vippsmobilepay.com/docs/APIs/epayment-api) for more details. + * + * The version of the OpenAPI document: 1.6.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Vipps.net.Models.Epayment.Client.OpenAPIDateConverter; + +namespace Vipps.net.Models.Epayment.Model +{ + /// + /// WebhookEvent + /// + [DataContract(Name = "WebhookEvent")] + public partial class WebhookEvent : IValidatableObject + { + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public PaymentEventName Name { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected WebhookEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// The merchant serial number (MSN) for the sales unit. (required). + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). (required). + /// Reference value for a payment, defined by Vipps MobilePay. (required). + /// name (required). + /// amount (required). + /// timestamp (required). + /// The Idempotency key of the request.. + /// The outcome of the event (required). + public WebhookEvent(string msn = default(string), string reference = default(string), string pspReference = default(string), PaymentEventName name = default(PaymentEventName), Amount amount = default(Amount), DateTime timestamp = default(DateTime), string idempotencyKey = default(string), bool success = default(bool)) + { + // to ensure "msn" is required (not null) + if (msn == null) + { + throw new ArgumentNullException("msn is a required property for WebhookEvent and cannot be null"); + } + this.Msn = msn; + // to ensure "reference" is required (not null) + if (reference == null) + { + throw new ArgumentNullException("reference is a required property for WebhookEvent and cannot be null"); + } + this.Reference = reference; + // to ensure "pspReference" is required (not null) + if (pspReference == null) + { + throw new ArgumentNullException("pspReference is a required property for WebhookEvent and cannot be null"); + } + this.PspReference = pspReference; + this.Name = name; + // to ensure "amount" is required (not null) + if (amount == null) + { + throw new ArgumentNullException("amount is a required property for WebhookEvent and cannot be null"); + } + this.Amount = amount; + this.Timestamp = timestamp; + this.Success = success; + this.IdempotencyKey = idempotencyKey; + } + + /// + /// The merchant serial number (MSN) for the sales unit. + /// + /// The merchant serial number (MSN) for the sales unit. + /* + 1234567 + */ + [DataMember(Name = "msn", IsRequired = true, EmitDefaultValue = true)] + public string Msn { get; set; } + + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /// + /// The `reference` is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not _globally_ unique, so several MSNs may use the same reference. See the [recommendations](/docs/knowledge-base/orderid/). + /* + acme-shop-123-order123abc + */ + [DataMember(Name = "reference", IsRequired = true, EmitDefaultValue = true)] + public string Reference { get; set; } + + /// + /// Reference value for a payment, defined by Vipps MobilePay. + /// + /// Reference value for a payment, defined by Vipps MobilePay. + [DataMember(Name = "pspReference", IsRequired = true, EmitDefaultValue = true)] + public string PspReference { get; set; } + + /// + /// Gets or Sets Amount + /// + [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] + public Amount Amount { get; set; } + + /// + /// Gets or Sets Timestamp + /// + [DataMember(Name = "timestamp", IsRequired = true, EmitDefaultValue = true)] + public DateTime Timestamp { get; set; } + + /// + /// The Idempotency key of the request. + /// + /// The Idempotency key of the request. + [DataMember(Name = "idempotencyKey", EmitDefaultValue = true)] + public string IdempotencyKey { get; set; } + + /// + /// The outcome of the event + /// + /// The outcome of the event + [DataMember(Name = "success", IsRequired = true, EmitDefaultValue = true)] + public bool Success { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class WebhookEvent {\n"); + sb.Append(" Msn: ").Append(Msn).Append("\n"); + sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" PspReference: ").Append(PspReference).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" IdempotencyKey: ").Append(IdempotencyKey).Append("\n"); + sb.Append(" Success: ").Append(Success).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Msn (string) maxLength + if (this.Msn != null && this.Msn.Length > 7) + { + yield return new ValidationResult("Invalid value for Msn, length must be less than 7.", new [] { "Msn" }); + } + + // Msn (string) minLength + if (this.Msn != null && this.Msn.Length < 4) + { + yield return new ValidationResult("Invalid value for Msn, length must be greater than 4.", new [] { "Msn" }); + } + + if (this.Msn != null) { + // Msn (string) pattern + Regex regexMsn = new Regex(@"^[0-9]{4,7}$", RegexOptions.CultureInvariant); + if (!regexMsn.Match(this.Msn).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Msn, must match a pattern of " + regexMsn, new [] { "Msn" }); + } + } + + // Reference (string) maxLength + if (this.Reference != null && this.Reference.Length > 50) + { + yield return new ValidationResult("Invalid value for Reference, length must be less than 50.", new [] { "Reference" }); + } + + // Reference (string) minLength + if (this.Reference != null && this.Reference.Length < 8) + { + yield return new ValidationResult("Invalid value for Reference, length must be greater than 8.", new [] { "Reference" }); + } + + if (this.Reference != null) { + // Reference (string) pattern + Regex regexReference = new Regex(@"^[a-zA-Z0-9-]{8,50}$", RegexOptions.CultureInvariant); + if (!regexReference.Match(this.Reference).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, must match a pattern of " + regexReference, new [] { "Reference" }); + } + } + + yield break; + } + } + +} diff --git a/src/Vipps.net.Models.Epayment/Vipps.net.Models.Epayment.csproj b/src/Vipps.net.Models.Epayment/Vipps.net.Models.Epayment.csproj new file mode 100644 index 0000000..fe448c7 --- /dev/null +++ b/src/Vipps.net.Models.Epayment/Vipps.net.Models.Epayment.csproj @@ -0,0 +1,37 @@ + + + + false + netstandard2.0 + Vipps.net.Models.Epayment + Vipps.net.Models.Epayment + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Vipps.net.Models.Epayment + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Vipps.net.Models.Epayment.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + false + + + + + + + + + + + + + + + + + diff --git a/src/Vipps.net.sln b/src/Vipps.net.sln index 5184c54..0db6f28 100644 --- a/src/Vipps.net.sln +++ b/src/Vipps.net.sln @@ -16,10 +16,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vipps.net.AspCoreDemo", "Vi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vipps.net.AspDemo", "Vipps.net.AspDemo\Vipps.net.AspDemo.csproj", "{4276E5A2-E884-48E8-B446-715FB1BCB23B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vipps.net.Codegen", "Vipps.net.Codegen\Vipps.net.Codegen.csproj", "{52AD8849-DDB6-4542-9E18-2219AF993CAF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vipps.net.IntegrationTests", "Tests\Vipps.net.IntegrationTests\Vipps.net.IntegrationTests.csproj", "{42DD89A8-0AE4-4CCD-9CAC-39B8F217805D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vipps.net.Models.Epayment", "Vipps.net.Models.Epayment\Vipps.net.Models.Epayment.csproj", "{275DEAA9-4BD8-4B75-B1A2-3436F21B7111}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vipps.net.Models.Checkout", "Vipps.net.Models.Checkout\Vipps.net.Models.Checkout.csproj", "{CC6D63A1-CA73-47AC-98E8-F008042FADDD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vipps.net.Models.Epayment.Test", "Vipps.net.Models.Epayment.Test\Vipps.net.Models.Epayment.Test.csproj", "{FDAB5625-8BA1-4FE2-BA73-EB3D496CFF85}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vipps.net.Models.Checkout.Test", "Vipps.net.Models.Checkout.Test\Vipps.net.Models.Checkout.Test.csproj", "{F8C3E3EF-F7CC-476C-803E-E4C44BEC3A46}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,14 +48,26 @@ Global {4276E5A2-E884-48E8-B446-715FB1BCB23B}.Debug|Any CPU.Build.0 = Debug|Any CPU {4276E5A2-E884-48E8-B446-715FB1BCB23B}.Release|Any CPU.ActiveCfg = Release|Any CPU {4276E5A2-E884-48E8-B446-715FB1BCB23B}.Release|Any CPU.Build.0 = Release|Any CPU - {52AD8849-DDB6-4542-9E18-2219AF993CAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {52AD8849-DDB6-4542-9E18-2219AF993CAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {52AD8849-DDB6-4542-9E18-2219AF993CAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {52AD8849-DDB6-4542-9E18-2219AF993CAF}.Release|Any CPU.Build.0 = Release|Any CPU {42DD89A8-0AE4-4CCD-9CAC-39B8F217805D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42DD89A8-0AE4-4CCD-9CAC-39B8F217805D}.Debug|Any CPU.Build.0 = Debug|Any CPU {42DD89A8-0AE4-4CCD-9CAC-39B8F217805D}.Release|Any CPU.ActiveCfg = Release|Any CPU {42DD89A8-0AE4-4CCD-9CAC-39B8F217805D}.Release|Any CPU.Build.0 = Release|Any CPU + {275DEAA9-4BD8-4B75-B1A2-3436F21B7111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {275DEAA9-4BD8-4B75-B1A2-3436F21B7111}.Debug|Any CPU.Build.0 = Debug|Any CPU + {275DEAA9-4BD8-4B75-B1A2-3436F21B7111}.Release|Any CPU.ActiveCfg = Release|Any CPU + {275DEAA9-4BD8-4B75-B1A2-3436F21B7111}.Release|Any CPU.Build.0 = Release|Any CPU + {CC6D63A1-CA73-47AC-98E8-F008042FADDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC6D63A1-CA73-47AC-98E8-F008042FADDD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC6D63A1-CA73-47AC-98E8-F008042FADDD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC6D63A1-CA73-47AC-98E8-F008042FADDD}.Release|Any CPU.Build.0 = Release|Any CPU + {FDAB5625-8BA1-4FE2-BA73-EB3D496CFF85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDAB5625-8BA1-4FE2-BA73-EB3D496CFF85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDAB5625-8BA1-4FE2-BA73-EB3D496CFF85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDAB5625-8BA1-4FE2-BA73-EB3D496CFF85}.Release|Any CPU.Build.0 = Release|Any CPU + {F8C3E3EF-F7CC-476C-803E-E4C44BEC3A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8C3E3EF-F7CC-476C-803E-E4C44BEC3A46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8C3E3EF-F7CC-476C-803E-E4C44BEC3A46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8C3E3EF-F7CC-476C-803E-E4C44BEC3A46}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Vipps.net/Infrastructure/BaseServiceClient.cs b/src/Vipps.net/Infrastructure/BaseServiceClient.cs index 29a62f0..a88a7b4 100644 --- a/src/Vipps.net/Infrastructure/BaseServiceClient.cs +++ b/src/Vipps.net/Infrastructure/BaseServiceClient.cs @@ -186,7 +186,7 @@ CancellationToken cancellationToken return response; } - private static HttpContent CreateRequestContent(TRequest vippsRequest) + private static StringContent CreateRequestContent(TRequest vippsRequest) where TRequest : class { if (vippsRequest is null) diff --git a/src/Vipps.net/Models/CheckoutModels.cs b/src/Vipps.net/Models/CheckoutModels.cs deleted file mode 100644 index 22823f3..0000000 --- a/src/Vipps.net/Models/CheckoutModels.cs +++ /dev/null @@ -1,1749 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org) -// -//---------------------- - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" - -namespace Vipps.net.Models.Checkout -{ - using System = global::System; - - - - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Amount - { - /// - /// Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] - public int Value { get; set; } - - /// - /// The currency identifier according to ISO 4217. Example: "NOK" - /// - [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Currency { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Defines the details of the billing - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class BillingDetails - { - /// - /// Example: "Ada" - /// - [Newtonsoft.Json.JsonProperty("firstName", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FirstName { get; set; } - - /// - /// Example: "Lovelace" - /// - [Newtonsoft.Json.JsonProperty("lastName", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string LastName { get; set; } - - /// - /// Example: "user@example.com" - /// - [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Email { get; set; } - - /// - /// If no country code is provided, defaults to Norway (47). Example: "4791234567" - /// - [Newtonsoft.Json.JsonProperty("phoneNumber", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PhoneNumber { get; set; } - - /// - /// Example: "Robert Levins gate 5" - /// - [Newtonsoft.Json.JsonProperty("streetAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string StreetAddress { get; set; } - - /// - /// Example: "0154" - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string PostalCode { get; set; } - - /// - /// Example: "Oslo" - /// - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string City { get; set; } - - /// - /// The ISO-3166-1 Alpha-2 representation of the country. Example: "NO" - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Country { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CheckoutConfig - { - /// - /// If customer is physically present: "customer_present", otherwise: "customer_not_present". - /// - [Newtonsoft.Json.JsonProperty("customerInteraction", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public CustomerInteraction? CustomerInteraction { get; set; } - - /// - /// Adjust the fields and values present in the Checkout. - /// - [Newtonsoft.Json.JsonProperty("elements", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public Elements? Elements { get; set; } - - /// - /// Countries to allow during session - /// - [Newtonsoft.Json.JsonProperty("countries", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Countries Countries { get; set; } - - /// - /// One of the following: "WEB_REDIRECT", "NATIVE_REDIRECT". To ensure having a return URL based on an app URL, use "NATIVE_REDIRECT". - /// - [Newtonsoft.Json.JsonProperty("userFlow", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public UserFlow? UserFlow { get; set; } - - /// - /// Requires the customer to consent to share their email and openid sub with the merchant to be able to make a wallet payment (default: false). - /// - [Newtonsoft.Json.JsonProperty("requireUserInfo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool? RequireUserInfo { get; set; } - - /// - /// If used, displays a checkbox that can be used to ask for extra consent. - /// - [Newtonsoft.Json.JsonProperty("customConsent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public CustomConsent CustomConsent { get; set; } - - /// - /// Decides whether the order lines are displayed as a shopping cart context in the checkout. - /// - [Newtonsoft.Json.JsonProperty("showOrderSummary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool? ShowOrderSummary { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Information about the merchant system. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CheckoutSessionThirdPartyInformationHeaders - { - /// - /// The name of the ecommerce solution. Example: "Acme Commerce". - /// - [Newtonsoft.Json.JsonProperty("vipps-System-Name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VippsSystemName { get; set; } - - /// - /// The version number of the ecommerce solution. Example: "3.1.2". - /// - [Newtonsoft.Json.JsonProperty("vipps-System-Version", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VippsSystemVersion { get; set; } - - /// - /// The name of the ecommerce plugin. Example: "acme-webshop". - /// - [Newtonsoft.Json.JsonProperty("vipps-System-Plugin-Name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VippsSystemPluginName { get; set; } - - /// - /// The version number of the ecommerce plugin. Example: "4.5.6". - /// - [Newtonsoft.Json.JsonProperty("vipps-System-Plugin-Version", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VippsSystemPluginVersion { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Countries - { - /// - /// List of allowed countries in ISO-3166 Alpha 2. If specified, the customer will only be able to select these countries. Example ["NO", "SE", "DK"] - /// - [Newtonsoft.Json.JsonProperty("supported", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Supported { get; set; } = new System.Collections.ObjectModel.Collection(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// If used, displays a checkbox that can be used to ask for extra consent. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CustomConsent - { - /// - /// Text displayed next to the checkbox. This text can contain up to one link in markdown format like this: [linkText](https://example.com) - /// - [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Text { get; set; } - - /// - /// Whether box has to be checked to complete the checkout. - /// - [Newtonsoft.Json.JsonProperty("required", Required = Newtonsoft.Json.Required.Always)] - public bool Required { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum CustomerInteraction - { - - [System.Runtime.Serialization.EnumMember(Value = @"CUSTOMER_PRESENT")] - CUSTOMER_PRESENT = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"CUSTOMER_NOT_PRESENT")] - CUSTOMER_NOT_PRESENT = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum Elements - { - - [System.Runtime.Serialization.EnumMember(Value = @"Full")] - Full = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"PaymentAndContactInfo")] - PaymentAndContactInfo = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"PaymentOnly")] - PaymentOnly = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum ExternalSessionState - { - - [System.Runtime.Serialization.EnumMember(Value = @"SessionCreated")] - SessionCreated = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"PaymentInitiated")] - PaymentInitiated = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"SessionExpired")] - SessionExpired = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"PaymentSuccessful")] - PaymentSuccessful = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"PaymentTerminated")] - PaymentTerminated = 4, - - } - - /// - /// Configuration required to enable Helthjem logistics options - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Helthjem - { - /// - /// The Username provided to you by Helthjem - /// - [Newtonsoft.Json.JsonProperty("username", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string Username { get; set; } - - /// - /// The Password provided to you by Helthjem - /// - [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string Password { get; set; } - - /// - /// The ShopId provided to you by Helthjem - /// - [Newtonsoft.Json.JsonProperty("shopId", Required = Newtonsoft.Json.Required.Always)] - public int ShopId { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class HelthjemLogisticsOption : LogisticsOptionBase - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public HelthjemLogisticsType? Type { get; set; } - - [Newtonsoft.Json.JsonProperty("customType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string CustomType { get; set; } - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"HELTHJEM")] - public string Brand { get; set; } = "HELTHJEM"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum HelthjemLogisticsType - { - - [System.Runtime.Serialization.EnumMember(Value = @"HOME_DELIVERY")] - HOME_DELIVERY = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"PICKUP_POINT")] - PICKUP_POINT = 1, - - } - - /// - /// Request to set up a Checkout session - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class InitiateSessionRequest - { - [Newtonsoft.Json.JsonProperty("merchantInfo", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PaymentMerchantInfo MerchantInfo { get; set; } = new PaymentMerchantInfo(); - - [Newtonsoft.Json.JsonProperty("transaction", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PaymentTransaction Transaction { get; set; } = new PaymentTransaction(); - - [Newtonsoft.Json.JsonProperty("logistics", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Logistics Logistics { get; set; } - - /// - /// If customer information is known, it can be prefilled. - /// - [Newtonsoft.Json.JsonProperty("prefillCustomer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public PrefillCustomer PrefillCustomer { get; set; } - - [Newtonsoft.Json.JsonProperty("configuration", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public CheckoutConfig Configuration { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Response from initiating a session. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class InitiateSessionResponse - { - /// - /// The token to be provided to Checkout. Example: "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJUdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIiwic2Vzc2lvblBvbGxpbmdVUkwiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAvY2hlY2tvdXQvc2Vzc2lvbi9UdHF1Y3I5ZDdKRHZ6clhYWTU1WUZRIn0.ln7VzZkNvUGu0HhyA_a8IbXQN35WhDBmCYC9IvyYL-I" - /// - [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Token { get; set; } - - /// - /// The URL of the checkout frontend. Example: "https://vippscheckout.vipps.no/v1/". - /// - [Newtonsoft.Json.JsonProperty("checkoutFrontendUrl", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string CheckoutFrontendUrl { get; set; } - - /// - /// The URL to poll for session information. Example: "https://api.vipps.no/checkout/v1/session/31gf1g413121". - /// - [Newtonsoft.Json.JsonProperty("pollingUrl", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PollingUrl { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Configuration required to enable Instabox logistics options - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Instabox - { - /// - /// The client id provided to you by Instabox - /// - [Newtonsoft.Json.JsonProperty("clientId", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string ClientId { get; set; } - - /// - /// The client secret provided to you by Instabox - /// - [Newtonsoft.Json.JsonProperty("clientSecret", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string ClientSecret { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Details needed to book an instabox order - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class InstaboxBookingDetails - { - /// - /// Identifies when the delivery options were fetched - /// - [Newtonsoft.Json.JsonProperty("availabilityToken", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string AvailabilityToken { get; set; } - - /// - /// Identifies the service (For example "EXPRESS") - /// - [Newtonsoft.Json.JsonProperty("serviceType", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string ServiceType { get; set; } - - /// - /// Identifies the location - /// - [Newtonsoft.Json.JsonProperty("sortCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SortCode { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class InstaboxLogisticsOption : LogisticsOptionBase - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public InstaboxLogisticsType? Type { get; set; } - - [Newtonsoft.Json.JsonProperty("customType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string CustomType { get; set; } - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"INSTABOX")] - public string Brand { get; set; } = "INSTABOX"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum InstaboxLogisticsType - { - - [System.Runtime.Serialization.EnumMember(Value = @"HOME_DELIVERY")] - HOME_DELIVERY = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"PICKUP_POINT")] - PICKUP_POINT = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Integrations - { - /// - /// Configuration required to enable Porterbuddy logistics options - /// - [Newtonsoft.Json.JsonProperty("porterbuddy", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Porterbuddy Porterbuddy { get; set; } - - /// - /// Configuration required to enable Instabox logistics options - /// - [Newtonsoft.Json.JsonProperty("instabox", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Instabox Instabox { get; set; } - - /// - /// Configuration required to enable Helthjem logistics options - /// - [Newtonsoft.Json.JsonProperty("helthjem", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Helthjem Helthjem { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// If both dynamic and fixed options are specified, dynamic options is provided to the user. - ///
If no DynamicOptionsCallback is provided, only fixed logistics options will be used. - ///
When using dynamic shipping we recommend that you define logistics.fixedOptions as a backup. - ///
If the callback does not resolve successfully within 8 seconds, returns null or an empty list the system will fall back to static options. - ///
If no fallback options are provided, the user will be presented with an error and will not be able to continue with the checkout. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Logistics - { - /// - /// Merchant's Callback URL for providing dynamic logistics options based on customer address. Example: "https://example.com/vipps/dynamiclogisticsoption". Can not be used with AddressFields set to false. - /// - [Newtonsoft.Json.JsonProperty("dynamicOptionsCallback", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string DynamicOptionsCallback { get; set; } - - /// - /// Fixed list of logistics options. - /// - [Newtonsoft.Json.JsonProperty("fixedOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Collections.Generic.ICollection FixedOptions { get; set; } - - /// - /// Some optional checkout features require carrier-specific configuration. Can not be used with AddressFields set to false. - /// - [Newtonsoft.Json.JsonProperty("integrations", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Integrations Integrations { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class LogisticsOptionBase - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(200, MinimumLength = 1)] - public string Id { get; set; } - - [Newtonsoft.Json.JsonProperty("priority", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] - public int Priority { get; set; } - - [Newtonsoft.Json.JsonProperty("isDefault", Required = Newtonsoft.Json.Required.Always)] - public bool IsDefault { get; set; } - - [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Headers required to retrieve an access token. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class MerchantAuthInfoHeaders - { - /// - /// Client ID for the merchant (the "username"). Found in the Vipps portal. Example: "fb492b5e-7907-4d83-bc20-c7fb60ca35de". - /// - [Newtonsoft.Json.JsonProperty("client_id", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string Client_id { get; set; } - - /// - /// Client Secret for the merchant (the "password"). Found in the Vipps portal. Example: "Y8Kteew6GE3ZmeycEt6egg==". - /// - [Newtonsoft.Json.JsonProperty("client_secret", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string Client_secret { get; set; } - - /// - /// Vipps Subscription key for the API product. Found in the Vipps portal. Example: "0f14ebcab0eb4b29ae0cb90d91b4a84a". - /// - [Newtonsoft.Json.JsonProperty("ocp-Apim-Subscription-Key", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string OcpApimSubscriptionKey { get; set; } - - /// - /// Vipps assigned unique number for a merchant. Found in the Vipps portal. Example: "123456". - /// - [Newtonsoft.Json.JsonProperty("merchant-Serial-Number", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string MerchantSerialNumber { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Information about the customer address used when retrieving dynamic logistics options. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class MerchantLogisticsCallbackRequestBody - { - /// - /// Example: "Robert Levins gate 5" - /// - [Newtonsoft.Json.JsonProperty("streetAddress", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string StreetAddress { get; set; } - - /// - /// Example: "0154" - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PostalCode { get; set; } - - /// - /// Example: "Oslo" - /// - [Newtonsoft.Json.JsonProperty("region", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Region { get; set; } - - /// - /// The ISO-3166-1 Alpha-2 representation of the country. Example: "NO" - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Country { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OrderBottomLine - { - /// - /// The currency identifier according to ISO 4217. Example: "NOK". - /// - [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(3, MinimumLength = 3)] - public string Currency { get; set; } - - /// - /// Tip amount for the order. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("tipAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public long? TipAmount { get; set; } - - /// - /// Amount paid by gift card or coupon. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("giftCardAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public long? GiftCardAmount { get; set; } - - /// - /// Identifier of the terminal / point of sale. - /// - [Newtonsoft.Json.JsonProperty("terminalId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string TerminalId { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OrderLine - { - /// - /// The name of the product in the order line. - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(2048, MinimumLength = 1)] - public string Name { get; set; } - - /// - /// The product ID. - /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(255, MinimumLength = 1)] - public string Id { get; set; } - - /// - /// Total amount of the order line, including tax and discount. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("totalAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long TotalAmount { get; set; } - - /// - /// Total amount of order line with discount excluding tax. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("totalAmountExcludingTax", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long TotalAmountExcludingTax { get; set; } - - /// - /// Total tax amount paid for the order line. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("totalTaxAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long TotalTaxAmount { get; set; } - - /// - /// Tax percentage for the order line. - /// - [Newtonsoft.Json.JsonProperty("taxPercentage", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0, 100)] - public int TaxPercentage { get; set; } - - /// - /// If no quantity info is provided the order line will default to 1 pcs. - /// - [Newtonsoft.Json.JsonProperty("unitInfo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public OrderUnitInfo UnitInfo { get; set; } - - /// - /// Total discount for the order line. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("discount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public long? Discount { get; set; } - - /// - /// URL linking back to the product at the merchant. - /// - [Newtonsoft.Json.JsonProperty("productUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ProductUrl { get; set; } - - /// - /// Flag for marking the orderline as returned. This will make it count negative towards all the sums in BottomLine. - /// - [Newtonsoft.Json.JsonProperty("isReturn", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool? IsReturn { get; set; } - - /// - /// Flag for marking the orderline as a shipping line. This will be shown differently in the app. - /// - [Newtonsoft.Json.JsonProperty("isShipping", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool? IsShipping { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OrderSummary - { - /// - /// The order lines contain descriptions of each item present in the order. - /// - [Newtonsoft.Json.JsonProperty("orderLines", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.MinLength(1)] - public System.Collections.Generic.ICollection OrderLines { get; set; } = new System.Collections.ObjectModel.Collection(); - - /// - /// Contains information regarding the order as a whole. - /// - [Newtonsoft.Json.JsonProperty("orderBottomLine", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public OrderBottomLine OrderBottomLine { get; set; } = new OrderBottomLine(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OrderUnitInfo - { - /// - /// Total price per unit, including tax and excluding discount. Must be in Minor Units. The smallest unit of a currency. Example 100 NOK = 10000. - /// - [Newtonsoft.Json.JsonProperty("unitPrice", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long UnitPrice { get; set; } - - /// - /// Quantity given as a integer or fraction (only for cosmetics). - /// - [Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Quantity { get; set; } - - /// - /// Available units for quantity. Will default to PCS if not set. - /// - [Newtonsoft.Json.JsonProperty("quantityUnit", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public QuantityUnit QuantityUnit { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OtherLogisticsOption : LogisticsOptionBase - { - [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(200, MinimumLength = 1)] - public string Title { get; set; } - - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"OTHER")] - public string Brand { get; set; } = "OTHER"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentMerchantInfo - { - /// - /// Complete URL for receiving callbacks. Example: "https://exmaple.com/vipps/payment-callback/ - /// - [Newtonsoft.Json.JsonProperty("callbackUrl", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string CallbackUrl { get; set; } - - /// - /// Complete URL for redirecting customers to when the checkout is finished. Example: "https://example.com/vipps". - /// - [Newtonsoft.Json.JsonProperty("returnUrl", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string ReturnUrl { get; set; } - - /// - /// The token will be supplied by the callback to the merchant as a header. Example: "iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJ". - /// - [Newtonsoft.Json.JsonProperty("callbackAuthorizationToken", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string CallbackAuthorizationToken { get; set; } - - /// - /// Complete URL to the merchant's terms and conditions. Example: "https://example.com/vipps/termsAndConditions". - /// - [Newtonsoft.Json.JsonProperty("termsAndConditionsUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string TermsAndConditionsUrl { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PaymentMethod - { - - [System.Runtime.Serialization.EnumMember(Value = @"Wallet")] - Wallet = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"Card")] - Card = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PaymentState - { - - [System.Runtime.Serialization.EnumMember(Value = @"CREATED")] - CREATED = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AUTHORIZED")] - AUTHORIZED = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"TERMINATED")] - TERMINATED = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentTransaction - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - /// - /// The merchant's unique reference for the transaction. Also known as OrderId. Example: "acme-shop-123-order123abc". See https://developer.vippsmobilepay.com/docs/vipps-developers/common-topics/orderid - /// - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[-a-zA-Z0-9]*$")] - public string Reference { get; set; } - - /// - /// Description visible to the customer during payment. Example: "One pair of Vipps socks". - /// - [Newtonsoft.Json.JsonProperty("paymentDescription", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength = 3)] - public string PaymentDescription { get; set; } - - /// - /// Contain descriptions of each item present in the order, and an order bottom line for information regarding the order as a whole. - /// - [Newtonsoft.Json.JsonProperty("orderSummary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public OrderSummary OrderSummary { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The pickup point the customer selected . - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PickupPoint - { - /// - /// Pickup point id provided by the carrier. Example: 121648 - /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Id { get; set; } - - /// - /// Pickup point name. Example: Extra Eiganes - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - /// - /// Pickup point's street address. Example: VITAMINVEIEN 7 - /// - [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Address { get; set; } - - /// - /// Pickup point's postal code. Example: 0485 - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PostalCode { get; set; } - - /// - /// Pickup point's city. Example: OSLO - /// - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string City { get; set; } - - /// - /// Pickup point's country. Example: NO - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Country { get; set; } - - /// - /// Pickup point's opening hours. Example: Man-Søn: 1000-2000 - /// - [Newtonsoft.Json.JsonProperty("openingHours", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Collections.Generic.ICollection OpeningHours { get; set; } - - /// - /// Instabox details - /// - [Newtonsoft.Json.JsonProperty("instabox", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public InstaboxBookingDetails Instabox { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Configuration required to enable Porterbuddy logistics options - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Porterbuddy - { - /// - /// The public key provided to you by Porterbuddy - /// - [Newtonsoft.Json.JsonProperty("publicToken", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PublicToken { get; set; } - - /// - /// The API key provided to you by Porterbuddy - /// - [Newtonsoft.Json.JsonProperty("apiKey", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public string ApiKey { get; set; } - - /// - /// Information about the sender - /// - [Newtonsoft.Json.JsonProperty("origin", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PorterbuddyOrigin Origin { get; set; } = new PorterbuddyOrigin(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PorterbuddyLogisticsOption : LogisticsOptionBase - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount Amount { get; set; } - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PorterbuddyLogisticsType? Type { get; set; } - - [Newtonsoft.Json.JsonProperty("customType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string CustomType { get; set; } - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"PORTERBUDDY")] - public string Brand { get; set; } = "PORTERBUDDY"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PorterbuddyLogisticsType - { - - [System.Runtime.Serialization.EnumMember(Value = @"HOME_DELIVERY")] - HOME_DELIVERY = 0, - - } - - /// - /// Details about the sender of the Porterbuddy parcels - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PorterbuddyOrigin - { - /// - /// The name of your store - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - /// - /// Your email address where Porterbuddy booking confirmation will be sent - /// - [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Email { get; set; } - - /// - /// Your phone number where Porterbuddy may send you important messages. Format must be MSISDN (including country code). Example: "4791234567" - /// - [Newtonsoft.Json.JsonProperty("phoneNumber", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PhoneNumber { get; set; } - - /// - /// Your address where Porterbuddy will pick up the parcels - /// - [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PorterbuddyOriginAddress Address { get; set; } = new PorterbuddyOriginAddress(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PorterbuddyOriginAddress - { - /// - /// Example: "Robert Levins gate 5" - /// - [Newtonsoft.Json.JsonProperty("streetAddress", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string StreetAddress { get; set; } - - /// - /// Example: "0154" - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PostalCode { get; set; } - - /// - /// Example: "Oslo" - /// - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string City { get; set; } - - /// - /// The ISO-3166-1 Alpha-2 representation of the country. Example: "NO" - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Country { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PostenLogisticsOption : LogisticsOptionBase - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PostenLogisticsType? Type { get; set; } - - [Newtonsoft.Json.JsonProperty("customType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string CustomType { get; set; } - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"POSTEN")] - public string Brand { get; set; } = "POSTEN"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PostenLogisticsType - { - - [System.Runtime.Serialization.EnumMember(Value = @"MAILBOX")] - MAILBOX = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"PICKUP_POINT")] - PICKUP_POINT = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"HOME_DELIVERY")] - HOME_DELIVERY = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PostnordLogisticsOption : LogisticsOptionBase - { - /// - /// Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 499 kr = 49900 øre. - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PostnordLogisticsType? Type { get; set; } - - [Newtonsoft.Json.JsonProperty("customType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string CustomType { get; set; } - - [Newtonsoft.Json.JsonProperty("brand", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"POSTNORD")] - public string Brand { get; set; } = "POSTNORD"; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PostnordLogisticsType - { - - [System.Runtime.Serialization.EnumMember(Value = @"PICKUP_POINT")] - PICKUP_POINT = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"HOME_DELIVERY")] - HOME_DELIVERY = 1, - - } - - /// - /// Information about the customer to be prefilled - ///
- ///
If any of the customer information is invalid such as the phone number, - ///
the customer will be prompted to input new user information. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PrefillCustomer - { - /// - /// Example: "Ada" - /// - [Newtonsoft.Json.JsonProperty("firstName", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FirstName { get; set; } - - /// - /// Example: "Lovelace" - /// - [Newtonsoft.Json.JsonProperty("lastName", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string LastName { get; set; } - - /// - /// Example: "user@example.com" - /// - [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Email { get; set; } - - /// - /// Format must be MSISDN (including country code). Example: "4791234567" - /// - [Newtonsoft.Json.JsonProperty("phoneNumber", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PhoneNumber { get; set; } - - /// - /// Example: "Robert Levins gate 5" - /// - [Newtonsoft.Json.JsonProperty("streetAddress", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string StreetAddress { get; set; } - - /// - /// Example: "Oslo" - /// - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string City { get; set; } - - /// - /// Example: "0154" - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PostalCode { get; set; } - - /// - /// The ISO-3166-1 Alpha-2 representation of the country. Example: "NO" - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Country { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum QuantityUnit - { - - [System.Runtime.Serialization.EnumMember(Value = @"PCS")] - PCS = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"KG")] - KG = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"KM")] - KM = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"MINUTE")] - MINUTE = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"LITRE")] - LITRE = 4, - - } - - /// - /// Defines the details of the payment. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ResponsePaymentDetails - { - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("state", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentState State { get; set; } - - [Newtonsoft.Json.JsonProperty("aggregate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public TransactionAggregate Aggregate { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Session information - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class SessionResponse - { - /// - /// The Id of the session. Example: "v52EtjZriRmGiKiAKHByK2". - /// - [Newtonsoft.Json.JsonProperty("sessionId", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SessionId { get; set; } - - /// - /// The merchant's serial number. Example: "123456" - /// - [Newtonsoft.Json.JsonProperty("merchantSerialNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string MerchantSerialNumber { get; set; } - - /// - /// The merchant's unique reference for the transaction. Also known as OrderId. Example: "acme-shop-123-order123abc". See https://developer.vippsmobilepay.com/docs/vipps-developers/common-topics/orderid - /// - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Reference { get; set; } - - /// - /// The state of the session. Example: "SessionStarted". The state of the payment is in PaymentDetails.State. - /// - [Newtonsoft.Json.JsonProperty("sessionState", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public ExternalSessionState SessionState { get; set; } - - [Newtonsoft.Json.JsonProperty("paymentMethod", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentMethod? PaymentMethod { get; set; } - - [Newtonsoft.Json.JsonProperty("paymentDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ResponsePaymentDetails PaymentDetails { get; set; } - - [Newtonsoft.Json.JsonProperty("userInfo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public UserInfo UserInfo { get; set; } - - [Newtonsoft.Json.JsonProperty("shippingDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ShippingDetails ShippingDetails { get; set; } - - [Newtonsoft.Json.JsonProperty("billingDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public BillingDetails BillingDetails { get; set; } - - [Newtonsoft.Json.JsonProperty("customConsentProvided", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool? CustomConsentProvided { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Defines the details of the shipping - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ShippingDetails - { - /// - /// Example: "Ada" - /// - [Newtonsoft.Json.JsonProperty("firstName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string FirstName { get; set; } - - /// - /// Example: "Lovelace" - /// - [Newtonsoft.Json.JsonProperty("lastName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string LastName { get; set; } - - /// - /// Example: "user@example.com" - /// - [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Email { get; set; } - - /// - /// If no country code is provided, defaults to Norway (47). Example: "4791234567" - /// - [Newtonsoft.Json.JsonProperty("phoneNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string PhoneNumber { get; set; } - - /// - /// Example: "Robert Levins gate 5" - /// - [Newtonsoft.Json.JsonProperty("streetAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string StreetAddress { get; set; } - - /// - /// Example: "0154" - /// - [Newtonsoft.Json.JsonProperty("postalCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string PostalCode { get; set; } - - /// - /// Example: "Oslo" - /// - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string City { get; set; } - - /// - /// The ISO-3166-1 Alpha-2 representation of the country. Example: "NO" - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Country { get; set; } - - /// - /// Id of the shipping method. Example: "123abc" - /// - [Newtonsoft.Json.JsonProperty("shippingMethodId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ShippingMethodId { get; set; } - - /// - /// Shipping method amount - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount Amount { get; set; } - - [Newtonsoft.Json.JsonProperty("pickupPoint", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public PickupPoint PickupPoint { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Defines the details of the transaction - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class TransactionAggregate - { - [Newtonsoft.Json.JsonProperty("cancelledAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount CancelledAmount { get; set; } - - [Newtonsoft.Json.JsonProperty("capturedAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount CapturedAmount { get; set; } - - [Newtonsoft.Json.JsonProperty("refundedAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount RefundedAmount { get; set; } - - [Newtonsoft.Json.JsonProperty("authorizedAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Amount AuthorizedAmount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum UserFlow - { - - [System.Runtime.Serialization.EnumMember(Value = @"WEB_REDIRECT")] - WEB_REDIRECT = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"NATIVE_REDIRECT")] - NATIVE_REDIRECT = 1, - - } - - /// - /// Data from the [Userinfo endpoint](https://developer.vippsmobilepay.com/api/userinfo#operation/getUserinfo). - ///
This will only be present if the UserInfo flow is used. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class UserInfo - { - /// - /// The openid sub that uniquely identifies a Vipps user. - /// - [Newtonsoft.Json.JsonProperty("sub", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Sub { get; set; } - - /// - /// Example: "user@example.com" - /// - [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Email { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - -} - -#pragma warning restore 1591 -#pragma warning restore 1573 -#pragma warning restore 472 -#pragma warning restore 114 -#pragma warning restore 108 -#pragma warning restore 3016 -#pragma warning restore 8603 \ No newline at end of file diff --git a/src/Vipps.net/Models/EpaymentModels.cs b/src/Vipps.net/Models/EpaymentModels.cs deleted file mode 100644 index 773c6f6..0000000 --- a/src/Vipps.net/Models/EpaymentModels.cs +++ /dev/null @@ -1,1386 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org) -// -//---------------------- - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" - -namespace Vipps.net.Models.Epayment -{ - using System = global::System; - - - - /// - /// The target customer if the identity is known. - ///
The customer can be specified either with phone number or with the - ///
user's personal QR code. - ///
Specifying more than one of these will result in an error. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Customer - { - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - [Newtonsoft.Json.JsonProperty("phoneNumber", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(15, MinimumLength = 10)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^\d{10,15}$")] - public string PhoneNumber { get; set; } - - /// - /// The full content of the user's personal QR code in the app. - /// - [Newtonsoft.Json.JsonProperty("personalQr", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(255, MinimumLength = 5)] - public string PersonalQr { get; set; } - - } - - /// - /// The full content of the user's personal QR code in the app, used in 'merchant scan' scenarios. - ///
After the personal QR code has been scanned in a physical context, send the complete QR - ///
code content in this field to initiate a payment from the user (and do not send `phoneNumber`). - ///
- ///
**Important:** The content of the QR code can change at any time, without warning. - ///
It is very important to send the _complete content of the QR code_, like the complete URL in the example below. - ///
While the personal QR code does reveal the user's phone number in this example, that may change. - ///
The [Userinfo API](https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/) - ///
should be used if you need the user to share personal information, - ///
such as phone number, email address, etc. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PersonalQrCode - { - /// - /// The full content of the user's personal QR code in the app. - /// - [Newtonsoft.Json.JsonProperty("personalQr", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(255, MinimumLength = 5)] - public string PersonalQr { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Amount object, containing a `value` and a `currency`. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Amount - { - [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public Currency Currency { get; set; } - - /// - /// Integer value of price in the currency's monetary subunit (e.g., Norwegian øre), - ///
or monetary unit where applicable (e.g., Japanese YEN). The type of the monetary - ///
unit is defined in ISO 4217. - ///
- [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Range(0D, 65000000D)] - public long Value { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Currency code as defined in ISO 4217. eg NOK for Norwegian kroner. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum Currency - { - [System.Runtime.Serialization.EnumMember(Value = @"NOK")] - NOK = 0, - [System.Runtime.Serialization.EnumMember(Value = @"DKK")] - DKK = 1, - [System.Runtime.Serialization.EnumMember(Value = @"EUR")] - EUR = 2 - } - - /// - /// The `CreatePaymentRequest` object. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CreatePaymentRequest - { - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("customer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Customer Customer { get; set; } - - /// - /// The type of customer interaction that triggers the purchase. - ///
`CUSTOMER_PRESENT` means that the customer is physically present at the - ///
point of sale when the payment is made, typically in a store. - ///
- [Newtonsoft.Json.JsonProperty("customerInteraction", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public CreatePaymentRequestCustomerInteraction CustomerInteraction { get; set; } = Vipps.net.Models.Epayment.CreatePaymentRequestCustomerInteraction.CUSTOMER_NOT_PRESENT; - - [Newtonsoft.Json.JsonProperty("industryData", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public IndustryData IndustryData { get; set; } - - [Newtonsoft.Json.JsonProperty("paymentMethod", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PaymentMethod PaymentMethod { get; set; } = new PaymentMethod(); - - [Newtonsoft.Json.JsonProperty("profile", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ProfileRequest Profile { get; set; } - - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - /// - /// The URL the user is returned to after the payment session. - ///
The URL must use the `https://` scheme or a custom URL scheme. - ///
- [Newtonsoft.Json.JsonProperty("returnUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ReturnUrl { get; set; } - - /// - /// The flow for bringing the user to the Vipps MobilePay app's payment confirmation screen. - ///
If `userFlow` is `PUSH_MESSAGE`, a valid value for `customer.phoneNumber` is required. - ///
- [Newtonsoft.Json.JsonProperty("userFlow", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public CreatePaymentRequestUserFlow UserFlow { get; set; } - - /// - /// The payment will expire at the given date and time. - ///
The format must adhere to RFC 3339. - ///
The value must be more than 10 minutes and less than 28 days in the future. - ///
Can only be combined with `userFlow: PUSH_MESSAGE` or `userFlow: QR`. - ///
- ///
If ExpiresAt is set, receipt also has to be set. - ///
- [Newtonsoft.Json.JsonProperty("expiresAt", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^((?:(\d{4}-\d{2}-\d{2})(T|t)(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|z|([+-](?:2[0-3]|[01][0-9]):[0-5][0-9])))$")] - public string ExpiresAt { get; set; } - - /// - /// Optional setting that is only applicable when `userFlow` is set to `QR`. - ///
This is used to set the format for the QR code. - ///
- [Newtonsoft.Json.JsonProperty("qrFormat", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public QrFormat QrFormat { get; set; } - - /// - /// The payment description summary that will be provided to the user - ///
through the app, the merchant portal, and the settlement files. - ///
- [Newtonsoft.Json.JsonProperty("paymentDescription", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength = 3)] - public string PaymentDescription { get; set; } - - [Newtonsoft.Json.JsonProperty("receipt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Receipt Receipt { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The `CreatePaymentResponse` object. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CreatePaymentResponse - { - /// - /// The URL to which the user is redirected when continuing the payment - ///
for `NATIVE_REDIRECT` and `WEB_REDIRECT`. When `userFlow` is `QR`, - ///
a link to the QR image (or the target URL) will be returned. - ///
Nothing will be returned when `userFlow` is `PUSH_MESSAGE`. - ///
- [Newtonsoft.Json.JsonProperty("redirectUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Uri RedirectUrl { get; set; } - - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The `GetPaymentResponse` object. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class GetPaymentResponse - { - [Newtonsoft.Json.JsonProperty("aggregate", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Aggregate Aggregate { get; set; } = new Aggregate(); - - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("state", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public State State { get; set; } - - [Newtonsoft.Json.JsonProperty("paymentMethod", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public PaymentMethodResponse PaymentMethod { get; set; } = new PaymentMethodResponse(); - - [Newtonsoft.Json.JsonProperty("profile", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public ProfileResponse Profile { get; set; } = new ProfileResponse(); - - [Newtonsoft.Json.JsonProperty("pspReference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PspReference { get; set; } - - /// - /// The URL you should redirect the user to to continue with the payment. - ///
This is the URL to the Vipps MobilePay landing page. - ///
See: https://developer.vippsmobilepay.com/docs/vipps-developers/common-topics/landing-page/ - ///
- [Newtonsoft.Json.JsonProperty("redirectUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Uri RedirectUrl { get; set; } - - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Additional compliance data related to the transaction. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class IndustryData - { - [Newtonsoft.Json.JsonProperty("airlineData", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public AirlineData AirlineData { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Airline related data. - ///
If present, `passengerName`, `airlineCode`, `airlineDesignatorCode`, - ///
and `agencyInvoiceNumber` are all required. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class AirlineData - { - /// - /// Reference number for the invoice, issued by the agency. - /// - [Newtonsoft.Json.JsonProperty("agencyInvoiceNumber", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(6, MinimumLength = 1)] - public string AgencyInvoiceNumber { get; set; } - - /// - /// IATA 3-digit accounting code (PAX); numeric. - ///
It identifies the carrier. eg KLM = 074. - ///
- [Newtonsoft.Json.JsonProperty("airlineCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(3, MinimumLength = 3)] - public string AirlineCode { get; set; } - - /// - /// IATA 2-letter accounting code (PAX); alphabetical. - ///
It identifies the carrier. Eg KLM = KL. - ///
- [Newtonsoft.Json.JsonProperty("airlineDesignatorCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(2, MinimumLength = 2)] - public string AirlineDesignatorCode { get; set; } - - /// - /// Passenger name, initials, and a title. - /// - [Newtonsoft.Json.JsonProperty("passengerName", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.StringLength(49, MinimumLength = 1)] - public string PassengerName { get; set; } - - /// - /// The ticket's unique identifier. - /// - [Newtonsoft.Json.JsonProperty("ticketNumber", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(150, MinimumLength = 1)] - public string TicketNumber { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Aggregate - { - [Newtonsoft.Json.JsonProperty("authorizedAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount AuthorizedAmount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("cancelledAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount CancelledAmount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("capturedAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount CapturedAmount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("refundedAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount RefundedAmount { get; set; } = new Amount(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class CaptureModificationRequest - { - [Newtonsoft.Json.JsonProperty("modificationAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount ModificationAmount { get; set; } = new Amount(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class RefundModificationRequest - { - [Newtonsoft.Json.JsonProperty("modificationAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount ModificationAmount { get; set; } = new Amount(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ModificationResponse - { - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("state", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public State State { get; set; } - - [Newtonsoft.Json.JsonProperty("aggregate", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Aggregate Aggregate { get; set; } = new Aggregate(); - - [Newtonsoft.Json.JsonProperty("pspReference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PspReference { get; set; } - - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PaymentEventName - { - - [System.Runtime.Serialization.EnumMember(Value = @"CREATED")] - CREATED = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ABORTED")] - ABORTED = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"EXPIRED")] - EXPIRED = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"CANCELLED")] - CANCELLED = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"CAPTURED")] - CAPTURED = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"REFUNDED")] - REFUNDED = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"AUTHORIZED")] - AUTHORIZED = 6, - - [System.Runtime.Serialization.EnumMember(Value = @"TERMINATED")] - TERMINATED = 7, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Address - { - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string City { get; set; } - - /// - /// Country code according to ISO 3166-2 (two capital letters). - /// - [Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[A-Z]{2}$")] - public string Country { get; set; } - - /// - /// Unique ID of the address, always provided in response from Vipps MobilePay. - /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid Id { get; set; } - - /// - /// Array of addressLines, for example street name, number, etc. - /// - [Newtonsoft.Json.JsonProperty("lines", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Lines { get; set; } = new System.Collections.ObjectModel.Collection(); - - /// - /// Postcode of the address in local country format. - /// - [Newtonsoft.Json.JsonProperty("postCode", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PostCode { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ProfileRequest - { - /// - /// A space-separated string list of requested user information in - ///
accordance with the OpenID Connect specification. - ///
See https://developer.vippsmobilepay.com/docs/APIs/userinfo-api/userinfo-api-guide/#scope - ///
- [Newtonsoft.Json.JsonProperty("scope", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Scope { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ProfileResponse - { - /// - /// If `profile.scope` was requested in `createPayment` this value will populate once - ///
`state` is `AUTHORIZED`. This can be used towards the - ///
[Userinfo endpoint](https://developer.vippsmobilepay.com/api/userinfo#operation/getUserinfo) - ///
to fetch requested user data. - ///
- [Newtonsoft.Json.JsonProperty("sub", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Sub { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentMethod - { - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentMethodType Type { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentMethodResponse - { - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentMethodType Type { get; set; } - - /// - /// The payment card's Bank Identification Number (BIN), that - ///
identifies which bank has issued the card. - ///
- [Newtonsoft.Json.JsonProperty("cardBin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(6, MinimumLength = 6)] - public string CardBin { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The paymentMethod type to be performed. - ///
`WALLET` is a card used in the Vipps MobilePay app. - ///
`CARD` is free-standing card payments, outside of the Vipps MobilePay app. - ///
`CARD` has to be combined with a `userFlow` of `WEB_REDIRECT`, - ///
as the card payment can not be completed in the Vipps MobilePay app. - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum PaymentMethodType - { - - [System.Runtime.Serialization.EnumMember(Value = @"WALLET")] - WALLET = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"CARD")] - CARD = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentAdjustment - { - [Newtonsoft.Json.JsonProperty("modificationAmount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount ModificationAmount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("modificationReference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string ModificationReference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class WebhookEvent - { - [Newtonsoft.Json.JsonProperty("msn", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(6, MinimumLength = 4)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[0-9]{4,6}$")] - public string Msn { get; set; } - - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - [Newtonsoft.Json.JsonProperty("pspReference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PspReference { get; set; } - - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentEventName Name { get; set; } - - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("timestamp", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset Timestamp { get; set; } - - /// - /// The Idempotency key of the request. - /// - [Newtonsoft.Json.JsonProperty("idempotencyKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string IdempotencyKey { get; set; } - - /// - /// The outcome of the event - /// - [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.Always)] - public bool Success { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentEvent - { - [Newtonsoft.Json.JsonProperty("reference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength = 8)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9-]{8,50}$")] - public string Reference { get; set; } - - [Newtonsoft.Json.JsonProperty("pspReference", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string PspReference { get; set; } - - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PaymentEventName Name { get; set; } - - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public Amount Amount { get; set; } = new Amount(); - - [Newtonsoft.Json.JsonProperty("timestamp", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset Timestamp { get; set; } - - /// - /// The idempotency key of the request. - ///
Specified by the merchant/partner making the API request. - ///
- [Newtonsoft.Json.JsonProperty("idempotencyKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.StringLength(50)] - public string IdempotencyKey { get; set; } - - /// - /// The outcome of the event - /// - [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.Always)] - public bool Success { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The standard error object, based on RFC 7808. - ///
See https://developer.vippsmobilepay.com/docs/knowledge-base/errors/ - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Problem - { - /// - /// A URI reference that identifies the problem type. - /// - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.Uri Type { get; set; } - - /// - /// A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem. - /// - [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Title { get; set; } - - /// - /// A human-readable explanation specific to this occurrence of the problem. - /// - [Newtonsoft.Json.JsonProperty("detail", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Detail { get; set; } - - /// - /// The HTTP response code. - /// - [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Always)] - public int Status { get; set; } - - /// - /// An id that can be used to facilitate in tracing the error. - /// - [Newtonsoft.Json.JsonProperty("traceId", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string TraceId { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// The state of the Payment. - ///
One of: - ///
- CREATED: User has not yet acted upon the payment - ///
- ABORTED: User has aborted the payment before authorization - ///
- EXPIRED: User did not act on the payment within the payment expiration time - ///
- AUTHORIZED: User has approved the payment - ///
- TERMINATED: Merchant has terminated the payment via the cancelPayment endpoint - ///
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum State - { - - [System.Runtime.Serialization.EnumMember(Value = @"CREATED")] - CREATED = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ABORTED")] - ABORTED = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"EXPIRED")] - EXPIRED = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"AUTHORIZED")] - AUTHORIZED = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"TERMINATED")] - TERMINATED = 4, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class ForceApprove - { - [Newtonsoft.Json.JsonProperty("customer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Customer Customer { get; set; } - - /// - /// The token value received in the redirectUrl property in the Create payment response - /// - [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Token { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Available units for quantity. Will default to PCS if not set - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum QuantityUnitEnum - { - - [System.Runtime.Serialization.EnumMember(Value = @"PCS")] - PCS = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"KG")] - KG = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"KM")] - KM = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"MINUTE")] - MINUTE = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"LITRE")] - LITRE = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"KWH")] - KWH = 5, - - } - - /// - /// Optional. If no quantity info is provided the order line will default to 1 pcs - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class UnitInfo - { - /// - /// Total price per unit, including tax and excluding discount - /// - [Newtonsoft.Json.JsonProperty("unitPrice", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? UnitPrice { get; set; } - - /// - /// Quantity given as a integer or fraction (only for cosmetics) - /// - [Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.ComponentModel.DataAnnotations.StringLength(10)] - [System.ComponentModel.DataAnnotations.RegularExpression(@"^\d+([\.]\d{1,8})?$")] - public string Quantity { get; set; } - - [Newtonsoft.Json.JsonProperty("quantityUnit", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public QuantityUnitEnum QuantityUnit { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// All numbers are interpreted as integers with two trailing zeros. ex: 10.00 = 1000. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class OrderLine - { - /// - /// Name of the product in the order line. - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - /// - /// The product ID - /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Id { get; set; } - - /// - /// Total amount of the order line, including tax and discount. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 10 kr = 1000 øre. - /// - [Newtonsoft.Json.JsonProperty("totalAmount", Required = Newtonsoft.Json.Required.AllowNull)] - public long? TotalAmount { get; set; } - - /// - /// Total amount of order line with discount excluding tax. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 8 kr = 800 øre. - /// - [Newtonsoft.Json.JsonProperty("totalAmountExcludingTax", Required = Newtonsoft.Json.Required.AllowNull)] - public long? TotalAmountExcludingTax { get; set; } - - /// - /// Total tax amount paid for the order line. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 2.5 kr = 250 øre. - /// - [Newtonsoft.Json.JsonProperty("totalTaxAmount", Required = Newtonsoft.Json.Required.AllowNull)] - public long? TotalTaxAmount { get; set; } - - /// - /// Tax percentage for the order line. Between 0-100 - /// - [Newtonsoft.Json.JsonProperty("taxPercentage", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0, 100)] - public int? TaxPercentage { get; set; } - - [Newtonsoft.Json.JsonProperty("unitInfo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public UnitInfo UnitInfo { get; set; } - - /// - /// Total discount for the order line. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 20 kr = 2000 øre. - /// - [Newtonsoft.Json.JsonProperty("discount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? Discount { get; set; } - - /// - /// Optional URL linking back to the product at the merchant. - /// - [Newtonsoft.Json.JsonProperty("productUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ProductUrl { get; set; } - - /// - /// Flag for marking the order line as returned. This will make it count negative towards all the sums in bottomLine. - /// - [Newtonsoft.Json.JsonProperty("isReturn", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsReturn { get; set; } - - /// - /// Flag for marking the order line as a shipping line. This will be shown differently in the app. - /// - [Newtonsoft.Json.JsonProperty("isShipping", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsShipping { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Currency information - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum CurrencyEnum - { - [System.Runtime.Serialization.EnumMember(Value = @"NOK")] - NOK = 0, - [System.Runtime.Serialization.EnumMember(Value = @"DKK")] - DKK = 1, - [System.Runtime.Serialization.EnumMember(Value = @"EUR")] - EUR = 2 - } - - /// - /// Deprecated, use a regular orderLine with "isShipping" flag. Using this will result in faulty calculation of sum and tax. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - [System.Obsolete] - public partial class ShippingInfo - { - /// - /// Total amount for the shipping, including tax and discount - /// - [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? Amount { get; set; } - - /// - /// Total amount for shipping excluding tax - /// - [Newtonsoft.Json.JsonProperty("amountExcludingTax", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? AmountExcludingTax { get; set; } - - /// - /// Total tax amount paid for the shipping - /// - [Newtonsoft.Json.JsonProperty("taxAmount", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? TaxAmount { get; set; } - - /// - /// Tax-percentage for the Shipping - /// - [Newtonsoft.Json.JsonProperty("taxPercentage", Required = Newtonsoft.Json.Required.AllowNull)] - [System.ComponentModel.DataAnnotations.Range(0, 100)] - public int? TaxPercentage { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class PaymentSources - { - [Newtonsoft.Json.JsonProperty("giftCard", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int GiftCard { get; set; } - - [Newtonsoft.Json.JsonProperty("card", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Card { get; set; } - - [Newtonsoft.Json.JsonProperty("voucher", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Voucher { get; set; } - - [Newtonsoft.Json.JsonProperty("cash", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Cash { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum BarcodeFormatEnum - { - - [System.Runtime.Serialization.EnumMember(Value = @"EAN-13")] - EAN13 = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"CODE 39")] - CODE_39 = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"CODE 128")] - CODE_128 = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Barcode - { - [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.AllowNull)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public BarcodeFormatEnum? Format { get; set; } - - [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.AllowNull)] - public string Data { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Summary of the order. Total amount and total. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 20 kr = 2000 øre. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class BottomLine - { - [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.AllowNull)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public CurrencyEnum? Currency { get; set; } - - /// - /// Tip amount for the order. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 20 kr = 2000 øre. - /// - [Newtonsoft.Json.JsonProperty("tipAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - public long? TipAmount { get; set; } - - /// - /// Amount paid by gift card or coupon. - /// - [Newtonsoft.Json.JsonProperty("giftCardAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - [System.Obsolete] - public long? GiftCardAmount { get; set; } - - /// - /// POS ID is the device number of the POS terminal - /// - [Newtonsoft.Json.JsonProperty("posId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string PosId { get; set; } - - /// - /// Deprecated, sum will be calculated based on the sum of the orderLines - /// - [Newtonsoft.Json.JsonProperty("totalAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.Obsolete] - public long? TotalAmount { get; set; } - - /// - /// Deprecated, tax will be calculated based on the sum of the totalTaxAmount field on each orderLine - /// - [Newtonsoft.Json.JsonProperty("totalTax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - [System.Obsolete] - public long? TotalTax { get; set; } - - /// - /// Deprecated, discount will be calculated based on the sum of the discount field on each orderLine - /// - [Newtonsoft.Json.JsonProperty("totalDiscount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - [System.Obsolete] - public long? TotalDiscount { get; set; } - - /// - /// Deprecated, use a regular orderLine with "isShipping" flag. Using this will result in faulty calculation of sum and tax. - /// - [Newtonsoft.Json.JsonProperty("shippingAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] - [System.Obsolete] - public long? ShippingAmount { get; set; } - - [Newtonsoft.Json.JsonProperty("shippingInfo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] -#pragma warning disable CS0612 // Type or member is obsolete // Autogenerated - public ShippingInfo ShippingInfo { get; set; } -#pragma warning restore CS0612 // Type or member is obsolete - - [Newtonsoft.Json.JsonProperty("paymentSources", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public PaymentSources PaymentSources { get; set; } - - [Newtonsoft.Json.JsonProperty("barcode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Barcode Barcode { get; set; } - - [Newtonsoft.Json.JsonProperty("receiptNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ReceiptNumber { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class Receipt - { - /// - /// All numbers are interpreted as integers with two trailing zeros. ex: 10.00 = 1000. Amounts are specified in minor units. For Norwegian kroner (NOK) that means 1 kr = 100 øre. Example: 10 kr = 1000 øre. - /// - [Newtonsoft.Json.JsonProperty("orderLines", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - [System.ComponentModel.DataAnnotations.MinLength(1)] - public System.Collections.Generic.ICollection OrderLines { get; set; } = new System.Collections.ObjectModel.Collection(); - - [Newtonsoft.Json.JsonProperty("bottomLine", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required] - public BottomLine BottomLine { get; set; } = new BottomLine(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum CreatePaymentRequestCustomerInteraction - { - - [System.Runtime.Serialization.EnumMember(Value = @"CUSTOMER_PRESENT")] - CUSTOMER_PRESENT = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"CUSTOMER_NOT_PRESENT")] - CUSTOMER_NOT_PRESENT = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum CreatePaymentRequestUserFlow - { - - [System.Runtime.Serialization.EnumMember(Value = @"PUSH_MESSAGE")] - PUSH_MESSAGE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"NATIVE_REDIRECT")] - NATIVE_REDIRECT = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"WEB_REDIRECT")] - WEB_REDIRECT = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"QR")] - QR = 3, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public partial class QrFormat - { - /// - /// If `userFlow` is `QR` and `qrFormat` is not set, the QR code image will be returned as `SVG+XML`, by default. - /// - [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public QrFormatFormat Format { get; set; } = Vipps.net.Models.Epayment.QrFormatFormat.IMAGE_SVG_XML; - - /// - /// For example, if the value is 200, then 200x200 px is set as the dimension for the QR code. - ///
This is only applicable when the format is set to `PNG`. If not set, the default is 1024. - ///
- [Newtonsoft.Json.JsonProperty("size", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [System.ComponentModel.DataAnnotations.Range(100, 2000)] - public int? Size { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0))")] - public enum QrFormatFormat - { - - [System.Runtime.Serialization.EnumMember(Value = @"TEXT/TARGETURL")] - TEXT_TARGETURL = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"IMAGE/SVG+XML")] - IMAGE_SVG_XML = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"IMAGE/PNG")] - IMAGE_PNG = 2, - - } - - -} - -#pragma warning restore 1591 -#pragma warning restore 1573 -#pragma warning restore 472 -#pragma warning restore 114 -#pragma warning restore 108 -#pragma warning restore 3016 -#pragma warning restore 8603 diff --git a/src/Vipps.net/Services/CheckoutService.cs b/src/Vipps.net/Services/CheckoutService.cs index ecd1af3..ce69c03 100644 --- a/src/Vipps.net/Services/CheckoutService.cs +++ b/src/Vipps.net/Services/CheckoutService.cs @@ -3,13 +3,14 @@ using System.Threading.Tasks; using Vipps.net.Infrastructure; using Vipps.net.Models.Checkout; +using Vipps.net.Models.Checkout.Model; namespace Vipps.net.Services { public interface IVippsCheckoutService { Task InitiateSession( - InitiateSessionRequest initiateSessionRequest, + InitiatePaymentSessionRequest initiateSessionRequest, CancellationToken cancellationToken = default ); @@ -29,13 +30,13 @@ public VippsCheckoutService(CheckoutServiceClient checkoutServiceClient) } public async Task InitiateSession( - InitiateSessionRequest initiateSessionRequest, + InitiatePaymentSessionRequest initiateSessionRequest, CancellationToken cancellationToken = default ) { var requestPath = $"/checkout/v3/session"; var sessionInitiationResult = await _checkoutServiceClient.ExecuteRequest< - InitiateSessionRequest, + InitiatePaymentSessionRequest, InitiateSessionResponse >(requestPath, HttpMethod.Post, initiateSessionRequest, cancellationToken); diff --git a/src/Vipps.net/Services/EpaymentService.cs b/src/Vipps.net/Services/EpaymentService.cs index 401d8f2..b8ff840 100644 --- a/src/Vipps.net/Services/EpaymentService.cs +++ b/src/Vipps.net/Services/EpaymentService.cs @@ -3,7 +3,7 @@ using System.Threading; using System.Threading.Tasks; using Vipps.net.Infrastructure; -using Vipps.net.Models.Epayment; +using Vipps.net.Models.Epayment.Model; namespace Vipps.net.Services { diff --git a/src/Vipps.net/Vipps.net.csproj b/src/Vipps.net/Vipps.net.csproj index 4f1b473..3d52715 100644 --- a/src/Vipps.net/Vipps.net.csproj +++ b/src/Vipps.net/Vipps.net.csproj @@ -1,12 +1,12 @@  - net6.0;net7.0;netcoreapp3.1;netstandard2.0;net48 + net6.0;netstandard2.0;net48 disable disable Vipps.net Vipps.net SDK Vipps.net - 0.9.6 + 0.9.7 Vipps Mobilepay AS Vipps Mobilepay AS Vipps SDK .Net @@ -28,6 +28,7 @@ true + 8.0 @@ -35,13 +36,17 @@ - + - + + + + + From fa59f42aeb75826cd6a625882f6bb5921df6cf55 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Tue, 8 Oct 2024 14:31:14 +0200 Subject: [PATCH 2/8] csharpier ignore --- .github/workflows/build_and_test.yml | 2 +- src/.csharpierignore | 4 ++++ .../EpaymentServiceTests.cs | 13 +++++++++---- .../Controllers/EpaymentController.cs | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 src/.csharpierignore diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7a7128b..1de097c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -18,7 +18,7 @@ jobs: id-token: write strategy: matrix: - dotnet-version: [ '7.0.x' ] + dotnet-version: [ '8.0.x' ] steps: - name: Get repo uses: actions/checkout@v3 diff --git a/src/.csharpierignore b/src/.csharpierignore new file mode 100644 index 0000000..eafca8d --- /dev/null +++ b/src/.csharpierignore @@ -0,0 +1,4 @@ +Vipps.net.Models.Checkout/ +Vipps.net.Models.Checkout.Test/ +Vipps.net.Models.Epayment/ +Vipps.net.Models.Epayment.Test/ diff --git a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs index b307b55..a1d7691 100644 --- a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs @@ -1,5 +1,4 @@ -using Vipps.net.Models.Epayment; -using Vipps.net.Models.Epayment.Model; +using Vipps.net.Models.Epayment.Model; namespace Vipps.net.IntegrationTests { @@ -46,7 +45,12 @@ public async Task Can_Create_Approve_Capture_Refund_Payment() await vippsApi.EpaymentService.ForceApprovePayment( reference, - new ForceApprove { Customer = new Customer(new CustomerPhoneNumber { PhoneNumber = CustomerPhoneNumber }) } + new ForceApprove + { + Customer = new Customer( + new CustomerPhoneNumber { PhoneNumber = CustomerPhoneNumber } + ) + } ); var captureResponse = await vippsApi.EpaymentService.CapturePayment( @@ -86,7 +90,8 @@ private static CreatePaymentRequest GetCreatePaymentRequest(string reference) return new CreatePaymentRequest( new Amount { - Currency = Currency.NOK, Value = 100 // 100 øre = 1 KR + Currency = Currency.NOK, + Value = 100 // 100 øre = 1 KR }, new Customer(new CustomerPhoneNumber { PhoneNumber = CustomerPhoneNumber }), null, diff --git a/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs b/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs index 702b8de..7fb567c 100644 --- a/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs +++ b/src/Vipps.net.AspCoreDemo/Controllers/EpaymentController.cs @@ -26,12 +26,12 @@ public async Task CreatePayment() { Amount = new Amount { Value = 1000, Currency = Currency.NOK }, PaymentMethod = new PaymentMethod { Type = PaymentMethodType.WALLET }, - Customer = new Customer (new CustomerPhoneNumber{ PhoneNumber = "4747375750"}), + Customer = new Customer(new CustomerPhoneNumber { PhoneNumber = "4747375750" }), Reference = Guid.NewGuid().ToString(), UserFlow = CreatePaymentRequest.UserFlowEnum.WEB_REDIRECT, ReturnUrl = $"http://localhost:3000", PaymentDescription = "paymentDescription", - Profile = new ProfileRequest { Scope = "name phoneNumber address birthDate email" }, + Profile = new ProfileRequest { Scope = "name phoneNumber address birthDate email" } }; var result = await _epaymentService.CreatePayment(request); From 78969d129b02bd887c6ec8100c115711a02322d0 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:16:14 +0200 Subject: [PATCH 3/8] fix --- .../CheckoutServiceTests.cs | 35 +++++++++---------- .../EpaymentServiceTests.cs | 4 +-- .../appsettings.json | 2 +- .../Vipps.net.AspDemo.csproj | 3 +- .../Infrastructure/BaseServiceClient.cs | 3 +- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs index ecfdbdb..cba5188 100644 --- a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs @@ -1,5 +1,4 @@ -using Vipps.net.Models.Checkout; -using Vipps.net.Models.Checkout.Model; +using Vipps.net.Models.Checkout.Model; namespace Vipps.net.IntegrationTests { @@ -11,22 +10,22 @@ public async Task Can_Create_And_Get_Session() { var vippsApi = TestSetup.CreateVippsAPI(); var reference = Guid.NewGuid().ToString(); - var sessionInitiationRequest = new InitiatePaymentSessionRequest - { - Transaction = new PaymentTransaction - { - Amount = new Amount { Currency = "NOK", Value = 1000 }, - Reference = reference, - PaymentDescription = nameof(Can_Create_And_Get_Session), - }, - MerchantInfo = new MerchantInfo - { - CallbackAuthorizationToken = Guid.NewGuid().ToString(), - CallbackUrl = "https://no.where.com/callback", - ReturnUrl = "https://no.where.com/return", - TermsAndConditionsUrl = "https://no.where.com/terms" - } - }; + var sessionInitiationRequest = new InitiatePaymentSessionRequest( + new PaymentTransaction( + new Amount(1000, "NOK"), + reference, + nameof(Can_Create_And_Get_Session) + ), + null, + "PAYMENT", + null, + new MerchantInfo( + "https://apitest.vipps.no/does-not-exist-callback", + "https://apitest.vipps.no/does-not-exist-return", + Guid.NewGuid().ToString(), + "https://apitest.vipps.no/does-not-exist-terms" + ) + ); var sessionResponse = await vippsApi.CheckoutService.InitiateSession( sessionInitiationRequest diff --git a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs index a1d7691..8e4bc7c 100644 --- a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs @@ -55,7 +55,7 @@ await vippsApi.EpaymentService.ForceApprovePayment( var captureResponse = await vippsApi.EpaymentService.CapturePayment( reference, - new CaptureModificationRequest { ModificationAmount = createPaymentRequest.Amount } + new CaptureModificationRequest(createPaymentRequest.Amount) ); Assert.IsNotNull(captureResponse); Assert.AreEqual(reference, captureResponse.Reference); @@ -63,7 +63,7 @@ await vippsApi.EpaymentService.ForceApprovePayment( var refundResponse = await vippsApi.EpaymentService.RefundPayment( reference, - new RefundModificationRequest { ModificationAmount = createPaymentRequest.Amount } + new RefundModificationRequest(createPaymentRequest.Amount) ); Assert.IsNotNull(refundResponse); Assert.AreEqual(reference, refundResponse.Reference); diff --git a/src/Tests/Vipps.net.IntegrationTests/appsettings.json b/src/Tests/Vipps.net.IntegrationTests/appsettings.json index 1735899..58218fc 100644 --- a/src/Tests/Vipps.net.IntegrationTests/appsettings.json +++ b/src/Tests/Vipps.net.IntegrationTests/appsettings.json @@ -6,7 +6,7 @@ } }, "AllowedHosts": "*", - "KeyvaultHost": "", + "KeyvaultHost": "vipps-login-jon-kv", "Vipps": { "ClientId": "Avoid checking these in to source control by reading them from a key vault like azure key vault", "ClientSecret": "", diff --git a/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj b/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj index 078f523..cabdab2 100644 --- a/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj +++ b/src/Vipps.net.AspDemo/Vipps.net.AspDemo.csproj @@ -14,7 +14,7 @@ Properties Vipps.net.AspDemo Vipps.net.AspDemo - netstandard2.0 + v4.7.2 false true @@ -169,6 +169,7 @@ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + diff --git a/src/Vipps.net/Infrastructure/BaseServiceClient.cs b/src/Vipps.net/Infrastructure/BaseServiceClient.cs index a88a7b4..0664d2f 100644 --- a/src/Vipps.net/Infrastructure/BaseServiceClient.cs +++ b/src/Vipps.net/Infrastructure/BaseServiceClient.cs @@ -121,7 +121,8 @@ private async Task ExecuteRequestBase( CancellationToken cancellationToken ) { - var absolutePath = $"{_vippsHttpClient.BaseAddress}{path}"; + var uri = new Uri(_vippsHttpClient.BaseAddress, path); + var absolutePath = uri.ToString(); var retryPolicy = PolicyHelper.GetRetryPolicyWithFallback( _logger, $"Request to {httpMethod.Method} {absolutePath} failed even after retries" From cd5f6b32ffeafda1e48cc02f7c173056ed761a8a Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:18:16 +0200 Subject: [PATCH 4/8] cleanup --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 1ee5385..d6c0822 100644 --- a/.gitignore +++ b/.gitignore @@ -358,5 +358,12 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +# Husky should only be enabled manually per developer for now +/.husky/pre-commit + +# Do not include secrets from windows forms demo +/src/Vipps.net.WindowsFormsDemo/secrets.xml +/src/Vipps.net.AspDemo/secrets.xml + # Fody - auto-generated XML schema FodyWeavers.xsd From a34f78065982f38a7c9b245964652abb018271a9 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:19:18 +0200 Subject: [PATCH 5/8] cleanup --- README.md | 201 +----------------------------------------------------- 1 file changed, 2 insertions(+), 199 deletions(-) diff --git a/README.md b/README.md index 5646177..22b993c 100644 --- a/README.md +++ b/README.md @@ -1,199 +1,2 @@ -# Vipps.net.Models.Checkout - the C# library for the checkout-backend-merchant-v3.API - -See the [Checkout API Guide](https://developer.vippsmobilepay.com/docs/APIs/checkout-api/). - -This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: v3 -- SDK version: 1.0.0 -- Generator version: 7.9.0 -- Build package: org.openapitools.codegen.languages.CSharpClientCodegen - - -## Frameworks supported -- .NET Core >=1.0 -- .NET Framework >=4.6 -- Mono/Xamarin >=vNext - - -## Dependencies - -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later - -The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: -``` -Install-Package RestSharp -Install-Package Newtonsoft.Json -Install-Package JsonSubTypes -Install-Package System.ComponentModel.Annotations -``` - -NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742). -NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406). - - -## Installation -Generate the DLL using your preferred tool (e.g. `dotnet build`) - -Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: -```csharp -using Vipps.net.Models.Checkout.Api; -using Vipps.net.Models.Checkout.Client; -using Vipps.net.Models.Checkout.Model; -``` - -## Usage - -To use the API client with a HTTP proxy, setup a `System.Net.WebProxy` -```csharp -Configuration c = new Configuration(); -System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/"); -webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; -c.Proxy = webProxy; -``` - - -## Getting Started - -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using Vipps.net.Models.Checkout.Api; -using Vipps.net.Models.Checkout.Client; -using Vipps.net.Models.Checkout.Model; - -namespace Example -{ - public class Example - { - public static void Main() - { - - Configuration config = new Configuration(); - config.BasePath = "https://apitest.vipps.no"; - var apiInstance = new SessionApi(config); - var vippsSystemName = Acme Commerce; // string | (optional) (default to "{{system_name}}") - var vippsSystemVersion = 3.1.2; // string | (optional) (default to "{{system_version}}") - var vippsSystemPluginName = acme-webshop; // string | (optional) (default to "{{system_plugin_name}}") - var vippsSystemPluginVersion = 4.5.6; // string | (optional) (default to "{{system_plugin_version}}") - var clientId = ; // string | (optional) (default to "{{client_id}}") - var clientSecret = ; // string | (optional) (default to "{{client_secret}}") - var ocpApimSubscriptionKey = ; // string | (optional) (default to "{{Ocp-Apim-Subscription-Key}}") - var merchantSerialNumber = ; // string | (optional) (default to "{{merchantSerialNumber}}") - var idempotencyKey = ; // string | (optional) (default to "{{Idempotency-Key}}") - var checkoutV3SessionPostRequest = new CheckoutV3SessionPostRequest(); // CheckoutV3SessionPostRequest | (optional) - - try - { - // Create a Checkout session - InitiateSessionResponse result = apiInstance.CheckoutV3SessionPost(vippsSystemName, vippsSystemVersion, vippsSystemPluginName, vippsSystemPluginVersion, clientId, clientSecret, ocpApimSubscriptionKey, merchantSerialNumber, idempotencyKey, checkoutV3SessionPostRequest); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling SessionApi.CheckoutV3SessionPost: " + e.Message ); - Debug.Print("Status Code: "+ e.ErrorCode); - Debug.Print(e.StackTrace); - } - - } - } -} -``` - - -## Documentation for API Endpoints - -All URIs are relative to *https://apitest.vipps.no* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*SessionApi* | [**CheckoutV3SessionPost**](docs/SessionApi.md#checkoutv3sessionpost) | **POST** /checkout/v3/session | Create a Checkout session -*SessionApi* | [**CheckoutV3SessionReferenceGet**](docs/SessionApi.md#checkoutv3sessionreferenceget) | **GET** /checkout/v3/session/{reference} | Get session info - - - -## Documentation for Models - - - [Model.Amount](docs/Amount.md) - - [Model.BillingDetails](docs/BillingDetails.md) - - [Model.CheckoutConfig](docs/CheckoutConfig.md) - - [Model.CheckoutProblemDetails](docs/CheckoutProblemDetails.md) - - [Model.CheckoutSessionThirdPartyInformationHeaders](docs/CheckoutSessionThirdPartyInformationHeaders.md) - - [Model.CheckoutV3SessionPost200ResponseInner](docs/CheckoutV3SessionPost200ResponseInner.md) - - [Model.CheckoutV3SessionPostRequest](docs/CheckoutV3SessionPostRequest.md) - - [Model.Countries](docs/Countries.md) - - [Model.CustomConsent](docs/CustomConsent.md) - - [Model.CustomerInteraction](docs/CustomerInteraction.md) - - [Model.DaoLogisticsOption](docs/DaoLogisticsOption.md) - - [Model.Elements](docs/Elements.md) - - [Model.EventSubscriptionCampaign](docs/EventSubscriptionCampaign.md) - - [Model.ExternalPaymentMethod](docs/ExternalPaymentMethod.md) - - [Model.ExternalPaymentMethodType](docs/ExternalPaymentMethodType.md) - - [Model.ExternalSessionState](docs/ExternalSessionState.md) - - [Model.GlsLogisticsOption](docs/GlsLogisticsOption.md) - - [Model.GlsLogisticsType](docs/GlsLogisticsType.md) - - [Model.Helthjem](docs/Helthjem.md) - - [Model.HelthjemLogisticsOption](docs/HelthjemLogisticsOption.md) - - [Model.HelthjemLogisticsType](docs/HelthjemLogisticsType.md) - - [Model.IdempotencyHeader](docs/IdempotencyHeader.md) - - [Model.InitiatePaymentSessionRequest](docs/InitiatePaymentSessionRequest.md) - - [Model.InitiateSessionRequestBase](docs/InitiateSessionRequestBase.md) - - [Model.InitiateSessionResponse](docs/InitiateSessionResponse.md) - - [Model.InitiateSubscriptionSessionRequest](docs/InitiateSubscriptionSessionRequest.md) - - [Model.Integrations](docs/Integrations.md) - - [Model.Interval](docs/Interval.md) - - [Model.IntervalUnit](docs/IntervalUnit.md) - - [Model.Logistics](docs/Logistics.md) - - [Model.LogisticsOptionBase](docs/LogisticsOptionBase.md) - - [Model.MerchantAuthInfoHeaders](docs/MerchantAuthInfoHeaders.md) - - [Model.MerchantInfo](docs/MerchantInfo.md) - - [Model.MerchantLogisticsCallbackRequestBody](docs/MerchantLogisticsCallbackRequestBody.md) - - [Model.OrderBottomLine](docs/OrderBottomLine.md) - - [Model.OrderLine](docs/OrderLine.md) - - [Model.OrderSummary](docs/OrderSummary.md) - - [Model.OrderUnitInfo](docs/OrderUnitInfo.md) - - [Model.OtherLogisticsOption](docs/OtherLogisticsOption.md) - - [Model.PaymentMethod](docs/PaymentMethod.md) - - [Model.PaymentSources](docs/PaymentSources.md) - - [Model.PaymentState](docs/PaymentState.md) - - [Model.PaymentTransaction](docs/PaymentTransaction.md) - - [Model.PeriodSubscriptionCampaign](docs/PeriodSubscriptionCampaign.md) - - [Model.PickupPoint](docs/PickupPoint.md) - - [Model.Porterbuddy](docs/Porterbuddy.md) - - [Model.PorterbuddyLogisticsOption](docs/PorterbuddyLogisticsOption.md) - - [Model.PorterbuddyLogisticsType](docs/PorterbuddyLogisticsType.md) - - [Model.PorterbuddyOrigin](docs/PorterbuddyOrigin.md) - - [Model.PorterbuddyOriginAddress](docs/PorterbuddyOriginAddress.md) - - [Model.PostenLogisticsOption](docs/PostenLogisticsOption.md) - - [Model.PostenLogisticsType](docs/PostenLogisticsType.md) - - [Model.PostiLogisticsOption](docs/PostiLogisticsOption.md) - - [Model.PostiLogisticsType](docs/PostiLogisticsType.md) - - [Model.PostnordLogisticsOption](docs/PostnordLogisticsOption.md) - - [Model.PostnordLogisticsType](docs/PostnordLogisticsType.md) - - [Model.PrefillCustomer](docs/PrefillCustomer.md) - - [Model.PriceSubscriptionCampaign](docs/PriceSubscriptionCampaign.md) - - [Model.QuantityUnit](docs/QuantityUnit.md) - - [Model.ResponseBankTransferPaymentDetails](docs/ResponseBankTransferPaymentDetails.md) - - [Model.ResponseCardPaymentDetails](docs/ResponseCardPaymentDetails.md) - - [Model.ResponseSubscriptionDetails](docs/ResponseSubscriptionDetails.md) - - [Model.ResponseWalletPaymentDetails](docs/ResponseWalletPaymentDetails.md) - - [Model.SessionResponse](docs/SessionResponse.md) - - [Model.SessionResponsePaymentDetails](docs/SessionResponsePaymentDetails.md) - - [Model.ShippingDetails](docs/ShippingDetails.md) - - [Model.Subscription](docs/Subscription.md) - - [Model.SubscriptionCampaign](docs/SubscriptionCampaign.md) - - [Model.SubscriptionState](docs/SubscriptionState.md) - - [Model.TransactionAggregate](docs/TransactionAggregate.md) - - [Model.UserFlow](docs/UserFlow.md) - - [Model.UserInfo](docs/UserInfo.md) - - - -## Documentation for Authorization - -Endpoints do not require authorization. - +ℹ️ Documentation is available at: +[Vipps MobilePay SDK Documentation](https://developer.vippsmobilepay.com/docs/SDKs/). \ No newline at end of file From bb75c15a8761617d455df7d92f04a055c1824bb2 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:21:31 +0200 Subject: [PATCH 6/8] cleanup --- src/Tests/Vipps.net.IntegrationTests/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Vipps.net.IntegrationTests/appsettings.json b/src/Tests/Vipps.net.IntegrationTests/appsettings.json index 58218fc..1735899 100644 --- a/src/Tests/Vipps.net.IntegrationTests/appsettings.json +++ b/src/Tests/Vipps.net.IntegrationTests/appsettings.json @@ -6,7 +6,7 @@ } }, "AllowedHosts": "*", - "KeyvaultHost": "vipps-login-jon-kv", + "KeyvaultHost": "", "Vipps": { "ClientId": "Avoid checking these in to source control by reading them from a key vault like azure key vault", "ClientSecret": "", From aaf508e2c3a85cc6cb98fb00f40cb73218c33bf6 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:45:21 +0200 Subject: [PATCH 7/8] enable it --- .github/workflows/build_and_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1de097c..78eee2c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -43,7 +43,7 @@ jobs: dotnet tool restore --tool-manifest src/.config/dotnet-tools.json cd src dotnet csharpier . --check - # - name: Install dependencies for IntegrationTests - # run: dotnet restore src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj - # - name: Run Integration Tests - # run: dotnet test src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj --no-restore --verbosity normal --environment vmp_net_sdk_CLIENT_ID=${{ secrets.CLIENT_ID }} --environment vmp_net_sdk_CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} --environment vmp_net_sdk_SUBSCRIPTION_KEY=${{ secrets.SUBSCRIPTION_KEY }} --environment vmp_net_sdk_MERCHANT_SERIAL_NUMBER=${{ secrets.MERCHANT_SERIAL_NUMBER }} + - name: Install dependencies for IntegrationTests + run: dotnet restore src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj + - name: Run Integration Tests + run: dotnet test src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj --no-restore --verbosity normal --environment vmp_net_sdk_CLIENT_ID=${{ secrets.CLIENT_ID }} --environment vmp_net_sdk_CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} --environment vmp_net_sdk_SUBSCRIPTION_KEY=${{ secrets.SUBSCRIPTION_KEY }} --environment vmp_net_sdk_MERCHANT_SERIAL_NUMBER=${{ secrets.MERCHANT_SERIAL_NUMBER }} From 620e9482d4a83c05e74547ff2c8324e52018f569 Mon Sep 17 00:00:00 2001 From: Jon Kjennbakken Date: Wed, 9 Oct 2024 06:53:24 +0200 Subject: [PATCH 8/8] version --- src/Vipps.net/Vipps.net.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Vipps.net/Vipps.net.csproj b/src/Vipps.net/Vipps.net.csproj index 3d52715..37b8b51 100644 --- a/src/Vipps.net/Vipps.net.csproj +++ b/src/Vipps.net/Vipps.net.csproj @@ -6,7 +6,7 @@ Vipps.net Vipps.net SDK Vipps.net - 0.9.7 + 1.0.0 Vipps Mobilepay AS Vipps Mobilepay AS Vipps SDK .Net