From 515885b40cc80d017877bc4b26d6dadb77aede3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Thu, 31 Jul 2025 19:29:52 +0200 Subject: [PATCH] Add enums and refactor authentication-related classes for standalone integration --- .../Authentication/AuthenticationClient.cs | 174 +++++++++ .../Authentication/IAuthenticationClient.cs | 52 +++ .../SessionSecretSdkCredentials.cs | 2 +- .../Common/AccountInfo/AccountAgeType.cs | 22 ++ .../AccountInfo/AccountChangeIndicatorType.cs | 19 + .../Common/AccountInfo/AccountInfo.cs | 159 ++++++++ .../AccountPasswordChangeIndicatorType.cs | 22 ++ .../Common/AccountInfo/AccountType.cs | 16 + .../AccountInfo/AuthenticationMethodType.cs} | 21 +- .../CardholderAccountAgeIndicatorType.cs | 22 ++ .../AccountInfo/ShippingAddressAgeType.cs | 19 + .../ThreeDsReqAuthMethodType.cs | 28 +- .../ThreeDsRequestorAuthenticationInfo.cs | 31 ++ .../Common/AuthenticationCategoryType.cs | 13 + .../Standalone/Common/AuthenticationType.cs | 22 ++ .../AuthenticationMethodType.cs | 19 + .../InitialTransaction/InitialTransaction.cs | 41 +++ .../Common/Installment/Installment.cs | 33 ++ .../MerchantRiskInfo/DeliveryTimeframeType.cs | 19 + .../MerchantRiskInfo/MerchantRiskInfo.cs | 88 +++++ .../PreOrderPurchaseIndicatorType.cs | 8 +- .../ReorderItemsIndicatorType.cs | 6 +- .../MerchantRiskInfo/ShippingIndicatorType.cs | 28 ++ .../Standalone/Common/Recurring/Recurring.cs | 24 ++ .../Common/Requests/SdkInterfaceType.cs | 16 + .../Common/Requests/SdkUiElementsType.cs | 22 ++ .../Requests/ThreeDsMethodCompletionType.cs | 16 + .../Standalone/Common/Responses/Acs/Acs.cs | 84 +++++ .../Acs/ChallengeCancelReasonType.cs} | 20 +- .../Common/Responses/Acs/InterfaceType.cs | 13 + .../Common/Responses/Acs/UiTemplateType.cs | 22 ++ .../Standalone/Common/Responses/Card/Card.cs | 28 ++ .../Card/Metadata/CardCategoryType.cs | 13 + .../Responses/Card/Metadata/CardType.cs | 22 ++ .../Responses/Card/Metadata/Metadata.cs | 45 +++ .../Responses/Certificates/Certificates.cs | 36 ++ .../Responses/ChallengeIndicatorType.cs | 19 + .../Standalone/Common/Responses/Ds/Ds.cs | 33 ++ .../Common/Responses/Exemption/AppliedType.cs | 37 ++ .../Common/Responses/Exemption/Exemption.cs | 33 ++ .../TrustedBeneficiary/StatusType.cs | 25 ++ .../TrustedBeneficiary/TrustedBeneficiary.cs | 26 ++ .../Common/Responses/ExperienceType.cs | 13 + .../Standalone/Common/Responses/FlowType.cs | 16 + .../Common/Responses/GoogleSpa/GoogleSpa.cs | 41 +++ .../Responses/GoogleSpa/Iframe/Iframe.cs | 21 ++ .../Common/Responses/GoogleSpa/Token/Token.cs | 27 ++ .../Common/Responses/NextActionsType.cs} | 23 +- .../Responses/Optimization/Optimization.cs | 29 ++ .../OptimizedProperties.cs | 27 ++ .../GoogleSpa/GoogleSpa.cs | 22 ++ .../GoogleSpa/StatusType.cs | 19 + .../PreferredExperiences.cs | 24 ++ .../Threeds/StatusType.cs | 19 + .../PreferredExperiences/Threeds/Threeds.cs | 22 ++ .../Common/Responses/ResponseCodeType.cs | 31 ++ .../Common/Responses/SchemeInfo/NameType.cs | 16 + .../Common/Responses/SchemeInfo/SchemeInfo.cs | 27 ++ .../Standalone/Common/Responses/SchemeType.cs | 31 ++ .../Common/Responses/StatusReasonType.cs | 22 ++ .../Standalone/Common/Responses/StatusType.cs | 37 ++ .../Threeds/ErrorDetails/ErrorDetails.cs | 35 ++ .../Common/Responses/Threeds/Threeds.cs | 28 ++ .../Standalone/Common}/TransactionType.cs | 20 +- .../GetSessionDetailsResponseOk.cs | 339 +++++++++++++++++ .../BillingDescriptor/BillingDescriptor.cs | 17 + .../ChallengeIndicatorType.cs | 34 ++ .../ChannelData/AbstractChannelData.cs | 20 + .../AppChannelData/AppChannelData.cs | 78 ++++ .../SdkEphemPubKey/SdkEphemPubKey.cs | 37 ++ .../BrowserChannelData/BrowserChannelData.cs | 114 ++++++ .../ChannelData/ChannelDataType.cs | 16 + .../MerchantInitiatedChannelData.cs | 22 ++ .../RequestType.cs | 40 ++ .../Completion/AbstractCompletion.cs | 16 + .../Completion/CompletionType.cs | 13 + .../HostedCompletion/HostedCompletion.cs | 32 ++ .../NonHostedCompletion.cs | 33 ++ .../GoogleSpa/GoogleSpa.cs | 17 + .../Marketplace/Marketplace.cs | 15 + .../Optimization/Optimization.cs | 15 + .../PreferredExperiencesType.cs | 13 + .../RequestASessionRequest.cs | 181 ++++++++++ .../ShippingAddress/ShippingAddress.cs | 60 +++ .../Source/AbstractSource.cs | 16 + .../Source/CardSource/CardSource.cs | 94 +++++ .../Common/BillingAddress/BillingAddress.cs | 60 +++ .../Source/Common/HomePhone/HomePhone.cs | 27 ++ .../Source/Common/MobilePhone/MobilePhone.cs | 27 ++ .../Source/Common/SchemeType.cs | 31 ++ .../Source/Common/WorkPhone/WorkPhone.cs | 27 ++ .../Source/IdSource/IdSource.cs | 86 +++++ .../NetworkTokenSource/NetworkTokenSource.cs | 99 +++++ .../Source/SourceType.cs | 19 + .../Source/TokenSource/TokenSource.cs | 86 +++++ .../Responses/RequestASessionResponse.cs | 18 + .../RequestASessionResponseAccepted.cs | 217 +++++++++++ .../RequestASessionResponseCreated.cs | 341 ++++++++++++++++++ .../CompleteASessionResponseNoContent.cs | 12 + .../Requests/AbstractUpdateASessionRequest.cs | 16 + .../Requests/AppRequest/AppRequest.cs | 78 ++++ .../SdkEphemPubKey/SdkEphemPubKey.cs | 37 ++ .../Requests/BrowserRequest/BrowserRequest.cs | 114 ++++++ .../Requests/ChannelType.cs | 16 + .../MerchantInitiatedRequest.cs | 21 ++ .../MerchantInitiatedRequest}/RequestType.cs | 36 +- .../UpdateASessionResponseOk.cs | 341 ++++++++++++++++++ .../ThreeDsMethodCompletionType.cs | 17 + ...ThreedsMethodCompletionIndicatorRequest.cs | 18 + ...eedsMethodCompletionIndicatorResponseOk.cs | 263 ++++++++++++++ src/CheckoutSdk/CheckoutApi.cs | 10 +- .../Common/ChallengeIndicatorType.cs | 17 +- src/CheckoutSdk/ICheckoutApi.cs | 4 +- src/CheckoutSdk/Payments/ShippingDetails.cs | 5 +- src/CheckoutSdk/Payments/ThreeDSRequest.cs | 7 +- src/CheckoutSdk/Sessions/Acs.cs | 27 -- .../Sessions/AuthenticationType.cs | 13 - src/CheckoutSdk/Sessions/CardInfo.cs | 13 - .../Sessions/CardholderAccountInfo.cs | 49 --- src/CheckoutSdk/Sessions/Category.cs | 10 - src/CheckoutSdk/Sessions/Certificates.cs | 9 - .../Sessions/Channel/AppSession.cs | 30 -- .../Sessions/Channel/BrowserSession.cs | 32 -- .../Sessions/Channel/ChannelData.cs | 12 - .../Sessions/Channel/ChannelType.cs | 11 - .../Channel/MerchantInitiatedSession.cs | 11 - .../Sessions/Channel/SdkEphemeralPublicKey.cs | 13 - .../Sessions/Channel/SdkInterfaceType.cs | 11 - .../Channel/ThreeDsMethodCompletion.cs | 9 - .../Sessions/Completion/CompletionInfo.cs | 12 - .../Sessions/Completion/CompletionInfoType.cs | 10 - .../Completion/HostedCompletionInfo.cs | 15 - .../Completion/NonHostedCompletionInfo.cs | 13 - .../Sessions/CreateSessionAcceptedResponse.cs | 63 ---- .../Sessions/CreateSessionOkResponse.cs | 6 - src/CheckoutSdk/Sessions/DeliveryTimeframe.cs | 12 - src/CheckoutSdk/Sessions/Ds.cs | 11 - src/CheckoutSdk/Sessions/DsPublicKeys.cs | 13 - .../Sessions/GetSessionResponse.cs | 89 ----- ...SessionResponseAfterChannelDataSupplied.cs | 66 ---- src/CheckoutSdk/Sessions/ISessionsClient.cs | 35 -- .../Sessions/InitialTransaction.cs | 15 - src/CheckoutSdk/Sessions/Installment.cs | 11 - src/CheckoutSdk/Sessions/MerchantRiskInfo.cs | 30 -- src/CheckoutSdk/Sessions/Optimization.cs | 13 - .../Sessions/OptimizedProperties.cs | 11 - src/CheckoutSdk/Sessions/Recurring.cs | 9 - src/CheckoutSdk/Sessions/ResponseCode.cs | 14 - src/CheckoutSdk/Sessions/SchemeInfo.cs | 11 - src/CheckoutSdk/Sessions/SessionAddress.cs | 9 - src/CheckoutSdk/Sessions/SessionInterface.cs | 10 - .../Sessions/SessionMarketplaceData.cs | 7 - src/CheckoutSdk/Sessions/SessionRequest.cs | 54 --- src/CheckoutSdk/Sessions/SessionResponse.cs | 18 - src/CheckoutSdk/Sessions/SessionScheme.cs | 17 - src/CheckoutSdk/Sessions/SessionSourceType.cs | 12 - src/CheckoutSdk/Sessions/SessionStatus.cs | 21 -- .../Sessions/SessionsBillingDescriptor.cs | 7 - .../Sessions/SessionsCardMetadataResponse.cs | 19 - src/CheckoutSdk/Sessions/SessionsClient.cs | 156 -------- src/CheckoutSdk/Sessions/ShippingIndicator.cs | 15 - .../Sessions/Source/SessionCardSource.cs | 21 -- .../Sessions/Source/SessionIdSource.cs | 11 - .../Source/SessionNetworkTokenSource.cs | 19 - .../Sessions/Source/SessionSource.cs | 26 -- .../Sessions/Source/SessionTokenSource.cs | 13 - src/CheckoutSdk/Sessions/StatusReason.cs | 17 - src/CheckoutSdk/Sessions/ThreeDSFlowType.cs | 14 - src/CheckoutSdk/Sessions/ThreeDsExemption.cs | 15 - .../ThreeDsMethodCompletionRequest.cs | 9 - .../ThreeDsRequestorAuthenticationInfo.cs | 13 - .../Sessions/TrustedBeneficiary.cs | 9 - .../Sessions/TrustedBeneficiaryStatusType.cs | 12 - src/CheckoutSdk/Sessions/UIElements.cs | 13 - .../AbstractSessionsIntegrationTest.cs | 228 ++++++++++++ .../Standalone/AuthenticationClientTest.cs} | 226 ++++++------ .../CompleteSessionsIntegrationTest.cs | 16 +- .../RequestAndGetSessionsIntegrationTest.cs | 74 ++-- .../SessionSecretSdkCredentialsTest.cs | 5 +- .../UpdateSessionsIntegrationTest.cs | 61 ++-- .../CheckoutApiExceptionTests.cs | 90 +++++ test/CheckoutSdkTest/CheckoutApiTest.cs | 2 +- .../PaymentContextsIntegrationTest.cs | 5 +- .../PaymentAuthorizationsIntegrationTest.cs | 2 +- .../AbstractSessionsIntegrationTest.cs | 174 --------- 185 files changed, 5649 insertions(+), 1700 deletions(-) create mode 100644 src/CheckoutSdk/Authentication/AuthenticationClient.cs create mode 100644 src/CheckoutSdk/Authentication/IAuthenticationClient.cs rename src/CheckoutSdk/{Sessions => Authentication}/SessionSecretSdkCredentials.cs (94%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountAgeType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountChangeIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountInfo.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountPasswordChangeIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountType.cs rename src/CheckoutSdk/{Sessions/AuthenticationMethod.cs => Authentication/Standalone/Common/AccountInfo/AuthenticationMethodType.cs} (57%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/CardholderAccountAgeIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ShippingAddressAgeType.cs rename src/CheckoutSdk/{Sessions => Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo}/ThreeDsReqAuthMethodType.cs (76%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsRequestorAuthenticationInfo.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationCategoryType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/AuthenticationMethodType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/InitialTransaction.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Installment/Installment.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/DeliveryTimeframeType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/MerchantRiskInfo.cs rename src/CheckoutSdk/{Sessions => Authentication/Standalone/Common/MerchantRiskInfo}/PreOrderPurchaseIndicatorType.cs (69%) rename src/CheckoutSdk/{Sessions => Authentication/Standalone/Common/MerchantRiskInfo}/ReorderItemsIndicatorType.cs (70%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ShippingIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Recurring/Recurring.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkInterfaceType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkUiElementsType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Requests/ThreeDsMethodCompletionType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/Acs.cs rename src/CheckoutSdk/{Sessions/ChallengeCancelReason.cs => Authentication/Standalone/Common/Responses/Acs/ChallengeCancelReasonType.cs} (72%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/InterfaceType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/UiTemplateType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Card.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardCategoryType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/Metadata.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Certificates/Certificates.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/ChallengeIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Ds/Ds.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/AppliedType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/Exemption.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/StatusType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/TrustedBeneficiary.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/ExperienceType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/FlowType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/GoogleSpa.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Iframe/Iframe.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Token/Token.cs rename src/CheckoutSdk/{Sessions/NextAction.cs => Authentication/Standalone/Common/Responses/NextActionsType.cs} (51%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/Optimization.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/OptimizedProperties/OptimizedProperties.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/GoogleSpa.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/StatusType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/PreferredExperiences.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/StatusType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/Threeds.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/ResponseCodeType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/NameType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/SchemeInfo.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusReasonType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/ErrorDetails/ErrorDetails.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/Threeds.cs rename src/CheckoutSdk/{Sessions => Authentication/Standalone/Common}/TransactionType.cs (67%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/GETSessionsId/Responses/GetSessionDetailsResponseOk/GetSessionDetailsResponseOk.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/BillingDescriptor/BillingDescriptor.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChallengeIndicatorType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AbstractChannelData.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/AppChannelData.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/SdkEphemPubKey/SdkEphemPubKey.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/BrowserChannelData/BrowserChannelData.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/ChannelDataType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/MerchantInitiatedChannelData.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/RequestType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/AbstractCompletion.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/CompletionType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/HostedCompletion/HostedCompletion.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/NonHostedCompletion/NonHostedCompletion.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/GoogleSpa/GoogleSpa.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Marketplace/Marketplace.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Optimization/Optimization.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/PreferredExperiencesType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/RequestASessionRequest.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ShippingAddress/ShippingAddress.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/AbstractSource.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/CardSource/CardSource.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/BillingAddress/BillingAddress.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/HomePhone/HomePhone.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/MobilePhone/MobilePhone.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/SchemeType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/WorkPhone/WorkPhone.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/IdSource/IdSource.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/NetworkTokenSource/NetworkTokenSource.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/SourceType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/TokenSource/TokenSource.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponse.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseAccepted/RequestASessionResponseAccepted.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseCreated/RequestASessionResponseCreated.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/POSTSessionsIdComplete/Responses/CompleteASessionResponseNoContent/CompleteASessionResponseNoContent.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AbstractUpdateASessionRequest.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/AppRequest.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/SdkEphemPubKey/SdkEphemPubKey.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/BrowserRequest/BrowserRequest.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/ChannelType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/MerchantInitiatedRequest.cs rename src/CheckoutSdk/{Sessions/Channel => Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest}/RequestType.cs (70%) create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Responses/UpdateASessionResponseOk/UpdateASessionResponseOk.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/ThreeDsMethodCompletionType.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/UpdateSessionThreedsMethodCompletionIndicatorRequest.cs create mode 100644 src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Responses/UpdateSessionThreedsMethodCompletionIndicatorResponseOk/UpdateSessionThreedsMethodCompletionIndicatorResponseOk.cs delete mode 100644 src/CheckoutSdk/Sessions/Acs.cs delete mode 100644 src/CheckoutSdk/Sessions/AuthenticationType.cs delete mode 100644 src/CheckoutSdk/Sessions/CardInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/CardholderAccountInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/Category.cs delete mode 100644 src/CheckoutSdk/Sessions/Certificates.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/AppSession.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/BrowserSession.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/ChannelData.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/ChannelType.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/MerchantInitiatedSession.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/SdkEphemeralPublicKey.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/SdkInterfaceType.cs delete mode 100644 src/CheckoutSdk/Sessions/Channel/ThreeDsMethodCompletion.cs delete mode 100644 src/CheckoutSdk/Sessions/Completion/CompletionInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/Completion/CompletionInfoType.cs delete mode 100644 src/CheckoutSdk/Sessions/Completion/HostedCompletionInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/Completion/NonHostedCompletionInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/CreateSessionAcceptedResponse.cs delete mode 100644 src/CheckoutSdk/Sessions/CreateSessionOkResponse.cs delete mode 100644 src/CheckoutSdk/Sessions/DeliveryTimeframe.cs delete mode 100644 src/CheckoutSdk/Sessions/Ds.cs delete mode 100644 src/CheckoutSdk/Sessions/DsPublicKeys.cs delete mode 100644 src/CheckoutSdk/Sessions/GetSessionResponse.cs delete mode 100644 src/CheckoutSdk/Sessions/GetSessionResponseAfterChannelDataSupplied.cs delete mode 100644 src/CheckoutSdk/Sessions/ISessionsClient.cs delete mode 100644 src/CheckoutSdk/Sessions/InitialTransaction.cs delete mode 100644 src/CheckoutSdk/Sessions/Installment.cs delete mode 100644 src/CheckoutSdk/Sessions/MerchantRiskInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/Optimization.cs delete mode 100644 src/CheckoutSdk/Sessions/OptimizedProperties.cs delete mode 100644 src/CheckoutSdk/Sessions/Recurring.cs delete mode 100644 src/CheckoutSdk/Sessions/ResponseCode.cs delete mode 100644 src/CheckoutSdk/Sessions/SchemeInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionAddress.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionInterface.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionMarketplaceData.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionRequest.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionResponse.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionScheme.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionSourceType.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionStatus.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionsBillingDescriptor.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionsCardMetadataResponse.cs delete mode 100644 src/CheckoutSdk/Sessions/SessionsClient.cs delete mode 100644 src/CheckoutSdk/Sessions/ShippingIndicator.cs delete mode 100644 src/CheckoutSdk/Sessions/Source/SessionCardSource.cs delete mode 100644 src/CheckoutSdk/Sessions/Source/SessionIdSource.cs delete mode 100644 src/CheckoutSdk/Sessions/Source/SessionNetworkTokenSource.cs delete mode 100644 src/CheckoutSdk/Sessions/Source/SessionSource.cs delete mode 100644 src/CheckoutSdk/Sessions/Source/SessionTokenSource.cs delete mode 100644 src/CheckoutSdk/Sessions/StatusReason.cs delete mode 100644 src/CheckoutSdk/Sessions/ThreeDSFlowType.cs delete mode 100644 src/CheckoutSdk/Sessions/ThreeDsExemption.cs delete mode 100644 src/CheckoutSdk/Sessions/ThreeDsMethodCompletionRequest.cs delete mode 100644 src/CheckoutSdk/Sessions/ThreeDsRequestorAuthenticationInfo.cs delete mode 100644 src/CheckoutSdk/Sessions/TrustedBeneficiary.cs delete mode 100644 src/CheckoutSdk/Sessions/TrustedBeneficiaryStatusType.cs delete mode 100644 src/CheckoutSdk/Sessions/UIElements.cs create mode 100644 test/CheckoutSdkTest/Authentification/Standalone/AbstractSessionsIntegrationTest.cs rename test/CheckoutSdkTest/{Sessions/SessionsClientTest.cs => Authentification/Standalone/AuthenticationClientTest.cs} (53%) rename test/CheckoutSdkTest/{Sessions => Authentification/Standalone}/CompleteSessionsIntegrationTest.cs (77%) rename test/CheckoutSdkTest/{Sessions => Authentification/Standalone}/RequestAndGetSessionsIntegrationTest.cs (78%) rename test/CheckoutSdkTest/{Sessions => Authentification/Standalone}/SessionSecretSdkCredentialsTest.cs (94%) rename test/CheckoutSdkTest/{Sessions => Authentification/Standalone}/UpdateSessionsIntegrationTest.cs (62%) create mode 100644 test/CheckoutSdkTest/CheckoutApiExceptionTests.cs delete mode 100644 test/CheckoutSdkTest/Sessions/AbstractSessionsIntegrationTest.cs diff --git a/src/CheckoutSdk/Authentication/AuthenticationClient.cs b/src/CheckoutSdk/Authentication/AuthenticationClient.cs new file mode 100644 index 00000000..3e1f7c28 --- /dev/null +++ b/src/CheckoutSdk/Authentication/AuthenticationClient.cs @@ -0,0 +1,174 @@ +using Checkout.Authentication.Standalone.GETSessionsId.Responses.GetSessionDetailsResponseOk; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest; +using Checkout.Authentication.Standalone.POSTSessions.Responses; +using Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseAccepted; +using Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseCreated; +using Checkout.Authentication.Standalone.POSTSessionsIdComplete.Responses.CompleteASessionResponseNoContent; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Responses.UpdateASessionResponseOk; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Responses. + UpdateSessionThreedsMethodCompletionIndicatorResponseOk; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Checkout.Authentication +{ + public class AuthenticationClient : AbstractClient, IAuthenticationClient + { + private const string SessionsPath = "sessions"; + private const string CollectDataPath = "collect-data"; + private const string CompletePath = "complete"; + private const string IssuerFingerprintPath = "issuer-fingerprint"; + private const string SessionIdPath = "sessionId"; + + private static readonly IDictionary RequestASessionResponseMappings = new Dictionary(); + + static AuthenticationClient() + { + RequestASessionResponseMappings[201] = typeof(RequestASessionResponseCreated); + RequestASessionResponseMappings[202] = typeof(RequestASessionResponseAccepted); + } + + public AuthenticationClient(IApiClient apiClient, CheckoutConfiguration configuration) + : base(apiClient, configuration, SdkAuthorizationType.OAuth) + { + } + + public async Task RequestASession(RequestASessionRequest requestASessionRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("requestASessionRequest", requestASessionRequest); + var resource = await ApiClient.Post(SessionsPath, SdkAuthorization(), + RequestASessionResponseMappings, + requestASessionRequest, cancellationToken); + + switch (resource) + { + case RequestASessionResponseCreated requestASessionResponseCreated: + return new RequestASessionResponse(requestASessionResponseCreated); + + case RequestASessionResponseAccepted requestASessionResponseAccepted: + return new RequestASessionResponse(requestASessionResponseAccepted); + + default: + throw new InvalidOperationException("Unexpected mapping type " + resource.GetType()); + } + } + + public async Task GetSessionDetails(string sessionId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionId", sessionId); + return await GetSessionDetails(sessionId, SdkAuthorization(), cancellationToken); + } + + public async Task GetSessionDetails(string sessionSecret, string sessionId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId); + return await GetSessionDetails(sessionId, SessionSecretAuthorization(sessionSecret), cancellationToken); + } + + public async Task UpdateASession(string sessionId, + AbstractUpdateASessionRequest updateASessionRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionId", sessionId, "updateASessionRequest", updateASessionRequest); + return await UpdateASession(sessionId, updateASessionRequest, SdkAuthorization(), cancellationToken); + } + + public async Task UpdateASession(string sessionSecret, string sessionId, + AbstractUpdateASessionRequest updateASessionRequest, CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId, + "updateASessionRequest", + updateASessionRequest); + return await UpdateASession(sessionId, updateASessionRequest, SessionSecretAuthorization(sessionSecret), + cancellationToken); + } + + public async Task CompleteASession(string sessionId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionId", sessionId); + return await CompleteASession(sessionId, SdkAuthorization(), cancellationToken); + } + + public async Task CompleteASession(string sessionSecret, string sessionId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId); + return await CompleteASession(sessionId, SessionSecretAuthorization(sessionSecret), cancellationToken); + } + + public Task + UpdateSessionThreedsMethodCompletionIndicator(string sessionId, + UpdateSessionThreedsMethodCompletionIndicatorRequest + updateSessionThreedsMethodCompletionIndicatorRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionId", sessionId, "updateSessionThreedsMethodCompletionIndicatorRequest", + updateSessionThreedsMethodCompletionIndicatorRequest); + return UpdateSessionThreedsMethodCompletionIndicator(sessionId, + updateSessionThreedsMethodCompletionIndicatorRequest, SdkAuthorization(), + cancellationToken); + } + + public Task + UpdateSessionThreedsMethodCompletionIndicator(string sessionSecret, + string sessionId, + UpdateSessionThreedsMethodCompletionIndicatorRequest + updateSessionThreedsMethodCompletionIndicatorRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", + sessionId, "updateSessionThreedsMethodCompletionIndicatorRequest", + updateSessionThreedsMethodCompletionIndicatorRequest); + return UpdateSessionThreedsMethodCompletionIndicator(sessionId, + updateSessionThreedsMethodCompletionIndicatorRequest, + SessionSecretAuthorization(sessionSecret), cancellationToken); + } + + private async Task GetSessionDetails(string sessionId, SdkAuthorization sdkAuthorization, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams(SessionIdPath, sessionId, "sdkAuthorization", sdkAuthorization); + return await ApiClient.Get(BuildPath(SessionsPath, sessionId), sdkAuthorization, + cancellationToken); + } + + private async Task UpdateASession(string sessionId, AbstractUpdateASessionRequest updateASessionRequest, + SdkAuthorization sdkAuthorization, + CancellationToken cancellationToken = default) + { + return await ApiClient.Put(BuildPath(SessionsPath, sessionId, CollectDataPath), + sdkAuthorization, updateASessionRequest, cancellationToken); + } + + private async Task CompleteASession(string sessionId, SdkAuthorization sdkAuthorization, + CancellationToken cancellationToken = default) + { + return await ApiClient.Post(BuildPath(SessionsPath, sessionId, CompletePath), + sdkAuthorization, null, + cancellationToken, null); + } + + private async Task UpdateSessionThreedsMethodCompletionIndicator( + string sessionId, UpdateSessionThreedsMethodCompletionIndicatorRequest updateSessionThreedsMethodCompletionIndicatorRequest, + SdkAuthorization sdkAuthorization, CancellationToken cancellationToken = default) + { + return await ApiClient.Put( + BuildPath(SessionsPath, sessionId, IssuerFingerprintPath), sdkAuthorization, + updateSessionThreedsMethodCompletionIndicatorRequest, cancellationToken); + } + + private static SdkAuthorization SessionSecretAuthorization(string sessionSecret) + { + return new SessionSecretSdkCredentials(sessionSecret).GetSdkAuthorization(SdkAuthorizationType.Custom); + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/IAuthenticationClient.cs b/src/CheckoutSdk/Authentication/IAuthenticationClient.cs new file mode 100644 index 00000000..5612495a --- /dev/null +++ b/src/CheckoutSdk/Authentication/IAuthenticationClient.cs @@ -0,0 +1,52 @@ +using Checkout.Authentication.Standalone.GETSessionsId.Responses.GetSessionDetailsResponseOk; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest; +using Checkout.Authentication.Standalone.POSTSessions.Responses; +using Checkout.Authentication.Standalone.POSTSessionsIdComplete.Responses.CompleteASessionResponseNoContent; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Responses.UpdateASessionResponseOk; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Responses. + UpdateSessionThreedsMethodCompletionIndicatorResponseOk; +using System.Threading; +using System.Threading.Tasks; + +namespace Checkout.Authentication +{ + public interface IAuthenticationClient + { + Task RequestASession(RequestASessionRequest requestASessionRequest, + CancellationToken cancellationToken = default); + + Task GetSessionDetails(string sessionId, + CancellationToken cancellationToken = default); + + Task GetSessionDetails(string sessionSecret, string sessionId, + CancellationToken cancellationToken = default); + + Task UpdateASession(string sessionId, + AbstractUpdateASessionRequest updateASessionRequest, + CancellationToken cancellationToken = default); + + Task UpdateASession(string sessionSecret, string sessionId, + AbstractUpdateASessionRequest updateASessionRequest, + CancellationToken cancellationToken = default); + + Task CompleteASession(string sessionId, + CancellationToken cancellationToken = default); + + Task CompleteASession(string sessionSecret, string sessionId, + CancellationToken cancellationToken = default); + + Task UpdateSessionThreedsMethodCompletionIndicator( + string sessionId, + UpdateSessionThreedsMethodCompletionIndicatorRequest updateSessionThreedsMethodCompletionIndicatorRequest, + CancellationToken cancellationToken = default); + + Task UpdateSessionThreedsMethodCompletionIndicator( + string sessionSecret, + string sessionId, + UpdateSessionThreedsMethodCompletionIndicatorRequest updateSessionThreedsMethodCompletionIndicatorRequest, + CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionSecretSdkCredentials.cs b/src/CheckoutSdk/Authentication/SessionSecretSdkCredentials.cs similarity index 94% rename from src/CheckoutSdk/Sessions/SessionSecretSdkCredentials.cs rename to src/CheckoutSdk/Authentication/SessionSecretSdkCredentials.cs index dbc4aab6..9c145789 100644 --- a/src/CheckoutSdk/Sessions/SessionSecretSdkCredentials.cs +++ b/src/CheckoutSdk/Authentication/SessionSecretSdkCredentials.cs @@ -1,4 +1,4 @@ -namespace Checkout.Sessions +namespace Checkout.Authentication { public class SessionSecretSdkCredentials : SdkCredentials { diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountAgeType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountAgeType.cs new file mode 100644 index 00000000..241ad6f8 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountAgeType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum AccountAgeType + { + [EnumMember(Value = "no_account")] + NoAccount, + + [EnumMember(Value = "created_during_transaction")] + CreatedDuringTransaction, + + [EnumMember(Value = "less_than_thirty_days")] + LessThanThirtyDays, + + [EnumMember(Value = "thirty_to_sixty_days")] + ThirtyToSixtyDays, + + [EnumMember(Value = "more_than_sixty_days")] + MoreThanSixtyDays, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountChangeIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountChangeIndicatorType.cs new file mode 100644 index 00000000..e62e0112 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountChangeIndicatorType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum AccountChangeIndicatorType + { + [EnumMember(Value = "this_transaction")] + ThisTransaction, + + [EnumMember(Value = "less_than_thirty_days")] + LessThanThirtyDays, + + [EnumMember(Value = "thirty_to_sixty_days")] + ThirtyToSixtyDays, + + [EnumMember(Value = "more_than_sixty_days")] + MoreThanSixtyDays, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountInfo.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountInfo.cs new file mode 100644 index 00000000..fdbf2e6a --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountInfo.cs @@ -0,0 +1,159 @@ +using System; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + /// + /// account_info + /// Additional information about the Cardholder's account. + /// + public class AccountInfo + { + /// + /// The number of purchases with this cardholder's account during the last six months. + /// [Optional] + /// [ 0 .. 9999 ] + /// + public double PurchaseCount { get; set; } + + /// + /// The length of time that the payment account was enrolled in the cardholder's account. + /// [Optional] + /// + public AccountAgeType? AccountAge { get; set; } + + /// + /// The number of Add Card attempts in the last 24 hours. + /// [Optional] + /// [ 0 .. 999 ] + /// + public double AddCardAttempts { get; set; } + + /// + /// Indicates when the shipping address used for this transaction was first used. + /// [Optional] + /// + public ShippingAddressAgeType? ShippingAddressAge { get; set; } + + /// + /// Indicates if the Cardholder Name on the account is identical to the shipping Name used for this transaction. + /// [Optional] + /// + public bool AccountNameMatchesShippingName { get; set; } + + /// + /// Indicates whether suspicious activity on the cardholder account has been observed. + /// [Optional] + /// + public bool SuspiciousAccountActivity { get; set; } + + /// + /// The number of transactions (successful and abandoned) for the cardholder account across all payment accounts + /// in the previous 24 hours + /// [Optional] + /// [ 0 .. 999 ] + /// + public double TransactionsToday { get; set; } + + /// + /// [DEPRECATED] + /// Information about how the cardholder was authenticated before or during the transaction. + /// [Optional] + /// + [Obsolete("This property will be removed in the future, and should not be used.")] + public AuthenticationMethodType? AuthenticationMethod { get; set; } + + /// + /// The length of time the cardholder has held the account with the 3DS Requestor. + /// [Optional] + /// + public CardholderAccountAgeIndicatorType? CardholderAccountAgeIndicator { get; set; } + + /// + /// The UTC date and time the cardholder’s account with the 3DS Requestor was last changed, in ISO 8601 format. + /// Changes that affect this value include: + /// updating the billing or shipping address + /// adding a new payment account + /// adding a new user + /// [Optional] + /// + /// + public DateTime AccountChange { get; set; } + + /// + /// The amount of time since the cardholder’s account information with the 3DS Requestor was last changed. + /// Changes that affect this value include: + /// updating the billing or shipping address + /// adding a new payment account + /// adding a new user + /// [Optional] + /// + public AccountChangeIndicatorType? AccountChangeIndicator { get; set; } + + /// + /// The UTC date and time the cardholder opened the account with the 3DS Requestor, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime AccountDate { get; set; } + + /// + /// The UTC date and time the cardholder’s account with the 3DS Requestor was last reset or had a password + /// change, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime AccountPasswordChange { get; set; } + + /// + /// The amount of time since the cardholder’s account with the 3DS Requestor was last reset or had a password + /// change. + /// [Optional] + /// + public AccountPasswordChangeIndicatorType? AccountPasswordChangeIndicator { get; set; } + + /// + /// The number of transactions associated with the cardholder's account with the 3DS Requestor in the previous + /// year. This value includes both successful and abandoned transactions, across all payment accounts. + /// Set this value to 999 if the number of transactions is 1000 or greater. + /// [Optional] + /// <= 3 + /// <= 999 + /// + public int TransactionsPerYear { get; set; } + + /// + /// The UTC date and time the payment account was enrolled in the cardholder’s account with the 3DS Requestor, + /// in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime PaymentAccountAge { get; set; } + + /// + /// The UTC date and time the shipping address used for the transaction was first used with the 3DS Requestor, + /// in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime ShippingAddressUsage { get; set; } + + /// + /// The type of account, in the case of a card product with multiple accounts. + /// [Optional] + /// + public AccountType? AccountType { get; set; } + + /// + /// Additional information about the account optionally provided by the 3DS Requestor. + /// [Optional] + /// <= 64 + /// + public string AccountId { get; set; } + + /// + /// Information about how the 3DS Requestor authenticated the cardholder before or during the transaction. + /// [Optional] + /// + public ThreeDsRequestorAuthenticationInfo.ThreeDsRequestorAuthenticationInfo ThreeDsRequestorAuthenticationInfo { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountPasswordChangeIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountPasswordChangeIndicatorType.cs new file mode 100644 index 00000000..8ebad61d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountPasswordChangeIndicatorType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum AccountPasswordChangeIndicatorType + { + [EnumMember(Value = "no_change")] + NoChange, + + [EnumMember(Value = "this_transaction")] + ThisTransaction, + + [EnumMember(Value = "less_than_thirty_days")] + LessThanThirtyDays, + + [EnumMember(Value = "thirty_to_sixty_days")] + ThirtyToSixtyDays, + + [EnumMember(Value = "more_than_sixty_days")] + MoreThanSixtyDays, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountType.cs new file mode 100644 index 00000000..4eb8e7e3 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AccountType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum AccountType + { + [EnumMember(Value = "not_applicable")] + NotApplicable, + + [EnumMember(Value = "credit")] + Credit, + + [EnumMember(Value = "debit")] + Debit, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/AuthenticationMethod.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AuthenticationMethodType.cs similarity index 57% rename from src/CheckoutSdk/Sessions/AuthenticationMethod.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AuthenticationMethodType.cs index 3a1c0b3c..3a8cdaa8 100644 --- a/src/CheckoutSdk/Sessions/AuthenticationMethod.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/AuthenticationMethodType.cs @@ -1,22 +1,25 @@ using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.AccountInfo { - public enum AuthenticationMethod + public enum AuthenticationMethodType { - [EnumMember(Value = "federated_id")] FederatedId, - [EnumMember(Value = "fido")] Fido, - - [EnumMember(Value = "issuer_credentials")] - IssuerCredentials, - [EnumMember(Value = "no_authentication")] NoAuthentication, [EnumMember(Value = "own_credentials")] OwnCredentials, + [EnumMember(Value = "federated_id")] + FederatedId, + + [EnumMember(Value = "issuer_credentials")] + IssuerCredentials, + [EnumMember(Value = "third_party_authentication")] - ThirdPartyAuthentication + ThirdPartyAuthentication, + + [EnumMember(Value = "fido")] + Fido, } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/CardholderAccountAgeIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/CardholderAccountAgeIndicatorType.cs new file mode 100644 index 00000000..6973286d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/CardholderAccountAgeIndicatorType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum CardholderAccountAgeIndicatorType + { + [EnumMember(Value = "no_account,")] + NoAccount, + + [EnumMember(Value = "this_transaction")] + ThisTransaction, + + [EnumMember(Value = "less_than_thirty_days")] + LessThanThirtyDays, + + [EnumMember(Value = "thirty_to_sixty_days")] + ThirtyToSixtyDays, + + [EnumMember(Value = "more_than_sixty_days")] + MoreThanSixtyDays, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ShippingAddressAgeType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ShippingAddressAgeType.cs new file mode 100644 index 00000000..0d2b8ee5 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ShippingAddressAgeType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo +{ + public enum ShippingAddressAgeType + { + [EnumMember(Value = "this_transaction")] + ThisTransaction, + + [EnumMember(Value = "less_than_thirty_days")] + LessThanThirtyDays, + + [EnumMember(Value = "thirty_to_sixty_days")] + ThirtyToSixtyDays, + + [EnumMember(Value = "more_than_sixty_days")] + MoreThanSixtyDays, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ThreeDsReqAuthMethodType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsReqAuthMethodType.cs similarity index 76% rename from src/CheckoutSdk/Sessions/ThreeDsReqAuthMethodType.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsReqAuthMethodType.cs index dedd23a3..bb32d3cb 100644 --- a/src/CheckoutSdk/Sessions/ThreeDsReqAuthMethodType.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsReqAuthMethodType.cs @@ -1,31 +1,31 @@ using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.AccountInfo.ThreeDsRequestorAuthenticationInfo { public enum ThreeDsReqAuthMethodType { - [EnumMember(Value = "federated_id")] + [EnumMember(Value = "no_threeds_requestor_authentication_occurred")] + NoThreedsRequestorAuthenticationOccurred, + + [EnumMember(Value = "three3ds_requestor_own_credentials")] + ThreeThreedsRequestorOwnCredentials, + + [EnumMember(Value = "federated_id")] FederatedId, + [EnumMember(Value = "issuer_credentials")] + IssuerCredentials, + + [EnumMember(Value = "third_party_authentication")] + ThirdPartyAuthentication, + [EnumMember(Value = "fido_authenticator")] FidoAuthenticator, [EnumMember(Value = "fido_authenticator_fido_assurance_data_signed")] FidoAuthenticatorFidoAssuranceDataSigned, - [EnumMember(Value = "issuer_credentials")] - IssuerCredentials, - - [EnumMember(Value = "no_threeds_requestor_authentication_occurred")] - NoThreedsRequestorAuthenticationOccurred, - [EnumMember(Value = "src_assurance_data")] SrcAssuranceData, - - [EnumMember(Value = "three3ds_requestor_own_credentials")] - Three3dsRequestorOwnCredentials, - - [EnumMember(Value = "third_party_authentication")] - ThirdPartyAuthentication } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsRequestorAuthenticationInfo.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsRequestorAuthenticationInfo.cs new file mode 100644 index 00000000..2fb06ec1 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AccountInfo/ThreeDsRequestorAuthenticationInfo/ThreeDsRequestorAuthenticationInfo.cs @@ -0,0 +1,31 @@ +using System; + +namespace Checkout.Authentication.Standalone.Common.AccountInfo.ThreeDsRequestorAuthenticationInfo +{ + /// + /// three_ds_requestor_authentication_info + /// Information about how the 3DS Requestor authenticated the cardholder before or during the transaction. + /// + public class ThreeDsRequestorAuthenticationInfo + { + /// + /// The mechanism used by the cardholder to authenticate with the 3DS Requestor. + /// [Optional] + /// + public ThreeDsReqAuthMethodType? ThreeDsReqAuthMethod { get; set; } + + /// + /// The UTC date and time the cardholder authenticated with the 3DS Requestor, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime ThreeDsReqAuthTimestamp { get; set; } + + /// + /// Data that documents and supports a specific authentication process. + /// [Optional] + /// <= 20000 + /// + public string ThreeDsReqAuthData { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationCategoryType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationCategoryType.cs new file mode 100644 index 00000000..32055345 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationCategoryType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common +{ + public enum AuthenticationCategoryType + { + [EnumMember(Value = "payment")] + Payment, + + [EnumMember(Value = "non_payment")] + NonPayment, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationType.cs new file mode 100644 index 00000000..12e69243 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/AuthenticationType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common +{ + public enum AuthenticationType + { + [EnumMember(Value = "regular")] + Regular, + + [EnumMember(Value = "recurring")] + Recurring, + + [EnumMember(Value = "installment")] + Installment, + + [EnumMember(Value = "maintain_card")] + MaintainCard, + + [EnumMember(Value = "add_card")] + AddCard, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/AuthenticationMethodType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/AuthenticationMethodType.cs new file mode 100644 index 00000000..05a8b3c3 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/AuthenticationMethodType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.InitialTransaction +{ + public enum AuthenticationMethodType + { + [EnumMember(Value = "frictionless_authentication")] + FrictionlessAuthentication, + + [EnumMember(Value = "challenge_occurred")] + ChallengeOccurred, + + [EnumMember(Value = "avs_verified")] + AvsVerified, + + [EnumMember(Value = "other_issuer_methods")] + OtherIssuerMethods, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/InitialTransaction.cs b/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/InitialTransaction.cs new file mode 100644 index 00000000..f64d7dc8 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/InitialTransaction/InitialTransaction.cs @@ -0,0 +1,41 @@ +namespace Checkout.Authentication.Standalone.Common.InitialTransaction +{ + /// + /// initial_transaction + /// Details of a previous transaction + /// + public class InitialTransaction + { + /// + /// The Access Control Server (ACS) transaction ID for a previously authenticated transaction + /// [Optional] + /// >= 36 + /// + public string AcsTransactionId { get; set; } + + /// + /// [Optional] + /// + public AuthenticationMethodType? AuthenticationMethod { get; set; } + + /// + /// The timestamp of the previous authentication, in ISO 8601 format. + /// [Optional] + /// + public string AuthenticationTimestamp { get; set; } + + /// + /// Data that documents and supports a specific authentication process + /// [Optional] + /// <= 2048 + /// + public string AuthenticationData { get; set; } + + /// + /// The ID for a previous session, which is used for retrieve the initial transaction's properties + /// [Optional] + /// 30 characters + /// + public string InitialSessionId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Installment/Installment.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Installment/Installment.cs new file mode 100644 index 00000000..5817dd44 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Installment/Installment.cs @@ -0,0 +1,33 @@ +namespace Checkout.Authentication.Standalone.Common.Installment +{ + /// + /// installment + /// Details of an installment authentication. This property is needed only for an installment authentication type. + /// Value will be ignored in any other cases. + /// + public class Installment + { + /// + /// Indicates the agreed total number of payment installments to be made in the duration of the installment + /// agreement. Required when the authentication type is instalment. + /// [Required] + /// <= 3 + /// >= 2 + /// + public int NumberOfPayments { get; set; } + + /// + /// Default: 1 Indicates the minimum number of days between authorisations. If no value is specified for an + /// installment authentication type the default value will be used. + /// [Optional] + /// + public int DaysBetweenPayments { get; set; } = 1; + + /// + /// Default: 99991231 Date after which no further authorisations are performed in the format yyyyMMdd. If no + /// value is specified for an installment authentication type the default value will be used. + /// [Optional] + /// + public string Expiry { get; set; } = "99991231"; + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/DeliveryTimeframeType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/DeliveryTimeframeType.cs new file mode 100644 index 00000000..441695de --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/DeliveryTimeframeType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.MerchantRiskInfo +{ + public enum DeliveryTimeframeType + { + [EnumMember(Value = "electronic_delivery")] + ElectronicDelivery, + + [EnumMember(Value = "same_day")] + SameDay, + + [EnumMember(Value = "overnight")] + Overnight, + + [EnumMember(Value = "two_day_or_more")] + TwoDayOrMore, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/MerchantRiskInfo.cs b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/MerchantRiskInfo.cs new file mode 100644 index 00000000..a5bd27d9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/MerchantRiskInfo.cs @@ -0,0 +1,88 @@ +using System; + +namespace Checkout.Authentication.Standalone.Common.MerchantRiskInfo +{ + /// + /// merchant_risk_info + /// Additional information about the cardholder's purchase. + /// + public class MerchantRiskInfo + { + /// + /// For Electronic delivery, the email address to which the merchandise was delivered. + /// [Optional] + /// <= 254 + /// + public string DeliveryEmail { get; set; } + + /// + /// Indicates the merchandise delivery timeframe. + /// [Optional] + /// + public DeliveryTimeframeType? DeliveryTimeframe { get; set; } + + /// + /// Indicates whether the cardholder is placing an order for merchandise with a future availability or release + /// date. + /// [Optional] + /// + public bool IsPreorder { get; set; } + + /// + /// Indicates whether the cardholder is reordering previously purchased merchandise. + /// [Optional] + /// + public bool IsReorder { get; set; } + + /// + /// Indicates the shipping method chosen for the transaction. Please choose an option that accurately describes + /// the cardholder's specific transaction. + /// [Optional] + /// + public ShippingIndicatorType? ShippingIndicator { get; set; } + + /// + /// Specifies whether the cardholder is reordering merchandise they've previously purchased. + /// [Optional] + /// + public ReorderItemsIndicatorType? ReorderItemsIndicator { get; set; } + + /// + /// Specifies whether the cardholder is placing an order for merchandise with an availability date or release + /// date in the future. + /// [Optional] + /// + public PreOrderPurchaseIndicatorType? PreOrderPurchaseIndicator { get; set; } + + /// + /// The UTC date the pre-ordered merchandise is expected to be available, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime PreOrderDate { get; set; } + + /// + /// The total purchase amount, in major units. For example, the major unit amount for a gift card purchase of + /// 135.20 USD is 135. Only applicable for prepaid or gift card purchases. + /// [Optional] + /// <= 15 + /// + public string GiftCardAmount { get; set; } + + /// + /// The currency code of the gift card, as a three-digit ISO 4217 code. Only applicable for prepaid or gift + /// card purchases. + /// [Optional] + /// 3 characters + /// + public string GiftCardCurrency { get; set; } + + /// + /// The total number of individual prepaid cards, gift cards, or gift codes purchased. Only applicable for + /// prepaid or gift card purchases. + /// [Optional] + /// 2 characters + /// + public string GiftCardCount { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/PreOrderPurchaseIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/PreOrderPurchaseIndicatorType.cs similarity index 69% rename from src/CheckoutSdk/Sessions/PreOrderPurchaseIndicatorType.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/PreOrderPurchaseIndicatorType.cs index 4b2ff2cc..b088e938 100644 --- a/src/CheckoutSdk/Sessions/PreOrderPurchaseIndicatorType.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/PreOrderPurchaseIndicatorType.cs @@ -1,13 +1,13 @@ using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.MerchantRiskInfo { public enum PreOrderPurchaseIndicatorType { + [EnumMember(Value = "merchandise_available")] + MerchandiseAvailable, + [EnumMember(Value = "future_availability")] FutureAvailability, - - [EnumMember(Value = "merchandise_available")] - MerchandiseAvailable } } \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ReorderItemsIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ReorderItemsIndicatorType.cs similarity index 70% rename from src/CheckoutSdk/Sessions/ReorderItemsIndicatorType.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ReorderItemsIndicatorType.cs index a01cee12..b0310fd1 100644 --- a/src/CheckoutSdk/Sessions/ReorderItemsIndicatorType.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ReorderItemsIndicatorType.cs @@ -1,13 +1,13 @@ using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.MerchantRiskInfo { public enum ReorderItemsIndicatorType { [EnumMember(Value = "first_time_ordered")] FirstTimeOrdered, - + [EnumMember(Value = "reordered")] - Reordered + Reordered, } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ShippingIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ShippingIndicatorType.cs new file mode 100644 index 00000000..887c857c --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/MerchantRiskInfo/ShippingIndicatorType.cs @@ -0,0 +1,28 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.MerchantRiskInfo +{ + public enum ShippingIndicatorType + { + [EnumMember(Value = "billing_address")] + BillingAddress, + + [EnumMember(Value = "another_address_on_file")] + AnotherAddressOnFile, + + [EnumMember(Value = "not_on_file")] + NotOnFile, + + [EnumMember(Value = "store_pick_up")] + StorePickUp, + + [EnumMember(Value = "digital_goods")] + DigitalGoods, + + [EnumMember(Value = "travel_and_event_no_shipping")] + TravelAndEventNoShipping, + + [EnumMember(Value = "other")] + Other, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Recurring/Recurring.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Recurring/Recurring.cs new file mode 100644 index 00000000..bd5cb6ac --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Recurring/Recurring.cs @@ -0,0 +1,24 @@ +namespace Checkout.Authentication.Standalone.Common.Recurring +{ + /// + /// recurring + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. Value + /// will be ignored in any other cases. + /// + public class Recurring + { + /// + /// Default: 1 Indicates the minimum number of days between authorisations. If no value is specified for a + /// recurring authentication type the default value will be used. + /// [Optional] + /// + public int DaysBetweenPayments { get; set; } = 1; + + /// + /// Default: 99991231 Date after which no further authorisations are performed in the format yyyyMMdd. If no + /// value is specified for a recurring authentication type the default value will be used. + /// [Optional] + /// + public string Expiry { get; set; } = "99991231"; + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkInterfaceType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkInterfaceType.cs new file mode 100644 index 00000000..48b50764 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkInterfaceType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Requests +{ + public enum SdkInterfaceType + { + [EnumMember(Value = "native")] + Native, + + [EnumMember(Value = "html")] + Html, + + [EnumMember(Value = "both")] + Both, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkUiElementsType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkUiElementsType.cs new file mode 100644 index 00000000..d69f9408 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/SdkUiElementsType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Requests +{ + public enum SdkUiElementsType + { + [EnumMember(Value = "text")] + Text, + + [EnumMember(Value = "single_select")] + SingleSelect, + + [EnumMember(Value = "multi_select")] + MultiSelect, + + [EnumMember(Value = "oob")] + Oob, + + [EnumMember(Value = "html_other")] + HtmlOther, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Requests/ThreeDsMethodCompletionType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/ThreeDsMethodCompletionType.cs new file mode 100644 index 00000000..13c31fcc --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Requests/ThreeDsMethodCompletionType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Requests +{ + public enum ThreeDsMethodCompletionType + { + [EnumMember(Value = "Y")] + Y, + + [EnumMember(Value = "N")] + N, + + [EnumMember(Value = "U")] + U, + } +} diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/Acs.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/Acs.cs new file mode 100644 index 00000000..b6e3535b --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/Acs.cs @@ -0,0 +1,84 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Acs +{ + /// + /// acs + /// The access control server (ACS) information. Can be empty if the session is still pending or if communication + /// with the ACS failed. This will be available when the channel data and issuer fingerprint result have been + /// provided. + /// + public class Acs + { + /// + /// EMVCo-assigned unique identifier to track approved ACS + /// [Required] + /// <= 32 + /// + public string ReferenceNumber { get; set; } + + /// + /// Universally unique transaction identifier assigned by the ACS + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// DS assigned ACS identifier + /// [Required] + /// <= 32 + /// + public string OperatorId { get; set; } + + /// + /// Indicates whether a challenge is required for the transaction to be authorized + /// [Required] + /// + public bool ChallengeMandated { get; set; } + + /// + /// Fully qualified URL of the ACS to be used for the challenge + /// [Optional] + /// <= 2048 + /// + public string Url { get; set; } + + /// + /// Contains the JSON web signature (JWS) compact serialization created by the ACS for a challenged app + /// authentication. (Example has been truncated for readability.) + /// [Optional] + /// <= 512 + /// + public string SignedContent { get; set; } + + /// + /// The type of authentication as returned from the ACS provider. • 01 = Static • 02 = Dynamic • 03 = OOB • + /// 04-79 = Reserved for EMVCo future use • 80-99 = Reserved for DS use + /// [Optional] + /// ^\d{2}$ + /// + public string AuthenticationType { get; set; } + + /// + /// Indicator informing the ACS and the DS that the authentication has been cancelled + /// [Optional] + /// + public ChallengeCancelReasonType? ChallengeCancelReason { get; set; } + + /// + /// [Optional] + /// + public InterfaceType? Interface { get; set; } + + /// + /// [Optional] + /// + public UiTemplateType? UiTemplate { get; set; } + + /// + /// Indicator in the 3D Secure 2 RReq when the challenge is cancelled + /// [Optional] + /// [ 0 .. 99 ] + /// + public string ChallengeCancelReasonCode { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ChallengeCancelReason.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/ChallengeCancelReasonType.cs similarity index 72% rename from src/CheckoutSdk/Sessions/ChallengeCancelReason.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/ChallengeCancelReasonType.cs index 0a4dbe4b..900f2281 100644 --- a/src/CheckoutSdk/Sessions/ChallengeCancelReason.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/ChallengeCancelReasonType.cs @@ -1,25 +1,25 @@ -using System.Runtime.Serialization; +using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.Responses.Acs { - public enum ChallengeCancelReason + public enum ChallengeCancelReasonType { [EnumMember(Value = "cardholder_cancel")] CardholderCancel, + [EnumMember(Value = "transaction_timed_out")] + TransactionTimedOut, + [EnumMember(Value = "challenge_timed_out")] ChallengeTimedOut, - - [EnumMember(Value = "sdk_timed_out")] - SdkTimedOut, [EnumMember(Value = "transaction_error")] TransactionError, - [EnumMember(Value = "transaction_timed_out")] - TransactionTimedOut, - [EnumMember(Value = "unknown")] - Unknown + Unknown, + + [EnumMember(Value = "sdk_timed_out")] + SdkTimedOut, } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/InterfaceType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/InterfaceType.cs new file mode 100644 index 00000000..b181febe --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/InterfaceType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Acs +{ + public enum InterfaceType + { + [EnumMember(Value = "native_ui")] + NativeUi, + + [EnumMember(Value = "html")] + Html, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/UiTemplateType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/UiTemplateType.cs new file mode 100644 index 00000000..7a34e076 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Acs/UiTemplateType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Acs +{ + public enum UiTemplateType + { + [EnumMember(Value = "text")] + Text, + + [EnumMember(Value = "single_select")] + SingleSelect, + + [EnumMember(Value = "multi_select")] + MultiSelect, + + [EnumMember(Value = "oob")] + Oob, + + [EnumMember(Value = "html_other")] + HtmlOther, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Card.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Card.cs new file mode 100644 index 00000000..3b963329 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Card.cs @@ -0,0 +1,28 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Card +{ + /// + /// card + /// Details related to the Session source. This property should always be in the response, unless a card source was + /// used and communication with Checkout.com's Vault was not possible. + /// + public class Card + { + /// + /// The identifier of the card instrument. + /// [Required] + /// + public string InstrumentId { get; set; } + + /// + /// A token that can uniquely identify this card across all customers. + /// [Required] + /// + public string Fingerprint { get; set; } + + /// + /// Additional details for this card + /// [Optional] + /// + public Metadata.Metadata Metadata { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardCategoryType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardCategoryType.cs new file mode 100644 index 00000000..d3dc4c8a --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardCategoryType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Card.Metadata +{ + public enum CardCategoryType + { + [EnumMember(Value = "CONSUMER")] + CONSUMER, + + [EnumMember(Value = "COMMERCIAL")] + COMMERCIAL, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardType.cs new file mode 100644 index 00000000..46e444e2 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/CardType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Card.Metadata +{ + public enum CardType + { + [EnumMember(Value = "CREDIT")] + CREDIT, + + [EnumMember(Value = "DEBIT")] + DEBIT, + + [EnumMember(Value = "PREPAID")] + PREPAID, + + [EnumMember(Value = "CHARGE")] + CHARGE, + + [EnumMember(Value = "DEFERRED DEBIT")] + DEFERREDDEBIT, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/Metadata.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/Metadata.cs new file mode 100644 index 00000000..f54b0154 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Card/Metadata/Metadata.cs @@ -0,0 +1,45 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Card.Metadata +{ + /// + /// metadata + /// Additional details for this card + /// + public class Metadata + { + /// + /// The card type + /// [Optional] + /// + public CardType? CardType { get; set; } + + /// + /// The card category. + /// [Optional] + /// + public CardCategoryType? CardCategory { get; set; } + + /// + /// The card issuer's name. + /// [Optional] + /// + public string IssuerName { get; set; } + + /// + /// The two letter alpha country code of the card issuer. + /// [Optional] + /// + public string IssuerCountry { get; set; } + + /// + /// The issuer/card scheme product identifier. + /// [Optional] + /// + public string ProductId { get; set; } + + /// + /// The issuer/card scheme product type. + /// [Optional] + /// + public string ProductType { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Certificates/Certificates.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Certificates/Certificates.cs new file mode 100644 index 00000000..82d4f907 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Certificates/Certificates.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.Common.Responses.Certificates +{ + /// + /// certificates + /// Public certificates specific to a Directory Server (DS) for encrypting device data and verifying ACS signed + /// content. Required when channel is app. + /// + public class Certificates + { + /// + /// A public certificate provided by the DS for encrytion of device data. It is a base64 URL encoded JSON web + /// key. + /// [Required] + /// <= 1024 + /// + public string DsPublic { get; set; } + + /// + /// Certificate authority (CA) public certificate (root) of the DS-CA. This certificate is used to validate the + /// ACS signed content JSON web signature (JWS) object. It is a base64 URL encoded DER encoded X.509. + /// [Optional] + /// <= 1024 + /// + public string CaPublic { get; set; } + + /// + /// An array of available certificate authority (CA) public certificates (root) of the DS-CA. + /// The certificates are used to validate the JSON web signature (JWS) object signed by the access control + /// server (ACS). Each array element is a Base64 URL-encoded DER-encoded X.509 certificate. + /// [Optional] + /// + public IList CaPublicAll { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ChallengeIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ChallengeIndicatorType.cs new file mode 100644 index 00000000..3ca9e2a7 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ChallengeIndicatorType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum ChallengeIndicatorType + { + [EnumMember(Value = "no_preference")] + NoPreference, + + [EnumMember(Value = "no_challenge_requested")] + NoChallengeRequested, + + [EnumMember(Value = "challenge_requested")] + ChallengeRequested, + + [EnumMember(Value = "challenge_requested_mandate")] + ChallengeRequestedMandate, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Ds/Ds.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Ds/Ds.cs new file mode 100644 index 00000000..b6c68562 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Ds/Ds.cs @@ -0,0 +1,33 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Ds +{ + /// + /// ds + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// + public class Ds + { + /// + /// Required if the session is deemed app-based. Registered application provider identifier (RID) that is unique + /// to the payment system. RIDs are defined by the ISO 7816-5 standard. Used as part of the device data + /// encryption process. + /// [Optional] + /// <= 32 + /// + public string DsId { get; set; } + + /// + /// EMVCo-assigned unique identifier to track approved DS + /// [Optional] + /// <= 32 + /// + public string ReferenceNumber { get; set; } + + /// + /// Universally unique transaction identifier assigned by the DS + /// [Optional] + /// 36 characters + /// + public string TransactionId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/AppliedType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/AppliedType.cs new file mode 100644 index 00000000..c996593e --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/AppliedType.cs @@ -0,0 +1,37 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Exemption +{ + public enum AppliedType + { + [EnumMember(Value = "none")] + None, + + [EnumMember(Value = "low_value")] + LowValue, + + [EnumMember(Value = "transaction_risk_assessment")] + TransactionRiskAssessment, + + [EnumMember(Value = "secure_corporate_payment")] + SecureCorporatePayment, + + [EnumMember(Value = "trusted_listing")] + TrustedListing, + + [EnumMember(Value = "3ds_outage")] + ThreedsOutage, + + [EnumMember(Value = "sca_delegation")] + ScaDelegation, + + [EnumMember(Value = "out_of_sca_scope")] + OutOfScaScope, + + [EnumMember(Value = "other")] + Other, + + [EnumMember(Value = "low_risk_program")] + LowRiskProgram, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/Exemption.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/Exemption.cs new file mode 100644 index 00000000..6af21aa1 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/Exemption.cs @@ -0,0 +1,33 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Exemption +{ + /// + /// exemption + /// Details related to exemption present in 3DS flow + /// + public class Exemption + { + /// + /// Indicates merchant requested exemption + /// [Optional] + /// + public string Requested { get; set; } + + /// + /// Indicates Issuer accepted or applied exemption + /// [Optional] + /// + public AppliedType? Applied { get; set; } + + /// + /// Indicates Cartes Bancaire specific exemption value + /// [Optional] + /// + public string Code { get; set; } + + /// + /// Details of the trusted listing status of the merchant. + /// [Optional] + /// + public TrustedBeneficiary.TrustedBeneficiary TrustedBeneficiary { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/StatusType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/StatusType.cs new file mode 100644 index 00000000..b3af724c --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/StatusType.cs @@ -0,0 +1,25 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.Exemption.TrustedBeneficiary +{ + public enum StatusType + { + [EnumMember(Value = "Y")] + Y, + + [EnumMember(Value = "N")] + N, + + [EnumMember(Value = "E")] + E, + + [EnumMember(Value = "P")] + P, + + [EnumMember(Value = "R")] + R, + + [EnumMember(Value = "U")] + U, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/TrustedBeneficiary.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/TrustedBeneficiary.cs new file mode 100644 index 00000000..ff21f6bd --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Exemption/TrustedBeneficiary/TrustedBeneficiary.cs @@ -0,0 +1,26 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Exemption.TrustedBeneficiary +{ + /// + /// trusted_beneficiary + /// Details of the trusted listing status of the merchant. + /// + public class TrustedBeneficiary + { + /// + /// Enables the communication of trusted beneficiary status between the Access Control Server (ACS), the + /// Directory Server (DS), and the 3D Secure (3DS) Requestor. + /// • Y = 3DS Requestor is allowlisted by cardholder • N = 3DS Requestor is not allowlisted by cardholder • E = + /// Not eligible as determined by issuer • P = Pending confirmation by cardholder • R = Cardholder rejected • U + /// = Allowlist status unknown, unavailable, or does not apply + /// [Optional] + /// + public StatusType? Status { get; set; } + + /// + /// The system setting trusted beneficiary status. + /// • 01 = 3DS Server • 02 = DS • 03 = ACS • 80-99 = DS-specific values + /// [Optional] + /// + public string Source { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ExperienceType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ExperienceType.cs new file mode 100644 index 00000000..c94d7fc6 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ExperienceType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum ExperienceType + { + [EnumMember(Value = "3ds")] + Threeds, + + [EnumMember(Value = "google_spa")] + GoogleSpa, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/FlowType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/FlowType.cs new file mode 100644 index 00000000..650ad3ea --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/FlowType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum FlowType + { + [EnumMember(Value = "challenged")] + Challenged, + + [EnumMember(Value = "frictionless")] + Frictionless, + + [EnumMember(Value = "frictionless_delegated")] + FrictionlessDelegated, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/GoogleSpa.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/GoogleSpa.cs new file mode 100644 index 00000000..71e3395f --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/GoogleSpa.cs @@ -0,0 +1,41 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.GoogleSpa +{ + /// + /// Non Hosted google_spa Class + /// Details of Google SPA (Secure Payment Authentication) + /// + public class GoogleSpa + { + /// + /// Fully qualified URL of the Google SPA (Secure Payment Authentication) frontend for user challenge/unlock + /// [Optional] + /// + public string ChallengeUrl { get; set; } + + /// + /// Indicates the amount of time (in minutes) allowed for establishing the initial connection to the user's + /// specific authentication session, as determined by the challenge_url) + /// [Optional] + /// + public string InitialTimeout { get; set; } + + /// + /// Indicates maximum amount of time (in minutes) allowed for completing all PSP-Google message exchanges for + /// current authentication session + /// [Optional] + /// + public string MaxTimeout { get; set; } + + /// + /// Details of the challenge iframe displayed in the Cardholder browser window + /// [Optional] + /// + public Iframe.Iframe Iframe { get; set; } + + /// + /// Token for the given PAN provisioned and authenticated + /// [Optional] + /// + public Token.Token Token { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Iframe/Iframe.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Iframe/Iframe.cs new file mode 100644 index 00000000..61ff36e5 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Iframe/Iframe.cs @@ -0,0 +1,21 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.GoogleSpa.Iframe +{ + /// + /// iframe + /// Details of the challenge iframe displayed in the Cardholder browser window + /// + public class Iframe + { + /// + /// Height of the challenge iframe displayed in the Cardholder browser window. + /// [Optional] + /// + public string Height { get; set; } + + /// + /// Width of the challenge iframe displayed in the Cardholder browser window. + /// [Optional] + /// + public string Width { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Token/Token.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Token/Token.cs new file mode 100644 index 00000000..f0100368 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/GoogleSpa/Token/Token.cs @@ -0,0 +1,27 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.GoogleSpa.Token +{ + /// + /// token + /// Token for the given PAN provisioned and authenticated + /// + public class Token + { + /// + /// Value of token. Represented as a numerical string + /// [Optional] + /// + public string Number { get; set; } + + /// + /// Expiry month of the token + /// [Optional] + /// + public double ExpiryMonth { get; set; } + + /// + /// Expiry year of the token + /// [Optional] + /// + public double ExpiryYear { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/NextAction.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/NextActionsType.cs similarity index 51% rename from src/CheckoutSdk/Sessions/NextAction.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/Responses/NextActionsType.cs index 14f4de94..a2ca99d6 100644 --- a/src/CheckoutSdk/Sessions/NextAction.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/NextActionsType.cs @@ -1,23 +1,22 @@ -using System.Runtime.Serialization; +using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common.Responses { - public enum NextAction + public enum NextActionsType { - [EnumMember(Value = "authenticate")] Authenticate, - - [EnumMember(Value = "challenge_cardholder")] - ChallengeCardholder, + [EnumMember(Value = "redirect_cardholder")] + RedirectCardholder, [EnumMember(Value = "collect_channel_data")] CollectChannelData, - - [EnumMember(Value = "complete")] Complete, [EnumMember(Value = "issuer_fingerprint")] - IssueFingerprint, + IssuerFingerprint, - [EnumMember(Value = "redirect_cardholder")] - RedirectCardholder + [EnumMember(Value = "challenge_cardholder")] + ChallengeCardholder, + + [EnumMember(Value = "complete")] + Complete, } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/Optimization.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/Optimization.cs new file mode 100644 index 00000000..bf927fe1 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/Optimization.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.Common.Responses.Optimization +{ + /// + /// optimization + /// The information about the optimization options selected + /// + public class Optimization + { + /// + /// Indicates if any optimization has been applied + /// [Optional] + /// + public bool Optimized { get; set; } + + /// + /// The optimization framework applied + /// [Optional] + /// + public string Framework { get; set; } + + /// + /// The collection of fields optimized + /// [Optional] + /// + public IList OptimizedProperties { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/OptimizedProperties/OptimizedProperties.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/OptimizedProperties/OptimizedProperties.cs new file mode 100644 index 00000000..62ff1dba --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Optimization/OptimizedProperties/OptimizedProperties.cs @@ -0,0 +1,27 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Optimization.OptimizedProperties +{ + /// + /// optimized_properties + /// The collection of fields optimized + /// + public class OptimizedProperties + { + /// + /// Name of the field which has been optimized. + /// [Optional] + /// + public string Field { get; set; } + + /// + /// Value prior to optimization. + /// [Optional] + /// + public string OriginalValue { get; set; } + + /// + /// Value prior to optimization. + /// [Optional] + /// + public string OptimizedValue { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/GoogleSpa.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/GoogleSpa.cs new file mode 100644 index 00000000..a82ee2c9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/GoogleSpa.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences.GoogleSpa +{ + /// + /// google_spa + /// Google SPA experience. + /// + public class GoogleSpa + { + /// + /// [Optional] + /// + public StatusType? Status { get; set; } + + /// + /// Reason(s) why processing the experience was unsuccessful. + /// [Optional] + /// + public IList Reason { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/StatusType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/StatusType.cs new file mode 100644 index 00000000..064bb1fb --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/GoogleSpa/StatusType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences.GoogleSpa +{ + public enum StatusType + { + [EnumMember(Value = "available")] + Available, + + [EnumMember(Value = "unprocessed")] + Unprocessed, + + [EnumMember(Value = "processed")] + Processed, + + [EnumMember(Value = "unavailable")] + Unavailable, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/PreferredExperiences.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/PreferredExperiences.cs new file mode 100644 index 00000000..74ba16cd --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/PreferredExperiences.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json; + +namespace Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences +{ + /// + /// preferred_experiences + /// Preferred Experiences + /// + public class PreferredExperiences + { + /// + /// Google SPA experience. + /// [Optional] + /// + public GoogleSpa.GoogleSpa GoogleSpa { get; set; } + + /// + /// 3DS experience. + /// [Optional] + /// + [JsonProperty(PropertyName = "3ds")] + public Threeds.Threeds Threeds { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/StatusType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/StatusType.cs new file mode 100644 index 00000000..885c3b55 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/StatusType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences.Threeds +{ + public enum StatusType + { + [EnumMember(Value = "available")] + Available, + + [EnumMember(Value = "unprocessed")] + Unprocessed, + + [EnumMember(Value = "processed")] + Processed, + + [EnumMember(Value = "unavailable")] + Unavailable, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/Threeds.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/Threeds.cs new file mode 100644 index 00000000..b203c029 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/PreferredExperiences/Threeds/Threeds.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences.Threeds +{ + /// + /// 3ds + /// 3DS experience. + /// + public class Threeds + { + /// + /// [Optional] + /// + public StatusType? Status { get; set; } + + /// + /// Reason(s) why processing the experience was unsuccessful. + /// [Optional] + /// + public IList Reason { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ResponseCodeType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ResponseCodeType.cs new file mode 100644 index 00000000..f4fc440b --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/ResponseCodeType.cs @@ -0,0 +1,31 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum ResponseCodeType + { + [EnumMember(Value = "Y")] + Y, + + [EnumMember(Value = "N")] + N, + + [EnumMember(Value = "U")] + U, + + [EnumMember(Value = "A")] + A, + + [EnumMember(Value = "C")] + C, + + [EnumMember(Value = "D")] + D, + + [EnumMember(Value = "R")] + R, + + [EnumMember(Value = "I")] + I, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/NameType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/NameType.cs new file mode 100644 index 00000000..4afd1044 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/NameType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses.SchemeInfo +{ + public enum NameType + { + [EnumMember(Value = "cartes_bancaires")] + CartesBancaires, + + [EnumMember(Value = "visa")] + Visa, + + [EnumMember(Value = "mastercard")] + Mastercard, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/SchemeInfo.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/SchemeInfo.cs new file mode 100644 index 00000000..53bc30c6 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeInfo/SchemeInfo.cs @@ -0,0 +1,27 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.SchemeInfo +{ + /// + /// scheme_info + /// Indicates scheme-specific information + /// + public class SchemeInfo + { + /// + /// Indicates which scheme was used to perform authentication + /// [Optional] + /// + public NameType? Name { get; set; } + + /// + /// Risk score calculated by Directory Server (DS). Cartes Bancaires 3D Secure 2 only + /// [Optional] + /// + public string Score { get; set; } + + /// + /// Identification of the algorithm used by the ACS to calculate the Authentication Value indicated + /// [Optional] + /// + public string Avalgo { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeType.cs new file mode 100644 index 00000000..f6c90e1c --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/SchemeType.cs @@ -0,0 +1,31 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum SchemeType + { + [EnumMember(Value = "visa")] + Visa, + + [EnumMember(Value = "mastercard")] + Mastercard, + + [EnumMember(Value = "jcb")] + Jcb, + + [EnumMember(Value = "amex")] + Amex, + + [EnumMember(Value = "diners")] + Diners, + + [EnumMember(Value = "cartes_bancaires")] + CartesBancaires, + + [EnumMember(Value = "discover")] + Discover, + + [EnumMember(Value = "upi")] + Upi, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusReasonType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusReasonType.cs new file mode 100644 index 00000000..08d5576d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusReasonType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum StatusReasonType + { + [EnumMember(Value = "ares_status")] + AresStatus, + + [EnumMember(Value = "ares_error")] + AresError, + + [EnumMember(Value = "rreq_error")] + RreqError, + + [EnumMember(Value = "rreq_status")] + RreqStatus, + + [EnumMember(Value = "risk_declined")] + RiskDeclined, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusType.cs new file mode 100644 index 00000000..a5d2ecf9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/StatusType.cs @@ -0,0 +1,37 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.Common.Responses +{ + public enum StatusType + { + [EnumMember(Value = "challenged")] + Challenged, + + [EnumMember(Value = "pending")] + Pending, + + [EnumMember(Value = "processing")] + Processing, + + [EnumMember(Value = "challenge_abandoned")] + ChallengeAbandoned, + + [EnumMember(Value = "expired")] + Expired, + + [EnumMember(Value = "approved")] + Approved, + + [EnumMember(Value = "attempted")] + Attempted, + + [EnumMember(Value = "unavailable")] + Unavailable, + + [EnumMember(Value = "declined")] + Declined, + + [EnumMember(Value = "rejected")] + Rejected, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/ErrorDetails/ErrorDetails.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/ErrorDetails/ErrorDetails.cs new file mode 100644 index 00000000..b0ecdb8d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/ErrorDetails/ErrorDetails.cs @@ -0,0 +1,35 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Threeds.ErrorDetails +{ + /// + /// error_details + /// Provides additional information about the error returned. + /// + public class ErrorDetails + { + /// + /// An error code identifying the type of issue. + /// [Optional] + /// + public string ErrorCode { get; set; } + + /// + /// A code that specifies which 3D Secure component identified the error. + /// [Optional] + /// + public string ErrorComponent { get; set; } + + /// + /// Provides additional details about the issue. + /// [Optional] + /// <= 2048 + /// + public string ErrorDetail { get; set; } + + /// + /// A description of the issue identified. + /// [Optional] + /// <= 2048 + /// + public string ErrorDescription { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/Threeds.cs b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/Threeds.cs new file mode 100644 index 00000000..6d533833 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/Common/Responses/Threeds/Threeds.cs @@ -0,0 +1,28 @@ +namespace Checkout.Authentication.Standalone.Common.Responses.Threeds +{ + /// + /// 3ds + /// This object provides more information about the 3DS experience + /// + public class Threeds + { + /// + /// The CReq message, encoded in Base 64. + /// [Optional] + /// + public string ChallengeRequest { get; set; } + + /// + /// The number of authentication attempts performed by the cardholder. + /// [Optional] + /// <= 2 + /// + public string InteractionCounter { get; set; } + + /// + /// Provides additional information about the error returned. + /// [Optional] + /// + public ErrorDetails.ErrorDetails ErrorDetails { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/TransactionType.cs b/src/CheckoutSdk/Authentication/Standalone/Common/TransactionType.cs similarity index 67% rename from src/CheckoutSdk/Sessions/TransactionType.cs rename to src/CheckoutSdk/Authentication/Standalone/Common/TransactionType.cs index f3f8b0bc..3563d68f 100644 --- a/src/CheckoutSdk/Sessions/TransactionType.cs +++ b/src/CheckoutSdk/Authentication/Standalone/Common/TransactionType.cs @@ -1,22 +1,22 @@ -using System.Runtime.Serialization; +using System.Runtime.Serialization; -namespace Checkout.Sessions +namespace Checkout.Authentication.Standalone.Common { public enum TransactionType { - [EnumMember(Value = "account_funding")] - AccountFunding, + [EnumMember(Value = "goods_service")] + GoodsService, [EnumMember(Value = "check_acceptance")] CheckAcceptance, - - [EnumMember(Value = "goods_service")] - GoodsService, + + [EnumMember(Value = "account_funding")] + AccountFunding, + + [EnumMember(Value = "quasi_card_transaction")] + QuasiCardTransaction, [EnumMember(Value = "prepaid_activation_and_load")] PrepaidActivationAndLoad, - - [EnumMember(Value = "quashi_card_transaction")] - QuashiCardTransaction } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/GETSessionsId/Responses/GetSessionDetailsResponseOk/GetSessionDetailsResponseOk.cs b/src/CheckoutSdk/Authentication/Standalone/GETSessionsId/Responses/GetSessionDetailsResponseOk/GetSessionDetailsResponseOk.cs new file mode 100644 index 00000000..5f18f441 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/GETSessionsId/Responses/GetSessionDetailsResponseOk/GetSessionDetailsResponseOk.cs @@ -0,0 +1,339 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.Installment; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Recurring; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Acs; +using Checkout.Authentication.Standalone.Common.Responses.Card; +using Checkout.Authentication.Standalone.Common.Responses.Certificates; +using Checkout.Authentication.Standalone.Common.Responses.Ds; +using Checkout.Authentication.Standalone.Common.Responses.GoogleSpa; +using Checkout.Authentication.Standalone.Common.Responses.Optimization; +using Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences; +using Checkout.Authentication.Standalone.Common.Responses.SchemeInfo; +using Checkout.Authentication.Standalone.Common.Responses.Threeds; +using Checkout.Common; +using System; +using System.Collections.Generic; +using ChallengeIndicatorType = Checkout.Authentication.Standalone.Common.Responses.ChallengeIndicatorType; +using Exemption = Checkout.Authentication.Standalone.Common.Responses.Exemption.Exemption; + +namespace Checkout.Authentication.Standalone.GETSessionsId.Responses.GetSessionDetailsResponseOk +{ + /// + /// Get session details Response 200 + /// Session retrieved successfully + /// + public class GetSessionDetailsResponseOk : Resource + { + /// + /// Session unique identifier + /// [Required] + /// ^(sid)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The transaction identifier that needs to be provided when communicating directly with the Access Control + /// Server (ACS) + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// Indicates the scheme this authentication is carried out against + /// [Required] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The amount in the minor currency. + /// [Required] + /// [ 0 .. 9223372036854776000 ] + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code + /// [Required] + /// + public Currency? Currency { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Required] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Required] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// Indicates the status of the session + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The protocol version number of the specification used by the API for authentication + /// [Required] + /// <= 50 + /// + public string ProtocolVersion { get; set; } + + /// + /// Default: "no_preference" Indicates the preference for whether or not a 3DS challenge should be performed. + /// The customer’s bank has the final say on whether or not the customer receives the challenge + /// [Required] + /// + public ChallengeIndicatorType ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; + + /// + /// A base64 encoded value prefixed with sek_ that gives access to client-side operations for a single + /// authentication within the Sessions API. This value is returned as the session_secret when requesting a + /// session. + /// [Optional] + /// ^(sek)_(.{44})$ + /// 48 characters + /// + public string SessionSecret { get; set; } + + /// + /// Indicates whether this session has been completed + /// [Optional] + /// + public bool Completed { get; set; } + + /// + /// Indicates whether this session involved a challenge. This will only be set after communication with the + /// scheme is finished. + /// [Optional] + /// + public bool Challenged { get; set; } + + /// + /// Public certificates specific to a Directory Server (DS) for encrypting device data and verifying ACS signed + /// content. Required when channel is app. + /// [Optional] + /// + public Certificates Certificates { get; set; } + + /// + /// When the Session is unavailable this will point to the reason it is so. + /// • ares_error = There was an issue in the Authentication response we got back from the Directory Server + /// (scheme server - 3DS2) • ares_status = The status was set to the status in the Authentication response we + /// got back from the Directory Server (scheme server - 3DS2) • rreq_error = There was an issue in the Response + /// we got back from the Access Control Server (issuer server - 3DS2) • rreq_status = The status was set to the + /// status in the Response we got back from the Access Control Server (issuer server - 3DS2) • risk_declined = + /// The status was set to declined because the Risk engine recommended we decline the authentication + /// [Optional] + /// + public StatusReasonType? StatusReason { get; set; } + + /// + /// Whether the authentication was successful. This will only be set if the Session is in a final state + /// [Optional] + /// + public bool Approved { get; set; } + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// Specifies which action to take in order to complete the session. + /// The redirect_cardholder action is only applicable for hosted sessions. + /// [Optional] + /// + public IList NextActions { get; set; } + + /// + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// [Optional] + /// + public Ds Ds { get; set; } + + /// + /// The access control server (ACS) information. Can be empty if the session is still pending or if + /// communication with the ACS failed. This will be available when the channel data and issuer fingerprint + /// result have been provided. + /// [Optional] + /// + public Acs Acs { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which indicates whether a transaction qualifies as an authenticated + /// transaction or account verification. Only available if communication with the scheme was successful and the + /// Session is in a final state. • Y = Authentication Verification Successful. • N = Not Authenticated + /// /Account Not Verified; Transaction denied. • U = Authentication/ Account Verification Could Not Be + /// Performed; Technical or other problem, as indicated in ARes or RReq. • A = Attempts Processing Performed; + /// Not Authenticated/Verified, but a proof of attempted authentication/verification is provided. • C = + /// Challenge Required; Additional authentication is required using the CReq/CRes. • D = Challenge Required; + /// Decoupled Authentication confirmed. • R = Authentication/ Account Verification Rejected; Issuer is + /// rejecting authentication/verification and request that authorization not be attempted. • I = Informational + /// Only; 3DS Requestor challenge preference acknowledged. + /// [Optional] + /// + public ResponseCodeType? ResponseCode { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which provides information on why the response_code field has the specified + /// value. Only available when response_code is not Y. earn more about the reasons for authentication + /// failures. + /// [Optional] + /// + public string ResponseStatusReason { get; set; } + + /// + /// Payment system-specific value provided as part of the ACS registration for each supported DS. Please be + /// advised that this field will only be included in responses when authenticating with a valid OAuth token and + /// not when authenticating with session_secret. Cryptogram can only be retrieved for up to 24 hours after the + /// session is created. + /// [Optional] + /// 28 characters + /// + public string Cryptogram { get; set; } + + /// + /// Electronic Commerce Indicator. Please be advised that this field will only be included in responses when + /// authenticating with a valid OAuth token and not when authenticating with session_secret. + /// [Optional] + /// 2 characters + /// + public string Eci { get; set; } + + /// + /// The xid value to use for authorization + /// [Optional] + /// + public string Xid { get; set; } + + /// + /// May provide cardholder information from the DS to be presented to the cardholder + /// [Optional] + /// + public string CardholderInfo { get; set; } + + /// + /// Details related to the Session source. This property should always be in the response, unless a card source + /// was used and communication with Checkout.com's Vault was not possible. + /// [Optional] + /// + public Card Card { get; set; } + + /// + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. + /// Value will be ignored in any other cases. + /// [Optional] + /// + public Recurring Recurring { get; set; } + + /// + /// Details of an installment authentication. This property is needed only for an installment authentication + /// type. Value will be ignored in any other cases. + /// [Optional] + /// + public Installment Installment { get; set; } + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// Indicates the card holder's IP address. Only available when the scheme selected is Cartes Bancaires. + /// [Optional] + /// + public string CustomerIp { get; set; } + + /// + /// Authentication date and time + /// [Optional] + /// + /// + public DateTime AuthenticationDate { get; set; } + + /// + /// Details related to exemption present in 3DS flow + /// [Optional] + /// + public Exemption Exemption { get; set; } + + /// + /// Indicates whether the 3D Secure 2 authentication was challenged or frictionless + /// [Optional] + /// + public FlowType? FlowType { get; set; } + + /// + /// The information about the optimization options selected + /// [Optional] + /// + public Optimization Optimization { get; set; } + + /// + /// Indicates scheme-specific information + /// [Optional] + /// + public SchemeInfo SchemeInfo { get; set; } + + /// + /// This object provides more information about the 3DS experience + /// [Optional] + /// + public Threeds Threeds { get; set; } + + /// + /// Preferred Experiences + /// [Optional] + /// + public PreferredExperiences PreferredExperiences { get; set; } + + /// + /// The authentication experience that was used for processing + /// [Optional] + /// + public ExperienceType? Experience { get; set; } + + /// + /// Details of Google SPA (Secure Payment Authentication) + /// [Optional] + /// + public GoogleSpa GoogleSpa { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/BillingDescriptor/BillingDescriptor.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/BillingDescriptor/BillingDescriptor.cs new file mode 100644 index 00000000..5a018985 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/BillingDescriptor/BillingDescriptor.cs @@ -0,0 +1,17 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.BillingDescriptor +{ + /// + /// billing_descriptor + /// An optional dynamic billing descriptor. + /// + public class BillingDescriptor + { + /// + /// A dynamic description of the payment that replaces the Merchant Name that is displayed in 3DS Challenge + /// window. Applies to card payments only. Special characters allowed: . ! * - = _ @ + /// [Optional] + /// <= 40 + /// + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChallengeIndicatorType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChallengeIndicatorType.cs new file mode 100644 index 00000000..6d96eb6d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChallengeIndicatorType.cs @@ -0,0 +1,34 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest +{ + public enum ChallengeIndicatorType + { + [EnumMember(Value = "no_preference")] + NoPreference, + + [EnumMember(Value = "no_challenge_requested")] + NoChallengeRequested, + + [EnumMember(Value = "challenge_requested")] + ChallengeRequested, + + [EnumMember(Value = "challenge_requested_mandate")] + ChallengeRequestedMandate, + + [EnumMember(Value = "low_value")] + LowValue, + + [EnumMember(Value = "trusted_listing")] + TrustedListing, + + [EnumMember(Value = "trusted_listing_prompt")] + TrustedListingPrompt, + + [EnumMember(Value = "transaction_risk_assessment")] + TransactionRiskAssessment, + + [EnumMember(Value = "data_share")] + DataShare, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AbstractChannelData.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AbstractChannelData.cs new file mode 100644 index 00000000..99ff9086 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AbstractChannelData.cs @@ -0,0 +1,20 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData +{ + /// + /// Abstract channel_data Class + /// The information gathered from the environment used to initiate the session + /// + public abstract class AbstractChannelData + { + /// + /// Default: "browser" Indicates the type of channel interface being used to initiate the transaction. + /// [Required] + /// + public ChannelDataType? Channel; + + protected AbstractChannelData(ChannelDataType channel) + { + Channel = channel; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/AppChannelData.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/AppChannelData.cs new file mode 100644 index 00000000..85a3f2fa --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/AppChannelData.cs @@ -0,0 +1,78 @@ +using Checkout.Authentication.Standalone.Common.Requests; +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.AppChannelData +{ + /// + /// app channel_data Class + /// The information gathered from the environment used to initiate the session + /// + public class AppChannelData : AbstractChannelData + { + /// + /// Initializes a new instance of the AppChannelData class. + /// + public AppChannelData() : base(ChannelDataType.App) + { + } + + /// + /// Universally unique ID created upon all installations and updates of the 3DS Requestor App on a consumer + /// device. This will be newly generated and stored by the 3DS SDK for each installation or update. + /// [Required] + /// 36 characters + /// + public string SdkAppId { get; set; } + + /// + /// Indicates maximum amount of time (in minutes) for all exchanges + /// [Required] + /// >= 5 + /// + public int SdkMaxTimeout { get; set; } + + /// + /// Public key component of the ephemeral key pair generated by the 3DS SDK and used to establish session keys + /// between the 3DS SDK and ACS. Refer to https://tools.ietf.org/html/rfc7517#appendix-A.1 + /// [Required] + /// + public SdkEphemPubKey.SdkEphemPubKey SdkEphemPubKey { get; set; } + + /// + /// A JSON web encryption (JWE) object in compact serialization, containing data encrypted by the SDK for the + /// Directory Server to decrypt. + /// [Required] + /// <= 64000 + /// + public string SdkEncryptedData { get; set; } + + /// + /// Identifies the vendor and version for the 3DS SDK that is integrated in a 3DS Requestor App, assigned by + /// EMVCo when the 3DS SDK is approved. + /// [Required] + /// <= 32 + /// + public string SdkReferenceNumber { get; set; } + + /// + /// Universally unique transaction identifier assigned by the 3DS SDK to identify a single transaction + /// [Required] + /// 36 characters + /// + public string SdkTransactionId { get; set; } + + /// + /// Lists all of the SDK interface types that the device supports for displaying specific challenge user + /// interfaces within the SDK + /// [Required] + /// + public SdkInterfaceType? SdkInterfaceType { get; set; } + + /// + /// Lists all the user interface elements that the cardholder's device supports for displaying specific + /// challenge user interfaces within the SDK + /// [Required] + /// + public IList SdkUiElements { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/SdkEphemPubKey/SdkEphemPubKey.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/SdkEphemPubKey/SdkEphemPubKey.cs new file mode 100644 index 00000000..cd7f5d7b --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/AppChannelData/SdkEphemPubKey/SdkEphemPubKey.cs @@ -0,0 +1,37 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.AppChannelData.SdkEphemPubKey +{ + /// + /// sdk_ephem_pub_key + /// Public key component of the ephemeral key pair generated by the 3DS SDK and used to establish session keys + /// between the 3DS SDK and ACS. Refer to https://tools.ietf.org/html/rfc7517#appendix-A.1 + /// + public class SdkEphemPubKey + { + /// + /// The key type. + /// [Optional] + /// + public string Kty { get; set; } + + /// + /// The type of elliptic curve. + /// [Optional] + /// <= 40 + /// + public string Crv { get; set; } + + /// + /// x coordinate of the elliptic curve that is base64url-encoded. + /// [Optional] + /// <= 100 + /// + public string X { get; set; } + + /// + /// y coordinate of the elliptic curve that is base64url-encoded. + /// [Optional] + /// <= 100 + /// + public string Y { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/BrowserChannelData/BrowserChannelData.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/BrowserChannelData/BrowserChannelData.cs new file mode 100644 index 00000000..6a356dd1 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/BrowserChannelData/BrowserChannelData.cs @@ -0,0 +1,114 @@ +using Checkout.Authentication.Standalone.Common.Requests; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.BrowserChannelData +{ + /// + /// browser channel_data Class + /// The information gathered from the environment used to initiate the session + /// + public class BrowserChannelData : AbstractChannelData + { + /// + /// Initializes a new instance of the BrowserChannelData class. + /// + public BrowserChannelData() : base(ChannelDataType.Browser) + { + } + + /// + /// Exact content of the HTTP accept headers as sent to the 3DS Requestor from the cardholder’s browser + /// [Required] + /// <= 2048 + /// + public string AcceptHeader { get; set; } + + /// + /// Boolean that represents the ability of the cardholder's browser to execute Java. Value is returned from the + /// navigator.javaEnabled property. + /// [Required] + /// + public bool JavaEnabled { get; set; } + + /// + /// Default: true Boolean that represents the ability of the cardholder's browser to execute Javascript. Value + /// is returned from the navigator.javascriptEnabled property. *only applicable/required for authentication + /// performed using 3DS 2.2. If authentications results in processing on 2.1 or lower, this field will be + /// disregarded. + /// [Required] + /// + public bool JavascriptEnabled { get; set; } = true; + + /// + /// Value representing the browser language as defined in IETF BCP47. Returned from the navigator.language + /// property. + /// [Required] + /// [ 1 .. 12 ] characters + /// + public string Language { get; set; } + + /// + /// Value representing the bit depth of the color palette for displaying images, in bits per pixel. Obtained + /// from the cardholder's browser from the screen.colorDepth property. + /// [Required] + /// [ 1 .. 2 ] characters + /// + public string ColorDepth { get; set; } + + /// + /// Total height of the cardholder’s screen in pixels. Value is returned from the screen.height property. + /// [Required] + /// [ 1 .. 6 ] characters + /// + public string ScreenHeight { get; set; } + + /// + /// Total width of the cardholder’s screen in pixels. Value is returned from the screen.width property. + /// [Required] + /// [ 1 .. 6 ] characters + /// + public string ScreenWidth { get; set; } + + /// + /// Time difference between UTC time and the local time of the cardholder's browser, in minutes. + /// [Required] + /// [ 1 .. 5 ] characters + /// + public string Timezone { get; set; } + + /// + /// Exact content of the HTTP user-agent header + /// [Required] + /// <= 2048 + /// + public string UserAgent { get; set; } + + /// + /// IP address of the browser as returned by the HTTP headers to the 3DS Requestor + /// [Required] + /// <= 45 + /// + public string IpAddress { get; set; } + + /// + /// Default: "U" Indicates whether the 3DS Method successfully completed • Y = Successfully completed • N = + /// Did not successfully complete • U = Unavailable (3DS Method URL was not present in the preperation response + /// (PRes) message data for the card range associated with the cardholder's account number) + /// [Optional] + /// 1 characters + /// + public ThreeDsMethodCompletionType ThreeDsMethodCompletion { get; set; } = ThreeDsMethodCompletionType.U; + + /// + /// Whether the Payment API is enabled for all parent frames. This is required for Google SPA support in hosted + /// sessions. + /// [Optional] + /// + public bool IframePaymentAllowed { get; set; } + + /// + /// The raw Sec-CH-UA header value. This can improve Google SPA support. + /// [Optional] + /// + public string UserAgentClientHint { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/ChannelDataType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/ChannelDataType.cs new file mode 100644 index 00000000..a5f25fa8 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/ChannelDataType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData +{ + public enum ChannelDataType + { + [EnumMember(Value = "merchant_initiated")] + MerchantInitiated, + + [EnumMember(Value = "app")] + App, + + [EnumMember(Value = "browser")] + Browser, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/MerchantInitiatedChannelData.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/MerchantInitiatedChannelData.cs new file mode 100644 index 00000000..9457441e --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/MerchantInitiatedChannelData.cs @@ -0,0 +1,22 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.MerchantInitiatedChannelData +{ + /// + /// merchant_initiated channel_data Class + /// The information gathered from the environment used to initiate the session + /// + public class MerchantInitiatedChannelData : AbstractChannelData + { + /// + /// Initializes a new instance of the MerchantInitiatedChannelData class. + /// + public MerchantInitiatedChannelData() : base(ChannelDataType.MerchantInitiated) + { + } + + /// + /// [Required] + /// + public RequestType? RequestType { get; set; } + + } +} diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/RequestType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/RequestType.cs new file mode 100644 index 00000000..34b151e9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ChannelData/MerchantInitiatedChannelData/RequestType.cs @@ -0,0 +1,40 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.MerchantInitiatedChannelData +{ + public enum RequestType + { + [EnumMember(Value = "recurring_transaction")] + RecurringTransaction, + + [EnumMember(Value = "installment_transaction")] + InstallmentTransaction, + + [EnumMember(Value = "add_card")] + AddCard, + + [EnumMember(Value = "maintain_card_information")] + MaintainCardInformation, + + [EnumMember(Value = "account_verification")] + AccountVerification, + + [EnumMember(Value = "split_or_delayed_shipment")] + SplitOrDelayedShipment, + + [EnumMember(Value = "top_up")] + TopUp, + + [EnumMember(Value = "mail_order")] + MailOrder, + + [EnumMember(Value = "telephone_order")] + TelephoneOrder, + + [EnumMember(Value = "whitelist_status_check")] + WhitelistStatusCheck, + + [EnumMember(Value = "other_payment")] + OtherPayment, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/AbstractCompletion.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/AbstractCompletion.cs new file mode 100644 index 00000000..869be022 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/AbstractCompletion.cs @@ -0,0 +1,16 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion +{ + /// + /// Abstract completion Class + /// The redirect information needed for callbacks or redirects after the payment is completed + /// + public abstract class AbstractCompletion + { + public CompletionType? Type; + + protected AbstractCompletion(CompletionType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/CompletionType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/CompletionType.cs new file mode 100644 index 00000000..016f3c52 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/CompletionType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion +{ + public enum CompletionType + { + [EnumMember(Value = "hosted")] + Hosted, + + [EnumMember(Value = "non_hosted")] + NonHosted, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/HostedCompletion/HostedCompletion.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/HostedCompletion/HostedCompletion.cs new file mode 100644 index 00000000..59e499b9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/HostedCompletion/HostedCompletion.cs @@ -0,0 +1,32 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion.HostedCompletion +{ + /// + /// hosted completion Class + /// The redirect information needed for callbacks or redirects after the payment is completed + /// + public class HostedCompletion : AbstractCompletion + { + /// + /// Initializes a new instance of the HostedCompletion class. + /// + public HostedCompletion() : base(CompletionType.Hosted) + { + } + + /// + /// For hosted sessions, this overrides the default success redirect URL configured on your account + /// [Required] + /// + /// <= 256 + /// + public string SuccessUrl { get; set; } + + /// + /// For hosted sessions, this overrides the default failure redirect URL configured on your account + /// [Required] + /// + /// <= 256 + /// + public string FailureUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/NonHostedCompletion/NonHostedCompletion.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/NonHostedCompletion/NonHostedCompletion.cs new file mode 100644 index 00000000..cc81ef83 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Completion/NonHostedCompletion/NonHostedCompletion.cs @@ -0,0 +1,33 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion.NonHostedCompletion +{ + /// + /// non_hosted completion Class + /// The redirect information needed for callbacks or redirects after the payment is completed + /// + public class NonHostedCompletion : AbstractCompletion + { + /// + /// Initializes a new instance of the NonHostedCompletion class. + /// + public NonHostedCompletion() : base(CompletionType.NonHosted) + { + } + + /// + /// For non-hosted sessions, you can define a URL to be called once the session is complete + /// [Optional] + /// + /// <= 256 + /// + public string CallbackUrl { get; set; } + + /// + /// For non-hosted sessions, you can define a URL to be your own challenge notification endpoint. When not + /// provided, a Checkout.com endpoint will be used. + /// [Optional] + /// + /// <= 256 + /// + public string ChallengeNotificationUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/GoogleSpa/GoogleSpa.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/GoogleSpa/GoogleSpa.cs new file mode 100644 index 00000000..e3736f2b --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/GoogleSpa/GoogleSpa.cs @@ -0,0 +1,17 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.GoogleSpa +{ + /// + /// google_spa + /// This object contains the Google SPA properties (non-hosted only) + /// + public class GoogleSpa + { + /// + /// Fully qualified URL for redirecting the user's browser session after authentication. For example, this field + /// may be the merchant's website for purchase confirmation once payment is complete. Required if in full + /// redirect (not iframe) mode. + /// [Optional] + /// + public string ContinueUrl { get; set; } + } +} diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Marketplace/Marketplace.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Marketplace/Marketplace.cs new file mode 100644 index 00000000..ce6cadca --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Marketplace/Marketplace.cs @@ -0,0 +1,15 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Marketplace +{ + /// + /// marketplace + /// Information related to authentication for payfac payments + /// + public class Marketplace + { + /// + /// The sub-entity that the authentication is being processed on behalf of + /// [Optional] + /// + public string SubEntityId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Optimization/Optimization.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Optimization/Optimization.cs new file mode 100644 index 00000000..ca7f62f9 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Optimization/Optimization.cs @@ -0,0 +1,15 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Optimization +{ + /// + /// optimization + /// Optionally opt into request optimization + /// + public class Optimization + { + /// + /// The theme-based option for optimization + /// [Optional] + /// + public string Framework { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/PreferredExperiencesType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/PreferredExperiencesType.cs new file mode 100644 index 00000000..134c403e --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/PreferredExperiencesType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest +{ + public enum PreferredExperiencesType + { + [EnumMember(Value = "3ds")] + Threeds, + + [EnumMember(Value = "google_spa")] + GoogleSpa, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/RequestASessionRequest.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/RequestASessionRequest.cs new file mode 100644 index 00000000..0f232953 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/RequestASessionRequest.cs @@ -0,0 +1,181 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.Installment; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Recurring; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.BrowserChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.CardSource; +using Checkout.Common; +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest +{ + /// + /// Request a session + /// Create a payment session to authenticate a cardholder before requesting a payment. + /// Payment sessions can be linked to one or more payments (in the case of recurring and other merchant-initiated + /// payments). + /// The next_actions object in the response tells you which actions can be performed next. + /// + public class RequestASessionRequest + { + /// + /// The three-letter ISO currency code + /// [Required] + /// 3 characters + /// + public Currency? Currency { get; set; } + + /// + /// The source of the authentication. + /// [Required] + /// + public AbstractSource Source { get; set; } = new CardSource(); + + /// + /// The redirect information needed for callbacks or redirects after the payment is completed + /// [Required] + /// + public AbstractCompletion Completion { get; set; } + + /// + /// The payment amount in the minor currency unit. + /// For recurring and installment payment types, this value is required and must be greater than zero. + /// Omitting this value will set authentication_category to non_payment. + /// [Optional] + /// <= 48 + /// >= 0 + /// + public long Amount { get; set; } + + /// + /// The processing channel to be used for the session. Required if this was not set in the request for the OAuth + /// token. + /// [Optional] + /// ^(pc)_(\w{26})$ + /// + public string ProcessingChannelId { get; set; } + + /// + /// Information related to authentication for payfac payments + /// [Optional] + /// + public Marketplace.Marketplace Marketplace { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Optional] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Optional] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Default: "no_preference" Indicates whether a challenge is requested for this session. The following are + /// requests for exemption: • low_value • trusted_listing • trusted_listing_prompt • + /// transaction_risk_assessment + /// If an exemption cannot be applied, then the value no_challenge_requested will be used instead. + /// [Optional] + /// <= 50 + /// + public ChallengeIndicatorType ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; + + /// + /// An optional dynamic billing descriptor. + /// [Optional] + /// + public BillingDescriptor.BillingDescriptor BillingDescriptor { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// The shipping address. Any special characters will be replaced. + /// [Optional] + /// + public ShippingAddress.ShippingAddress ShippingAddress { get; set; } + + /// + /// Indicates whether the cardholder shipping address and billing address are the same. + /// [Optional] + /// + public bool ShippingAddressMatchesBilling { get; set; } + + /// + /// The information gathered from the environment used to initiate the session + /// [Optional] + /// + public AbstractChannelData ChannelData { get; set; } + + /// + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. + /// Value will be ignored in any other cases. + /// [Optional] + /// + public Recurring Recurring { get; set; } + + /// + /// Details of an installment authentication. This property is needed only for an installment authentication + /// type. Value will be ignored in any other cases. + /// [Optional] + /// + public Installment Installment { get; set; } + + /// + /// Optionally opt into request optimization + /// [Optional] + /// + public Optimization.Optimization Optimization { get; set; } + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// This object contains the Google SPA properties (non-hosted only) + /// [Optional] + /// + public GoogleSpa.GoogleSpa GoogleSpa { get; set; } + + /// + /// Indicates the chosen experience(s) for this session. Available experiences include: • 3ds • google_spa + /// [Optional] + /// + public IList PreferredExperiences { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ShippingAddress/ShippingAddress.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ShippingAddress/ShippingAddress.cs new file mode 100644 index 00000000..438d9d34 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/ShippingAddress/ShippingAddress.cs @@ -0,0 +1,60 @@ +using Checkout.Common; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ShippingAddress +{ + /// + /// shipping_address + /// The shipping address. Any special characters will be replaced. + /// + public class ShippingAddress + { + /// + /// The first line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine1 { get; set; } + + /// + /// The second line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine2 { get; set; } + + /// + /// The third line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine3 { get; set; } + + /// + /// The address city + /// [Optional] + /// <= 50 + /// + public string City { get; set; } + + /// + /// The country subdivision code defined in ISO 3166-2 + /// [Optional] + /// 3 characters + /// + public string State { get; set; } + + /// + /// The address zip/postal code + /// [Optional] + /// <= 16 + /// + public string Zip { get; set; } + + /// + /// The two-letter ISO country code of the address + /// [Optional] + /// 2 characters + /// + public CountryCode? Country { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/AbstractSource.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/AbstractSource.cs new file mode 100644 index 00000000..046d7f70 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/AbstractSource.cs @@ -0,0 +1,16 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source +{ + /// + /// Abstract source Class + /// The source of the authentication. + /// + public abstract class AbstractSource + { + public SourceType? Type; + + protected AbstractSource(SourceType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/CardSource/CardSource.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/CardSource/CardSource.cs new file mode 100644 index 00000000..5f37da8c --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/CardSource/CardSource.cs @@ -0,0 +1,94 @@ +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.BillingAddress; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.HomePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.MobilePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.WorkPhone; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.CardSource +{ + /// + /// card source Class + /// The source of the authentication. + /// + public class CardSource : AbstractSource + { + /// + /// Initializes a new instance of the CardSource class. + /// + public CardSource() : base(SourceType.Card) + { + } + + /// + /// The card number. + /// [Required] + /// [ 13 .. 19 ] characters + /// + public string Number { get; set; } + + /// + /// The expiry month of the card. + /// [Required] + /// [ 1 .. 2 ] characters [ 1 .. 12 ] + /// + public int ExpiryMonth { get; set; } + + /// + /// The expiry year of the card. + /// [Required] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// Indicates the cardholder scheme choice + /// [Optional] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The customer's billing address. Any special characters will be replaced. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The cardholder's home phone number + /// [Optional] + /// + public HomePhone HomePhone { get; set; } + + /// + /// The cardholder's mobile phone number + /// [Optional] + /// + public MobilePhone MobilePhone { get; set; } + + /// + /// The cardholder's work phone number + /// [Optional] + /// + public WorkPhone WorkPhone { get; set; } + + /// + /// The email of the cardholder + /// [Optional] + /// <= 254 + /// + public string Email { get; set; } + + /// + /// The name of the cardholder. Any special characters will be replaced. + /// [Optional] + /// [ 2 .. 45 ] characters + /// [ 2 .. 45 ] + /// + public string Name { get; set; } + + /// + /// Default: false This must be set to true for authentications that use stored card details + /// [Optional] + /// + public bool Stored { get; set; } = false; + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/BillingAddress/BillingAddress.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/BillingAddress/BillingAddress.cs new file mode 100644 index 00000000..e1960e89 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/BillingAddress/BillingAddress.cs @@ -0,0 +1,60 @@ +using Checkout.Common; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.BillingAddress +{ + /// + /// billing_address + /// The customer's billing address. Any special characters will be replaced. + /// + public class BillingAddress + { + /// + /// The first line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine1 { get; set; } + + /// + /// The second line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine2 { get; set; } + + /// + /// The third line of the address + /// [Optional] + /// <= 50 + /// + public string AddressLine3 { get; set; } + + /// + /// The address city + /// [Optional] + /// <= 50 + /// + public string City { get; set; } + + /// + /// The country subdivision code defined in ISO 3166-2 + /// [Optional] + /// 3 characters + /// + public string State { get; set; } + + /// + /// The address zip/postal code + /// [Optional] + /// <= 16 + /// + public string Zip { get; set; } + + /// + /// The two-letter ISO country code of the address + /// [Optional] + /// 2 characters + /// + public CountryCode? Country { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/HomePhone/HomePhone.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/HomePhone/HomePhone.cs new file mode 100644 index 00000000..2de74711 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/HomePhone/HomePhone.cs @@ -0,0 +1,27 @@ +using Checkout.Common; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.HomePhone +{ + /// + /// home_phone + /// The cardholder's home phone number + /// + public class HomePhone + { + /// + /// Country code. According to ITU-E.164 + /// [Required] + /// [ 1 .. 3 ] characters + /// ^\d{1,3}$ + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The rest of the number. According to ITU-E.164 + /// [Required] + /// ^\d{1,15}$ + /// <= 15 + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/MobilePhone/MobilePhone.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/MobilePhone/MobilePhone.cs new file mode 100644 index 00000000..0fac7b7f --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/MobilePhone/MobilePhone.cs @@ -0,0 +1,27 @@ +using Checkout.Common; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.MobilePhone +{ + /// + /// mobile_phone + /// The cardholder's mobile phone number + /// + public class MobilePhone + { + /// + /// Country code. According to ITU-E.164 + /// [Required] + /// [ 1 .. 3 ] characters + /// ^\d{1,3}$ + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The rest of the number. According to ITU-E.164 + /// [Required] + /// ^\d{1,15}$ + /// <= 15 + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/SchemeType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/SchemeType.cs new file mode 100644 index 00000000..b0f960da --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/SchemeType.cs @@ -0,0 +1,31 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common +{ + public enum SchemeType + { + [EnumMember(Value = "amex")] + Amex, + + [EnumMember(Value = "cartes_bancaires")] + CartesBancaires, + + [EnumMember(Value = "diners")] + Diners, + + [EnumMember(Value = "mastercard")] + Mastercard, + + [EnumMember(Value = "visa")] + Visa, + + [EnumMember(Value = "discover")] + Discover, + + [EnumMember(Value = "upi")] + Upi, + + [EnumMember(Value = "jcb")] + Jcb, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/WorkPhone/WorkPhone.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/WorkPhone/WorkPhone.cs new file mode 100644 index 00000000..175dff83 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/Common/WorkPhone/WorkPhone.cs @@ -0,0 +1,27 @@ +using Checkout.Common; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.WorkPhone +{ + /// + /// work_phone + /// The cardholder's work phone number + /// + public class WorkPhone + { + /// + /// Country code. According to ITU-E.164 + /// [Required] + /// [ 1 .. 3 ] characters + /// ^\d{1,3}$ + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The rest of the number. According to ITU-E.164 + /// [Required] + /// ^\d{1,15}$ + /// <= 15 + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/IdSource/IdSource.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/IdSource/IdSource.cs new file mode 100644 index 00000000..d89794ac --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/IdSource/IdSource.cs @@ -0,0 +1,86 @@ +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.BillingAddress; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.HomePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.MobilePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.WorkPhone; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.IdSource +{ + /// + /// id source Class + /// The source of the authentication. + /// + public class IdSource : AbstractSource + { + /// + /// Initializes a new instance of the IdSource class. + /// + public IdSource() : base(SourceType.Id) + { + } + + /// + /// The card instrument id + /// [Required] + /// <= 100 + /// + public string Id { get; set; } + + /// + /// Indicates the cardholder scheme choice + /// [Optional] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The card number. + /// [Optional] + /// + public string Number { get; set; } + + /// + /// The expiry month of the card. + /// [Optional] + /// [ 1 .. 2 ] characters [ 1 .. 12 ] + /// + public int ExpiryMonth { get; set; } + + /// + /// The expiry year of the card. + /// [Optional] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// The customer's billing address. Any special characters will be replaced. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The cardholder's home phone number + /// [Optional] + /// + public HomePhone HomePhone { get; set; } + + /// + /// The cardholder's mobile phone number + /// [Optional] + /// + public MobilePhone MobilePhone { get; set; } + + /// + /// The cardholder's work phone number + /// [Optional] + /// + public WorkPhone WorkPhone { get; set; } + + /// + /// The email of the cardholder + /// [Optional] + /// <= 254 + /// + public string Email { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/NetworkTokenSource/NetworkTokenSource.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/NetworkTokenSource/NetworkTokenSource.cs new file mode 100644 index 00000000..a62d6aed --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/NetworkTokenSource/NetworkTokenSource.cs @@ -0,0 +1,99 @@ +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.BillingAddress; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.HomePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.MobilePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.WorkPhone; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.NetworkTokenSource +{ + /// + /// network_token source Class + /// The source of the authentication. + /// + public class NetworkTokenSource : AbstractSource + { + /// + /// Initializes a new instance of the NetworkTokenSource class. + /// + public NetworkTokenSource() : base(SourceType.NetworkToken) + { + } + + /// + /// The network token PAN + /// [Required] + /// [ 9 .. 19 ] characters + /// + public string Token { get; set; } + + /// + /// The expiry month of the card. + /// [Required] + /// [ 1 .. 2 ] characters [ 1 .. 12 ] + /// + public int ExpiryMonth { get; set; } + + /// + /// The expiry year of the card. + /// [Required] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// Indicates the cardholder scheme choice + /// [Optional] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The card number. + /// [Optional] + /// + public string Number { get; set; } + + /// + /// The customer's billing address. Any special characters will be replaced. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The cardholder's home phone number + /// [Optional] + /// + public HomePhone HomePhone { get; set; } + + /// + /// The cardholder's mobile phone number + /// [Optional] + /// + public MobilePhone MobilePhone { get; set; } + + /// + /// The cardholder's work phone number + /// [Optional] + /// + public WorkPhone WorkPhone { get; set; } + + /// + /// The email of the cardholder + /// [Optional] + /// <= 254 + /// + public string Email { get; set; } + + /// + /// The customer's name. Any special characters will be replaced. + /// [Optional] + /// [ 2 .. 45 ] characters + /// + public string Name { get; set; } + + /// + /// Default: false This must be set to true for authentications that use stored card details + /// [Optional] + /// + public bool Stored { get; set; } = false; + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/SourceType.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/SourceType.cs new file mode 100644 index 00000000..34554922 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/SourceType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source +{ + public enum SourceType + { + [EnumMember(Value = "card")] + Card, + + [EnumMember(Value = "id")] + Id, + + [EnumMember(Value = "token")] + Token, + + [EnumMember(Value = "network_token")] + NetworkToken, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/TokenSource/TokenSource.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/TokenSource/TokenSource.cs new file mode 100644 index 00000000..cae3919b --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Requests/RequestASessionRequest/Source/TokenSource/TokenSource.cs @@ -0,0 +1,86 @@ +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.BillingAddress; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.HomePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.MobilePhone; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.Common.WorkPhone; + +namespace Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.TokenSource +{ + /// + /// token source Class + /// The source of the authentication. + /// + public class TokenSource : AbstractSource + { + /// + /// Initializes a new instance of the TokenSource class. + /// + public TokenSource() : base(SourceType.Token) + { + } + + /// + /// The Checkout.com card token + /// [Required] + /// <= 100 + /// + public string Token { get; set; } + + /// + /// Indicates the cardholder scheme choice + /// [Optional] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The card number. + /// [Optional] + /// + public string Number { get; set; } + + /// + /// The expiry month of the card. + /// [Optional] + /// [ 1 .. 2 ] characters [ 1 .. 12 ] + /// + public int ExpiryMonth { get; set; } + + /// + /// The expiry year of the card. + /// [Optional] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// The customer's billing address. Any special characters will be replaced. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The cardholder's home phone number + /// [Optional] + /// + public HomePhone HomePhone { get; set; } + + /// + /// The cardholder's mobile phone number + /// [Optional] + /// + public MobilePhone MobilePhone { get; set; } + + /// + /// The cardholder's work phone number + /// [Optional] + /// + public WorkPhone WorkPhone { get; set; } + + /// + /// The email of the cardholder + /// [Optional] + /// <= 254 + /// + public string Email { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponse.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponse.cs new file mode 100644 index 00000000..00c6c9e0 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponse.cs @@ -0,0 +1,18 @@ +namespace Checkout.Authentication.Standalone.POSTSessions.Responses +{ + public class RequestASessionResponse + { + public RequestASessionResponseAccepted.RequestASessionResponseAccepted Accepted { get; set; } + public RequestASessionResponseCreated.RequestASessionResponseCreated Created { get; set; } + + public RequestASessionResponse(RequestASessionResponseAccepted.RequestASessionResponseAccepted accepted) + { + Accepted = accepted; + } + + public RequestASessionResponse(RequestASessionResponseCreated.RequestASessionResponseCreated created) + { + Created = created; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseAccepted/RequestASessionResponseAccepted.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseAccepted/RequestASessionResponseAccepted.cs new file mode 100644 index 00000000..d3067cf5 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseAccepted/RequestASessionResponseAccepted.cs @@ -0,0 +1,217 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.Installment; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Recurring; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Card; +using Checkout.Authentication.Standalone.Common.Responses.Certificates; +using Checkout.Authentication.Standalone.Common.Responses.Ds; +using Checkout.Authentication.Standalone.Common.Responses.GoogleSpa; +using Checkout.Authentication.Standalone.Common.Responses.Optimization; +using Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences; +using Checkout.Common; +using System; +using System.Collections.Generic; +using ChallengeIndicatorType = Checkout.Authentication.Standalone.Common.Responses.ChallengeIndicatorType; + +namespace Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseAccepted +{ + /// + /// Request a session Response 202 + /// Session accepted and further action required + /// + public class RequestASessionResponseAccepted : Resource + { + /// + /// A base64 encoded value prefixed with sek_ that gives access to client-side operations for a single + /// authentication within the Sessions API. This value is returned as the session_secret when requesting a + /// session. + /// [Required] + /// ^(sek)_(.{44})$ + /// 48 characters + /// + public string SessionSecret { get; set; } + + /// + /// Session unique identifier + /// [Required] + /// ^(sid)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The transaction identifier that needs to be provided when communicating directly with the Access Control + /// Server (ACS) + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// Indicates the scheme this authentication is carried out against + /// [Required] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The amount in the minor currency. + /// [Required] + /// [ 0 .. 9223372036854776000 ] + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code + /// [Required] + /// + public Currency? Currency { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Required] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Required] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// The status of the session. + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The protocol version number of the specification used by the API for authentication + /// [Required] + /// <= 50 + /// + public string ProtocolVersion { get; set; } + + /// + /// Default: "no_preference" Indicates the preference for whether or not a 3DS challenge should be performed. + /// The customer’s bank has the final say on whether or not the customer receives the challenge + /// [Required] + /// + public ChallengeIndicatorType ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; + + /// + /// Authentication date and time + /// [Required] + /// + /// + public DateTime AuthenticationDate { get; set; } + + /// + /// Specifies which action to take in order to complete the session. + /// The redirect_cardholder action is only applicable for hosted sessions. + /// [Required] + /// + public IList NextActions { get; set; } + + /// + /// Specifies if the session was completed. + /// [Optional] + /// + public bool Completed { get; set; } + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// Details related to the Session source. This property should always be in the response, unless a card source + /// was used and communication with Checkout.com's Vault was not possible. + /// [Optional] + /// + public Card Card { get; set; } + + /// + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. + /// Value will be ignored in any other cases. + /// [Optional] + /// + public Recurring Recurring { get; set; } + + /// + /// Details of an installment authentication. This property is needed only for an installment authentication + /// type. Value will be ignored in any other cases. + /// [Optional] + /// + public Installment Installment { get; set; } + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// The information about the optimization options selected + /// [Optional] + /// + public Optimization Optimization { get; set; } + + /// + /// Preferred Experiences + /// [Optional] + /// + public PreferredExperiences PreferredExperiences { get; set; } + + /// + /// The authentication experience that was used for processing + /// [Optional] + /// + public ExperienceType? Experience { get; set; } + + /// + /// Details of Google SPA (Secure Payment Authentication) + /// [Optional] + /// + public GoogleSpa GoogleSpa { get; set; } + + /// + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// [Optional] + /// + public Ds Ds { get; set; } + + /// + /// Public certificates specific to a Directory Server (DS) for encrypting device data and verifying ACS signed + /// content. Required when channel is app. + /// [Optional] + /// + public Certificates Certificates { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseCreated/RequestASessionResponseCreated.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseCreated/RequestASessionResponseCreated.cs new file mode 100644 index 00000000..ab84eaf3 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessions/Responses/RequestASessionResponseCreated/RequestASessionResponseCreated.cs @@ -0,0 +1,341 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.Installment; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Recurring; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Acs; +using Checkout.Authentication.Standalone.Common.Responses.Card; +using Checkout.Authentication.Standalone.Common.Responses.Certificates; +using Checkout.Authentication.Standalone.Common.Responses.Ds; +using Checkout.Authentication.Standalone.Common.Responses.GoogleSpa; +using Checkout.Authentication.Standalone.Common.Responses.Optimization; +using Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences; +using Checkout.Authentication.Standalone.Common.Responses.SchemeInfo; +using Checkout.Authentication.Standalone.Common.Responses.Threeds; +using Checkout.Common; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using ChallengeIndicatorType = Checkout.Authentication.Standalone.Common.Responses.ChallengeIndicatorType; +using Exemption = Checkout.Authentication.Standalone.Common.Responses.Exemption.Exemption; + +namespace Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseCreated +{ + /// + /// Request a session Response 201 + /// Session processed successfully + /// + public class RequestASessionResponseCreated : Resource + { + /// + /// A base64 encoded value prefixed with sek_ that gives access to client-side operations for a single + /// authentication within the Sessions API. This value is returned as the session_secret when requesting a + /// session. + /// [Required] + /// ^(sek)_(.{44})$ + /// 48 characters + /// + public string SessionSecret { get; set; } + + /// + /// Session unique identifier + /// [Required] + /// ^(sid)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The transaction identifier that needs to be provided when communicating directly with the Access Control + /// Server (ACS) + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// Indicates the scheme this authentication is carried out against + /// [Required] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The amount in the minor currency. + /// [Required] + /// [ 0 .. 9223372036854776000 ] + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code + /// [Required] + /// + public Currency? Currency { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Required] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Required] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// Indicates the status of the session + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The protocol version number of the specification used by the API for authentication + /// [Required] + /// <= 50 + /// + public string ProtocolVersion { get; set; } + + /// + /// Default: "no_preference" Indicates the preference for whether or not a 3DS challenge should be performed. + /// The customer’s bank has the final say on whether or not the customer receives the challenge + /// [Required] + /// + public ChallengeIndicatorType ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; + + /// + /// Indicates whether this session has been completed + /// [Optional] + /// + public bool Completed { get; set; } + + /// + /// Indicates whether this session involved a challenge. This will only be set after communication with the + /// scheme is finished. + /// [Optional] + /// + public bool Challenged { get; set; } + + /// + /// Public certificates specific to a Directory Server (DS) for encrypting device data and verifying ACS signed + /// content. Required when channel is app. + /// [Optional] + /// + public Certificates Certificates { get; set; } + + /// + /// When the Session is unavailable this will point to the reason it is so. + /// • ares_error = There was an issue in the Authentication response we got back from the Directory Server + /// (scheme server - 3DS2) • ares_status = The status was set to the status in the Authentication response we + /// got back from the Directory Server (scheme server - 3DS2) • rreq_error = There was an issue in the Response + /// we got back from the Access Control Server (issuer server - 3DS2) • rreq_status = The status was set to the + /// status in the Response we got back from the Access Control Server (issuer server - 3DS2) • risk_declined = + /// The status was set to declined because the Risk engine recommended we decline the authentication + /// [Optional] + /// + public StatusReasonType? StatusReason { get; set; } + + /// + /// Whether the authentication was successful. This will only be set if the Session is in a final state + /// [Optional] + /// + public bool Approved { get; set; } + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// Specifies which action to take in order to complete the session. + /// The redirect_cardholder action is only applicable for hosted sessions. + /// [Optional] + /// + public IList NextActions { get; set; } + + /// + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// [Optional] + /// + public Ds Ds { get; set; } + + /// + /// The access control server (ACS) information. Can be empty if the session is still pending or if + /// communication with the ACS failed. This will be available when the channel data and issuer fingerprint + /// result have been provided. + /// [Optional] + /// + public Acs Acs { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which indicates whether a transaction qualifies as an authenticated + /// transaction or account verification. Only available if communication with the scheme was successful and the + /// Session is in a final state. • Y = Authentication Verification Successful. • N = Not Authenticated + /// /Account Not Verified; Transaction denied. • U = Authentication/ Account Verification Could Not Be + /// Performed; Technical or other problem, as indicated in ARes or RReq. • A = Attempts Processing Performed; + /// Not Authenticated/Verified, but a proof of attempted authentication/verification is provided. • C = + /// Challenge Required; Additional authentication is required using the CReq/CRes. • D = Challenge Required; + /// Decoupled Authentication confirmed. • R = Authentication/ Account Verification Rejected; Issuer is + /// rejecting authentication/verification and request that authorization not be attempted. • I = Informational + /// Only; 3DS Requestor challenge preference acknowledged. + /// [Optional] + /// + public ResponseCodeType? ResponseCode { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which provides information on why the response_code field has the specified + /// value. Only available when response_code is not Y. Learn more about the reasons for authentication + /// failures. + /// [Optional] + /// + public string ResponseStatusReason { get; set; } + + /// + /// Payment system-specific value provided as part of the ACS registration for each supported DS. Please be + /// advised that this field will only be included in responses when authenticating with a valid OAuth token and + /// not when authenticating with session_secret. Cryptogram can only be retrieved for up to 24 hours after the + /// session is created. + /// [Optional] + /// 28 characters + /// + public string Cryptogram { get; set; } + + /// + /// Electronic Commerce Indicator. Please be advised that this field will only be included in responses when + /// authenticating with a valid OAuth token and not when authenticating with session_secret. + /// [Optional] + /// 2 characters + /// + public string Eci { get; set; } + + /// + /// The xid value to use for authorization + /// [Optional] + /// + public string Xid { get; set; } + + /// + /// May provide cardholder information from the DS to be presented to the cardholder + /// [Optional] + /// + public string CardholderInfo { get; set; } + + /// + /// Details related to the Session source. This property should always be in the response, unless a card source + /// was used and communication with Checkout.com's Vault was not possible. + /// [Optional] + /// + public Card Card { get; set; } + + /// + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. + /// Value will be ignored in any other cases. + /// [Optional] + /// + public Recurring Recurring { get; set; } + + /// + /// Details of an installment authentication. This property is needed only for an installment authentication + /// type. Value will be ignored in any other cases. + /// [Optional] + /// + public Installment Installment { get; set; } + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// Indicates the card holder's IP address. Only available when the scheme selected is Cartes Bancaires. + /// [Optional] + /// + public string CustomerIp { get; set; } + + /// + /// Authentication date and time + /// [Optional] + /// + /// + public DateTime AuthenticationDate { get; set; } + + /// + /// Details related to exemption present in 3DS flow + /// [Optional] + /// + public Exemption Exemption { get; set; } + + /// + /// Indicates whether the 3D Secure 2 authentication was challenged or frictionless + /// [Optional] + /// + public FlowType? FlowType { get; set; } + + /// + /// The information about the optimization options selected + /// [Optional] + /// + public Optimization Optimization { get; set; } + + /// + /// Indicates scheme-specific information + /// [Optional] + /// + public SchemeInfo SchemeInfo { get; set; } + + /// + /// This object provides more information about the 3DS experience + /// [Optional] + /// + [JsonProperty(PropertyName = "3ds")] + public Threeds Threeds { get; set; } + + /// + /// Preferred Experiences + /// [Optional] + /// + public PreferredExperiences PreferredExperiences { get; set; } + + /// + /// The authentication experience that was used for processing + /// [Optional] + /// + public ExperienceType? Experience { get; set; } + + /// + /// Details of Google SPA (Secure Payment Authentication) + /// [Optional] + /// + public GoogleSpa GoogleSpa { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/POSTSessionsIdComplete/Responses/CompleteASessionResponseNoContent/CompleteASessionResponseNoContent.cs b/src/CheckoutSdk/Authentication/Standalone/POSTSessionsIdComplete/Responses/CompleteASessionResponseNoContent/CompleteASessionResponseNoContent.cs new file mode 100644 index 00000000..1b569840 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/POSTSessionsIdComplete/Responses/CompleteASessionResponseNoContent/CompleteASessionResponseNoContent.cs @@ -0,0 +1,12 @@ +using Checkout.Payments; + +namespace Checkout.Authentication.Standalone.POSTSessionsIdComplete.Responses.CompleteASessionResponseNoContent +{ + /// + /// Complete a session Response 204 + /// Session completed successfully + /// + public class CompleteASessionResponseNoContent : VoidResponse + { + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AbstractUpdateASessionRequest.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AbstractUpdateASessionRequest.cs new file mode 100644 index 00000000..c681ae5d --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AbstractUpdateASessionRequest.cs @@ -0,0 +1,16 @@ +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests +{ + public abstract class AbstractUpdateASessionRequest + { + /// + /// Default: "browser" Indicates the type of channel interface being used to initiate the transaction. + /// [Required] + /// + public ChannelType? Channel; + + protected AbstractUpdateASessionRequest(ChannelType channel) + { + Channel = channel; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/AppRequest.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/AppRequest.cs new file mode 100644 index 00000000..588f7979 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/AppRequest.cs @@ -0,0 +1,78 @@ +using Checkout.Authentication.Standalone.Common.Requests; +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.AppRequest +{ + /// + /// Update a session + /// Update a session by providing information about the environment. + /// + public class AppRequest : AbstractUpdateASessionRequest + { + /// + /// Initializes a new instance of the App class. + /// + public AppRequest() : base(ChannelType.App) + { + } + + /// + /// Universally unique ID created upon all installations and updates of the 3DS Requestor App on a consumer + /// device. This will be newly generated and stored by the 3DS SDK for each installation or update. + /// [Required] + /// 36 characters + /// + public string SdkAppId { get; set; } + + /// + /// Indicates maximum amount of time (in minutes) for all exchanges + /// [Required] + /// >= 5 + /// + public int SdkMaxTimeout { get; set; } + + /// + /// Public key component of the ephemeral key pair generated by the 3DS SDK and used to establish session keys + /// between the 3DS SDK and ACS. Refer to https://tools.ietf.org/html/rfc7517#appendix-A.1 + /// [Required] + /// + public SdkEphemPubKey.SdkEphemPubKey SdkEphemPubKey { get; set; } + + /// + /// A JSON web encryption (JWE) object in compact serialization, containing data encrypted by the SDK for the + /// Directory Server to decrypt. + /// [Required] + /// <= 64000 + /// + public string SdkEncryptedData { get; set; } + + /// + /// Identifies the vendor and version for the 3DS SDK that is integrated in a 3DS Requestor App, assigned by + /// EMVCo when the 3DS SDK is approved. + /// [Required] + /// <= 32 + /// + public string SdkReferenceNumber { get; set; } + + /// + /// Universally unique transaction identifier assigned by the 3DS SDK to identify a single transaction + /// [Required] + /// 36 characters + /// + public string SdkTransactionId { get; set; } + + /// + /// Lists all of the SDK interface types that the device supports for displaying specific challenge user + /// interfaces within the SDK + /// [Required] + /// + public SdkInterfaceType? SdkInterfaceType { get; set; } + + /// + /// Lists all the user interface elements that the cardholder's device supports for displaying specific + /// challenge user interfaces within the SDK + /// [Required] + /// + public IList SdkUiElements { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/SdkEphemPubKey/SdkEphemPubKey.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/SdkEphemPubKey/SdkEphemPubKey.cs new file mode 100644 index 00000000..57c42ed3 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/AppRequest/SdkEphemPubKey/SdkEphemPubKey.cs @@ -0,0 +1,37 @@ +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.AppRequest.SdkEphemPubKey +{ + /// + /// sdk_ephem_pub_key + /// Public key component of the ephemeral key pair generated by the 3DS SDK and used to establish session keys + /// between the 3DS SDK and ACS. Refer to https://tools.ietf.org/html/rfc7517#appendix-A.1 + /// + public class SdkEphemPubKey + { + /// + /// The key type. + /// [Optional] + /// + public string Kty { get; set; } + + /// + /// The type of elliptic curve. + /// [Optional] + /// <= 40 + /// + public string Crv { get; set; } + + /// + /// x coordinate of the elliptic curve that is base64url-encoded. + /// [Optional] + /// <= 100 + /// + public string X { get; set; } + + /// + /// y coordinate of the elliptic curve that is base64url-encoded. + /// [Optional] + /// <= 100 + /// + public string Y { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/BrowserRequest/BrowserRequest.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/BrowserRequest/BrowserRequest.cs new file mode 100644 index 00000000..dd05b7b6 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/BrowserRequest/BrowserRequest.cs @@ -0,0 +1,114 @@ +using Checkout.Authentication.Standalone.Common.Requests; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.BrowserRequest +{ + /// + /// Update a session + /// Update a session by providing information about the environment. + /// + public class BrowserRequest : AbstractUpdateASessionRequest + { + /// + /// Initializes a new instance of the Browser class. + /// + public BrowserRequest() : base(ChannelType.Browser) + { + } + + /// + /// Exact content of the HTTP accept headers as sent to the 3DS Requestor from the cardholder’s browser + /// [Required] + /// <= 2048 + /// + public string AcceptHeader { get; set; } + + /// + /// Boolean that represents the ability of the cardholder's browser to execute Java. Value is returned from the + /// navigator.javaEnabled property. + /// [Required] + /// + public bool JavaEnabled { get; set; } + + /// + /// Default: true Boolean that represents the ability of the cardholder's browser to execute Javascript. Value + /// is returned from the navigator.javascriptEnabled property. *only applicable/required for authentication + /// performed using 3DS 2.2. If authentications results in processing on 2.1 or lower, this field will be + /// disregarded. + /// [Required] + /// + public bool JavascriptEnabled { get; set; } = true; + + /// + /// Value representing the browser language as defined in IETF BCP47. Returned from the navigator.language + /// property. + /// [Required] + /// [ 1 .. 12 ] characters + /// + public string Language { get; set; } + + /// + /// Value representing the bit depth of the color palette for displaying images, in bits per pixel. Obtained + /// from the cardholder's browser from the screen.colorDepth property. + /// [Required] + /// [ 1 .. 2 ] characters + /// + public string ColorDepth { get; set; } + + /// + /// Total height of the cardholder’s screen in pixels. Value is returned from the screen.height property. + /// [Required] + /// [ 1 .. 6 ] characters + /// + public string ScreenHeight { get; set; } + + /// + /// Total width of the cardholder’s screen in pixels. Value is returned from the screen.width property. + /// [Required] + /// [ 1 .. 6 ] characters + /// + public string ScreenWidth { get; set; } + + /// + /// Time difference between UTC time and the local time of the cardholder's browser, in minutes. + /// [Required] + /// [ 1 .. 5 ] characters + /// + public string Timezone { get; set; } + + /// + /// Exact content of the HTTP user-agent header + /// [Required] + /// <= 2048 + /// + public string UserAgent { get; set; } + + /// + /// IP address of the browser as returned by the HTTP headers to the 3DS Requestor + /// [Required] + /// <= 45 + /// + public string IpAddress { get; set; } + + /// + /// Default: "U" Indicates whether the 3DS Method successfully completed • Y = Successfully completed • N = + /// Did not successfully complete • U = Unavailable (3DS Method URL was not present in the preperation response + /// (PRes) message data for the card range associated with the cardholder's account number) + /// [Optional] + /// 1 characters + /// + public ThreeDsMethodCompletionType ThreeDsMethodCompletion { get; set; } = ThreeDsMethodCompletionType.U; + + /// + /// Whether the Payment API is enabled for all parent frames. This is required for Google SPA support in hosted + /// sessions. + /// [Optional] + /// + public bool IframePaymentAllowed { get; set; } + + /// + /// The raw Sec-CH-UA header value. This can improve Google SPA support. + /// [Optional] + /// + public string UserAgentClientHint { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/ChannelType.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/ChannelType.cs new file mode 100644 index 00000000..18af6a84 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/ChannelType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests +{ + public enum ChannelType + { + [EnumMember(Value = "browser")] + Browser, + + [EnumMember(Value = "app")] + App, + + [EnumMember(Value = "merchant_initiated")] + MerchantInitiated, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/MerchantInitiatedRequest.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/MerchantInitiatedRequest.cs new file mode 100644 index 00000000..aa1e19d6 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/MerchantInitiatedRequest.cs @@ -0,0 +1,21 @@ +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.MerchantInitiatedRequest +{ + /// + /// Update a session + /// Update a session by providing information about the environment. + /// + public class MerchantInitiatedRequest : AbstractUpdateASessionRequest + { + /// + /// Initializes a new instance of the MerchantInitiated class. + /// + public MerchantInitiatedRequest() : base(ChannelType.MerchantInitiated) + { + } + + /// + /// [Required] + /// + public RequestType? RequestType { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/RequestType.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/RequestType.cs similarity index 70% rename from src/CheckoutSdk/Sessions/Channel/RequestType.cs rename to src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/RequestType.cs index e7f83831..80124269 100644 --- a/src/CheckoutSdk/Sessions/Channel/RequestType.cs +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Requests/MerchantInitiatedRequest/RequestType.cs @@ -1,40 +1,40 @@ using System.Runtime.Serialization; -namespace Checkout.Sessions.Channel +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.MerchantInitiatedRequest { public enum RequestType { - [EnumMember(Value = "account_verification")] - AccountVerification, - - [EnumMember(Value = "add_card")] - AddCard, + [EnumMember(Value = "recurring_transaction")] + RecurringTransaction, [EnumMember(Value = "installment_transaction")] InstallmentTransaction, - - [EnumMember(Value = "mail_order")] - MailOrder, + + [EnumMember(Value = "add_card")] + AddCard, [EnumMember(Value = "maintain_card_information")] MaintainCardInformation, - - [EnumMember(Value = "other_payment")] - OtherPayment, - [EnumMember(Value = "recurring_transaction")] - RecurringTransaction, + [EnumMember(Value = "account_verification")] + AccountVerification, [EnumMember(Value = "split_or_delayed_shipment")] SplitOrDelayedShipment, + [EnumMember(Value = "top_up")] + TopUp, + + [EnumMember(Value = "mail_order")] + MailOrder, + [EnumMember(Value = "telephone_order")] TelephoneOrder, - - [EnumMember(Value = "top_up")] - TopUp, [EnumMember(Value = "whitelist_status_check")] - WhitelistStatusCheck + WhitelistStatusCheck, + + [EnumMember(Value = "other_payment")] + OtherPayment, } } \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Responses/UpdateASessionResponseOk/UpdateASessionResponseOk.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Responses/UpdateASessionResponseOk/UpdateASessionResponseOk.cs new file mode 100644 index 00000000..93d7e76c --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdCollectData/Responses/UpdateASessionResponseOk/UpdateASessionResponseOk.cs @@ -0,0 +1,341 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.Installment; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Recurring; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Acs; +using Checkout.Authentication.Standalone.Common.Responses.Card; +using Checkout.Authentication.Standalone.Common.Responses.Certificates; +using Checkout.Authentication.Standalone.Common.Responses.Ds; +using Checkout.Authentication.Standalone.Common.Responses.GoogleSpa; +using Checkout.Authentication.Standalone.Common.Responses.Optimization; +using Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences; +using Checkout.Authentication.Standalone.Common.Responses.SchemeInfo; +using Checkout.Authentication.Standalone.Common.Responses.Threeds; +using Checkout.Common; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using ChallengeIndicatorType = Checkout.Authentication.Standalone.Common.Responses.ChallengeIndicatorType; +using Exemption = Checkout.Authentication.Standalone.Common.Responses.Exemption.Exemption; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Responses.UpdateASessionResponseOk +{ + /// + /// Update a session Response 200 + /// Session updated successfully + /// + public class UpdateASessionResponseOk : Resource + { + /// + /// Session unique identifier + /// [Required] + /// ^(sid)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The transaction identifier that needs to be provided when communicating directly with the Access Control + /// Server (ACS) + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// Indicates the scheme this authentication is carried out against + /// [Required] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The amount in the minor currency. + /// [Required] + /// [ 0 .. 9223372036854776000 ] + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code + /// [Required] + /// + public Currency? Currency { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Required] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Required] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// Indicates the status of the session + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The protocol version number of the specification used by the API for authentication + /// [Required] + /// <= 50 + /// + public string ProtocolVersion { get; set; } + + /// + /// Default: "no_preference" Indicates the preference for whether or not a 3DS challenge should be performed. + /// The customer’s bank has the final say on whether or not the customer receives the challenge + /// [Required] + /// + public ChallengeIndicatorType ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; + + /// + /// A base64 encoded value prefixed with sek_ that gives access to client-side operations for a single + /// authentication within the Sessions API. This value is returned as the session_secret when requesting a + /// session. + /// [Optional] + /// ^(sek)_(.{44})$ + /// 48 characters + /// + public string SessionSecret { get; set; } + + /// + /// Indicates whether this session has been completed + /// [Optional] + /// + public bool Completed { get; set; } + + /// + /// Indicates whether this session involved a challenge. This will only be set after communication with the + /// scheme is finished. + /// [Optional] + /// + public bool Challenged { get; set; } + + /// + /// Public certificates specific to a Directory Server (DS) for encrypting device data and verifying ACS signed + /// content. Required when channel is app. + /// [Optional] + /// + public Certificates Certificates { get; set; } + + /// + /// When the Session is unavailable this will point to the reason it is so. + /// • ares_error = There was an issue in the Authentication response we got back from the Directory Server + /// (scheme server - 3DS2) • ares_status = The status was set to the status in the Authentication response we + /// got back from the Directory Server (scheme server - 3DS2) • rreq_error = There was an issue in the Response + /// we got back from the Access Control Server (issuer server - 3DS2) • rreq_status = The status was set to the + /// status in the Response we got back from the Access Control Server (issuer server - 3DS2) • risk_declined = + /// The status was set to declined because the Risk engine recommended we decline the authentication + /// [Optional] + /// + public StatusReasonType? StatusReason { get; set; } + + /// + /// Whether the authentication was successful. This will only be set if the Session is in a final state + /// [Optional] + /// + public bool Approved { get; set; } + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// Specifies which action to take in order to complete the session. + /// The redirect_cardholder action is only applicable for hosted sessions. + /// [Optional] + /// + public IList NextActions { get; set; } + + /// + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// [Optional] + /// + public Ds Ds { get; set; } + + /// + /// The access control server (ACS) information. Can be empty if the session is still pending or if + /// communication with the ACS failed. This will be available when the channel data and issuer fingerprint + /// result have been provided. + /// [Optional] + /// + public Acs Acs { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which indicates whether a transaction qualifies as an authenticated + /// transaction or account verification. Only available if communication with the scheme was successful and the + /// Session is in a final state. • Y = Authentication Verification Successful. • N = Not Authenticated + /// /Account Not Verified; Transaction denied. • U = Authentication/ Account Verification Could Not Be + /// Performed; Technical or other problem, as indicated in ARes or RReq. • A = Attempts Processing Performed; + /// Not Authenticated/Verified, but a proof of attempted authentication/verification is provided. • C = + /// Challenge Required; Additional authentication is required using the CReq/CRes. • D = Challenge Required; + /// Decoupled Authentication confirmed. • R = Authentication/ Account Verification Rejected; Issuer is + /// rejecting authentication/verification and request that authorization not be attempted. • I = Informational + /// Only; 3DS Requestor challenge preference acknowledged. + /// [Optional] + /// + public ResponseCodeType? ResponseCode { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which provides information on why the response_code field has the specified + /// value. Only available when response_code is not Y. Learn more about the reasons for authentication + /// failures. + /// [Optional] + /// + public string ResponseStatusReason { get; set; } + + /// + /// Payment system-specific value provided as part of the ACS registration for each supported DS. Please be + /// advised that this field will only be included in responses when authenticating with a valid OAuth token and + /// not when authenticating with session_secret. Cryptogram can only be retrieved for up to 24 hours after the + /// session is created. + /// [Optional] + /// 28 characters + /// + public string Cryptogram { get; set; } + + /// + /// Electronic Commerce Indicator. Please be advised that this field will only be included in responses when + /// authenticating with a valid OAuth token and not when authenticating with session_secret. + /// [Optional] + /// 2 characters + /// + public string Eci { get; set; } + + /// + /// The xid value to use for authorization + /// [Optional] + /// + public string Xid { get; set; } + + /// + /// May provide cardholder information from the DS to be presented to the cardholder + /// [Optional] + /// + public string CardholderInfo { get; set; } + + /// + /// Details related to the Session source. This property should always be in the response, unless a card source + /// was used and communication with Checkout.com's Vault was not possible. + /// [Optional] + /// + public Card Card { get; set; } + + /// + /// Details of a recurring authentication. This property is needed only for a recurring authentication type. + /// Value will be ignored in any other cases. + /// [Optional] + /// + public Recurring Recurring { get; set; } + + /// + /// Details of an installment authentication. This property is needed only for an installment authentication + /// type. Value will be ignored in any other cases. + /// [Optional] + /// + public Installment Installment { get; set; } + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// Indicates the card holder's IP address. Only available when the scheme selected is Cartes Bancaires. + /// [Optional] + /// + public string CustomerIp { get; set; } + + /// + /// Authentication date and time + /// [Optional] + /// + /// + public DateTime AuthenticationDate { get; set; } + + /// + /// Details related to exemption present in 3DS flow + /// [Optional] + /// + public Exemption Exemption { get; set; } + + /// + /// Indicates whether the 3D Secure 2 authentication was challenged or frictionless + /// [Optional] + /// + public FlowType? FlowType { get; set; } + + /// + /// The information about the optimization options selected + /// [Optional] + /// + public Optimization Optimization { get; set; } + + /// + /// Indicates scheme-specific information + /// [Optional] + /// + public SchemeInfo SchemeInfo { get; set; } + + /// + /// This object provides more information about the 3DS experience + /// [Optional] + /// + [JsonProperty(PropertyName = "3ds")] + public Threeds Threeds { get; set; } + + /// + /// Preferred Experiences + /// [Optional] + /// + public PreferredExperiences PreferredExperiences { get; set; } + + /// + /// The authentication experience that was used for processing + /// [Optional] + /// + public ExperienceType? Experience { get; set; } + + /// + /// Details of Google SPA (Secure Payment Authentication) + /// [Optional] + /// + public GoogleSpa GoogleSpa { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/ThreeDsMethodCompletionType.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/ThreeDsMethodCompletionType.cs new file mode 100644 index 00000000..8ba1faf2 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/ThreeDsMethodCompletionType.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest +{ + public enum ThreeDsMethodCompletionType + { + [EnumMember(Value = "Y")] + Y, + + [EnumMember(Value = "N")] + N, + + [EnumMember(Value = "U")] + U, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/UpdateSessionThreedsMethodCompletionIndicatorRequest.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/UpdateSessionThreedsMethodCompletionIndicatorRequest.cs new file mode 100644 index 00000000..d0247b5a --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Requests/UpdateSessionThreedsMethodCompletionIndicatorRequest/UpdateSessionThreedsMethodCompletionIndicatorRequest.cs @@ -0,0 +1,18 @@ +namespace Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest +{ + /// + /// Update session 3DS Method completion indicator + /// Update the session's 3DS Method completion indicator based on the result of accessing the 3DS Method URL. + /// + public class UpdateSessionThreedsMethodCompletionIndicatorRequest + { + /// + /// The result of the 3DS method URL. Default to U if a response is not received from the 3DS Method URL within + /// 10 seconds. + /// [Required] + /// 1 characters + /// + public ThreeDsMethodCompletionType? ThreeDsMethodCompletion { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Responses/UpdateSessionThreedsMethodCompletionIndicatorResponseOk/UpdateSessionThreedsMethodCompletionIndicatorResponseOk.cs b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Responses/UpdateSessionThreedsMethodCompletionIndicatorResponseOk/UpdateSessionThreedsMethodCompletionIndicatorResponseOk.cs new file mode 100644 index 00000000..bfa86ba6 --- /dev/null +++ b/src/CheckoutSdk/Authentication/Standalone/PUTSessionsIdIssuerFingerprint/Responses/UpdateSessionThreedsMethodCompletionIndicatorResponseOk/UpdateSessionThreedsMethodCompletionIndicatorResponseOk.cs @@ -0,0 +1,263 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.AccountInfo; +using Checkout.Authentication.Standalone.Common.InitialTransaction; +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Acs; +using Checkout.Authentication.Standalone.Common.Responses.Card; +using Checkout.Authentication.Standalone.Common.Responses.Ds; +using Checkout.Authentication.Standalone.Common.Responses.GoogleSpa; +using Checkout.Authentication.Standalone.Common.Responses.PreferredExperiences; +using Checkout.Authentication.Standalone.Common.Responses.Threeds; +using Checkout.Common; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Responses. + UpdateSessionThreedsMethodCompletionIndicatorResponseOk +{ + /// + /// Update session 3DS Method completion indicator Response 200 + /// Session updated successfully + /// + public class UpdateSessionThreedsMethodCompletionIndicatorResponseOk : Resource + { + /// + /// Session unique identifier + /// [Required] + /// ^(sid)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The transaction identifier that needs to be provided when communicating directly with the Access Control + /// Server (ACS) + /// [Required] + /// 36 characters + /// + public string TransactionId { get; set; } + + /// + /// Indicates the scheme this authentication is carried out against + /// [Required] + /// + public SchemeType? Scheme { get; set; } + + /// + /// The amount in the minor currency. + /// [Required] + /// [ 0 .. 9223372036854776000 ] + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code + /// [Required] + /// + public Currency? Currency { get; set; } + + /// + /// Default: "regular" Indicates the type of payment this session is for. Please note the spelling of + /// installment consists of two ls. + /// [Required] + /// + public AuthenticationType AuthenticationType { get; set; } = AuthenticationType.Regular; + + /// + /// Default: "payment" Indicates the category of the authentication request + /// [Required] + /// + public AuthenticationCategoryType AuthenticationCategory { get; set; } = AuthenticationCategoryType.Payment; + + /// + /// Indicates the status of the session + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The protocol version number of the specification used by the API for authentication + /// [Required] + /// <= 50 + /// + public string ProtocolVersion { get; set; } + + /// + /// A base64 encoded value prefixed with sek_ that gives access to client-side operations for a single + /// authentication within the Sessions API. This value is returned as the session_secret when requesting a + /// session. + /// [Optional] + /// ^(sek)_(.{44})$ + /// 48 characters + /// + public string SessionSecret { get; set; } + + /// + /// Indicates whether this session has been completed + /// [Optional] + /// + public bool Completed { get; set; } + + /// + /// Indicates whether this session involved a challenge. This will only be set after communication with the + /// scheme is finished. + /// [Optional] + /// + public bool Challenged { get; set; } + + /// + /// When the Session is unavailable this will point to the reason it is so. + /// • ares_error = There was an issue in the Authentication response we got back from the Directory Server + /// (scheme server - 3DS2) • ares_status = The status was set to the status in the Authentication response we + /// got back from the Directory Server (scheme server - 3DS2) • rreq_error = There was an issue in the Response + /// we got back from the Access Control Server (issuer server - 3DS2) • rreq_status = The status was set to the + /// status in the Response we got back from the Access Control Server (issuer server - 3DS2) • risk_declined = + /// The status was set to declined because the Risk engine recommended we decline the authentication + /// [Optional] + /// + public StatusReasonType? StatusReason { get; set; } + + /// + /// Whether the authentication was successful. This will only be set if the Session is in a final state + /// [Optional] + /// + public bool Approved { get; set; } + + /// + /// Additional information about the Cardholder's account. + /// [Optional] + /// + public AccountInfo AccountInfo { get; set; } + + /// + /// Additional information about the cardholder's purchase. + /// [Optional] + /// + public MerchantRiskInfo MerchantRiskInfo { get; set; } + + /// + /// A reference you can later use to identify this payment, such as an order number. Do not pass sensitive + /// information in this field e.g. card details + /// [Optional] + /// <= 100 + /// + public string Reference { get; set; } + + /// + /// Default: "goods_service" Identifies the type of transaction being authenticated + /// [Optional] + /// <= 50 + /// + public TransactionType TransactionType { get; set; } = TransactionType.GoodsService; + + /// + /// Details of a previous transaction + /// [Optional] + /// + public InitialTransaction InitialTransaction { get; set; } + + /// + /// Specifies which action to take in order to complete the session. + /// The redirect_cardholder action is only applicable for hosted sessions. + /// [Optional] + /// + public IList NextActions { get; set; } + + /// + /// The directory server (DS) information. Can be empty if the session is pending or communication with the DS + /// failed + /// [Optional] + /// + public Ds Ds { get; set; } + + /// + /// The access control server (ACS) information. Can be empty if the session is still pending or if + /// communication with the ACS failed. This will be available when the channel data and issuer fingerprint + /// result have been provided. + /// [Optional] + /// + public Acs Acs { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which indicates whether a transaction qualifies as an authenticated + /// transaction or account verification. Only available if communication with the scheme was successful and the + /// Session is in a final state. • Y = Authentication Verification Successful. • N = Not Authenticated + /// /Account Not Verified; Transaction denied. • U = Authentication/ Account Verification Could Not Be + /// Performed; Technical or other problem, as indicated in ARes or RReq. • A = Attempts Processing Performed; + /// Not Authenticated/Verified, but a proof of attempted authentication/verification is provided. • C = + /// Challenge Required; Additional authentication is required using the CReq/CRes. • D = Challenge Required; + /// Decoupled Authentication confirmed. • R = Authentication/ Account Verification Rejected; Issuer is + /// rejecting authentication/verification and request that authorization not be attempted. • I = Informational + /// Only; 3DS Requestor challenge preference acknowledged. + /// [Optional] + /// + public ResponseCodeType? ResponseCode { get; set; } + + /// + /// Only available as a result of a 3DS2 authentication. + /// The response from the DS or ACS which provides information on why the response_code field has the specified + /// value. Only available when response_code is not Y. Learn more about the reasons for authentication + /// failures. + /// [Optional] + /// + public string ResponseStatusReason { get; set; } + + /// + /// Payment system-specific value provided as part of the ACS registration for each supported DS. Please be + /// advised that this field will only be included in responses when authenticating with a valid OAuth token and + /// not when authenticating with session_secret. Cryptogram can only be retrieved for up to 24 hours after the + /// session is created. + /// [Optional] + /// 28 characters + /// + public string Cryptogram { get; set; } + + /// + /// Electronic Commerce Indicator. Please be advised that this field will only be included in responses when + /// authenticating with a valid OAuth token and not when authenticating with session_secret. + /// [Optional] + /// 2 characters + /// + public string Eci { get; set; } + + /// + /// The xid value to use for authorization + /// [Optional] + /// + public string Xid { get; set; } + + /// + /// Preferred Experiences + /// [Optional] + /// + public PreferredExperiences PreferredExperiences { get; set; } + + /// + /// The authentication experience that was used for processing + /// [Optional] + /// + public ExperienceType? Experience { get; set; } + + /// + /// Details of Google SPA (Secure Payment Authentication) + /// [Optional] + /// + public GoogleSpa GoogleSpa { get; set; } + + /// + /// Details related to the Session source. This property should always be in the response, unless a card source + /// was used and communication with Checkout.com's Vault was not possible. + /// [Optional] + /// + public Card Card { get; set; } + + /// + /// Provides additional information about the 3DS authentication experience. + /// [Optional] + /// + [JsonProperty(PropertyName = "3ds")] + public Threeds Threeds { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/CheckoutApi.cs b/src/CheckoutSdk/CheckoutApi.cs index 979ba5e4..db137cd4 100644 --- a/src/CheckoutSdk/CheckoutApi.cs +++ b/src/CheckoutSdk/CheckoutApi.cs @@ -1,4 +1,5 @@ using Checkout.Accounts; +using Checkout.Authentication; using Checkout.Balances; using Checkout.Issuing; using Checkout.Customers; @@ -16,7 +17,6 @@ using Checkout.Payments.Sessions; using Checkout.Reports; using Checkout.Risk; -using Checkout.Sessions; using Checkout.Tokens; using Checkout.Transfers; using Checkout.Workflows; @@ -33,7 +33,7 @@ public class CheckoutApi : ICheckoutApi private readonly IRiskClient _riskClient; private readonly IForexClient _forexClient; private readonly IWorkflowsClient _workflowsClient; - private readonly ISessionsClient _sessionsClient; + private readonly IAuthenticationClient _authenticationClient; private readonly IAccountsClient _accountsClient; private readonly IPaymentLinksClient _paymentLinksClient; private readonly IHostedPaymentsClient _hostedPaymentsClient; @@ -59,7 +59,7 @@ public CheckoutApi(CheckoutConfiguration configuration) _riskClient = new RiskClient(baseApiClient, configuration); _forexClient = new ForexClient(baseApiClient, configuration); _workflowsClient = new WorkflowsClient(baseApiClient, configuration); - _sessionsClient = new SessionsClient(baseApiClient, configuration); + _authenticationClient = new AuthenticationClient(baseApiClient, configuration); _accountsClient = new AccountsClient( baseApiClient, FilesApiClient(configuration), @@ -151,9 +151,9 @@ public IWorkflowsClient WorkflowsClient() return _workflowsClient; } - public ISessionsClient SessionsClient() + public IAuthenticationClient AuthenticationClient() { - return _sessionsClient; + return _authenticationClient; } public IAccountsClient AccountsClient() diff --git a/src/CheckoutSdk/Common/ChallengeIndicatorType.cs b/src/CheckoutSdk/Common/ChallengeIndicatorType.cs index 0556cc5b..fb0a16db 100644 --- a/src/CheckoutSdk/Common/ChallengeIndicatorType.cs +++ b/src/CheckoutSdk/Common/ChallengeIndicatorType.cs @@ -4,18 +4,17 @@ namespace Checkout.Common { public enum ChallengeIndicatorType { + [EnumMember(Value = "no_preference")] + NoPreference, + + [EnumMember(Value = "no_challenge_requested")] + NoChallengeRequested, + [EnumMember(Value = "challenge_requested")] ChallengeRequested, - + [EnumMember(Value = "challenge_requested_mandate")] ChallengeRequestedMandate, - - [EnumMember(Value = "no_challenge_requested")] - NoChallengeRequested, - - [EnumMember(Value = "no_preference")] - NoPreference, - } -} \ No newline at end of file +} diff --git a/src/CheckoutSdk/ICheckoutApi.cs b/src/CheckoutSdk/ICheckoutApi.cs index 9d924002..37262804 100644 --- a/src/CheckoutSdk/ICheckoutApi.cs +++ b/src/CheckoutSdk/ICheckoutApi.cs @@ -1,4 +1,5 @@ using Checkout.Accounts; +using Checkout.Authentication; using Checkout.Balances; using Checkout.Issuing; using Checkout.Customers; @@ -16,7 +17,6 @@ using Checkout.Payments.Sessions; using Checkout.Reports; using Checkout.Risk; -using Checkout.Sessions; using Checkout.Tokens; using Checkout.Transfers; using Checkout.Workflows; @@ -41,7 +41,7 @@ public interface ICheckoutApi : ICheckoutApiClient IWorkflowsClient WorkflowsClient(); - ISessionsClient SessionsClient(); + IAuthenticationClient AuthenticationClient(); IAccountsClient AccountsClient(); diff --git a/src/CheckoutSdk/Payments/ShippingDetails.cs b/src/CheckoutSdk/Payments/ShippingDetails.cs index d108c07f..e428ce87 100644 --- a/src/CheckoutSdk/Payments/ShippingDetails.cs +++ b/src/CheckoutSdk/Payments/ShippingDetails.cs @@ -1,6 +1,7 @@ +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; using Checkout.Common; using Checkout.Payments.Contexts; -using Checkout.Sessions; + namespace Checkout.Payments { @@ -18,7 +19,7 @@ public class ShippingDetails public string FromAddressZip { get; set; } - public DeliveryTimeframe? Timeframe { get; set; } + public DeliveryTimeframeType? Timeframe { get; set; } public PaymentContextsShippingMethod? Method { get; set; } diff --git a/src/CheckoutSdk/Payments/ThreeDSRequest.cs b/src/CheckoutSdk/Payments/ThreeDSRequest.cs index 8b7dd598..81016a05 100644 --- a/src/CheckoutSdk/Payments/ThreeDSRequest.cs +++ b/src/CheckoutSdk/Payments/ThreeDSRequest.cs @@ -1,7 +1,8 @@ -using Checkout.Common; -using Checkout.Sessions; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Common; using Newtonsoft.Json; using System; +using ChallengeIndicatorType = Checkout.Common.ChallengeIndicatorType; namespace Checkout.Payments { @@ -32,7 +33,7 @@ public class ThreeDsRequest public long? AuthenticationAmount { get; set; } - public ThreeDSFlowType? FlowType { get; set; } + public FlowType? FlowType { get; set; } public string StatusReasonCode { get; set; } diff --git a/src/CheckoutSdk/Sessions/Acs.cs b/src/CheckoutSdk/Sessions/Acs.cs deleted file mode 100644 index 1176deaa..00000000 --- a/src/CheckoutSdk/Sessions/Acs.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Checkout.Sessions -{ - public class Acs - { - public string ReferenceNumber { get; set; } - - public string TransactionId { get; set; } - - public string OperatorId { get; set; } - - public string Url { get; set; } - - public string SignedContent { get; set; } - - public bool? ChallengeMandated { get; set; } - - public string AuthenticationType { get; set; } - - public ChallengeCancelReason? ChallengeCancelReason { get; set; } - - public SessionInterface? Interface { get; set; } - - public UIElements? UiTemplate { get; set; } - - public string ChallengeCancelReasonCode { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/AuthenticationType.cs b/src/CheckoutSdk/Sessions/AuthenticationType.cs deleted file mode 100644 index fd84dd6f..00000000 --- a/src/CheckoutSdk/Sessions/AuthenticationType.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum AuthenticationType - { - [EnumMember(Value = "add_card")] AddCard, - [EnumMember(Value = "installment")] Installment, - [EnumMember(Value = "maintain_card")] MaintainCard, - [EnumMember(Value = "recurring")] Recurring, - [EnumMember(Value = "regular")] Regular - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/CardInfo.cs b/src/CheckoutSdk/Sessions/CardInfo.cs deleted file mode 100644 index 107ecfb0..00000000 --- a/src/CheckoutSdk/Sessions/CardInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class CardInfo - { - public string InstrumentId { get; set; } - - public string Fingerprint { get; set; } - - public SessionsCardMetadataResponse Metadata { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/CardholderAccountInfo.cs b/src/CheckoutSdk/Sessions/CardholderAccountInfo.cs deleted file mode 100644 index f2616b10..00000000 --- a/src/CheckoutSdk/Sessions/CardholderAccountInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Checkout.Common; -using System; - -namespace Checkout.Sessions -{ - public class CardholderAccountInfo - { - public long? PurchaseCount { get; set; } - - public string AccountAge { get; set; } - - public long? AddCardAttempts { get; set; } - - public string ShippingAddressAge { get; set; } - - public bool? AccountNameMatchesShippingName { get; set; } - - public bool? SuspiciousAccountActivity { get; set; } - - public long? TransactionsToday { get; set; } - - [Obsolete("This property will be removed in the future, and should not be used.")] - public AuthenticationMethod? AuthenticationMethod { get; set; } - - public CardholderAccountAgeIndicatorType? CardholderAccountAgeIndicator { get; set; } - - public DateTime? AccountChange { get; set; } - - public AccountChangeIndicatorType? AccountChangeIndicator { get; set; } - - public DateTime? AccountDate { get; set; } - - public string AccountPasswordChange { get; set; } - - public AccountPasswordChangeIndicatorType? AccountPasswordChangeIndicator { get; set; } - - public int? TransactionsPerYear { get; set; } - - public DateTime? PaymentAccountAge { get; set; } - - public DateTime? ShippingAddressUsage { get; set; } - - public AccountTypeCardProductType? AccountType { get; set; } - - public string AccountId { get; set; } - - public ThreeDsRequestorAuthenticationInfo ThreeDsRequestorAuthenticationInfo { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Category.cs b/src/CheckoutSdk/Sessions/Category.cs deleted file mode 100644 index 67ac7606..00000000 --- a/src/CheckoutSdk/Sessions/Category.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum Category - { - [EnumMember(Value = "payment")] Payment, - [EnumMember(Value = "non_payment")] NonPayment - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Certificates.cs b/src/CheckoutSdk/Sessions/Certificates.cs deleted file mode 100644 index 70ded670..00000000 --- a/src/CheckoutSdk/Sessions/Certificates.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Checkout.Sessions -{ - public class Certificates - { - public string DsPublic { get; set; } - - public string CaPublic { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/AppSession.cs b/src/CheckoutSdk/Sessions/Channel/AppSession.cs deleted file mode 100644 index 926ed059..00000000 --- a/src/CheckoutSdk/Sessions/Channel/AppSession.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Checkout.Sessions.Channel -{ - public class AppSession : ChannelData - { - public string SdkAppId { get; set; } - - public long? SdkMaxTimeout { get; set; } - - [JsonProperty(PropertyName = "sdk_ephem_pub_key")] - public SdkEphemeralPublicKey SdkEphemeralPublicKey { get; set; } - - public string SdkReferenceNumber { get; set; } - - public string SdkEncryptedData { get; set; } - - public string SdkTransactionId { get; set; } - - public SdkInterfaceType? SdkInterfaceType { get; set; } - - [JsonProperty(PropertyName = "sdk_ui_elements")] - public IList SdkUIElements { get; set; } - - public AppSession() : base(ChannelType.App) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/BrowserSession.cs b/src/CheckoutSdk/Sessions/Channel/BrowserSession.cs deleted file mode 100644 index df953fa1..00000000 --- a/src/CheckoutSdk/Sessions/Channel/BrowserSession.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Checkout.Sessions.Channel -{ - public class BrowserSession : ChannelData - { - public ThreeDsMethodCompletion? ThreeDsMethodCompletion { get; set; } = - Sessions.Channel.ThreeDsMethodCompletion.U; - - public string AcceptHeader { get; set; } - - public bool? JavaEnabled { get; set; } - - public bool? JavascriptEnabled { get; set; } - - public string Language { get; set; } - - public string ColorDepth { get; set; } - - public string ScreenHeight { get; set; } - - public string ScreenWidth { get; set; } - - public string Timezone { get; set; } - - public string UserAgent { get; set; } - - public string IpAddress { get; set; } - - public BrowserSession() : base(ChannelType.Browser) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/ChannelData.cs b/src/CheckoutSdk/Sessions/Channel/ChannelData.cs deleted file mode 100644 index daa4b87c..00000000 --- a/src/CheckoutSdk/Sessions/Channel/ChannelData.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Checkout.Sessions.Channel -{ - public abstract class ChannelData - { - public ChannelType? Channel { get; set; } - - protected ChannelData(ChannelType channel) - { - Channel = channel; - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/ChannelType.cs b/src/CheckoutSdk/Sessions/Channel/ChannelType.cs deleted file mode 100644 index e8e37d4c..00000000 --- a/src/CheckoutSdk/Sessions/Channel/ChannelType.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions.Channel -{ - public enum ChannelType - { - [EnumMember(Value = "app")] App, - [EnumMember(Value = "browser")] Browser, - [EnumMember(Value = "merchant_initiated")] MerchantInitiated - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/MerchantInitiatedSession.cs b/src/CheckoutSdk/Sessions/Channel/MerchantInitiatedSession.cs deleted file mode 100644 index dcd9b69b..00000000 --- a/src/CheckoutSdk/Sessions/Channel/MerchantInitiatedSession.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions.Channel -{ - public class MerchantInitiatedSession : ChannelData - { - public RequestType RequestType { get; set; } - - public MerchantInitiatedSession() : base(ChannelType.MerchantInitiated) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/SdkEphemeralPublicKey.cs b/src/CheckoutSdk/Sessions/Channel/SdkEphemeralPublicKey.cs deleted file mode 100644 index a8482893..00000000 --- a/src/CheckoutSdk/Sessions/Channel/SdkEphemeralPublicKey.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Checkout.Sessions.Channel -{ - public class SdkEphemeralPublicKey - { - public string Kty { get; set; } - - public string Crv { get; set; } - - public string X { get; set; } - - public string Y { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/SdkInterfaceType.cs b/src/CheckoutSdk/Sessions/Channel/SdkInterfaceType.cs deleted file mode 100644 index 339de02c..00000000 --- a/src/CheckoutSdk/Sessions/Channel/SdkInterfaceType.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions.Channel -{ - public enum SdkInterfaceType - { - [EnumMember(Value = "both")] Both, - [EnumMember(Value = "html")] Html, - [EnumMember(Value = "native")] Native - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Channel/ThreeDsMethodCompletion.cs b/src/CheckoutSdk/Sessions/Channel/ThreeDsMethodCompletion.cs deleted file mode 100644 index 94b17ae4..00000000 --- a/src/CheckoutSdk/Sessions/Channel/ThreeDsMethodCompletion.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Checkout.Sessions.Channel -{ - public enum ThreeDsMethodCompletion - { - Y, - N, - U - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Completion/CompletionInfo.cs b/src/CheckoutSdk/Sessions/Completion/CompletionInfo.cs deleted file mode 100644 index d4ec68ab..00000000 --- a/src/CheckoutSdk/Sessions/Completion/CompletionInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Checkout.Sessions.Completion -{ - public abstract class CompletionInfo - { - public CompletionInfoType? Type { get; set; } - - protected CompletionInfo(CompletionInfoType type) - { - Type = type; - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Completion/CompletionInfoType.cs b/src/CheckoutSdk/Sessions/Completion/CompletionInfoType.cs deleted file mode 100644 index c153b18b..00000000 --- a/src/CheckoutSdk/Sessions/Completion/CompletionInfoType.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions.Completion -{ - public enum CompletionInfoType - { - [EnumMember(Value = "hosted")] Hosted, - [EnumMember(Value = "non_hosted")] NonHosted - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Completion/HostedCompletionInfo.cs b/src/CheckoutSdk/Sessions/Completion/HostedCompletionInfo.cs deleted file mode 100644 index f4ef6ed1..00000000 --- a/src/CheckoutSdk/Sessions/Completion/HostedCompletionInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Checkout.Sessions.Completion -{ - public class HostedCompletionInfo : CompletionInfo - { - public string CallbackUrl { get; set; } - - public string SuccessUrl { get; set; } - - public string FailureUrl { get; set; } - - public HostedCompletionInfo() : base(CompletionInfoType.Hosted) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Completion/NonHostedCompletionInfo.cs b/src/CheckoutSdk/Sessions/Completion/NonHostedCompletionInfo.cs deleted file mode 100644 index 11b5c1db..00000000 --- a/src/CheckoutSdk/Sessions/Completion/NonHostedCompletionInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Checkout.Sessions.Completion -{ - public class NonHostedCompletionInfo : CompletionInfo - { - public string CallbackUrl { get; set; } - - public string ChallengeNotificationUrl { get; set; } - - public NonHostedCompletionInfo() : base(CompletionInfoType.NonHosted) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/CreateSessionAcceptedResponse.cs b/src/CheckoutSdk/Sessions/CreateSessionAcceptedResponse.cs deleted file mode 100644 index 2c74d272..00000000 --- a/src/CheckoutSdk/Sessions/CreateSessionAcceptedResponse.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Checkout.Common; -using System; -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class CreateSessionAcceptedResponse : Resource - { - public string Id { get; set; } - - public string SessionSecret { get; set; } - - public string TransactionId { get; set; } - - public SessionScheme? Scheme { get; set; } - - public long? Amount { get; set; } - - public Currency? Currency { get; set; } - - public bool? Completed { get; set; } - - public bool? Challenged { get; set; } - - public AuthenticationType? AuthenticationType { get; set; } - - public Category? AuthenticationCategory { get; set; } - - public SessionStatus? Status { get; set; } - - public StatusReason? StatusReason { get; set; } - - public IList NextActions { get; set; } - - public string ProtocolVersion { get; set; } - - public CardholderAccountInfo AccountInfo { get; set; } - - public MerchantRiskInfo MerchantRiskInfo { get; set; } - - public string Reference { get; set; } - - public CardInfo Card { get; set; } - - public Recurring Recurring { get; set; } - - public Installment Installment { get; set; } - - public InitialTransaction InitialTransaction { get; set; } - - public DateTime? AuthenticationDate { get; set; } - - public ChallengeIndicatorType? ChallengeIndicator { get; set; } - - public Optimization Optimization { get; set; } - - public Ds Ds { get; set; } - - public DsPublicKeys Certificates { get; set; } - - public TransactionType? TransactionType { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/CreateSessionOkResponse.cs b/src/CheckoutSdk/Sessions/CreateSessionOkResponse.cs deleted file mode 100644 index fa1291f6..00000000 --- a/src/CheckoutSdk/Sessions/CreateSessionOkResponse.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Checkout.Sessions -{ - public class CreateSessionOkResponse : GetSessionResponse - { - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/DeliveryTimeframe.cs b/src/CheckoutSdk/Sessions/DeliveryTimeframe.cs deleted file mode 100644 index 4303b0e5..00000000 --- a/src/CheckoutSdk/Sessions/DeliveryTimeframe.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum DeliveryTimeframe - { - [EnumMember(Value = "electronic_delivery")] ElectronicDelivery, - [EnumMember(Value = "same_day")] SameDay, - [EnumMember(Value = "overnight")] Overnight, - [EnumMember(Value = "two_day_or_more")] TwoDayOrMore, - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Ds.cs b/src/CheckoutSdk/Sessions/Ds.cs deleted file mode 100644 index 6b73a6bc..00000000 --- a/src/CheckoutSdk/Sessions/Ds.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions -{ - public class Ds - { - public string DsId { get; set; } - - public string ReferenceNumber { get; set; } - - public string TransactionId { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/DsPublicKeys.cs b/src/CheckoutSdk/Sessions/DsPublicKeys.cs deleted file mode 100644 index d5d4e7a1..00000000 --- a/src/CheckoutSdk/Sessions/DsPublicKeys.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class DsPublicKeys - { - public string DsPublic { get; set; } - - public string CaPublic { get; set; } - - public IList CaPublicAll { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/GetSessionResponse.cs b/src/CheckoutSdk/Sessions/GetSessionResponse.cs deleted file mode 100644 index 7f0b0b5d..00000000 --- a/src/CheckoutSdk/Sessions/GetSessionResponse.cs +++ /dev/null @@ -1,89 +0,0 @@ -using Checkout.Common; -using System; -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class GetSessionResponse : Resource - { - public string Id { get; set; } - - public string SessionSecret { get; set; } - - public string TransactionId { get; set; } - - public SessionScheme? Scheme { get; set; } - - public long? Amount { get; set; } - - public Currency? Currency { get; set; } - - public bool? Completed { get; set; } - - public bool? Challenged { get; set; } - - public AuthenticationType? AuthenticationType { get; set; } - - public Category? AuthenticationCategory { get; set; } - - public DsPublicKeys Certificates { get; set; } - - public SessionStatus? Status { get; set; } - - public StatusReason? StatusReason { get; set; } - - public bool? Approved { get; set; } - - public string ProtocolVersion { get; set; } - - public CardholderAccountInfo AccountInfo { get; set; } - - public MerchantRiskInfo MerchantRiskInfo { get; set; } - - public string Reference { get; set; } - - public TransactionType? TransactionType { get; set; } - - public IList NextActions { get; set; } - - public Ds Ds { get; set; } - - public Acs Acs { get; set; } - - public ResponseCode? ResponseCode { get; set; } - - public string ResponseStatusReason { get; set; } - - public string Pareq { get; set; } - - public string Cryptogram { get; set; } - - public string Eci { get; set; } - - public string Xid { get; set; } - - public string CardholderInfo { get; set; } - - public CardInfo Card { get; set; } - - public Recurring Recurring { get; set; } - - public Installment Installment { get; set; } - - public InitialTransaction InitialTransaction { get; set; } - - public string CustomerIp { get; set; } - - public DateTime? AuthenticationDate { get; set; } - - public ThreeDsExemption Exemption { get; set; } - - public ThreeDSFlowType? FlowType { get; set; } - - public ChallengeIndicatorType? ChallengeIndicator { get; set; } - - public Optimization Optimization { get; set; } - - public SchemeInfo SchemeInfo { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/GetSessionResponseAfterChannelDataSupplied.cs b/src/CheckoutSdk/Sessions/GetSessionResponseAfterChannelDataSupplied.cs deleted file mode 100644 index b24b6cf9..00000000 --- a/src/CheckoutSdk/Sessions/GetSessionResponseAfterChannelDataSupplied.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Checkout.Common; -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class GetSessionResponseAfterChannelDataSupplied : Resource - { - public string Id { get; set; } - - public string SessionSecret { get; set; } - - public string TransactionId { get; set; } - - public SessionScheme? Scheme { get; set; } - - public long? Amount { get; set; } - - public Currency? Currency { get; set; } - - public bool? Completed { get; set; } - - public bool? Challenged { get; set; } - - public AuthenticationType? AuthenticationType { get; set; } - - public Category? AuthenticationCategory { get; set; } - - public DsPublicKeys Certificates { get; set; } - - public SessionStatus? Status { get; set; } - - public StatusReason? StatusReason { get; set; } - - public bool? Approved { get; set; } - - public string ProtocolVersion { get; set; } - - public CardholderAccountInfo AccountInfo { get; set; } - - public MerchantRiskInfo MerchantRiskInfo { get; set; } - - public string Reference { get; set; } - - public string TransactionType { get; set; } - - public IList NextActions { get; set; } - - public Ds Ds { get; set; } - - public Acs Acs { get; set; } - - public ResponseCode? ResponseCode { get; set; } - - public string ResponseStatusReason { get; set; } - - public string Pareq { get; set; } - - public string Cryptogram { get; set; } - - public string Eci { get; set; } - - public string Xid { get; set; } - - public CardInfo Card { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ISessionsClient.cs b/src/CheckoutSdk/Sessions/ISessionsClient.cs deleted file mode 100644 index f8fb696c..00000000 --- a/src/CheckoutSdk/Sessions/ISessionsClient.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Checkout.Sessions.Channel; -using System.Threading; -using System.Threading.Tasks; - -namespace Checkout.Sessions -{ - public interface ISessionsClient - { - Task RequestSession(SessionRequest sessionRequest, - CancellationToken cancellationToken = default); - - Task GetSessionDetails(string sessionId, CancellationToken cancellationToken = default); - - Task GetSessionDetails(string sessionSecret, string sessionId, - CancellationToken cancellationToken = default); - - Task UpdateSession(string sessionId, ChannelData channelData, - CancellationToken cancellationToken = default); - - Task UpdateSession(string sessionSecret, string sessionId, ChannelData channelData, - CancellationToken cancellationToken = default); - - Task CompleteSession(string sessionId, CancellationToken cancellationToken = default); - - Task CompleteSession(string sessionSecret, string sessionId, CancellationToken cancellationToken = default); - - Task Update3dsMethodCompletionIndicator(string sessionId, - ThreeDsMethodCompletionRequest threeDsMethodCompletionRequest, - CancellationToken cancellationToken = default); - - Task Update3dsMethodCompletionIndicator(string sessionSecret, - string sessionId, ThreeDsMethodCompletionRequest threeDsMethodCompletionRequest, - CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/InitialTransaction.cs b/src/CheckoutSdk/Sessions/InitialTransaction.cs deleted file mode 100644 index e3dcaaee..00000000 --- a/src/CheckoutSdk/Sessions/InitialTransaction.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Checkout.Sessions -{ - public class InitialTransaction - { - public string AcsTransactionId { get; set; } - - public string AuthenticationMethod { get; set; } - - public string AuthenticationTimestamp { get; set; } - - public string AuthenticationData { get; set; } - - public string InitialSessionId { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Installment.cs b/src/CheckoutSdk/Sessions/Installment.cs deleted file mode 100644 index 79bced32..00000000 --- a/src/CheckoutSdk/Sessions/Installment.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions -{ - public class Installment - { - public long? NumberOfPayments { get; set; } - - public long? DaysBetweenPayments { get; set; } = 1L; - - public string Expiry { get; set; } = "99991231"; - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/MerchantRiskInfo.cs b/src/CheckoutSdk/Sessions/MerchantRiskInfo.cs deleted file mode 100644 index 9d865409..00000000 --- a/src/CheckoutSdk/Sessions/MerchantRiskInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace Checkout.Sessions -{ - public class MerchantRiskInfo - { - public string DeliveryEmail { get; set; } - - public DeliveryTimeframe? DeliveryTimeframe { get; set; } - - public bool? IsPreorder { get; set; } - - public bool? IsReorder { get; set; } - - public ShippingIndicator? ShippingIndicator { get; set; } - - public ReorderItemsIndicatorType? ReorderItemsIndicator { get; set; } - - public PreOrderPurchaseIndicatorType? PreOrderPurchaseIndicator { get; set; } - - public DateTime? PreOrderDate { get; set; } - - public string GiftCardAmount { get; set; } - - public string GiftCardCurrency { get; set; } - - public string GiftCardCount { get; set; } - - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Optimization.cs b/src/CheckoutSdk/Sessions/Optimization.cs deleted file mode 100644 index 901844e9..00000000 --- a/src/CheckoutSdk/Sessions/Optimization.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace Checkout.Sessions -{ - public class Optimization - { - public bool Optimized { get; set; } - - public string Framework { get; set; } - - public IList OptimizedProperties { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/OptimizedProperties.cs b/src/CheckoutSdk/Sessions/OptimizedProperties.cs deleted file mode 100644 index c9fc7628..00000000 --- a/src/CheckoutSdk/Sessions/OptimizedProperties.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions -{ - public class OptimizedProperties - { - public string Field { get; set; } - - public string OriginalValue { get; set; } - - public string OptimizedValue { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Recurring.cs b/src/CheckoutSdk/Sessions/Recurring.cs deleted file mode 100644 index 7571fcec..00000000 --- a/src/CheckoutSdk/Sessions/Recurring.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Checkout.Sessions -{ - public class Recurring - { - public long? DaysBetweenPayments { get; set; } = 1L; - - public string Expiry { get; set; } = "99991231"; - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ResponseCode.cs b/src/CheckoutSdk/Sessions/ResponseCode.cs deleted file mode 100644 index 34f1228f..00000000 --- a/src/CheckoutSdk/Sessions/ResponseCode.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Checkout.Sessions -{ - public enum ResponseCode - { - A, - C, - D, - I, - N, - R, - U, - Y - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SchemeInfo.cs b/src/CheckoutSdk/Sessions/SchemeInfo.cs deleted file mode 100644 index 89d13f5d..00000000 --- a/src/CheckoutSdk/Sessions/SchemeInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions -{ - public class SchemeInfo - { - public SessionScheme? Name { get; set; } - - public string Score { get; set; } - - public string Avalgo { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionAddress.cs b/src/CheckoutSdk/Sessions/SessionAddress.cs deleted file mode 100644 index 4b0a22b8..00000000 --- a/src/CheckoutSdk/Sessions/SessionAddress.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Sessions -{ - public class SessionAddress : Address - { - public string AddressLine3 { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionInterface.cs b/src/CheckoutSdk/Sessions/SessionInterface.cs deleted file mode 100644 index 4592ac67..00000000 --- a/src/CheckoutSdk/Sessions/SessionInterface.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum SessionInterface - { - [EnumMember(Value = "html")] Html, - [EnumMember(Value = "native_ui")] NativeUi - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionMarketplaceData.cs b/src/CheckoutSdk/Sessions/SessionMarketplaceData.cs deleted file mode 100644 index 41d5a6b7..00000000 --- a/src/CheckoutSdk/Sessions/SessionMarketplaceData.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Checkout.Sessions -{ - public class SessionMarketplaceData - { - public string SubEntityId { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionRequest.cs b/src/CheckoutSdk/Sessions/SessionRequest.cs deleted file mode 100644 index 8534a2e2..00000000 --- a/src/CheckoutSdk/Sessions/SessionRequest.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Checkout.Common; -using Checkout.Sessions.Channel; -using Checkout.Sessions.Completion; -using Checkout.Sessions.Source; - -namespace Checkout.Sessions -{ - public class SessionRequest - { - public SessionSource Source { get; set; } = new SessionCardSource(); - - public long? Amount { get; set; } - - public Currency? Currency { get; set; } - - public string ProcessingChannelId { get; set; } - - public SessionMarketplaceData Marketplace { get; set; } - - public AuthenticationType? AuthenticationType { get; set; } = Sessions.AuthenticationType.Regular; - - public Category? AuthenticationCategory { get; set; } = Category.Payment; - - public CardholderAccountInfo AccountInfo { get; set; } - - public ChallengeIndicatorType? ChallengeIndicator { get; set; } = ChallengeIndicatorType.NoPreference; - - public SessionsBillingDescriptor BillingDescriptor { get; set; } - - public string Reference { get; set; } - - public MerchantRiskInfo MerchantRiskInfo { get; set; } - - public string PriorTransactionReference { get; set; } - - public TransactionType? TransactionType { get; set; } = Sessions.TransactionType.GoodsService; - - public SessionAddress ShippingAddress { get; set; } - - public bool? ShippingAddressMatchesBilling { get; set; } - - public CompletionInfo Completion { get; set; } - - public ChannelData ChannelData { get; set; } - - public Recurring Recurring { get; set; } - - public Installment Installment { get; set; } - - public Optimization Optimization { get; set; } - - public InitialTransaction InitialTransaction { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionResponse.cs b/src/CheckoutSdk/Sessions/SessionResponse.cs deleted file mode 100644 index fa42919b..00000000 --- a/src/CheckoutSdk/Sessions/SessionResponse.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Checkout.Sessions -{ - public class SessionResponse - { - public CreateSessionAcceptedResponse Accepted { get; set; } - public CreateSessionOkResponse Created { get; set; } - - public SessionResponse(CreateSessionAcceptedResponse accepted) - { - Accepted = accepted; - } - - public SessionResponse(CreateSessionOkResponse created) - { - Created = created; - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionScheme.cs b/src/CheckoutSdk/Sessions/SessionScheme.cs deleted file mode 100644 index c927ace7..00000000 --- a/src/CheckoutSdk/Sessions/SessionScheme.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum SessionScheme - { - [EnumMember(Value = "amex")] Amex, - - [EnumMember(Value = "cartes_bancaires")] - CartesBancaires, - - [EnumMember(Value = "diners")] Diners, - [EnumMember(Value = "jcb")] Jcb, - [EnumMember(Value = "mastercard")] Mastercard, - [EnumMember(Value = "visa")] Visa - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionSourceType.cs b/src/CheckoutSdk/Sessions/SessionSourceType.cs deleted file mode 100644 index 99b5337b..00000000 --- a/src/CheckoutSdk/Sessions/SessionSourceType.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum SessionSourceType - { - [EnumMember(Value = "card")] Card, - [EnumMember(Value = "id")] Id, - [EnumMember(Value = "token")] Token, - [EnumMember(Value = "network_token")] NetworkToken - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionStatus.cs b/src/CheckoutSdk/Sessions/SessionStatus.cs deleted file mode 100644 index 37b29fdf..00000000 --- a/src/CheckoutSdk/Sessions/SessionStatus.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum SessionStatus - { - [EnumMember(Value = "approved")] Approved, - [EnumMember(Value = "attempted")] Attempted, - - [EnumMember(Value = "challenge_abandoned")] - ChallengeAbandoned, - - [EnumMember(Value = "challenged")] Challenged, - [EnumMember(Value = "declined")] Declined, - [EnumMember(Value = "expired")] Expired, - [EnumMember(Value = "pending")] Pending, - [EnumMember(Value = "processing")] Processing, - [EnumMember(Value = "rejected")] Rejected, - [EnumMember(Value = "unavailable")] Unavailable - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionsBillingDescriptor.cs b/src/CheckoutSdk/Sessions/SessionsBillingDescriptor.cs deleted file mode 100644 index 22273e8d..00000000 --- a/src/CheckoutSdk/Sessions/SessionsBillingDescriptor.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Checkout.Sessions -{ - public class SessionsBillingDescriptor - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionsCardMetadataResponse.cs b/src/CheckoutSdk/Sessions/SessionsCardMetadataResponse.cs deleted file mode 100644 index 36e7221c..00000000 --- a/src/CheckoutSdk/Sessions/SessionsCardMetadataResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Sessions -{ - public class SessionsCardMetadataResponse - { - public CardType CardType { get; set; } - - public CardCategory CardCategory { get; set; } - - public string IssuerName { get; set; } - - public CountryCode IssuerCountry { get; set; } - - public string ProductId { get; set; } - - public string ProductType { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/SessionsClient.cs b/src/CheckoutSdk/Sessions/SessionsClient.cs deleted file mode 100644 index afad08ab..00000000 --- a/src/CheckoutSdk/Sessions/SessionsClient.cs +++ /dev/null @@ -1,156 +0,0 @@ -using Checkout.Sessions.Channel; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Checkout.Sessions -{ - public class SessionsClient : AbstractClient, ISessionsClient - { - private const string SessionsPath = "sessions"; - private const string CollectDataPath = "collect-data"; - private const string CompletePath = "complete"; - private const string IssuerFingerprintPath = "issuer-fingerprint"; - private const string SessionIdPath = "sessionId"; - - private static readonly IDictionary SessionResponseMappings = new Dictionary(); - - static SessionsClient() - { - SessionResponseMappings[201] = typeof(CreateSessionOkResponse); - SessionResponseMappings[202] = typeof(CreateSessionAcceptedResponse); - } - - public SessionsClient(IApiClient apiClient, CheckoutConfiguration configuration) - : base(apiClient, configuration, SdkAuthorizationType.OAuth) - { - } - - public async Task RequestSession(SessionRequest sessionRequest, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionRequest", sessionRequest); - return await CreateSession(sessionRequest, cancellationToken); - } - - public async Task GetSessionDetails(string sessionId, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionId", sessionId); - return await GetSessionDetails(sessionId, SdkAuthorization(), cancellationToken); - } - - public async Task GetSessionDetails(string sessionSecret, string sessionId, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId); - return await GetSessionDetails(sessionId, SessionSecretAuthorization(sessionSecret), cancellationToken); - } - - public async Task UpdateSession(string sessionId, ChannelData channelData, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionId", sessionId, "channelData", channelData); - return await UpdateSession(sessionId, channelData, SdkAuthorization(), cancellationToken); - } - - public async Task UpdateSession(string sessionSecret, string sessionId, - ChannelData channelData, CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId, "channelData", - channelData); - return await UpdateSession(sessionId, channelData, SessionSecretAuthorization(sessionSecret), - cancellationToken); - } - - public async Task CompleteSession(string sessionId, CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionId", sessionId); - return await CompleteSession(sessionId, SdkAuthorization(), cancellationToken); - } - - public async Task CompleteSession(string sessionSecret, string sessionId, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", sessionId); - return await CompleteSession(sessionId, SessionSecretAuthorization(sessionSecret), cancellationToken); - } - - public Task Update3dsMethodCompletionIndicator(string sessionId, - ThreeDsMethodCompletionRequest threeDsMethodCompletionRequest, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionId", sessionId, "threeDsMethodCompletionRequest", - threeDsMethodCompletionRequest); - return Update3dsMethodCompletionIndicator(sessionId, threeDsMethodCompletionRequest, SdkAuthorization(), - cancellationToken); - } - - public Task Update3dsMethodCompletionIndicator(string sessionSecret, - string sessionId, ThreeDsMethodCompletionRequest threeDsMethodCompletionRequest, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams("sessionSecret", sessionSecret, "sessionId", - sessionId, "threeDsMethodCompletionRequest", threeDsMethodCompletionRequest); - return Update3dsMethodCompletionIndicator(sessionId, threeDsMethodCompletionRequest, - SessionSecretAuthorization(sessionSecret), cancellationToken); - } - - private async Task CreateSession(SessionRequest sessionRequest, - CancellationToken cancellationToken = default) - { - var resource = await ApiClient.Post(SessionsPath, SdkAuthorization(), SessionResponseMappings, - sessionRequest, cancellationToken); - - switch (resource) - { - case CreateSessionOkResponse createSessionOkResponse: - return new SessionResponse(createSessionOkResponse); - - case CreateSessionAcceptedResponse createSessionAcceptedResponse: - return new SessionResponse(createSessionAcceptedResponse); - - default: - throw new InvalidOperationException("Unexpected mapping type " + resource.GetType()); - } - } - - private async Task GetSessionDetails(string sessionId, SdkAuthorization sdkAuthorization, - CancellationToken cancellationToken = default) - { - CheckoutUtils.ValidateParams(SessionIdPath, sessionId, "sdkAuthorization", sdkAuthorization); - return await ApiClient.Get(BuildPath(SessionsPath, sessionId), sdkAuthorization, - cancellationToken); - } - - private async Task UpdateSession(string sessionId, ChannelData channelData, - SdkAuthorization sdkAuthorization, - CancellationToken cancellationToken = default) - { - return await ApiClient.Put(BuildPath(SessionsPath, sessionId, CollectDataPath), - sdkAuthorization, channelData, cancellationToken); - } - - private async Task CompleteSession(string sessionId, SdkAuthorization sdkAuthorization, - CancellationToken cancellationToken = default) - { - return await ApiClient.Post(BuildPath(SessionsPath, sessionId, CompletePath), sdkAuthorization, null, - cancellationToken, null); - } - - private async Task Update3dsMethodCompletionIndicator( - string sessionId, ThreeDsMethodCompletionRequest threeDsMethodCompletionRequest, - SdkAuthorization sdkAuthorization, CancellationToken cancellationToken = default) - { - return await ApiClient.Put( - BuildPath(SessionsPath, sessionId, IssuerFingerprintPath), sdkAuthorization, - threeDsMethodCompletionRequest, cancellationToken); - } - - private static SdkAuthorization SessionSecretAuthorization(string sessionSecret) - { - return new SessionSecretSdkCredentials(sessionSecret).GetSdkAuthorization(SdkAuthorizationType.Custom); - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ShippingIndicator.cs b/src/CheckoutSdk/Sessions/ShippingIndicator.cs deleted file mode 100644 index 6918d434..00000000 --- a/src/CheckoutSdk/Sessions/ShippingIndicator.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum ShippingIndicator - { - [EnumMember(Value = "billing_address")] BillingAddress, - [EnumMember(Value = "another_address_on_file")] AnotherAddressOnFile, - [EnumMember(Value = "not_on_file")] NotOnFile, - [EnumMember(Value = "store_pick_up")] StorePickUp, - [EnumMember(Value = "digital_goods")] DigitalGoods, - [EnumMember(Value = "travel_and_event_no_shipping")] TravelAndEventNoShipping, - [EnumMember(Value = "other")] Other, - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Source/SessionCardSource.cs b/src/CheckoutSdk/Sessions/Source/SessionCardSource.cs deleted file mode 100644 index 3866fb18..00000000 --- a/src/CheckoutSdk/Sessions/Source/SessionCardSource.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Checkout.Sessions.Source -{ - public class SessionCardSource : SessionSource - { - public string Number { get; set; } - - public int? ExpiryMonth { get; set; } - - public int? ExpiryYear { get; set; } - - public string Name { get; set; } - - public bool? Stored { get; set; } = false; - - public bool? StoreForFutureUse { get; set; } - - public SessionCardSource() : base(SessionSourceType.Card) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Source/SessionIdSource.cs b/src/CheckoutSdk/Sessions/Source/SessionIdSource.cs deleted file mode 100644 index 2855d481..00000000 --- a/src/CheckoutSdk/Sessions/Source/SessionIdSource.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Sessions.Source -{ - public class SessionIdSource : SessionSource - { - public string Id { get; set; } - - public SessionIdSource() : base(SessionSourceType.Id) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Source/SessionNetworkTokenSource.cs b/src/CheckoutSdk/Sessions/Source/SessionNetworkTokenSource.cs deleted file mode 100644 index c73c25f4..00000000 --- a/src/CheckoutSdk/Sessions/Source/SessionNetworkTokenSource.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Checkout.Sessions.Source -{ - public class SessionNetworkTokenSource : SessionSource - { - public string Token { get; set; } - - public int? ExpiryMonth { get; set; } - - public int? ExpiryYear { get; set; } - - public string Name { get; set; } - - public bool? Stored { get; set; } - - public SessionNetworkTokenSource() : base(SessionSourceType.NetworkToken) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Source/SessionSource.cs b/src/CheckoutSdk/Sessions/Source/SessionSource.cs deleted file mode 100644 index 19970ec0..00000000 --- a/src/CheckoutSdk/Sessions/Source/SessionSource.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Sessions.Source -{ - public abstract class SessionSource - { - public SessionSourceType? Type { get; set; } - - public SessionAddress BillingAddress { get; set; } - - public Phone HomePhone { get; set; } - - public Phone MobilePhone { get; set; } - - public Phone WorkPhone { get; set; } - - public string Email { get; set; } - - public SessionScheme? Scheme { get; set; } - - protected SessionSource(SessionSourceType type) - { - Type = type; - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/Source/SessionTokenSource.cs b/src/CheckoutSdk/Sessions/Source/SessionTokenSource.cs deleted file mode 100644 index ad2ee87f..00000000 --- a/src/CheckoutSdk/Sessions/Source/SessionTokenSource.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Checkout.Sessions.Source -{ - public class SessionTokenSource : SessionSource - { - public string Token { get; set; } - - public bool? StoreForFutureUse { get; set; } - - public SessionTokenSource() : base(SessionSourceType.Token) - { - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/StatusReason.cs b/src/CheckoutSdk/Sessions/StatusReason.cs deleted file mode 100644 index ef3419b4..00000000 --- a/src/CheckoutSdk/Sessions/StatusReason.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum StatusReason - { - [EnumMember(Value = "ares_error")] AresError, - [EnumMember(Value = "ares_status")] AresStatus, - [EnumMember(Value = "veres_error")] VeresError, - [EnumMember(Value = "veres_status")] VeresStatus, - [EnumMember(Value = "pares_error")] ParesError, - [EnumMember(Value = "pares_status")] ParesStatus, - [EnumMember(Value = "rreq_error")] RreqError, - [EnumMember(Value = "rreq_status")] RreqStatus, - [EnumMember(Value = "risk_declined")] RiskDeclined - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ThreeDSFlowType.cs b/src/CheckoutSdk/Sessions/ThreeDSFlowType.cs deleted file mode 100644 index 8de929e0..00000000 --- a/src/CheckoutSdk/Sessions/ThreeDSFlowType.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum ThreeDSFlowType - { - [EnumMember(Value = "challenged")] Challenged, - - [EnumMember(Value = "frictionless")] Frictionless, - - [EnumMember(Value = "frictionless_delegated")] - FrictionlessDelegated, - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ThreeDsExemption.cs b/src/CheckoutSdk/Sessions/ThreeDsExemption.cs deleted file mode 100644 index 846c1978..00000000 --- a/src/CheckoutSdk/Sessions/ThreeDsExemption.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Sessions -{ - public class ThreeDsExemption - { - public string Requested { get; set; } - - public Exemption? Applied { get; set; } - - public string Code { get; set; } - - public TrustedBeneficiary TrustedBeneficiary { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ThreeDsMethodCompletionRequest.cs b/src/CheckoutSdk/Sessions/ThreeDsMethodCompletionRequest.cs deleted file mode 100644 index a513aec2..00000000 --- a/src/CheckoutSdk/Sessions/ThreeDsMethodCompletionRequest.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Checkout.Sessions.Channel; - -namespace Checkout.Sessions -{ - public class ThreeDsMethodCompletionRequest - { - public ThreeDsMethodCompletion? ThreeDsMethodCompletion { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/ThreeDsRequestorAuthenticationInfo.cs b/src/CheckoutSdk/Sessions/ThreeDsRequestorAuthenticationInfo.cs deleted file mode 100644 index 5a33b107..00000000 --- a/src/CheckoutSdk/Sessions/ThreeDsRequestorAuthenticationInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Checkout.Sessions -{ - public class ThreeDsRequestorAuthenticationInfo - { - public ThreeDsReqAuthMethodType? ThreeDsReqAuthMethod { get; set; } - - public DateTime? ThreeDsReqAuthTimestamp { get; set; } - - public string ThreeDsReqAuthData { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/TrustedBeneficiary.cs b/src/CheckoutSdk/Sessions/TrustedBeneficiary.cs deleted file mode 100644 index 11ff910b..00000000 --- a/src/CheckoutSdk/Sessions/TrustedBeneficiary.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Checkout.Sessions -{ - public class TrustedBeneficiary - { - public TrustedBeneficiaryStatusType? Status { get; set; } - - public string Source { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/TrustedBeneficiaryStatusType.cs b/src/CheckoutSdk/Sessions/TrustedBeneficiaryStatusType.cs deleted file mode 100644 index 450dcd4e..00000000 --- a/src/CheckoutSdk/Sessions/TrustedBeneficiaryStatusType.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Checkout.Sessions -{ - public enum TrustedBeneficiaryStatusType - { - E, - N, - P, - R, - U, - Y - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Sessions/UIElements.cs b/src/CheckoutSdk/Sessions/UIElements.cs deleted file mode 100644 index 2fd65acf..00000000 --- a/src/CheckoutSdk/Sessions/UIElements.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Sessions -{ - public enum UIElements - { - [EnumMember(Value = "html_other")] HtmlOther, - [EnumMember(Value = "multi_select")] MultiSelect, - [EnumMember(Value = "oob")] Oob, - [EnumMember(Value = "single_select")] SingleSelect, - [EnumMember(Value = "text")] Text - } -} \ No newline at end of file diff --git a/test/CheckoutSdkTest/Authentification/Standalone/AbstractSessionsIntegrationTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/AbstractSessionsIntegrationTest.cs new file mode 100644 index 00000000..a26f1187 --- /dev/null +++ b/test/CheckoutSdkTest/Authentification/Standalone/AbstractSessionsIntegrationTest.cs @@ -0,0 +1,228 @@ +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.Requests; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.AppChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.AppChannelData. + SdkEphemPubKey; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.BrowserChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData. + MerchantInitiatedChannelData; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion.HostedCompletion; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Completion.NonHostedCompletion; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ShippingAddress; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.CardSource; +using Checkout.Authentication.Standalone.POSTSessions.Responses; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.AppRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.BrowserRequest; +using Checkout.Common; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AuthenticationType = Checkout.Authentication.Standalone.Common.AuthenticationType; +using ChallengeIndicatorType = + Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChallengeIndicatorType; +using ThreeDsMethodCompletionType = + Checkout.Authentication.Standalone.Common.Requests.ThreeDsMethodCompletionType; +using TransactionType = Checkout.Authentication.Standalone.Common.TransactionType; + +namespace Checkout.Authentification.Standalone +{ + public abstract class AbstractSessionsIntegrationTest : SandboxTestFixture + { + protected AbstractSessionsIntegrationTest() : base(PlatformType.DefaultOAuth) + { + } + + protected async Task CreateNonHostedSession( + AbstractChannelData channelData, + AuthenticationCategoryType authenticationCategory, + ChallengeIndicatorType challengeIndicator, + TransactionType transactionType) + { + var shippingAddress = new ShippingAddress + { + AddressLine1 = "CheckoutSdk.com", + AddressLine2 = "90 Tottenham Court Road", + AddressLine3 = "14 Wells Mews", + City = "London", + State = "ENG", + Country = CountryCode.GB + }; + + var source = new CardSource { Number = "4242424242424242", ExpiryMonth = 6, ExpiryYear = 2030, }; + + var sessionRequest = new RequestASessionRequest + { + Source = source, + Amount = 6540L, + Currency = Currency.GBP, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + AuthenticationCategory = authenticationCategory, + ChallengeIndicator = challengeIndicator, + TransactionType = transactionType, + ShippingAddress = shippingAddress, + Completion = new NonHostedCompletion { CallbackUrl = "https://merchant.com/callback" }, + ChannelData = channelData, + }; + + return await DefaultApi.AuthenticationClient().RequestASession(sessionRequest, CancellationToken.None); + } + + protected async Task CreateHostedSession() + { + var shippingAddress = new ShippingAddress() + { + AddressLine1 = "Checkout.com", + AddressLine2 = "90 Tottenham Court Road", + AddressLine3 = "14 Wells Mews", + City = "London", + State = "ENG", + Country = CountryCode.GB, + Zip = "W1T 4TJ" + }; + + var sessionRequest = new RequestASessionRequest + { + Source = new CardSource { ExpiryMonth = 1, ExpiryYear = 2030, Number = "4485040371536584" }, + Amount = 100L, + Currency = Currency.GBP, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + AuthenticationType = AuthenticationType.Regular, + AuthenticationCategory = AuthenticationCategoryType.Payment, + ChallengeIndicator = ChallengeIndicatorType.NoPreference, + Reference = "ORD-5023-4E89", + TransactionType = TransactionType.GoodsService, + ShippingAddress = shippingAddress, + Completion = new HostedCompletion + { + FailureUrl = "https://example.com/sessions/fail", + SuccessUrl = "https://example.com/sessions/success", + } + }; + + return await Retriable( + async () => await DefaultApi.AuthenticationClient() + .RequestASession(sessionRequest, CancellationToken.None), + HasSessionAccepted); + } + + protected static AbstractChannelData BrowserChannelData() + { + return new BrowserChannelData + { + AcceptHeader = "Accept: *.*, q=0.1", + JavaEnabled = true, + JavascriptEnabled = true, + Language = "FR-fr", + ColorDepth = "16", + ScreenWidth = "1920", + ScreenHeight = "1080", + Timezone = "60", + UserAgent = + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", + ThreeDsMethodCompletion = ThreeDsMethodCompletionType.Y, + IpAddress = "1.12.123.255" + }; + } + + protected static AbstractChannelData AppChannelData() + { + var sdkEphemPubKey = new SdkEphemPubKey + { + Kty = "EC", + Crv = "P-256", + X = "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", + Y = "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0" + }; + + var appSession = new AppChannelData + { + SdkAppId = "dbd64fcb-c19a-4728-8849-e3d50bfdde39", + SdkMaxTimeout = 5, + SdkEncryptedData = "{}", + SdkEphemPubKey = sdkEphemPubKey, + SdkReferenceNumber = "3DS_LOA_SDK_PPFU_020100_00007", + SdkTransactionId = "b2385523-a66c-4907-ac3c-91848e8c0067", + SdkInterfaceType = SdkInterfaceType.Both, + SdkUiElements = + new List { SdkUiElementsType.SingleSelect, SdkUiElementsType.HtmlOther } + }; + + return appSession; + } + + protected static AbstractChannelData MerchantInitiatedChannelData() + { + return new MerchantInitiatedChannelData { RequestType = RequestType.RecurringTransaction }; + } + + protected static AbstractUpdateASessionRequest BrowserRequest() + { + return new BrowserRequest + { + AcceptHeader = "Accept: *.*, q=0.1", + JavaEnabled = true, + JavascriptEnabled = true, + Language = "FR-fr", + ColorDepth = "16", + ScreenWidth = "1920", + ScreenHeight = "1080", + Timezone = "60", + UserAgent = + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", + ThreeDsMethodCompletion = ThreeDsMethodCompletionType.Y, + IpAddress = "1.12.123.255" + }; + } + + protected static AbstractUpdateASessionRequest AppRequest() + { + var sdkEphemPubKey = + new + Authentication.Standalone.PUTSessionsIdCollectData.Requests.AppRequest.SdkEphemPubKey. + SdkEphemPubKey() + { + Kty = "EC", + Crv = "P-256", + X = "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", + Y = "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0" + }; + + var appSession = new AppRequest() + { + SdkAppId = "dbd64fcb-c19a-4728-8849-e3d50bfdde39", + SdkMaxTimeout = 5, + SdkEncryptedData = "{}", + SdkEphemPubKey = sdkEphemPubKey, + SdkReferenceNumber = "3DS_LOA_SDK_PPFU_020100_00007", + SdkTransactionId = "b2385523-a66c-4907-ac3c-91848e8c0067", + SdkInterfaceType = + SdkInterfaceType.Both, + SdkUiElements = + new List + { + SdkUiElementsType.SingleSelect, + SdkUiElementsType.HtmlOther + } + }; + + return appSession; + } + + private static bool HasSessionAccepted(RequestASessionResponse obj) + { + return obj.Accepted != null && + obj.Accepted.Card != null; + } + + private static bool HasSessionCreated(RequestASessionResponse obj) + { + return obj.Created != null && + obj.Created.Certificates != null && + obj.Created.Ds != null && + obj.Created.Card != null; + } + } +} \ No newline at end of file diff --git a/test/CheckoutSdkTest/Sessions/SessionsClientTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/AuthenticationClientTest.cs similarity index 53% rename from test/CheckoutSdkTest/Sessions/SessionsClientTest.cs rename to test/CheckoutSdkTest/Authentification/Standalone/AuthenticationClientTest.cs index 44b3db17..ac3a6bd2 100644 --- a/test/CheckoutSdkTest/Sessions/SessionsClientTest.cs +++ b/test/CheckoutSdkTest/Authentification/Standalone/AuthenticationClientTest.cs @@ -1,6 +1,18 @@ -using Checkout.Common; -using Checkout.Sessions.Channel; -using Checkout.Sessions.Source; +using Checkout.Authentication; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.Common.Responses.Exemption; +using Checkout.Authentication.Standalone.Common.Responses.SchemeInfo; +using Checkout.Authentication.Standalone.GETSessionsId.Responses.GetSessionDetailsResponseOk; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.IdSource; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.Source.NetworkTokenSource; +using Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseAccepted; +using Checkout.Authentication.Standalone.POSTSessions.Responses.RequestASessionResponseCreated; +using Checkout.Authentication.Standalone.POSTSessionsIdComplete.Responses.CompleteASessionResponseNoContent; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Requests.AppRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Responses.UpdateASessionResponseOk; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests.UpdateSessionThreeDSMethodCompletionIndicatorRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Responses.UpdateSessionThreedsMethodCompletionIndicatorResponseOk; using Moq; using Shouldly; using System; @@ -8,10 +20,11 @@ using System.Threading; using System.Threading.Tasks; using Xunit; +using Acs = Checkout.Authentication.Standalone.Common.Responses.Acs.Acs; -namespace Checkout.Sessions +namespace Checkout.Authentification.Standalone { - public class SessionsClientTest : UnitTestFixture + public class AuthenticationClientTest : UnitTestFixture { private const string Sessions = "sessions"; private const string CollectData = "collect-data"; @@ -24,20 +37,20 @@ public class SessionsClientTest : UnitTestFixture private readonly Mock _httpClientFactory = new Mock(); private readonly Mock _configuration; - private ISessionsClient _sessionsClient; + private IAuthenticationClient _authenticationClient; private static readonly SdkAuthorization SessionSecretAuthorization = new SessionSecretSdkCredentials("sessionSecret").GetSdkAuthorization(SdkAuthorizationType.Custom); private static readonly IDictionary SessionResponseMappings = new Dictionary(); - static SessionsClientTest() + static AuthenticationClientTest() { - SessionResponseMappings[201] = typeof(CreateSessionOkResponse); - SessionResponseMappings[202] = typeof(CreateSessionAcceptedResponse); + SessionResponseMappings[201] = typeof(RequestASessionResponseCreated); + SessionResponseMappings[202] = typeof(RequestASessionResponseAccepted); } - public SessionsClientTest() + public AuthenticationClientTest() { _sdkCredentials.Setup(credentials => credentials.GetSdkAuthorization(SdkAuthorizationType.OAuth)) .Returns(_authorization); @@ -52,19 +65,19 @@ public SessionsClientTest() [Fact] private async Task ShouldRequestSessionCreateSessionOkResponse() { - var request = new SessionRequest + var request = new RequestASessionRequest { - Source = new SessionNetworkTokenSource + Source = new NetworkTokenSource { Token = "token", ExpiryMonth = 12, ExpiryYear = 2030, Name = "name" } }; - var response = new CreateSessionOkResponse + var response = new RequestASessionResponseCreated { - Acs = new Acs {ChallengeCancelReasonCode = "code"}, - SchemeInfo = new SchemeInfo + Acs = new Acs { ChallengeCancelReasonCode = "code" }, + SchemeInfo = new Authentication.Standalone.Common.Responses.SchemeInfo.SchemeInfo() { - Name = SessionScheme.CartesBancaires, Score = "score", Avalgo = "avalgo" + Name = NameType.CartesBancaires, Score = "score", Avalgo = "avalgo" } }; @@ -75,9 +88,9 @@ private async Task ShouldRequestSessionCreateSessionOkResponse() CancellationToken.None, null)) .ReturnsAsync(() => response); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var getSessionResponse = await _sessionsClient.RequestSession(request, CancellationToken.None); + var getSessionResponse = await _authenticationClient.RequestASession(request, CancellationToken.None); getSessionResponse.ShouldNotBeNull(); getSessionResponse.Accepted.ShouldBeNull(); @@ -92,11 +105,12 @@ private async Task ShouldRequestSessionCreateSessionOkResponse() [Fact] private async Task ShouldRequestSessionCreateSessionAcceptedResponse() { - var request = new SessionRequest {Source = new SessionIdSource {Id = "id"}}; - var response = new CreateSessionAcceptedResponse + var request = new RequestASessionRequest() { Source = new IdSource { Id = "id" } }; + var response = new RequestASessionResponseAccepted { AuthenticationDate = DateTime.Now, - ChallengeIndicator = ChallengeIndicatorType.ChallengeRequestedMandate + ChallengeIndicator = Authentication.Standalone.Common.Responses.ChallengeIndicatorType + .ChallengeRequestedMandate }; _apiClient.Setup(apiClient => @@ -106,9 +120,9 @@ private async Task ShouldRequestSessionCreateSessionAcceptedResponse() CancellationToken.None, null)) .ReturnsAsync(() => response); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var getSessionResponse = await _sessionsClient.RequestSession(request, CancellationToken.None); + var getSessionResponse = await _authenticationClient.RequestASession(request, CancellationToken.None); getSessionResponse.ShouldNotBeNull(); getSessionResponse.Accepted.ShouldNotBeNull(); @@ -122,42 +136,46 @@ private async Task RequestSessionShouldThrowOnNullRequest() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.RequestSession(null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.RequestASession(null, CancellationToken.None); } catch (Exception ex) { ex.ShouldNotBeNull(); ex.ShouldBeAssignableTo(typeof(CheckoutArgumentException)); - ex.Message.ShouldBe("sessionRequest cannot be null"); + ex.Message.ShouldBe("requestASessionRequest cannot be null"); } } [Fact] private async Task ShouldGetSessionDetails() { - var response = new GetSessionResponse + var response = new GetSessionDetailsResponseOk { Exemption = - new ThreeDsExemption + new Authentication.Standalone.Common.Responses.Exemption.Exemption() { - Requested = "requested", Applied = Exemption.RecurringOperation, Code = "code" + Requested = "requested", Applied = AppliedType.None, Code = "code" }, AuthenticationDate = DateTime.Now, - FlowType = ThreeDSFlowType.Frictionless, - ChallengeIndicator = ChallengeIndicatorType.ChallengeRequested, - SchemeInfo = new SchemeInfo {Name = SessionScheme.CartesBancaires, Score = "score", Avalgo = "avalgo"} + FlowType = FlowType.Frictionless, + ChallengeIndicator = + Authentication.Standalone.Common.Responses.ChallengeIndicatorType.ChallengeRequested, + SchemeInfo = new Authentication.Standalone.Common.Responses.SchemeInfo.SchemeInfo() + { + Name = NameType.CartesBancaires, Score = "score", Avalgo = "avalgo" + } }; _apiClient.Setup(apiClient => - apiClient.Get($"{Sessions}/id", + apiClient.Get($"{Sessions}/id", _sdkCredentials.Object.GetSdkAuthorization(SdkAuthorizationType.OAuth), CancellationToken.None)) .ReturnsAsync(() => response); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var getSessionResponse = await _sessionsClient.GetSessionDetails("id", CancellationToken.None); + var getSessionResponse = await _authenticationClient.GetSessionDetails("id", CancellationToken.None); getSessionResponse.ShouldNotBeNull(); getSessionResponse.Exemption.ShouldNotBeNull(); @@ -170,17 +188,17 @@ private async Task ShouldGetSessionDetails() [Fact] private async Task ShouldGetSessionDetailsSessionSecret() { - var response = new Mock(); + var response = new Mock(); _apiClient.Setup(apiClient => - apiClient.Get($"{Sessions}/id", SessionSecretAuthorization, + apiClient.Get($"{Sessions}/id", SessionSecretAuthorization, CancellationToken.None)) .ReturnsAsync(() => response.Object); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); var getSessionResponse = - await _sessionsClient.GetSessionDetails("sessionSecret", "id", CancellationToken.None); + await _authenticationClient.GetSessionDetails("sessionSecret", "id", CancellationToken.None); getSessionResponse.ShouldNotBeNull(); } @@ -190,8 +208,8 @@ private async Task GetSessionDetailsShouldThrowOnNullRequest() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.GetSessionDetails(null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.GetSessionDetails(null, CancellationToken.None); } catch (Exception ex) { @@ -206,8 +224,8 @@ private async Task GetSessionDetailsShouldThrowOnSessionSecret() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.GetSessionDetails(null, null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.GetSessionDetails(null, null, CancellationToken.None); } catch (Exception ex) { @@ -220,19 +238,20 @@ private async Task GetSessionDetailsShouldThrowOnSessionSecret() [Fact] private async Task ShouldUpdateSessionDetails() { - var request = new Mock(); - var response = new Mock(); + var request = new Mock(); + var response = new Mock(); _apiClient.Setup(apiClient => - apiClient.Put($"{Sessions}/id/{CollectData}", + apiClient.Put($"{Sessions}/id/{CollectData}", _sdkCredentials.Object.GetSdkAuthorization(SdkAuthorizationType.OAuth), request.Object, CancellationToken.None, null)) .ReturnsAsync(() => response.Object); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var getSessionResponse = await _sessionsClient.UpdateSession("id", request.Object, CancellationToken.None); + var getSessionResponse = + await _authenticationClient.UpdateASession("id", request.Object, CancellationToken.None); getSessionResponse.ShouldNotBeNull(); } @@ -240,19 +259,20 @@ private async Task ShouldUpdateSessionDetails() [Fact] private async Task ShouldUpdateSessionDetailsSessionSecret() { - var request = new Mock(); - var response = new Mock(); + var request = new Mock(); + var response = new Mock(); _apiClient.Setup(apiClient => - apiClient.Put($"{Sessions}/id/{CollectData}", SessionSecretAuthorization, + apiClient.Put($"{Sessions}/id/{CollectData}", SessionSecretAuthorization, request.Object, CancellationToken.None, null)) .ReturnsAsync(() => response.Object); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); var getSessionResponse = - await _sessionsClient.UpdateSession("sessionSecret", "id", request.Object, CancellationToken.None); + await _authenticationClient.UpdateASession("sessionSecret", "id", request.Object, + CancellationToken.None); getSessionResponse.ShouldNotBeNull(); } @@ -262,8 +282,8 @@ private async Task UpdateSessionShouldThrowOnNullRequest() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.UpdateSession(null, null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateASession(null, null, CancellationToken.None); } catch (Exception ex) { @@ -274,14 +294,14 @@ private async Task UpdateSessionShouldThrowOnNullRequest() try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.UpdateSession("id", null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateASession("id", null, CancellationToken.None); } catch (Exception ex) { ex.ShouldNotBeNull(); ex.ShouldBeAssignableTo(typeof(CheckoutArgumentException)); - ex.Message.ShouldBe("channelData cannot be null"); + ex.Message.ShouldBe("updateASessionRequest cannot be null"); } } @@ -290,8 +310,8 @@ private async Task UpdateSessionShouldThrowOnNullRequestSessionSecret() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.UpdateSession("secret", null, null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateASession("secret", null, null, CancellationToken.None); } catch (Exception ex) { @@ -302,20 +322,20 @@ private async Task UpdateSessionShouldThrowOnNullRequestSessionSecret() try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.UpdateSession("secret", "id", null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateASession("secret", "id", null, CancellationToken.None); } catch (Exception ex) { ex.ShouldNotBeNull(); ex.ShouldBeAssignableTo(typeof(CheckoutArgumentException)); - ex.Message.ShouldBe("channelData cannot be null"); + ex.Message.ShouldBe("updateASessionRequest cannot be null"); } try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.UpdateSession(null, "id", new AppSession(), CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateASession(null, "id", new AppRequest(), CancellationToken.None); } catch (Exception ex) { @@ -328,16 +348,14 @@ private async Task UpdateSessionShouldThrowOnNullRequestSessionSecret() [Fact] private async Task ShouldCompleteSession() { - var response = new Mock(); - _apiClient.Setup(apiClient => - apiClient.Post($"{Sessions}/id/{Complete}", _authorization, null, + apiClient.Post($"{Sessions}/id/{Complete}", _authorization, null, CancellationToken.None, null)) - .ReturnsAsync(() => new EmptyResponse()); + .ReturnsAsync(() => new CompleteASessionResponseNoContent()); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var completeSessionResponse = _sessionsClient.CompleteSession("id", CancellationToken.None); + var completeSessionResponse = _authenticationClient.CompleteASession("id", CancellationToken.None); await completeSessionResponse; completeSessionResponse.IsCompleted.ShouldBe(true); } @@ -345,17 +363,15 @@ private async Task ShouldCompleteSession() [Fact] private async Task ShouldCompleteSessionSessionSecret() { - var response = new Mock(); - _apiClient.Setup(apiClient => - apiClient.Post($"{Sessions}/id/{Complete}", SessionSecretAuthorization, null, + apiClient.Post($"{Sessions}/id/{Complete}", SessionSecretAuthorization, null, CancellationToken.None, null)) - .ReturnsAsync(() => new EmptyResponse()); + .ReturnsAsync(() => new CompleteASessionResponseNoContent()); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); var completeSessionResponse = - _sessionsClient.CompleteSession("sessionSecret", "id", CancellationToken.None); + _authenticationClient.CompleteASession("sessionSecret", "id", CancellationToken.None); await completeSessionResponse; completeSessionResponse.IsCompleted.ShouldBe(true); } @@ -365,8 +381,8 @@ private async Task CompleteSessionShouldThrowOnNullRequest() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.CompleteSession(null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.CompleteASession(null, CancellationToken.None); } catch (Exception ex) { @@ -381,8 +397,8 @@ private async Task CompleteSessionShouldThrowOnNullRequestSessionSecret() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.CompleteSession(null, "sessionSecret", CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.CompleteASession(null, "sessionSecret", CancellationToken.None); } catch (Exception ex) { @@ -395,20 +411,21 @@ private async Task CompleteSessionShouldThrowOnNullRequestSessionSecret() [Fact] private async Task ShouldUpdate3dsMethodCompletionIndicator() { - var request = new Mock(); - var response = new Mock(); + var request = new Mock(); + var response = new Mock(); _apiClient.Setup(apiClient => - apiClient.Put($"{Sessions}/id/{IssuerFingerprint}", + apiClient.Put($"{Sessions}/id/{IssuerFingerprint}", _sdkCredentials.Object.GetSdkAuthorization(SdkAuthorizationType.OAuth), request.Object, CancellationToken.None, null)) .ReturnsAsync(() => response.Object); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); var getSessionResponse = - await _sessionsClient.Update3dsMethodCompletionIndicator("id", request.Object, CancellationToken.None); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator("id", request.Object, + CancellationToken.None); getSessionResponse.ShouldNotBeNull(); } @@ -416,18 +433,19 @@ private async Task ShouldUpdate3dsMethodCompletionIndicator() [Fact] private async Task ShouldUpdate3dsMethodCompletionIndicatorSessionSecret() { - var request = new Mock(); - var response = new Mock(); + var request = new Mock(); + var response = new Mock(); _apiClient.Setup(apiClient => - apiClient.Put($"{Sessions}/id/{IssuerFingerprint}", + apiClient.Put($"{Sessions}/id/{IssuerFingerprint}", SessionSecretAuthorization, request.Object, CancellationToken.None, null)) .ReturnsAsync(() => response.Object); - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); - var getSessionResponse = await _sessionsClient.Update3dsMethodCompletionIndicator("sessionSecret", "id", + var getSessionResponse = await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator("sessionSecret", + "id", request.Object, CancellationToken.None); @@ -439,8 +457,8 @@ private async Task Update3dsMethodCompletionIndicatorShouldThrowOnNullRequest() { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.Update3dsMethodCompletionIndicator(null, null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator(null, null, CancellationToken.None); } catch (Exception ex) { @@ -451,14 +469,14 @@ private async Task Update3dsMethodCompletionIndicatorShouldThrowOnNullRequest() try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.Update3dsMethodCompletionIndicator("id", null, CancellationToken.None); + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator("id", null, CancellationToken.None); } catch (Exception ex) { ex.ShouldNotBeNull(); ex.ShouldBeAssignableTo(typeof(CheckoutArgumentException)); - ex.Message.ShouldBe("threeDsMethodCompletionRequest cannot be null"); + ex.Message.ShouldBe("updateSessionThreedsMethodCompletionIndicatorRequest cannot be null"); } } @@ -467,8 +485,8 @@ private async Task Update3dsMethodCompletionIndicatorShouldThrowOnNullRequestSes { try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.Update3dsMethodCompletionIndicator("sessionSecret", null, null, + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator("sessionSecret", null, null, CancellationToken.None); } catch (Exception ex) @@ -480,22 +498,22 @@ await _sessionsClient.Update3dsMethodCompletionIndicator("sessionSecret", null, try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.Update3dsMethodCompletionIndicator("sessionSecret", "id", null, + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator("sessionSecret", "id", null, CancellationToken.None); } catch (Exception ex) { ex.ShouldNotBeNull(); ex.ShouldBeAssignableTo(typeof(CheckoutArgumentException)); - ex.Message.ShouldBe("threeDsMethodCompletionRequest cannot be null"); + ex.Message.ShouldBe("updateSessionThreedsMethodCompletionIndicatorRequest cannot be null"); } try { - _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); - await _sessionsClient.Update3dsMethodCompletionIndicator(null, "id", - new ThreeDsMethodCompletionRequest(), + _authenticationClient = new AuthenticationClient(_apiClient.Object, _configuration.Object); + await _authenticationClient.UpdateSessionThreedsMethodCompletionIndicator(null, "id", + new UpdateSessionThreedsMethodCompletionIndicatorRequest(), CancellationToken.None); } catch (Exception ex) diff --git a/test/CheckoutSdkTest/Sessions/CompleteSessionsIntegrationTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/CompleteSessionsIntegrationTest.cs similarity index 77% rename from test/CheckoutSdkTest/Sessions/CompleteSessionsIntegrationTest.cs rename to test/CheckoutSdkTest/Authentification/Standalone/CompleteSessionsIntegrationTest.cs index bad14ef0..cd513fd4 100644 --- a/test/CheckoutSdkTest/Sessions/CompleteSessionsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Authentification/Standalone/CompleteSessionsIntegrationTest.cs @@ -1,11 +1,13 @@ -using Shouldly; +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.Responses; +using Shouldly; using System; using System.Net; using System.Threading.Tasks; using Xunit; using Xunit.Sdk; -namespace Checkout.Sessions +namespace Checkout.Authentification.Standalone { public class CompleteSessionsIntegrationTest : AbstractSessionsIntegrationTest { @@ -25,10 +27,10 @@ private async Task ShouldTryToCompleteCardSessionBrowserSession(bool usingSessio created.Amount.ShouldNotBeNull(); created.Card.ShouldNotBeNull(); created.AuthenticationType.ShouldBe(AuthenticationType.Regular); - created.AuthenticationCategory.ShouldBe(Category.Payment); - created.Status.ShouldBe(SessionStatus.Pending); + created.AuthenticationCategory.ShouldBe(AuthenticationCategoryType.Payment); + created.Status.ShouldBe(StatusType.Pending); created.NextActions.Count.ShouldBe(1); - created.NextActions[0].ShouldBe(NextAction.RedirectCardholder); + created.NextActions[0].ShouldBe(NextActionsType.RedirectCardholder); created.GetSelfLink().ShouldNotBeNull(); created.GetLink("success_url").ShouldNotBeNull(); created.GetLink("failure_url").ShouldNotBeNull(); @@ -43,11 +45,11 @@ private async Task TryComplete(bool usingSessionSecret, string sessionId, string { if (!usingSessionSecret) { - await DefaultApi.SessionsClient().CompleteSession(sessionId); + await DefaultApi.AuthenticationClient().CompleteASession(sessionId); } else { - await DefaultApi.SessionsClient().CompleteSession(sessionSecret, sessionId); + await DefaultApi.AuthenticationClient().CompleteASession(sessionSecret, sessionId); } throw new XunitException(); diff --git a/test/CheckoutSdkTest/Sessions/RequestAndGetSessionsIntegrationTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/RequestAndGetSessionsIntegrationTest.cs similarity index 78% rename from test/CheckoutSdkTest/Sessions/RequestAndGetSessionsIntegrationTest.cs rename to test/CheckoutSdkTest/Authentification/Standalone/RequestAndGetSessionsIntegrationTest.cs index 074157c0..98c6cd0d 100644 --- a/test/CheckoutSdkTest/Sessions/RequestAndGetSessionsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Authentification/Standalone/RequestAndGetSessionsIntegrationTest.cs @@ -1,20 +1,24 @@ -using Checkout.Common; +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChannelData.AppChannelData; using Shouldly; using System.Collections.Generic; using System.Threading.Tasks; using Xunit; +using ChallengeIndicatorType = Checkout.Authentication.Standalone.POSTSessions.Requests.RequestASessionRequest.ChallengeIndicatorType; -namespace Checkout.Sessions +namespace Checkout.Authentification.Standalone { public class RequestAndGetSessionsIntegrationTest : AbstractSessionsIntegrationTest { [Theory] [MemberData(nameof(SessionsTypes))] - private async Task ShouldRequestAndGetCardSessionBrowserSession(Category category, + private async Task ShouldRequestAndGetCardSessionBrowserSession( + AuthenticationCategoryType category, ChallengeIndicatorType challengeIndicator, TransactionType transactionType) { - var browserSession = BrowserSession(); + var browserSession = BrowserChannelData(); var sessionResponse = await CreateNonHostedSession(browserSession, category, challengeIndicator, transactionType); @@ -33,18 +37,18 @@ private async Task ShouldRequestAndGetCardSessionBrowserSession(Category categor response.AuthenticationType.ShouldBe(AuthenticationType.Regular); response.AuthenticationCategory.ShouldBe(category); - response.Status.ShouldBe(SessionStatus.Challenged); + response.Status.ShouldBe(StatusType.Challenged); response.NextActions.Count.ShouldBe(1); - response.NextActions[0].ShouldBe(NextAction.ChallengeCardholder); + response.NextActions[0].ShouldBe(NextActionsType.ChallengeCardholder); response.TransactionType.ShouldBe(transactionType); - response.ResponseCode.ShouldBe(ResponseCode.C); + response.ResponseCode.ShouldBe(ResponseCodeType.C); response.AuthenticationDate.ShouldNotBeNull(); response.GetSelfLink().ShouldNotBeNull(); response.GetLink("callback_url").ShouldNotBeNull(); response.Completed.ShouldBe(false); - var getSessionResponse = await DefaultApi.SessionsClient().GetSessionDetails(response.Id); + var getSessionResponse = await DefaultApi.AuthenticationClient().GetSessionDetails(response.Id); getSessionResponse.ShouldNotBeNull(); @@ -58,11 +62,11 @@ private async Task ShouldRequestAndGetCardSessionBrowserSession(Category categor getSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular); getSessionResponse.AuthenticationCategory.ShouldBe(category); - getSessionResponse.Status.ShouldBe(SessionStatus.Challenged); + getSessionResponse.Status.ShouldBe(StatusType.Challenged); getSessionResponse.NextActions.Count.ShouldBe(1); - getSessionResponse.NextActions[0].ShouldBe(NextAction.ChallengeCardholder); + getSessionResponse.NextActions[0].ShouldBe(NextActionsType.ChallengeCardholder); getSessionResponse.TransactionType.ShouldBe(transactionType); - getSessionResponse.ResponseCode.ShouldBe(ResponseCode.C); + getSessionResponse.ResponseCode.ShouldBe(ResponseCodeType.C); response.AuthenticationDate.ShouldNotBeNull(); getSessionResponse.GetSelfLink().ShouldNotBeNull(); @@ -70,7 +74,7 @@ private async Task ShouldRequestAndGetCardSessionBrowserSession(Category categor getSessionResponse.Completed.ShouldBe(false); var getSessionSecretSessionResponse = - await DefaultApi.SessionsClient().GetSessionDetails(response.SessionSecret, response.Id); + await DefaultApi.AuthenticationClient().GetSessionDetails(response.SessionSecret, response.Id); getSessionSecretSessionResponse.Certificates.ShouldBeNull(); getSessionSecretSessionResponse.SessionSecret.ShouldBeNull(); @@ -84,24 +88,24 @@ private async Task ShouldRequestAndGetCardSessionBrowserSession(Category categor getSessionSecretSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular); getSessionSecretSessionResponse.AuthenticationCategory.ShouldBe(category); - getSessionSecretSessionResponse.Status.ShouldBe(SessionStatus.Challenged); + getSessionSecretSessionResponse.Status.ShouldBe(StatusType.Challenged); getSessionSecretSessionResponse.NextActions.Count.ShouldBe(1); - getSessionSecretSessionResponse.NextActions[0].ShouldBe(NextAction.ChallengeCardholder); + getSessionSecretSessionResponse.NextActions[0].ShouldBe(NextActionsType.ChallengeCardholder); getSessionSecretSessionResponse.TransactionType.ShouldBe(transactionType); - getSessionSecretSessionResponse.ResponseCode.ShouldBe(ResponseCode.C); + getSessionSecretSessionResponse.ResponseCode.ShouldBe(ResponseCodeType.C); getSessionResponse.GetSelfLink().ShouldNotBeNull(); getSessionResponse.GetLink("callback_url").ShouldNotBeNull(); getSessionResponse.Completed.ShouldBe(false); } - [Theory(Skip = "unstable")] + [Theory(Skip = "use on demand")] [MemberData(nameof(SessionsTypes))] - private async Task ShouldRequestAndGetCardSessionAppSession(Category category, + private async Task ShouldRequestAndGetCardSessionAppSession(AuthenticationCategoryType category, ChallengeIndicatorType challengeIndicator, TransactionType transactionType) { - var appSession = AppSession(); + var appSession = new AppChannelData(); var sessionResponse = await CreateNonHostedSession(appSession, category, challengeIndicator, transactionType); @@ -118,15 +122,15 @@ private async Task ShouldRequestAndGetCardSessionAppSession(Category category, response.AuthenticationType.ShouldBe(AuthenticationType.Regular); response.AuthenticationCategory.ShouldBe(category); - response.Status.ShouldBe(SessionStatus.Pending); + response.Status.ShouldBe(StatusType.Pending); response.NextActions.Count.ShouldBe(1); - response.NextActions[0].ShouldBe(NextAction.CollectChannelData); + response.NextActions[0].ShouldBe(NextActionsType.CollectChannelData); response.GetSelfLink().ShouldNotBeNull(); response.GetLink("callback_url").ShouldNotBeNull(); response.Completed.ShouldBe(false); - var getSessionResponse = await DefaultApi.SessionsClient().GetSessionDetails(response.Id); + var getSessionResponse = await DefaultApi.AuthenticationClient().GetSessionDetails(response.Id); getSessionResponse.ShouldNotBeNull(); @@ -141,9 +145,9 @@ private async Task ShouldRequestAndGetCardSessionAppSession(Category category, getSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular); getSessionResponse.AuthenticationCategory.ShouldBe(category); - getSessionResponse.Status.ShouldBe(SessionStatus.Pending); + getSessionResponse.Status.ShouldBe(StatusType.Pending); getSessionResponse.NextActions.Count.ShouldBe(1); - getSessionResponse.NextActions[0].ShouldBe(NextAction.CollectChannelData); + getSessionResponse.NextActions[0].ShouldBe(NextActionsType.CollectChannelData); getSessionResponse.TransactionType.ShouldBe(transactionType); getSessionResponse.ResponseCode.ShouldBeNull(); getSessionResponse.AuthenticationDate.ShouldNotBeNull(); @@ -153,13 +157,13 @@ private async Task ShouldRequestAndGetCardSessionAppSession(Category category, getSessionResponse.Completed.ShouldBe(false); } - [Theory(Skip = "unstable")] + [Theory(Skip = "use on demand")] [MemberData(nameof(SessionsTypes))] - private async Task ShouldRequestAndGetCardSessionMerchantInitiatedSession(Category category, + private async Task ShouldRequestAndGetCardSessionMerchantInitiatedSession(AuthenticationCategoryType category, ChallengeIndicatorType challengeIndicator, TransactionType transactionType) { - var merchantInitiatedSession = MerchantInitiatedSession(); + var merchantInitiatedSession = MerchantInitiatedChannelData(); var sessionResponse = await CreateNonHostedSession(merchantInitiatedSession, category, challengeIndicator, transactionType); @@ -178,16 +182,16 @@ private async Task ShouldRequestAndGetCardSessionMerchantInitiatedSession(Catego response.AuthenticationType.ShouldBe(AuthenticationType.Regular); response.AuthenticationCategory.ShouldBe(category); - response.Status.ShouldBe(SessionStatus.Unavailable); + response.Status.ShouldBe(StatusType.Unavailable); response.NextActions.Count.ShouldBe(1); - response.NextActions[0].ShouldBe(NextAction.Complete); + response.NextActions[0].ShouldBe(NextActionsType.Complete); response.TransactionType.ShouldBe(transactionType); response.GetSelfLink().ShouldNotBeNull(); response.GetLink("callback_url").ShouldNotBeNull(); response.Completed.ShouldBe(false); - var getSessionResponse = await DefaultApi.SessionsClient().GetSessionDetails(response.Id); + var getSessionResponse = await DefaultApi.AuthenticationClient().GetSessionDetails(response.Id); getSessionResponse.ShouldNotBeNull(); @@ -202,11 +206,11 @@ private async Task ShouldRequestAndGetCardSessionMerchantInitiatedSession(Catego getSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular); getSessionResponse.AuthenticationCategory.ShouldBe(category); - getSessionResponse.Status.ShouldBe(SessionStatus.Unavailable); + getSessionResponse.Status.ShouldBe(StatusType.Unavailable); getSessionResponse.NextActions.Count.ShouldBe(1); - getSessionResponse.NextActions[0].ShouldBe(NextAction.Complete); + getSessionResponse.NextActions[0].ShouldBe(NextActionsType.Complete); getSessionResponse.TransactionType.ShouldBe(transactionType); - getSessionResponse.ResponseCode.ShouldBe(ResponseCode.U); + getSessionResponse.ResponseCode.ShouldBe(ResponseCodeType.U); getSessionResponse.AuthenticationDate.ShouldNotBeNull(); getSessionResponse.GetSelfLink().ShouldNotBeNull(); @@ -217,15 +221,15 @@ private async Task ShouldRequestAndGetCardSessionMerchantInitiatedSession(Catego public static IEnumerable SessionsTypes => new List { - new object[] {Category.Payment, ChallengeIndicatorType.NoPreference, TransactionType.GoodsService}, + new object[] {AuthenticationCategoryType.Payment, ChallengeIndicatorType.NoPreference, TransactionType.GoodsService}, new object[] { - Category.NonPayment, ChallengeIndicatorType.ChallengeRequested, + AuthenticationCategoryType.NonPayment, ChallengeIndicatorType.ChallengeRequested, TransactionType.CheckAcceptance }, new object[] { - Category.NonPayment, ChallengeIndicatorType.ChallengeRequestedMandate, + AuthenticationCategoryType.NonPayment, ChallengeIndicatorType.ChallengeRequestedMandate, TransactionType.AccountFunding } }; diff --git a/test/CheckoutSdkTest/Sessions/SessionSecretSdkCredentialsTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/SessionSecretSdkCredentialsTest.cs similarity index 94% rename from test/CheckoutSdkTest/Sessions/SessionSecretSdkCredentialsTest.cs rename to test/CheckoutSdkTest/Authentification/Standalone/SessionSecretSdkCredentialsTest.cs index 55ee762e..ed001837 100644 --- a/test/CheckoutSdkTest/Sessions/SessionSecretSdkCredentialsTest.cs +++ b/test/CheckoutSdkTest/Authentification/Standalone/SessionSecretSdkCredentialsTest.cs @@ -1,9 +1,10 @@ -using Shouldly; +using Checkout.Authentication; +using Shouldly; using System; using Xunit; using Xunit.Sdk; -namespace Checkout.Sessions +namespace Checkout.Authentification.Standalone { public class SessionSecretSdkCredentialsTest { diff --git a/test/CheckoutSdkTest/Sessions/UpdateSessionsIntegrationTest.cs b/test/CheckoutSdkTest/Authentification/Standalone/UpdateSessionsIntegrationTest.cs similarity index 62% rename from test/CheckoutSdkTest/Sessions/UpdateSessionsIntegrationTest.cs rename to test/CheckoutSdkTest/Authentification/Standalone/UpdateSessionsIntegrationTest.cs index 2efb0569..3f22997f 100644 --- a/test/CheckoutSdkTest/Sessions/UpdateSessionsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Authentification/Standalone/UpdateSessionsIntegrationTest.cs @@ -1,10 +1,20 @@ -using Checkout.Sessions.Channel; +using Checkout.Authentication.Standalone.Common; +using Checkout.Authentication.Standalone.Common.Responses; +using Checkout.Authentication.Standalone.PUTSessionsIdCollectData.Responses.UpdateASessionResponseOk; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest; +using Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Responses. + UpdateSessionThreedsMethodCompletionIndicatorResponseOk; using Shouldly; using System.Threading; using System.Threading.Tasks; using Xunit; +using AuthenticationType = Checkout.Authentication.Standalone.Common.AuthenticationType; +using ThreeDsMethodCompletionType = + Checkout.Authentication.Standalone.PUTSessionsIdIssuerFingerprint.Requests. + UpdateSessionThreeDSMethodCompletionIndicatorRequest.ThreeDsMethodCompletionType; -namespace Checkout.Sessions +namespace Checkout.Authentification.Standalone { public class UpdateSessionsIntegrationTest : AbstractSessionsIntegrationTest { @@ -25,18 +35,20 @@ private async Task ShouldUpdateCardSessionUsingSessionSecret(bool usingSessionSe created.TransactionId.ShouldNotBeNull(); created.Amount.ShouldNotBeNull(); created.AuthenticationType.ShouldBe(AuthenticationType.Regular); - created.AuthenticationCategory.ShouldBe(Category.Payment); + created.AuthenticationCategory.ShouldBe(AuthenticationCategoryType.Payment); created.NextActions.Count.ShouldBe(1); - created.NextActions[0].ShouldBe(NextAction.RedirectCardholder); + created.NextActions[0].ShouldBe(NextActionsType.RedirectCardholder); created.GetSelfLink().ShouldNotBeNull(); created.GetLink("success_url").ShouldNotBeNull(); created.GetLink("failure_url").ShouldNotBeNull(); created.GetLink("redirect_url").ShouldNotBeNull(); - GetSessionResponse updated = usingSessionSecret - ? await DefaultApi.SessionsClient().UpdateSession(created.SessionSecret, created.Id, BrowserSession(), + UpdateASessionResponseOk updated = usingSessionSecret + ? await DefaultApi.AuthenticationClient().UpdateASession(created.SessionSecret, created.Id, + BrowserRequest(), CancellationToken.None) - : await DefaultApi.SessionsClient().UpdateSession(created.Id, BrowserSession(), CancellationToken.None); + : await DefaultApi.AuthenticationClient() + .UpdateASession(created.Id, BrowserRequest(), CancellationToken.None); updated.ShouldNotBeNull(); updated.HttpStatusCode.ShouldNotBeNull(); @@ -52,8 +64,8 @@ private async Task ShouldUpdateCardSessionUsingSessionSecret(bool usingSessionSe updated.Amount.ShouldNotBeNull(); updated.Card.ShouldNotBeNull(); updated.AuthenticationType.ShouldBe(AuthenticationType.Regular); - updated.AuthenticationCategory.ShouldBe(Category.Payment); - updated.Status.ShouldBe(SessionStatus.Approved); + updated.AuthenticationCategory.ShouldBe(AuthenticationCategoryType.Payment); + updated.Status.ShouldBe(StatusType.Approved); updated.NextActions.Count.ShouldBe(0); updated.GetSelfLink().ShouldNotBeNull(); updated.GetLink("success_url").ShouldNotBeNull(); @@ -61,7 +73,7 @@ private async Task ShouldUpdateCardSessionUsingSessionSecret(bool usingSessionSe updated.GetLink("redirect_url").ShouldBeNull(); } - [Fact(Skip = "Unavailable")] + [Fact] private async Task ShouldUpdateCardSession() { var createSessionResponse = await CreateHostedSession(); @@ -77,17 +89,17 @@ private async Task ShouldUpdateCardSession() created.Amount.ShouldNotBeNull(); created.Card.ShouldNotBeNull(); created.AuthenticationType.ShouldBe(AuthenticationType.Regular); - created.AuthenticationCategory.ShouldBe(Category.Payment); - created.Status.ShouldBe(SessionStatus.Pending); + created.AuthenticationCategory.ShouldBe(AuthenticationCategoryType.Payment); + created.Status.ShouldBe(StatusType.Pending); created.NextActions.Count.ShouldBe(1); - created.NextActions[0].ShouldBe(NextAction.RedirectCardholder); + created.NextActions[0].ShouldBe(NextActionsType.RedirectCardholder); created.GetSelfLink().ShouldNotBeNull(); created.GetLink("success_url").ShouldNotBeNull(); created.GetLink("failure_url").ShouldNotBeNull(); created.GetLink("redirect_url").ShouldNotBeNull(); - var updated = await DefaultApi.SessionsClient() - .UpdateSession(created.Id, AppSession(), CancellationToken.None); + var updated = await DefaultApi.AuthenticationClient() + .UpdateASession(created.Id, AppRequest(), CancellationToken.None); updated.ShouldNotBeNull(); updated.Id.ShouldNotBeNull(); @@ -95,14 +107,12 @@ private async Task ShouldUpdateCardSession() updated.Amount.ShouldNotBeNull(); updated.Card.ShouldNotBeNull(); updated.AuthenticationType.ShouldBe(AuthenticationType.Regular); - updated.AuthenticationCategory.ShouldBe(Category.Payment); - updated.Status.ShouldBe(SessionStatus.Challenged); - updated.NextActions.Count.ShouldBe(1); - updated.NextActions[0].ShouldBe(NextAction.RedirectCardholder); + updated.AuthenticationCategory.ShouldBe(AuthenticationCategoryType.Payment); + updated.Status.ShouldBe(StatusType.Unavailable); + updated.NextActions.Count.ShouldBe(0); updated.GetSelfLink().ShouldNotBeNull(); updated.GetLink("success_url").ShouldNotBeNull(); updated.GetLink("failure_url").ShouldNotBeNull(); - updated.GetLink("redirect_url").ShouldNotBeNull(); } [Theory] @@ -117,15 +127,16 @@ private async Task ShouldUpdate3dsMethodCompletionIndicator(bool usingSessionSec var created = createSessionResponse.Accepted; - var threeDsMethodCompletionRequest = new ThreeDsMethodCompletionRequest() + var threeDsMethodCompletionRequest = new UpdateSessionThreedsMethodCompletionIndicatorRequest() { - ThreeDsMethodCompletion = ThreeDsMethodCompletion.Y + ThreeDsMethodCompletion = ThreeDsMethodCompletionType.Y }; - GetSessionResponseAfterChannelDataSupplied updated = usingSessionSecret - ? await DefaultApi.SessionsClient().Update3dsMethodCompletionIndicator(created.Id, + UpdateSessionThreedsMethodCompletionIndicatorResponseOk updated = usingSessionSecret + ? await DefaultApi.AuthenticationClient().UpdateSessionThreedsMethodCompletionIndicator(created.Id, threeDsMethodCompletionRequest, CancellationToken.None) - : await DefaultApi.SessionsClient().Update3dsMethodCompletionIndicator(created.SessionSecret, created.Id, + : await DefaultApi.AuthenticationClient().UpdateSessionThreedsMethodCompletionIndicator( + created.SessionSecret, created.Id, threeDsMethodCompletionRequest, CancellationToken.None); updated.ShouldNotBeNull(); diff --git a/test/CheckoutSdkTest/CheckoutApiExceptionTests.cs b/test/CheckoutSdkTest/CheckoutApiExceptionTests.cs new file mode 100644 index 00000000..4559ec74 --- /dev/null +++ b/test/CheckoutSdkTest/CheckoutApiExceptionTests.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Xunit; + +namespace Checkout +{ + public class CheckoutExceptionTests + { + [Fact] + public async Task ShouldThrowCheckoutArgumentExceptionWithMessage() + { + var ex = await Assert.ThrowsAsync(() => + throw new CheckoutArgumentException("Argument error occurred")); + Assert.Equal("Argument error occurred", ex.Message); + } + + [Fact] + public async Task ShouldThrowCheckoutArgumentExceptionWithoutMessage() + { + var ex = await Assert.ThrowsAsync(() => + throw new CheckoutArgumentException(null)); + Assert.Equal("Exception of type 'Checkout.CheckoutArgumentException' was thrown.", ex.Message); + } + + [Fact] + public async Task ShouldThrowCheckoutAuthorizationExceptionWithMessage() + { + var ex = await Assert.ThrowsAsync(() => + throw new CheckoutAuthorizationException("Authorization error occurred")); + Assert.Equal("Authorization error occurred", ex.Message); + } + + [Theory] + [InlineData(SdkAuthorizationType.SecretKey)] + [InlineData(SdkAuthorizationType.PublicKey)] + [InlineData(SdkAuthorizationType.SecretKeyOrOAuth)] + [InlineData(SdkAuthorizationType.PublicKeyOrOAuth)] + [InlineData(SdkAuthorizationType.OAuth)] + [InlineData(SdkAuthorizationType.Custom)] + public async Task ShouldThrowInvalidAuthorization(SdkAuthorizationType authType) + { + var ex = await Assert.ThrowsAsync(() => + throw CheckoutAuthorizationException.InvalidAuthorization(authType)); + Assert.Contains($"{authType} authorization type", ex.Message); + } + + [Fact] + public void ShouldConstructApiExceptionWithFullData() + { + var details = new Dictionary + { + { "error_type", "request_invalid" }, + { "error_codes", new[] { "invalid_field" } }, + { "request_id", "req_123456" } + }; + + var exception = new CheckoutApiException("req_123456", HttpStatusCode.BadRequest, details); + + Assert.Equal("req_123456", exception.RequestId); + Assert.Equal(HttpStatusCode.BadRequest, exception.HttpStatusCode); + Assert.Equal(details, exception.ErrorDetails); + Assert.Contains("400", exception.Message); + } + + [Fact] + public void ShouldHandleApiExceptionWithoutDetails() + { + var exception = new CheckoutApiException("req_789", HttpStatusCode.InternalServerError, null); + + Assert.Equal("req_789", exception.RequestId); + Assert.Equal(HttpStatusCode.InternalServerError, exception.HttpStatusCode); + Assert.Null(exception.ErrorDetails); + } + + [Theory] + [InlineData(HttpStatusCode.BadRequest)] + [InlineData(HttpStatusCode.Unauthorized)] + [InlineData(HttpStatusCode.Forbidden)] + [InlineData(HttpStatusCode.NotFound)] + [InlineData(HttpStatusCode.InternalServerError)] + public void ShouldHandleApiExceptionWithVariousStatusCodes(HttpStatusCode code) + { + var exception = new CheckoutApiException($"req_{(int)code}", code, null); + + Assert.Equal(code, exception.HttpStatusCode); + Assert.Equal($"req_{(int)code}", exception.RequestId); + } + } +} diff --git a/test/CheckoutSdkTest/CheckoutApiTest.cs b/test/CheckoutSdkTest/CheckoutApiTest.cs index 44a939e2..77a9cab0 100644 --- a/test/CheckoutSdkTest/CheckoutApiTest.cs +++ b/test/CheckoutSdkTest/CheckoutApiTest.cs @@ -62,7 +62,7 @@ public void ShouldInstantiateAndRetrieveClientsDefault() checkoutApi.RiskClient().ShouldNotBeNull(); checkoutApi.ForexClient().ShouldNotBeNull(); checkoutApi.WorkflowsClient().ShouldNotBeNull(); - checkoutApi.SessionsClient().ShouldNotBeNull(); + checkoutApi.AuthenticationClient().ShouldNotBeNull(); checkoutApi.AccountsClient().ShouldNotBeNull(); checkoutApi.PaymentLinksClient().ShouldNotBeNull(); checkoutApi.HostedPaymentsClient().ShouldNotBeNull(); diff --git a/test/CheckoutSdkTest/Payments/Contexts/PaymentContextsIntegrationTest.cs b/test/CheckoutSdkTest/Payments/Contexts/PaymentContextsIntegrationTest.cs index 0fd1e44d..12603db0 100644 --- a/test/CheckoutSdkTest/Payments/Contexts/PaymentContextsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/Contexts/PaymentContextsIntegrationTest.cs @@ -1,7 +1,6 @@ +using Checkout.Authentication.Standalone.Common.MerchantRiskInfo; using Checkout.Common; -using Checkout.Payments.Request.Source.Apm; using Checkout.Payments.Request.Source.Contexts; -using Checkout.Sessions; using Shouldly; using System.Collections.Generic; using System.Threading.Tasks; @@ -151,7 +150,7 @@ private async Task ShouldGetAPaymentContext() Address = GetAddress(), Phone = GetPhone(), FromAddressZip = "43434", - Timeframe = DeliveryTimeframe.ElectronicDelivery, + Timeframe = DeliveryTimeframeType.ElectronicDelivery, Method = PaymentContextsShippingMethod.Digital, Delay = 0 }, diff --git a/test/CheckoutSdkTest/Payments/PaymentAuthorizationsIntegrationTest.cs b/test/CheckoutSdkTest/Payments/PaymentAuthorizationsIntegrationTest.cs index 46ed0147..e4f3fc94 100644 --- a/test/CheckoutSdkTest/Payments/PaymentAuthorizationsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/PaymentAuthorizationsIntegrationTest.cs @@ -100,7 +100,7 @@ private async Task MakeAuthorizationEstimatedPayment() { Enabled = true }, - Authentication = new Authentication + Authentication = new Request.Authentication { PreferredExperiences = new List { diff --git a/test/CheckoutSdkTest/Sessions/AbstractSessionsIntegrationTest.cs b/test/CheckoutSdkTest/Sessions/AbstractSessionsIntegrationTest.cs deleted file mode 100644 index 8c5d85a9..00000000 --- a/test/CheckoutSdkTest/Sessions/AbstractSessionsIntegrationTest.cs +++ /dev/null @@ -1,174 +0,0 @@ -using Checkout.Common; -using Checkout.Sessions.Channel; -using Checkout.Sessions.Completion; -using Checkout.Sessions.Source; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Checkout.Sessions -{ - public abstract class AbstractSessionsIntegrationTest : SandboxTestFixture - { - protected AbstractSessionsIntegrationTest() : base(PlatformType.DefaultOAuth) - { - } - - protected async Task CreateNonHostedSession(ChannelData channelData, - Category authenticationCategory, - ChallengeIndicatorType challengeIndicator, - TransactionType transactionType) - { - var billingAddress = new SessionAddress - { - AddressLine1 = "CheckoutSdk.com", - AddressLine2 = "90 Tottenham Court Road", - City = "London", - State = "ENG", - Country = CountryCode.GB - }; - - var source = new SessionCardSource - { - Number = TestCardSource.Visa.Number, - ExpiryMonth = TestCardSource.Visa.ExpiryMonth, - ExpiryYear = TestCardSource.Visa.ExpiryYear, - Name = "John Doe", - Email = GenerateRandomEmail(), - BillingAddress = billingAddress, - HomePhone = GetPhone(), - MobilePhone = GetPhone(), - WorkPhone = GetPhone() - }; - - var shippingAddress = new SessionAddress - { - AddressLine1 = "Checkout.com", - AddressLine2 = "ABC building", - AddressLine3 = "14 Wells Mews", - City = "London", - State = "ENG", - Zip = "W1T 4TJ", - Country = CountryCode.GB - }; - - var sessionRequest = new SessionRequest - { - Source = source, - Amount = 6540L, - Currency = Currency.USD, - ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), - Marketplace = new SessionMarketplaceData {SubEntityId = "ent_ocw5i74vowfg2edpy66izhts2u"}, - AuthenticationCategory = authenticationCategory, - ChallengeIndicator = challengeIndicator, - BillingDescriptor = new SessionsBillingDescriptor {Name = "SUPERHEROES.COM"}, - Reference = "ORD-5023-4E89", - TransactionType = transactionType, - ShippingAddress = shippingAddress, - Completion = new NonHostedCompletionInfo {CallbackUrl = "https://merchant.com/callback"}, - ChannelData = channelData - }; - - return await DefaultApi.SessionsClient().RequestSession(sessionRequest, CancellationToken.None); - } - - protected async Task CreateHostedSession() - { - var shippingAddress = new SessionAddress - { - AddressLine1 = "Checkout.com", - AddressLine2 = "90 Tottenham Court Road", - City = "London", - State = "ENG", - Country = CountryCode.GB, - Zip = "W1T 4TJ" - }; - - var sessionRequest = new SessionRequest - { - Source = new SessionCardSource {ExpiryMonth = 1, ExpiryYear = 2030, Number = "4485040371536584"}, - Amount = 100L, - Currency = Currency.USD, - ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), - AuthenticationType = AuthenticationType.Regular, - AuthenticationCategory = Category.Payment, - ChallengeIndicator = ChallengeIndicatorType.NoPreference, - Reference = "ORD-5023-4E89", - TransactionType = TransactionType.GoodsService, - ShippingAddress = shippingAddress, - Completion = new HostedCompletionInfo - { - FailureUrl = "https://example.com/sessions/fail", - SuccessUrl = "https://example.com/sessions/success", - } - }; - - return await Retriable( - async () => await DefaultApi.SessionsClient().RequestSession(sessionRequest, CancellationToken.None), - HasSessionAccepted); - } - - protected static ChannelData BrowserSession() - { - return new BrowserSession - { - AcceptHeader = "Accept: *.*, q=0.1", - JavaEnabled = true, - JavascriptEnabled = true, - Language = "FR-fr", - ColorDepth = "16", - ScreenWidth = "1920", - ScreenHeight = "1080", - Timezone = "60", - UserAgent = - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", - ThreeDsMethodCompletion = ThreeDsMethodCompletion.Y, - IpAddress = "1.12.123.255" - }; - } - - protected static ChannelData AppSession() - { - var sdkEphemeralPublicKey = new SdkEphemeralPublicKey - { - Kty = "EC", - Crv = "P-256", - X = "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", - Y = "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0" - }; - - var appSession = new AppSession - { - SdkAppId = "dbd64fcb-c19a-4728-8849-e3d50bfdde39", - SdkMaxTimeout = 5L, - SdkEncryptedData = "{}", - SdkEphemeralPublicKey = sdkEphemeralPublicKey, - SdkReferenceNumber = "3DS_LOA_SDK_PPFU_020100_00007", - SdkTransactionId = "b2385523-a66c-4907-ac3c-91848e8c0067", - SdkInterfaceType = SdkInterfaceType.Both, - SdkUIElements = new List {UIElements.SingleSelect, UIElements.HtmlOther} - }; - - return appSession; - } - - protected static ChannelData MerchantInitiatedSession() - { - return new MerchantInitiatedSession { RequestType = RequestType.RecurringTransaction }; - } - - private static bool HasSessionAccepted(SessionResponse obj) - { - return obj.Accepted != null && - obj.Accepted.Card != null; - } - - private static bool HasSessionCreated(SessionResponse obj) - { - return obj.Created != null && - obj.Created.Certificates != null && - obj.Created.Ds != null && - obj.Created.Card != null; - } - } -} \ No newline at end of file