From 8076a719c33fffb7a0f59314702fc4f0e047bf57 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 15 Feb 2019 06:38:47 -0600 Subject: [PATCH 001/160] Made ModelTests, ConfigTests, and ControllerTests targets dependencies of PayPalTests --- Package.swift | 2 +- Tests/ConfigTests/ConfigTests.swift | 2 +- Tests/ControllerTests/ControllerTests.swift | 2 +- Tests/PayPalTests/XCTestManifests.swift | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 9db414e5..3f139443 100644 --- a/Package.swift +++ b/Package.swift @@ -21,6 +21,6 @@ let package = Package( .testTarget(name: "ConfigTests", dependencies: ["PayPal", "TestUtilities"]), .testTarget(name: "ControllerTests", dependencies: ["PayPal", "SwiftGD", "TestUtilities"]), .testTarget(name: "ModelTests", dependencies: ["PayPal", "TestUtilities"]), - .testTarget(name: "PayPalTests", dependencies: ["PayPal", "Vapor", "JSON"]), + .testTarget(name: "PayPalTests", dependencies: ["PayPal", "Vapor", "JSON", "ConfigTests", "ControllerTests", "ModelTests"]), ] ) diff --git a/Tests/ConfigTests/ConfigTests.swift b/Tests/ConfigTests/ConfigTests.swift index 2348d536..4782e9ea 100644 --- a/Tests/ConfigTests/ConfigTests.swift +++ b/Tests/ConfigTests/ConfigTests.swift @@ -1 +1 @@ -@_exported import TestsUtilities +@_exported import TestUtilities diff --git a/Tests/ControllerTests/ControllerTests.swift b/Tests/ControllerTests/ControllerTests.swift index 2348d536..4782e9ea 100644 --- a/Tests/ControllerTests/ControllerTests.swift +++ b/Tests/ControllerTests/ControllerTests.swift @@ -1 +1 @@ -@_exported import TestsUtilities +@_exported import TestUtilities diff --git a/Tests/PayPalTests/XCTestManifests.swift b/Tests/PayPalTests/XCTestManifests.swift index 3b544f60..f71e57a0 100644 --- a/Tests/PayPalTests/XCTestManifests.swift +++ b/Tests/PayPalTests/XCTestManifests.swift @@ -1,4 +1,7 @@ import XCTest +import ModelTests +import ConfigTests +import ControllerTests #if !os(macOS) public func allTests() -> [XCTestCaseEntry] { From c16ba26c29b4fb343097965dcb0ee12c825d1cf6 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 27 Feb 2019 14:14:20 -0600 Subject: [PATCH 002/160] swift package update --- Package.resolved | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Package.resolved b/Package.resolved index 7076e693..93d2747a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/vapor/core.git", "state": { "branch": null, - "revision": "1794ff138bd669175a2528d27695028d7cb30471", - "version": "3.5.0" + "revision": "33e6b1a5fe0cfd06353022fe03a8da7bf7a1fb01", + "version": "3.6.0" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/vapor/crypto.git", "state": { "branch": null, - "revision": "bce9ac891c9b33fc045deda713e0d976d13b749a", - "version": "3.3.1" + "revision": "45bb12d13cdec80dbd1cc0685ea002e51ab83439", + "version": "3.3.2" } }, { @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/vapor/database-kit.git", "state": { "branch": null, - "revision": "3557894af50914e134803a684b42a9ea6eefaea2", - "version": "1.3.2" + "revision": "8f352c8e66dab301ab9bfef912a01ce1361ba1e4", + "version": "1.3.3" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/vapor/http.git", "state": { "branch": null, - "revision": "6973bf50dab8dd00e4daf8cb82ca72b33f5db016", - "version": "3.1.6" + "revision": "b57005e0de30ba36372ac41bfce1ac12b2bc3272", + "version": "3.1.8" } }, { @@ -87,8 +87,8 @@ "repositoryURL": "https://github.com/vapor/multipart.git", "state": { "branch": null, - "revision": "e57007c23a52b68e44ebdfc70cbe882a7c4f1ec3", - "version": "3.0.2" + "revision": "bd7736c5f28e48ed8b683dcc9df3dcd346064c2b", + "version": "3.0.3" } }, { @@ -96,8 +96,8 @@ "repositoryURL": "https://github.com/vapor/routing.git", "state": { "branch": null, - "revision": "3219e328491b0853b8554c5a694add344d2c6cfb", - "version": "3.0.1" + "revision": "626190ddd2bd9f967743b60ba6adaf90bbd2651c", + "version": "3.0.2" } }, { @@ -105,8 +105,8 @@ "repositoryURL": "https://github.com/vapor/service.git", "state": { "branch": null, - "revision": "281a70b69783891900be31a9e70051b6fe19e146", - "version": "1.0.0" + "revision": "4907311d7d7f609365982fa302b8b17ffdeb46da", + "version": "1.0.1" } }, { @@ -114,8 +114,8 @@ "repositoryURL": "https://github.com/apple/swift-nio.git", "state": { "branch": null, - "revision": "03c541a24dd0558c942b15d8464eb75d70a921c4", - "version": "1.12.1" + "revision": "98434c1f1d687ff5a24d2cabfbd19b5c7d2d7a2f", + "version": "1.13.0" } }, { @@ -186,8 +186,8 @@ "repositoryURL": "https://github.com/vapor/vapor.git", "state": { "branch": null, - "revision": "54cbf396147aba77ecb32e7fc75a3d13251551b1", - "version": "3.1.1" + "revision": "6c7284681c3432fee29c268babf954be6816cbfb", + "version": "3.2.2" } }, { From 0d87b4ad4d71e5dd6983ee93cc0069514259d2b2 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 27 Feb 2019 14:18:27 -0600 Subject: [PATCH 003/160] Removed redundant MultipartData: MultipartDataConvertible conformance --- Sources/PayPal/Utilities/MultipartRelatedCoding.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Sources/PayPal/Utilities/MultipartRelatedCoding.swift b/Sources/PayPal/Utilities/MultipartRelatedCoding.swift index d201b9ee..efbed3ef 100644 --- a/Sources/PayPal/Utilities/MultipartRelatedCoding.swift +++ b/Sources/PayPal/Utilities/MultipartRelatedCoding.swift @@ -23,14 +23,6 @@ extension MultipartPart { } } -extension MultipartPart: MultipartPartConvertible { - /// /// Converts `self` to `MultipartPart`. In other words, we return `self`. - public func convertToMultipartPart() throws -> MultipartPart { return self } - - /// Converts a `MultipartPart` to `Self`. In other words, we return what is passed in. - public static func convertFromMultipartPart(_ part: MultipartPart) throws -> MultipartPart { return part } -} - extension Dictionary where Key: LosslessStringConvertible, Value == MultipartPartConvertible { /// Converts an dictionary of `String: MultipartPartConvertible` objects to keyed `MultipartPart`s From c368437db16349cdedf5ac0f7708fc46e5dca40f Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Feb 2019 11:09:38 -0600 Subject: [PATCH 004/160] Organized ModelTests files into sub-directories --- Tests/ModelTests/{ => AccountTests}/AccountErrorDetailTests.swift | 0 Tests/ModelTests/{ => AccountTests}/AccountErrorTests.swift | 0 .../{ => AccountTests}/AccountOwnerRelationshipTests.swift | 0 .../{ => AccountTests}/AccountPermissionEnumTests.swift | 0 Tests/ModelTests/{ => AccountTests}/AccountPermissionTests.swift | 0 Tests/ModelTests/{ => AccountTests}/AccountRelationTests.swift | 0 .../ModelTests/{ => AccountTests}/AccountRelationTypeTests.swift | 0 Tests/ModelTests/{ => AccountTests}/AccountStatusTests.swift | 0 Tests/ModelTests/{ => AccountTests}/AccountTypeTests.swift | 0 Tests/ModelTests/{ => ActivityTests}/ActivityResponseTests.swift | 0 Tests/ModelTests/{ => ActivityTests}/ActivityTests.swift | 0 .../ModelTests/{ => AddressTests}/AddressNormalizationTests.swift | 0 Tests/ModelTests/{ => AddressTests}/AddressTests.swift | 0 .../{ => AppContextTests}/AppContextShippingTests.swift | 0 Tests/ModelTests/{ => AppContextTests}/AppContextTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingAgreementTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingInfoTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingPaymentTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingPlanListTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingPlanStateTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingPlanTests.swift | 0 Tests/ModelTests/{ => BillingTests}/BillingPlanTypeTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessNameTest.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessNameTypeTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessOwnerAddress.swift | 0 .../{ => BusinessTests}/BusinessOwnerAddressTypeTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessOwnerIDTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessOwnerIDType.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessOwnerTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessSubTypeTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessTests.swift | 0 Tests/ModelTests/{ => BusinessTests}/BusinessTypeTests.swift | 0 Tests/ModelTests/{ => CaptureTests}/CaptureReasonTests.swift | 0 Tests/ModelTests/{ => CaptureTests}/CaptureStatusTests.swift | 0 Tests/ModelTests/{ => CaptureTests}/CaptureTests.swift | 0 Tests/ModelTests/{ => CardTests}/CreditCardStateTests.swift | 0 Tests/ModelTests/{ => CardTests}/CreditCardTests.swift | 0 Tests/ModelTests/{ => CardTests}/CreditCardTokenTests.swift | 0 Tests/ModelTests/{ => CardTests}/CreditDebitCodeTests.swift | 0 Tests/ModelTests/{ => ChargeTests}/ChargeTests.swift | 0 Tests/ModelTests/{ => ChargeTests}/ChargeTypeTests.swift | 0 .../ModelTests/{ => CustomerTests}/CustomerDisputeListTests.swift | 0 Tests/ModelTests/{ => CustomerTests}/CustomerDisputeTests.swift | 0 .../{ => CustomerTests}/CustomerServiceMessageTests.swift | 0 .../{ => CustomerTests}/CustomerServiceMessageTypeTests.swift | 0 Tests/ModelTests/{ => CustomerTests}/CustomerServiceTests.swift | 0 Tests/ModelTests/{ => DetailedTests}/DetailTests.swift | 0 .../{ => DetailedTests}/DetailedAmountDetailTests.swift | 0 Tests/ModelTests/{ => DetailedTests}/DetailedAmountTests.swift | 0 .../ModelTests/{ => DisputeTests}/AcceptDisputeReasonTests.swift | 0 Tests/ModelTests/{ => DisputeTests}/AcceptDisputeTests.swift | 0 Tests/ModelTests/{ => DisputeTests}/DisputeChannelTests.swift | 0 .../ModelTests/{ => DisputeTests}/DisputeLifCycleStageTests.swift | 0 Tests/ModelTests/{ => DisputeTests}/DisputeOutcomeTests.swift | 0 Tests/ModelTests/{ => DisputeTests}/DisputeResolutionOffer.swift | 0 Tests/ModelTests/{ => DisputeTests}/DisputeStatusTests.swift | 0 Tests/ModelTests/{ => EmailTests}/CCEmailTests.swift | 0 Tests/ModelTests/{ => EmailTests}/EmailFrequencyTests.swift | 0 Tests/ModelTests/{ => ErrorTests}/PayPalAPIErrorTests.swift | 0 .../ModelTests/{ => ErrorTests}/PayPalAPIIdentityErrorTests.swift | 0 Tests/ModelTests/{ => EvidenceTests}/EvidenceInfoTests.swift | 0 Tests/ModelTests/{ => EvidenceTests}/EvidenceTests.swift | 0 Tests/ModelTests/{ => EvidenceTests}/EvidenceTypeTests.swift | 0 .../FinancialInstrumentAccountTypeTests.swift | 0 .../{ => FinancialTests}/FinancialInstrumentTests.swift | 0 .../{ => FinancialTests}/FinancialInstrumentTypeTests.swift | 0 .../{ => FraudTests}/FraudManagementFilterIDTests.swift | 0 .../ModelTests/{ => FraudTests}/FraudManagementFilterTests.swift | 0 .../{ => FraudTests}/FraudManagementFilterTypeTests.swift | 0 Tests/ModelTests/{ => FundingTests}/FundingInstrumentTests.swift | 0 Tests/ModelTests/{ => FundingTests}/FundingOptionTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceItemTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceListTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceMeasureTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoicePaymentTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceReminderTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceSearchTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceStatusTests.swift | 0 Tests/ModelTests/{ => InvoiceTests}/InvoiceTests.swift | 0 .../{ => LegalAgreementTests}/LegalAgreementTests.swift | 0 .../{ => LegalAgreementTests}/LegalAgreementTypeTests.swift | 0 Tests/ModelTests/{ => MerchantTests}/MerchantAccountTests.swift | 0 .../ModelTests/{ => MerchantTests}/MerchantPreferancesTests.swift | 0 Tests/ModelTests/{ => MessageTests}/MessagePosterTests.swift | 0 Tests/ModelTests/{ => MessageTests}/MessageTests.swift | 0 Tests/ModelTests/{ => MoneyTests}/MoneyRangeTests.swift | 0 Tests/ModelTests/{ => MoneyTests}/MoneyTests.swift | 0 Tests/ModelTests/{ => OfferTests}/OfferTests.swift | 0 Tests/ModelTests/{ => OfferTests}/OfferTypeTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderIntentTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderItemTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderMetadataTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPayerInfoTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPayerMethodTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPayerStatusTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPayerTaxTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPayerTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPaymentDetailTests.swift | 0 .../{ => OrderTests}/OrderPaymentDisbursementTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPaymentRequestTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderPaymentTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderRedirectsTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderStatusTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderUnitReasonTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderUnitStatusTests.swift | 0 Tests/ModelTests/{ => OrderTests}/OrderUnitTests.swift | 0 Tests/ModelTests/{ => PartnerTests}/PartnerFeeTests.swift | 0 Tests/ModelTests/{ => PartnerTests}/PartnerOptionsTests.swift | 0 Tests/ModelTests/{ => PayTests}/PayeeMetadataTests.swift | 0 Tests/ModelTests/{ => PayTests}/PayeeTests.swift | 0 Tests/ModelTests/{ => PayTests}/PayerInfoTests.swift | 0 Tests/ModelTests/{ => PayTests}/PayerTests.swift | 0 .../ModelTests/{ => PaymentTests}/PaymentDetailMethodTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentDetailTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentDetailTypeTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentExecutorTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentHoldTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentIntentTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentItemListTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentItemTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentListTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentMethodTests.swift | 0 .../ModelTests/{ => PaymentTests}/PaymentOptionsMethodTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentProtectionTests.swift | 0 .../{ => PaymentTests}/PaymentProtectionTypeTests.swift | 0 .../{ => PaymentTests}/PaymentReceivingPreferencesTests.swift | 0 .../ModelTests/{ => PaymentTests}/PaymentRefundResultTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentRefundStateTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentRefundTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentSaleModeTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentSaleReasonTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentSaleStateTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentStateTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentSummaryTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentTermTypeTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentTransactionTests.swift | 0 .../{ => PaymentTests}/PaymentTransactionTypeTests.swift | 0 Tests/ModelTests/{ => PaymentTests}/PaymentTypeTests.swift | 0 Tests/ModelTests/{ => PhoneTests}/PhoneNumberTests.swift | 0 Tests/ModelTests/{ => PhoneTests}/PhoneTypeTests.swift | 0 Tests/ModelTests/{ => PhoneTests}/TypedPhoneNumberTests.swift | 0 Tests/ModelTests/{ => RefundTests}/RefundDetailTests.swift | 0 Tests/ModelTests/{ => RefundTests}/RefundStatusTests.swift | 0 Tests/ModelTests/{ => RefundTests}/RefundTests.swift | 0 .../{ => RelatedResourceTests}/RelatedProcessorTests.swift | 0 .../RelatedResourceAuthorizationTests.swift | 0 .../{ => RelatedResourceTests}/RelatedResourceCaptureTests.swift | 0 .../{ => RelatedResourceTests}/RelatedResourceOrderTests.swift | 0 .../{ => RelatedResourceTests}/RelatedResourceRefundTests.swift | 0 .../{ => RelatedResourceTests}/RelatedResourceSaleTests.swift | 0 .../{ => RelatedResourceTests}/RelatedResourceTests.swift | 0 .../ResourceAuthorizationPaymentModeTests.swift | 0 .../{ => ResourceTests}/ResourceAuthorizationReasonTests.swift | 0 .../{ => ResourceTests}/ResourceAuthorizationStateTests.swift | 0 .../{ => ResourceTests}/ResourceCaptureReasonTests.swift | 0 .../{ => ResourceTests}/ResourceCaptureStateTests.swift | 0 .../{ => ResourceTests}/ResourceOrderPaymentModeTests.swift | 0 .../ModelTests/{ => ResourceTests}/ResourceOrderReasonTests.swift | 0 .../ModelTests/{ => ResourceTests}/ResourceOrderStateTests.swift | 0 .../{ => ResourceTests}/ResourceProcessorAdviceTests.swift | 0 .../ModelTests/{ => ResourceTests}/ResourceRefundStateTests.swift | 0 Tests/ModelTests/{ => SaleTests}/SaleStatusTests.swift | 0 Tests/ModelTests/{ => SaleTests}/SaleTests.swift | 0 Tests/ModelTests/{ => SaleTests}/SalesVenueTests.swift | 0 Tests/ModelTests/{ => SaleTests}/SellerTests.swift | 0 Tests/ModelTests/{ => ShippingTests}/ShippingCostsTests.swift | 0 Tests/ModelTests/{ => ShippingTests}/ShippingInfoTests.swift | 0 Tests/ModelTests/{ => StakeholderTests}/StakeholderTests.swift | 0 .../ModelTests/{ => StakeholderTests}/StakeholderTypeTests.swift | 0 Tests/ModelTests/{ => TemplateTests}/TemplateDataTests.swift | 0 .../ModelTests/{ => TemplateTests}/TemplateListFieldsTests.swift | 0 Tests/ModelTests/{ => TemplateTests}/TemplateListTests.swift | 0 .../{ => TemplateTests}/TemplateSettingFieldTests.swift | 0 .../{ => TemplateTests}/TemplateSettingsMetadataTests.swift | 0 Tests/ModelTests/{ => TemplateTests}/TemplateSettingsTests.swift | 0 Tests/ModelTests/{ => TemplateTests}/TemplateTests.swift | 0 Tests/ModelTests/{ => TermTests}/TermTests.swift | 0 Tests/ModelTests/{ => TermTests}/TermTypeTests.swift | 0 .../{ => TransactionTests}/TransactionInfoStatusTests.swift | 0 .../ModelTests/{ => TransactionTests}/TransactionInfoTests.swift | 0 .../ModelTests/{ => TransactionTests}/TransactionStateTests.swift | 0 Tests/ModelTests/{ => TransactionTests}/TransactionTests.swift | 0 Tests/ModelTests/{ => UserIntoTests}/UserInfoAddressTests.swift | 0 Tests/ModelTests/{ => UserIntoTests}/UserInfoTests.swift | 0 186 files changed, 0 insertions(+), 0 deletions(-) rename Tests/ModelTests/{ => AccountTests}/AccountErrorDetailTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountErrorTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountOwnerRelationshipTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountPermissionEnumTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountPermissionTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountRelationTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountRelationTypeTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountStatusTests.swift (100%) rename Tests/ModelTests/{ => AccountTests}/AccountTypeTests.swift (100%) rename Tests/ModelTests/{ => ActivityTests}/ActivityResponseTests.swift (100%) rename Tests/ModelTests/{ => ActivityTests}/ActivityTests.swift (100%) rename Tests/ModelTests/{ => AddressTests}/AddressNormalizationTests.swift (100%) rename Tests/ModelTests/{ => AddressTests}/AddressTests.swift (100%) rename Tests/ModelTests/{ => AppContextTests}/AppContextShippingTests.swift (100%) rename Tests/ModelTests/{ => AppContextTests}/AppContextTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingAgreementTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingInfoTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingPaymentTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingPlanListTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingPlanStateTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingPlanTests.swift (100%) rename Tests/ModelTests/{ => BillingTests}/BillingPlanTypeTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessNameTest.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessNameTypeTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessOwnerAddress.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessOwnerAddressTypeTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessOwnerIDTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessOwnerIDType.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessOwnerTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessSubTypeTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessTests.swift (100%) rename Tests/ModelTests/{ => BusinessTests}/BusinessTypeTests.swift (100%) rename Tests/ModelTests/{ => CaptureTests}/CaptureReasonTests.swift (100%) rename Tests/ModelTests/{ => CaptureTests}/CaptureStatusTests.swift (100%) rename Tests/ModelTests/{ => CaptureTests}/CaptureTests.swift (100%) rename Tests/ModelTests/{ => CardTests}/CreditCardStateTests.swift (100%) rename Tests/ModelTests/{ => CardTests}/CreditCardTests.swift (100%) rename Tests/ModelTests/{ => CardTests}/CreditCardTokenTests.swift (100%) rename Tests/ModelTests/{ => CardTests}/CreditDebitCodeTests.swift (100%) rename Tests/ModelTests/{ => ChargeTests}/ChargeTests.swift (100%) rename Tests/ModelTests/{ => ChargeTests}/ChargeTypeTests.swift (100%) rename Tests/ModelTests/{ => CustomerTests}/CustomerDisputeListTests.swift (100%) rename Tests/ModelTests/{ => CustomerTests}/CustomerDisputeTests.swift (100%) rename Tests/ModelTests/{ => CustomerTests}/CustomerServiceMessageTests.swift (100%) rename Tests/ModelTests/{ => CustomerTests}/CustomerServiceMessageTypeTests.swift (100%) rename Tests/ModelTests/{ => CustomerTests}/CustomerServiceTests.swift (100%) rename Tests/ModelTests/{ => DetailedTests}/DetailTests.swift (100%) rename Tests/ModelTests/{ => DetailedTests}/DetailedAmountDetailTests.swift (100%) rename Tests/ModelTests/{ => DetailedTests}/DetailedAmountTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/AcceptDisputeReasonTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/AcceptDisputeTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/DisputeChannelTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/DisputeLifCycleStageTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/DisputeOutcomeTests.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/DisputeResolutionOffer.swift (100%) rename Tests/ModelTests/{ => DisputeTests}/DisputeStatusTests.swift (100%) rename Tests/ModelTests/{ => EmailTests}/CCEmailTests.swift (100%) rename Tests/ModelTests/{ => EmailTests}/EmailFrequencyTests.swift (100%) rename Tests/ModelTests/{ => ErrorTests}/PayPalAPIErrorTests.swift (100%) rename Tests/ModelTests/{ => ErrorTests}/PayPalAPIIdentityErrorTests.swift (100%) rename Tests/ModelTests/{ => EvidenceTests}/EvidenceInfoTests.swift (100%) rename Tests/ModelTests/{ => EvidenceTests}/EvidenceTests.swift (100%) rename Tests/ModelTests/{ => EvidenceTests}/EvidenceTypeTests.swift (100%) rename Tests/ModelTests/{ => FinancialTests}/FinancialInstrumentAccountTypeTests.swift (100%) rename Tests/ModelTests/{ => FinancialTests}/FinancialInstrumentTests.swift (100%) rename Tests/ModelTests/{ => FinancialTests}/FinancialInstrumentTypeTests.swift (100%) rename Tests/ModelTests/{ => FraudTests}/FraudManagementFilterIDTests.swift (100%) rename Tests/ModelTests/{ => FraudTests}/FraudManagementFilterTests.swift (100%) rename Tests/ModelTests/{ => FraudTests}/FraudManagementFilterTypeTests.swift (100%) rename Tests/ModelTests/{ => FundingTests}/FundingInstrumentTests.swift (100%) rename Tests/ModelTests/{ => FundingTests}/FundingOptionTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceItemTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceListTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceMeasureTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoicePaymentTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceReminderTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceSearchTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceStatusTests.swift (100%) rename Tests/ModelTests/{ => InvoiceTests}/InvoiceTests.swift (100%) rename Tests/ModelTests/{ => LegalAgreementTests}/LegalAgreementTests.swift (100%) rename Tests/ModelTests/{ => LegalAgreementTests}/LegalAgreementTypeTests.swift (100%) rename Tests/ModelTests/{ => MerchantTests}/MerchantAccountTests.swift (100%) rename Tests/ModelTests/{ => MerchantTests}/MerchantPreferancesTests.swift (100%) rename Tests/ModelTests/{ => MessageTests}/MessagePosterTests.swift (100%) rename Tests/ModelTests/{ => MessageTests}/MessageTests.swift (100%) rename Tests/ModelTests/{ => MoneyTests}/MoneyRangeTests.swift (100%) rename Tests/ModelTests/{ => MoneyTests}/MoneyTests.swift (100%) rename Tests/ModelTests/{ => OfferTests}/OfferTests.swift (100%) rename Tests/ModelTests/{ => OfferTests}/OfferTypeTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderIntentTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderItemTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderMetadataTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPayerInfoTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPayerMethodTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPayerStatusTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPayerTaxTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPayerTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPaymentDetailTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPaymentDisbursementTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPaymentRequestTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderPaymentTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderRedirectsTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderStatusTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderUnitReasonTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderUnitStatusTests.swift (100%) rename Tests/ModelTests/{ => OrderTests}/OrderUnitTests.swift (100%) rename Tests/ModelTests/{ => PartnerTests}/PartnerFeeTests.swift (100%) rename Tests/ModelTests/{ => PartnerTests}/PartnerOptionsTests.swift (100%) rename Tests/ModelTests/{ => PayTests}/PayeeMetadataTests.swift (100%) rename Tests/ModelTests/{ => PayTests}/PayeeTests.swift (100%) rename Tests/ModelTests/{ => PayTests}/PayerInfoTests.swift (100%) rename Tests/ModelTests/{ => PayTests}/PayerTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentDetailMethodTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentDetailTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentDetailTypeTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentExecutorTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentHoldTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentIntentTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentItemListTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentItemTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentListTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentMethodTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentOptionsMethodTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentProtectionTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentProtectionTypeTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentReceivingPreferencesTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentRefundResultTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentRefundStateTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentRefundTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentSaleModeTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentSaleReasonTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentSaleStateTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentStateTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentSummaryTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentTermTypeTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentTransactionTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentTransactionTypeTests.swift (100%) rename Tests/ModelTests/{ => PaymentTests}/PaymentTypeTests.swift (100%) rename Tests/ModelTests/{ => PhoneTests}/PhoneNumberTests.swift (100%) rename Tests/ModelTests/{ => PhoneTests}/PhoneTypeTests.swift (100%) rename Tests/ModelTests/{ => PhoneTests}/TypedPhoneNumberTests.swift (100%) rename Tests/ModelTests/{ => RefundTests}/RefundDetailTests.swift (100%) rename Tests/ModelTests/{ => RefundTests}/RefundStatusTests.swift (100%) rename Tests/ModelTests/{ => RefundTests}/RefundTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedProcessorTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceAuthorizationTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceCaptureTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceOrderTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceRefundTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceSaleTests.swift (100%) rename Tests/ModelTests/{ => RelatedResourceTests}/RelatedResourceTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceAuthorizationPaymentModeTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceAuthorizationReasonTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceAuthorizationStateTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceCaptureReasonTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceCaptureStateTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceOrderPaymentModeTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceOrderReasonTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceOrderStateTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceProcessorAdviceTests.swift (100%) rename Tests/ModelTests/{ => ResourceTests}/ResourceRefundStateTests.swift (100%) rename Tests/ModelTests/{ => SaleTests}/SaleStatusTests.swift (100%) rename Tests/ModelTests/{ => SaleTests}/SaleTests.swift (100%) rename Tests/ModelTests/{ => SaleTests}/SalesVenueTests.swift (100%) rename Tests/ModelTests/{ => SaleTests}/SellerTests.swift (100%) rename Tests/ModelTests/{ => ShippingTests}/ShippingCostsTests.swift (100%) rename Tests/ModelTests/{ => ShippingTests}/ShippingInfoTests.swift (100%) rename Tests/ModelTests/{ => StakeholderTests}/StakeholderTests.swift (100%) rename Tests/ModelTests/{ => StakeholderTests}/StakeholderTypeTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateDataTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateListFieldsTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateListTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateSettingFieldTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateSettingsMetadataTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateSettingsTests.swift (100%) rename Tests/ModelTests/{ => TemplateTests}/TemplateTests.swift (100%) rename Tests/ModelTests/{ => TermTests}/TermTests.swift (100%) rename Tests/ModelTests/{ => TermTests}/TermTypeTests.swift (100%) rename Tests/ModelTests/{ => TransactionTests}/TransactionInfoStatusTests.swift (100%) rename Tests/ModelTests/{ => TransactionTests}/TransactionInfoTests.swift (100%) rename Tests/ModelTests/{ => TransactionTests}/TransactionStateTests.swift (100%) rename Tests/ModelTests/{ => TransactionTests}/TransactionTests.swift (100%) rename Tests/ModelTests/{ => UserIntoTests}/UserInfoAddressTests.swift (100%) rename Tests/ModelTests/{ => UserIntoTests}/UserInfoTests.swift (100%) diff --git a/Tests/ModelTests/AccountErrorDetailTests.swift b/Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift similarity index 100% rename from Tests/ModelTests/AccountErrorDetailTests.swift rename to Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift diff --git a/Tests/ModelTests/AccountErrorTests.swift b/Tests/ModelTests/AccountTests/AccountErrorTests.swift similarity index 100% rename from Tests/ModelTests/AccountErrorTests.swift rename to Tests/ModelTests/AccountTests/AccountErrorTests.swift diff --git a/Tests/ModelTests/AccountOwnerRelationshipTests.swift b/Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift similarity index 100% rename from Tests/ModelTests/AccountOwnerRelationshipTests.swift rename to Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift diff --git a/Tests/ModelTests/AccountPermissionEnumTests.swift b/Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift similarity index 100% rename from Tests/ModelTests/AccountPermissionEnumTests.swift rename to Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift diff --git a/Tests/ModelTests/AccountPermissionTests.swift b/Tests/ModelTests/AccountTests/AccountPermissionTests.swift similarity index 100% rename from Tests/ModelTests/AccountPermissionTests.swift rename to Tests/ModelTests/AccountTests/AccountPermissionTests.swift diff --git a/Tests/ModelTests/AccountRelationTests.swift b/Tests/ModelTests/AccountTests/AccountRelationTests.swift similarity index 100% rename from Tests/ModelTests/AccountRelationTests.swift rename to Tests/ModelTests/AccountTests/AccountRelationTests.swift diff --git a/Tests/ModelTests/AccountRelationTypeTests.swift b/Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift similarity index 100% rename from Tests/ModelTests/AccountRelationTypeTests.swift rename to Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift diff --git a/Tests/ModelTests/AccountStatusTests.swift b/Tests/ModelTests/AccountTests/AccountStatusTests.swift similarity index 100% rename from Tests/ModelTests/AccountStatusTests.swift rename to Tests/ModelTests/AccountTests/AccountStatusTests.swift diff --git a/Tests/ModelTests/AccountTypeTests.swift b/Tests/ModelTests/AccountTests/AccountTypeTests.swift similarity index 100% rename from Tests/ModelTests/AccountTypeTests.swift rename to Tests/ModelTests/AccountTests/AccountTypeTests.swift diff --git a/Tests/ModelTests/ActivityResponseTests.swift b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift similarity index 100% rename from Tests/ModelTests/ActivityResponseTests.swift rename to Tests/ModelTests/ActivityTests/ActivityResponseTests.swift diff --git a/Tests/ModelTests/ActivityTests.swift b/Tests/ModelTests/ActivityTests/ActivityTests.swift similarity index 100% rename from Tests/ModelTests/ActivityTests.swift rename to Tests/ModelTests/ActivityTests/ActivityTests.swift diff --git a/Tests/ModelTests/AddressNormalizationTests.swift b/Tests/ModelTests/AddressTests/AddressNormalizationTests.swift similarity index 100% rename from Tests/ModelTests/AddressNormalizationTests.swift rename to Tests/ModelTests/AddressTests/AddressNormalizationTests.swift diff --git a/Tests/ModelTests/AddressTests.swift b/Tests/ModelTests/AddressTests/AddressTests.swift similarity index 100% rename from Tests/ModelTests/AddressTests.swift rename to Tests/ModelTests/AddressTests/AddressTests.swift diff --git a/Tests/ModelTests/AppContextShippingTests.swift b/Tests/ModelTests/AppContextTests/AppContextShippingTests.swift similarity index 100% rename from Tests/ModelTests/AppContextShippingTests.swift rename to Tests/ModelTests/AppContextTests/AppContextShippingTests.swift diff --git a/Tests/ModelTests/AppContextTests.swift b/Tests/ModelTests/AppContextTests/AppContextTests.swift similarity index 100% rename from Tests/ModelTests/AppContextTests.swift rename to Tests/ModelTests/AppContextTests/AppContextTests.swift diff --git a/Tests/ModelTests/BillingAgreementTests.swift b/Tests/ModelTests/BillingTests/BillingAgreementTests.swift similarity index 100% rename from Tests/ModelTests/BillingAgreementTests.swift rename to Tests/ModelTests/BillingTests/BillingAgreementTests.swift diff --git a/Tests/ModelTests/BillingInfoTests.swift b/Tests/ModelTests/BillingTests/BillingInfoTests.swift similarity index 100% rename from Tests/ModelTests/BillingInfoTests.swift rename to Tests/ModelTests/BillingTests/BillingInfoTests.swift diff --git a/Tests/ModelTests/BillingPaymentTests.swift b/Tests/ModelTests/BillingTests/BillingPaymentTests.swift similarity index 100% rename from Tests/ModelTests/BillingPaymentTests.swift rename to Tests/ModelTests/BillingTests/BillingPaymentTests.swift diff --git a/Tests/ModelTests/BillingPlanListTests.swift b/Tests/ModelTests/BillingTests/BillingPlanListTests.swift similarity index 100% rename from Tests/ModelTests/BillingPlanListTests.swift rename to Tests/ModelTests/BillingTests/BillingPlanListTests.swift diff --git a/Tests/ModelTests/BillingPlanStateTests.swift b/Tests/ModelTests/BillingTests/BillingPlanStateTests.swift similarity index 100% rename from Tests/ModelTests/BillingPlanStateTests.swift rename to Tests/ModelTests/BillingTests/BillingPlanStateTests.swift diff --git a/Tests/ModelTests/BillingPlanTests.swift b/Tests/ModelTests/BillingTests/BillingPlanTests.swift similarity index 100% rename from Tests/ModelTests/BillingPlanTests.swift rename to Tests/ModelTests/BillingTests/BillingPlanTests.swift diff --git a/Tests/ModelTests/BillingPlanTypeTests.swift b/Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift similarity index 100% rename from Tests/ModelTests/BillingPlanTypeTests.swift rename to Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift diff --git a/Tests/ModelTests/BusinessNameTest.swift b/Tests/ModelTests/BusinessTests/BusinessNameTest.swift similarity index 100% rename from Tests/ModelTests/BusinessNameTest.swift rename to Tests/ModelTests/BusinessTests/BusinessNameTest.swift diff --git a/Tests/ModelTests/BusinessNameTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift similarity index 100% rename from Tests/ModelTests/BusinessNameTypeTests.swift rename to Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift diff --git a/Tests/ModelTests/BusinessOwnerAddress.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift similarity index 100% rename from Tests/ModelTests/BusinessOwnerAddress.swift rename to Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift diff --git a/Tests/ModelTests/BusinessOwnerAddressTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift similarity index 100% rename from Tests/ModelTests/BusinessOwnerAddressTypeTests.swift rename to Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift diff --git a/Tests/ModelTests/BusinessOwnerIDTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift similarity index 100% rename from Tests/ModelTests/BusinessOwnerIDTests.swift rename to Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift diff --git a/Tests/ModelTests/BusinessOwnerIDType.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift similarity index 100% rename from Tests/ModelTests/BusinessOwnerIDType.swift rename to Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift diff --git a/Tests/ModelTests/BusinessOwnerTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift similarity index 100% rename from Tests/ModelTests/BusinessOwnerTests.swift rename to Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift diff --git a/Tests/ModelTests/BusinessSubTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift similarity index 100% rename from Tests/ModelTests/BusinessSubTypeTests.swift rename to Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift diff --git a/Tests/ModelTests/BusinessTests.swift b/Tests/ModelTests/BusinessTests/BusinessTests.swift similarity index 100% rename from Tests/ModelTests/BusinessTests.swift rename to Tests/ModelTests/BusinessTests/BusinessTests.swift diff --git a/Tests/ModelTests/BusinessTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift similarity index 100% rename from Tests/ModelTests/BusinessTypeTests.swift rename to Tests/ModelTests/BusinessTests/BusinessTypeTests.swift diff --git a/Tests/ModelTests/CaptureReasonTests.swift b/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift similarity index 100% rename from Tests/ModelTests/CaptureReasonTests.swift rename to Tests/ModelTests/CaptureTests/CaptureReasonTests.swift diff --git a/Tests/ModelTests/CaptureStatusTests.swift b/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift similarity index 100% rename from Tests/ModelTests/CaptureStatusTests.swift rename to Tests/ModelTests/CaptureTests/CaptureStatusTests.swift diff --git a/Tests/ModelTests/CaptureTests.swift b/Tests/ModelTests/CaptureTests/CaptureTests.swift similarity index 100% rename from Tests/ModelTests/CaptureTests.swift rename to Tests/ModelTests/CaptureTests/CaptureTests.swift diff --git a/Tests/ModelTests/CreditCardStateTests.swift b/Tests/ModelTests/CardTests/CreditCardStateTests.swift similarity index 100% rename from Tests/ModelTests/CreditCardStateTests.swift rename to Tests/ModelTests/CardTests/CreditCardStateTests.swift diff --git a/Tests/ModelTests/CreditCardTests.swift b/Tests/ModelTests/CardTests/CreditCardTests.swift similarity index 100% rename from Tests/ModelTests/CreditCardTests.swift rename to Tests/ModelTests/CardTests/CreditCardTests.swift diff --git a/Tests/ModelTests/CreditCardTokenTests.swift b/Tests/ModelTests/CardTests/CreditCardTokenTests.swift similarity index 100% rename from Tests/ModelTests/CreditCardTokenTests.swift rename to Tests/ModelTests/CardTests/CreditCardTokenTests.swift diff --git a/Tests/ModelTests/CreditDebitCodeTests.swift b/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift similarity index 100% rename from Tests/ModelTests/CreditDebitCodeTests.swift rename to Tests/ModelTests/CardTests/CreditDebitCodeTests.swift diff --git a/Tests/ModelTests/ChargeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTests.swift similarity index 100% rename from Tests/ModelTests/ChargeTests.swift rename to Tests/ModelTests/ChargeTests/ChargeTests.swift diff --git a/Tests/ModelTests/ChargeTypeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift similarity index 100% rename from Tests/ModelTests/ChargeTypeTests.swift rename to Tests/ModelTests/ChargeTests/ChargeTypeTests.swift diff --git a/Tests/ModelTests/CustomerDisputeListTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift similarity index 100% rename from Tests/ModelTests/CustomerDisputeListTests.swift rename to Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift diff --git a/Tests/ModelTests/CustomerDisputeTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift similarity index 100% rename from Tests/ModelTests/CustomerDisputeTests.swift rename to Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift diff --git a/Tests/ModelTests/CustomerServiceMessageTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift similarity index 100% rename from Tests/ModelTests/CustomerServiceMessageTests.swift rename to Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift diff --git a/Tests/ModelTests/CustomerServiceMessageTypeTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift similarity index 100% rename from Tests/ModelTests/CustomerServiceMessageTypeTests.swift rename to Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift diff --git a/Tests/ModelTests/CustomerServiceTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift similarity index 100% rename from Tests/ModelTests/CustomerServiceTests.swift rename to Tests/ModelTests/CustomerTests/CustomerServiceTests.swift diff --git a/Tests/ModelTests/DetailTests.swift b/Tests/ModelTests/DetailedTests/DetailTests.swift similarity index 100% rename from Tests/ModelTests/DetailTests.swift rename to Tests/ModelTests/DetailedTests/DetailTests.swift diff --git a/Tests/ModelTests/DetailedAmountDetailTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift similarity index 100% rename from Tests/ModelTests/DetailedAmountDetailTests.swift rename to Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift diff --git a/Tests/ModelTests/DetailedAmountTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift similarity index 100% rename from Tests/ModelTests/DetailedAmountTests.swift rename to Tests/ModelTests/DetailedTests/DetailedAmountTests.swift diff --git a/Tests/ModelTests/AcceptDisputeReasonTests.swift b/Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift similarity index 100% rename from Tests/ModelTests/AcceptDisputeReasonTests.swift rename to Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift diff --git a/Tests/ModelTests/AcceptDisputeTests.swift b/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift similarity index 100% rename from Tests/ModelTests/AcceptDisputeTests.swift rename to Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift diff --git a/Tests/ModelTests/DisputeChannelTests.swift b/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift similarity index 100% rename from Tests/ModelTests/DisputeChannelTests.swift rename to Tests/ModelTests/DisputeTests/DisputeChannelTests.swift diff --git a/Tests/ModelTests/DisputeLifCycleStageTests.swift b/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift similarity index 100% rename from Tests/ModelTests/DisputeLifCycleStageTests.swift rename to Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift diff --git a/Tests/ModelTests/DisputeOutcomeTests.swift b/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift similarity index 100% rename from Tests/ModelTests/DisputeOutcomeTests.swift rename to Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift diff --git a/Tests/ModelTests/DisputeResolutionOffer.swift b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift similarity index 100% rename from Tests/ModelTests/DisputeResolutionOffer.swift rename to Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift diff --git a/Tests/ModelTests/DisputeStatusTests.swift b/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift similarity index 100% rename from Tests/ModelTests/DisputeStatusTests.swift rename to Tests/ModelTests/DisputeTests/DisputeStatusTests.swift diff --git a/Tests/ModelTests/CCEmailTests.swift b/Tests/ModelTests/EmailTests/CCEmailTests.swift similarity index 100% rename from Tests/ModelTests/CCEmailTests.swift rename to Tests/ModelTests/EmailTests/CCEmailTests.swift diff --git a/Tests/ModelTests/EmailFrequencyTests.swift b/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift similarity index 100% rename from Tests/ModelTests/EmailFrequencyTests.swift rename to Tests/ModelTests/EmailTests/EmailFrequencyTests.swift diff --git a/Tests/ModelTests/PayPalAPIErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift similarity index 100% rename from Tests/ModelTests/PayPalAPIErrorTests.swift rename to Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift diff --git a/Tests/ModelTests/PayPalAPIIdentityErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift similarity index 100% rename from Tests/ModelTests/PayPalAPIIdentityErrorTests.swift rename to Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift diff --git a/Tests/ModelTests/EvidenceInfoTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift similarity index 100% rename from Tests/ModelTests/EvidenceInfoTests.swift rename to Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift diff --git a/Tests/ModelTests/EvidenceTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTests.swift similarity index 100% rename from Tests/ModelTests/EvidenceTests.swift rename to Tests/ModelTests/EvidenceTests/EvidenceTests.swift diff --git a/Tests/ModelTests/EvidenceTypeTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift similarity index 100% rename from Tests/ModelTests/EvidenceTypeTests.swift rename to Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift diff --git a/Tests/ModelTests/FinancialInstrumentAccountTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift similarity index 100% rename from Tests/ModelTests/FinancialInstrumentAccountTypeTests.swift rename to Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift diff --git a/Tests/ModelTests/FinancialInstrumentTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift similarity index 100% rename from Tests/ModelTests/FinancialInstrumentTests.swift rename to Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift diff --git a/Tests/ModelTests/FinancialInstrumentTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift similarity index 100% rename from Tests/ModelTests/FinancialInstrumentTypeTests.swift rename to Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift diff --git a/Tests/ModelTests/FraudManagementFilterIDTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift similarity index 100% rename from Tests/ModelTests/FraudManagementFilterIDTests.swift rename to Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift diff --git a/Tests/ModelTests/FraudManagementFilterTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift similarity index 100% rename from Tests/ModelTests/FraudManagementFilterTests.swift rename to Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift diff --git a/Tests/ModelTests/FraudManagementFilterTypeTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift similarity index 100% rename from Tests/ModelTests/FraudManagementFilterTypeTests.swift rename to Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift diff --git a/Tests/ModelTests/FundingInstrumentTests.swift b/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift similarity index 100% rename from Tests/ModelTests/FundingInstrumentTests.swift rename to Tests/ModelTests/FundingTests/FundingInstrumentTests.swift diff --git a/Tests/ModelTests/FundingOptionTests.swift b/Tests/ModelTests/FundingTests/FundingOptionTests.swift similarity index 100% rename from Tests/ModelTests/FundingOptionTests.swift rename to Tests/ModelTests/FundingTests/FundingOptionTests.swift diff --git a/Tests/ModelTests/InvoiceItemTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceItemTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift diff --git a/Tests/ModelTests/InvoiceListTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceListTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceListTests.swift diff --git a/Tests/ModelTests/InvoiceMeasureTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceMeasureTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift diff --git a/Tests/ModelTests/InvoicePaymentTests.swift b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift similarity index 100% rename from Tests/ModelTests/InvoicePaymentTests.swift rename to Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift diff --git a/Tests/ModelTests/InvoiceReminderTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceReminderTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift diff --git a/Tests/ModelTests/InvoiceSearchTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceSearchTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift diff --git a/Tests/ModelTests/InvoiceStatusTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceStatusTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift diff --git a/Tests/ModelTests/InvoiceTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift similarity index 100% rename from Tests/ModelTests/InvoiceTests.swift rename to Tests/ModelTests/InvoiceTests/InvoiceTests.swift diff --git a/Tests/ModelTests/LegalAgreementTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift similarity index 100% rename from Tests/ModelTests/LegalAgreementTests.swift rename to Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift diff --git a/Tests/ModelTests/LegalAgreementTypeTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift similarity index 100% rename from Tests/ModelTests/LegalAgreementTypeTests.swift rename to Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift diff --git a/Tests/ModelTests/MerchantAccountTests.swift b/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift similarity index 100% rename from Tests/ModelTests/MerchantAccountTests.swift rename to Tests/ModelTests/MerchantTests/MerchantAccountTests.swift diff --git a/Tests/ModelTests/MerchantPreferancesTests.swift b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift similarity index 100% rename from Tests/ModelTests/MerchantPreferancesTests.swift rename to Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift diff --git a/Tests/ModelTests/MessagePosterTests.swift b/Tests/ModelTests/MessageTests/MessagePosterTests.swift similarity index 100% rename from Tests/ModelTests/MessagePosterTests.swift rename to Tests/ModelTests/MessageTests/MessagePosterTests.swift diff --git a/Tests/ModelTests/MessageTests.swift b/Tests/ModelTests/MessageTests/MessageTests.swift similarity index 100% rename from Tests/ModelTests/MessageTests.swift rename to Tests/ModelTests/MessageTests/MessageTests.swift diff --git a/Tests/ModelTests/MoneyRangeTests.swift b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift similarity index 100% rename from Tests/ModelTests/MoneyRangeTests.swift rename to Tests/ModelTests/MoneyTests/MoneyRangeTests.swift diff --git a/Tests/ModelTests/MoneyTests.swift b/Tests/ModelTests/MoneyTests/MoneyTests.swift similarity index 100% rename from Tests/ModelTests/MoneyTests.swift rename to Tests/ModelTests/MoneyTests/MoneyTests.swift diff --git a/Tests/ModelTests/OfferTests.swift b/Tests/ModelTests/OfferTests/OfferTests.swift similarity index 100% rename from Tests/ModelTests/OfferTests.swift rename to Tests/ModelTests/OfferTests/OfferTests.swift diff --git a/Tests/ModelTests/OfferTypeTests.swift b/Tests/ModelTests/OfferTests/OfferTypeTests.swift similarity index 100% rename from Tests/ModelTests/OfferTypeTests.swift rename to Tests/ModelTests/OfferTests/OfferTypeTests.swift diff --git a/Tests/ModelTests/OrderIntentTests.swift b/Tests/ModelTests/OrderTests/OrderIntentTests.swift similarity index 100% rename from Tests/ModelTests/OrderIntentTests.swift rename to Tests/ModelTests/OrderTests/OrderIntentTests.swift diff --git a/Tests/ModelTests/OrderItemTests.swift b/Tests/ModelTests/OrderTests/OrderItemTests.swift similarity index 100% rename from Tests/ModelTests/OrderItemTests.swift rename to Tests/ModelTests/OrderTests/OrderItemTests.swift diff --git a/Tests/ModelTests/OrderMetadataTests.swift b/Tests/ModelTests/OrderTests/OrderMetadataTests.swift similarity index 100% rename from Tests/ModelTests/OrderMetadataTests.swift rename to Tests/ModelTests/OrderTests/OrderMetadataTests.swift diff --git a/Tests/ModelTests/OrderPayerInfoTests.swift b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift similarity index 100% rename from Tests/ModelTests/OrderPayerInfoTests.swift rename to Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift diff --git a/Tests/ModelTests/OrderPayerMethodTests.swift b/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift similarity index 100% rename from Tests/ModelTests/OrderPayerMethodTests.swift rename to Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift diff --git a/Tests/ModelTests/OrderPayerStatusTests.swift b/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift similarity index 100% rename from Tests/ModelTests/OrderPayerStatusTests.swift rename to Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift diff --git a/Tests/ModelTests/OrderPayerTaxTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift similarity index 100% rename from Tests/ModelTests/OrderPayerTaxTests.swift rename to Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift diff --git a/Tests/ModelTests/OrderPayerTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTests.swift similarity index 100% rename from Tests/ModelTests/OrderPayerTests.swift rename to Tests/ModelTests/OrderTests/OrderPayerTests.swift diff --git a/Tests/ModelTests/OrderPaymentDetailTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift similarity index 100% rename from Tests/ModelTests/OrderPaymentDetailTests.swift rename to Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift diff --git a/Tests/ModelTests/OrderPaymentDisbursementTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift similarity index 100% rename from Tests/ModelTests/OrderPaymentDisbursementTests.swift rename to Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift diff --git a/Tests/ModelTests/OrderPaymentRequestTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift similarity index 100% rename from Tests/ModelTests/OrderPaymentRequestTests.swift rename to Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift diff --git a/Tests/ModelTests/OrderPaymentTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentTests.swift similarity index 100% rename from Tests/ModelTests/OrderPaymentTests.swift rename to Tests/ModelTests/OrderTests/OrderPaymentTests.swift diff --git a/Tests/ModelTests/OrderRedirectsTests.swift b/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift similarity index 100% rename from Tests/ModelTests/OrderRedirectsTests.swift rename to Tests/ModelTests/OrderTests/OrderRedirectsTests.swift diff --git a/Tests/ModelTests/OrderStatusTests.swift b/Tests/ModelTests/OrderTests/OrderStatusTests.swift similarity index 100% rename from Tests/ModelTests/OrderStatusTests.swift rename to Tests/ModelTests/OrderTests/OrderStatusTests.swift diff --git a/Tests/ModelTests/OrderTests.swift b/Tests/ModelTests/OrderTests/OrderTests.swift similarity index 100% rename from Tests/ModelTests/OrderTests.swift rename to Tests/ModelTests/OrderTests/OrderTests.swift diff --git a/Tests/ModelTests/OrderUnitReasonTests.swift b/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift similarity index 100% rename from Tests/ModelTests/OrderUnitReasonTests.swift rename to Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift diff --git a/Tests/ModelTests/OrderUnitStatusTests.swift b/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift similarity index 100% rename from Tests/ModelTests/OrderUnitStatusTests.swift rename to Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift diff --git a/Tests/ModelTests/OrderUnitTests.swift b/Tests/ModelTests/OrderTests/OrderUnitTests.swift similarity index 100% rename from Tests/ModelTests/OrderUnitTests.swift rename to Tests/ModelTests/OrderTests/OrderUnitTests.swift diff --git a/Tests/ModelTests/PartnerFeeTests.swift b/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift similarity index 100% rename from Tests/ModelTests/PartnerFeeTests.swift rename to Tests/ModelTests/PartnerTests/PartnerFeeTests.swift diff --git a/Tests/ModelTests/PartnerOptionsTests.swift b/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift similarity index 100% rename from Tests/ModelTests/PartnerOptionsTests.swift rename to Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift diff --git a/Tests/ModelTests/PayeeMetadataTests.swift b/Tests/ModelTests/PayTests/PayeeMetadataTests.swift similarity index 100% rename from Tests/ModelTests/PayeeMetadataTests.swift rename to Tests/ModelTests/PayTests/PayeeMetadataTests.swift diff --git a/Tests/ModelTests/PayeeTests.swift b/Tests/ModelTests/PayTests/PayeeTests.swift similarity index 100% rename from Tests/ModelTests/PayeeTests.swift rename to Tests/ModelTests/PayTests/PayeeTests.swift diff --git a/Tests/ModelTests/PayerInfoTests.swift b/Tests/ModelTests/PayTests/PayerInfoTests.swift similarity index 100% rename from Tests/ModelTests/PayerInfoTests.swift rename to Tests/ModelTests/PayTests/PayerInfoTests.swift diff --git a/Tests/ModelTests/PayerTests.swift b/Tests/ModelTests/PayTests/PayerTests.swift similarity index 100% rename from Tests/ModelTests/PayerTests.swift rename to Tests/ModelTests/PayTests/PayerTests.swift diff --git a/Tests/ModelTests/PaymentDetailMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift similarity index 100% rename from Tests/ModelTests/PaymentDetailMethodTests.swift rename to Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift diff --git a/Tests/ModelTests/PaymentDetailTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift similarity index 100% rename from Tests/ModelTests/PaymentDetailTests.swift rename to Tests/ModelTests/PaymentTests/PaymentDetailTests.swift diff --git a/Tests/ModelTests/PaymentDetailTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentDetailTypeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift diff --git a/Tests/ModelTests/PaymentExecutorTests.swift b/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift similarity index 100% rename from Tests/ModelTests/PaymentExecutorTests.swift rename to Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift diff --git a/Tests/ModelTests/PaymentHoldTests.swift b/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift similarity index 100% rename from Tests/ModelTests/PaymentHoldTests.swift rename to Tests/ModelTests/PaymentTests/PaymentHoldTests.swift diff --git a/Tests/ModelTests/PaymentIntentTests.swift b/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift similarity index 100% rename from Tests/ModelTests/PaymentIntentTests.swift rename to Tests/ModelTests/PaymentTests/PaymentIntentTests.swift diff --git a/Tests/ModelTests/PaymentItemListTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift similarity index 100% rename from Tests/ModelTests/PaymentItemListTests.swift rename to Tests/ModelTests/PaymentTests/PaymentItemListTests.swift diff --git a/Tests/ModelTests/PaymentItemTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemTests.swift similarity index 100% rename from Tests/ModelTests/PaymentItemTests.swift rename to Tests/ModelTests/PaymentTests/PaymentItemTests.swift diff --git a/Tests/ModelTests/PaymentListTests.swift b/Tests/ModelTests/PaymentTests/PaymentListTests.swift similarity index 100% rename from Tests/ModelTests/PaymentListTests.swift rename to Tests/ModelTests/PaymentTests/PaymentListTests.swift diff --git a/Tests/ModelTests/PaymentMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift similarity index 100% rename from Tests/ModelTests/PaymentMethodTests.swift rename to Tests/ModelTests/PaymentTests/PaymentMethodTests.swift diff --git a/Tests/ModelTests/PaymentOptionsMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift similarity index 100% rename from Tests/ModelTests/PaymentOptionsMethodTests.swift rename to Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift diff --git a/Tests/ModelTests/PaymentProtectionTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift similarity index 100% rename from Tests/ModelTests/PaymentProtectionTests.swift rename to Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift diff --git a/Tests/ModelTests/PaymentProtectionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentProtectionTypeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift diff --git a/Tests/ModelTests/PaymentReceivingPreferencesTests.swift b/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift similarity index 100% rename from Tests/ModelTests/PaymentReceivingPreferencesTests.swift rename to Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift diff --git a/Tests/ModelTests/PaymentRefundResultTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift similarity index 100% rename from Tests/ModelTests/PaymentRefundResultTests.swift rename to Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift diff --git a/Tests/ModelTests/PaymentRefundStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift similarity index 100% rename from Tests/ModelTests/PaymentRefundStateTests.swift rename to Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift diff --git a/Tests/ModelTests/PaymentRefundTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift similarity index 100% rename from Tests/ModelTests/PaymentRefundTests.swift rename to Tests/ModelTests/PaymentTests/PaymentRefundTests.swift diff --git a/Tests/ModelTests/PaymentSaleModeTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentSaleModeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift diff --git a/Tests/ModelTests/PaymentSaleReasonTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift similarity index 100% rename from Tests/ModelTests/PaymentSaleReasonTests.swift rename to Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift diff --git a/Tests/ModelTests/PaymentSaleStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift similarity index 100% rename from Tests/ModelTests/PaymentSaleStateTests.swift rename to Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift diff --git a/Tests/ModelTests/PaymentStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentStateTests.swift similarity index 100% rename from Tests/ModelTests/PaymentStateTests.swift rename to Tests/ModelTests/PaymentTests/PaymentStateTests.swift diff --git a/Tests/ModelTests/PaymentSummaryTests.swift b/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift similarity index 100% rename from Tests/ModelTests/PaymentSummaryTests.swift rename to Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift diff --git a/Tests/ModelTests/PaymentTermTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentTermTypeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift diff --git a/Tests/ModelTests/PaymentTests.swift b/Tests/ModelTests/PaymentTests/PaymentTests.swift similarity index 100% rename from Tests/ModelTests/PaymentTests.swift rename to Tests/ModelTests/PaymentTests/PaymentTests.swift diff --git a/Tests/ModelTests/PaymentTransactionTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift similarity index 100% rename from Tests/ModelTests/PaymentTransactionTests.swift rename to Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift diff --git a/Tests/ModelTests/PaymentTransactionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentTransactionTypeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift diff --git a/Tests/ModelTests/PaymentTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift similarity index 100% rename from Tests/ModelTests/PaymentTypeTests.swift rename to Tests/ModelTests/PaymentTests/PaymentTypeTests.swift diff --git a/Tests/ModelTests/PhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift similarity index 100% rename from Tests/ModelTests/PhoneNumberTests.swift rename to Tests/ModelTests/PhoneTests/PhoneNumberTests.swift diff --git a/Tests/ModelTests/PhoneTypeTests.swift b/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift similarity index 100% rename from Tests/ModelTests/PhoneTypeTests.swift rename to Tests/ModelTests/PhoneTests/PhoneTypeTests.swift diff --git a/Tests/ModelTests/TypedPhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift similarity index 100% rename from Tests/ModelTests/TypedPhoneNumberTests.swift rename to Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift diff --git a/Tests/ModelTests/RefundDetailTests.swift b/Tests/ModelTests/RefundTests/RefundDetailTests.swift similarity index 100% rename from Tests/ModelTests/RefundDetailTests.swift rename to Tests/ModelTests/RefundTests/RefundDetailTests.swift diff --git a/Tests/ModelTests/RefundStatusTests.swift b/Tests/ModelTests/RefundTests/RefundStatusTests.swift similarity index 100% rename from Tests/ModelTests/RefundStatusTests.swift rename to Tests/ModelTests/RefundTests/RefundStatusTests.swift diff --git a/Tests/ModelTests/RefundTests.swift b/Tests/ModelTests/RefundTests/RefundTests.swift similarity index 100% rename from Tests/ModelTests/RefundTests.swift rename to Tests/ModelTests/RefundTests/RefundTests.swift diff --git a/Tests/ModelTests/RelatedProcessorTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift similarity index 100% rename from Tests/ModelTests/RelatedProcessorTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift diff --git a/Tests/ModelTests/RelatedResourceAuthorizationTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceAuthorizationTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift diff --git a/Tests/ModelTests/RelatedResourceCaptureTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceCaptureTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift diff --git a/Tests/ModelTests/RelatedResourceOrderTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceOrderTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift diff --git a/Tests/ModelTests/RelatedResourceRefundTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceRefundTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift diff --git a/Tests/ModelTests/RelatedResourceSaleTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceSaleTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift diff --git a/Tests/ModelTests/RelatedResourceTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift similarity index 100% rename from Tests/ModelTests/RelatedResourceTests.swift rename to Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift diff --git a/Tests/ModelTests/ResourceAuthorizationPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift similarity index 100% rename from Tests/ModelTests/ResourceAuthorizationPaymentModeTests.swift rename to Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift diff --git a/Tests/ModelTests/ResourceAuthorizationReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift similarity index 100% rename from Tests/ModelTests/ResourceAuthorizationReasonTests.swift rename to Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift diff --git a/Tests/ModelTests/ResourceAuthorizationStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift similarity index 100% rename from Tests/ModelTests/ResourceAuthorizationStateTests.swift rename to Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift diff --git a/Tests/ModelTests/ResourceCaptureReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift similarity index 100% rename from Tests/ModelTests/ResourceCaptureReasonTests.swift rename to Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift diff --git a/Tests/ModelTests/ResourceCaptureStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift similarity index 100% rename from Tests/ModelTests/ResourceCaptureStateTests.swift rename to Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift diff --git a/Tests/ModelTests/ResourceOrderPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift similarity index 100% rename from Tests/ModelTests/ResourceOrderPaymentModeTests.swift rename to Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift diff --git a/Tests/ModelTests/ResourceOrderReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift similarity index 100% rename from Tests/ModelTests/ResourceOrderReasonTests.swift rename to Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift diff --git a/Tests/ModelTests/ResourceOrderStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift similarity index 100% rename from Tests/ModelTests/ResourceOrderStateTests.swift rename to Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift diff --git a/Tests/ModelTests/ResourceProcessorAdviceTests.swift b/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift similarity index 100% rename from Tests/ModelTests/ResourceProcessorAdviceTests.swift rename to Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift diff --git a/Tests/ModelTests/ResourceRefundStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift similarity index 100% rename from Tests/ModelTests/ResourceRefundStateTests.swift rename to Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift diff --git a/Tests/ModelTests/SaleStatusTests.swift b/Tests/ModelTests/SaleTests/SaleStatusTests.swift similarity index 100% rename from Tests/ModelTests/SaleStatusTests.swift rename to Tests/ModelTests/SaleTests/SaleStatusTests.swift diff --git a/Tests/ModelTests/SaleTests.swift b/Tests/ModelTests/SaleTests/SaleTests.swift similarity index 100% rename from Tests/ModelTests/SaleTests.swift rename to Tests/ModelTests/SaleTests/SaleTests.swift diff --git a/Tests/ModelTests/SalesVenueTests.swift b/Tests/ModelTests/SaleTests/SalesVenueTests.swift similarity index 100% rename from Tests/ModelTests/SalesVenueTests.swift rename to Tests/ModelTests/SaleTests/SalesVenueTests.swift diff --git a/Tests/ModelTests/SellerTests.swift b/Tests/ModelTests/SaleTests/SellerTests.swift similarity index 100% rename from Tests/ModelTests/SellerTests.swift rename to Tests/ModelTests/SaleTests/SellerTests.swift diff --git a/Tests/ModelTests/ShippingCostsTests.swift b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift similarity index 100% rename from Tests/ModelTests/ShippingCostsTests.swift rename to Tests/ModelTests/ShippingTests/ShippingCostsTests.swift diff --git a/Tests/ModelTests/ShippingInfoTests.swift b/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift similarity index 100% rename from Tests/ModelTests/ShippingInfoTests.swift rename to Tests/ModelTests/ShippingTests/ShippingInfoTests.swift diff --git a/Tests/ModelTests/StakeholderTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift similarity index 100% rename from Tests/ModelTests/StakeholderTests.swift rename to Tests/ModelTests/StakeholderTests/StakeholderTests.swift diff --git a/Tests/ModelTests/StakeholderTypeTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift similarity index 100% rename from Tests/ModelTests/StakeholderTypeTests.swift rename to Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift diff --git a/Tests/ModelTests/TemplateDataTests.swift b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift similarity index 100% rename from Tests/ModelTests/TemplateDataTests.swift rename to Tests/ModelTests/TemplateTests/TemplateDataTests.swift diff --git a/Tests/ModelTests/TemplateListFieldsTests.swift b/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift similarity index 100% rename from Tests/ModelTests/TemplateListFieldsTests.swift rename to Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift diff --git a/Tests/ModelTests/TemplateListTests.swift b/Tests/ModelTests/TemplateTests/TemplateListTests.swift similarity index 100% rename from Tests/ModelTests/TemplateListTests.swift rename to Tests/ModelTests/TemplateTests/TemplateListTests.swift diff --git a/Tests/ModelTests/TemplateSettingFieldTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift similarity index 100% rename from Tests/ModelTests/TemplateSettingFieldTests.swift rename to Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift diff --git a/Tests/ModelTests/TemplateSettingsMetadataTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift similarity index 100% rename from Tests/ModelTests/TemplateSettingsMetadataTests.swift rename to Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift diff --git a/Tests/ModelTests/TemplateSettingsTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift similarity index 100% rename from Tests/ModelTests/TemplateSettingsTests.swift rename to Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift diff --git a/Tests/ModelTests/TemplateTests.swift b/Tests/ModelTests/TemplateTests/TemplateTests.swift similarity index 100% rename from Tests/ModelTests/TemplateTests.swift rename to Tests/ModelTests/TemplateTests/TemplateTests.swift diff --git a/Tests/ModelTests/TermTests.swift b/Tests/ModelTests/TermTests/TermTests.swift similarity index 100% rename from Tests/ModelTests/TermTests.swift rename to Tests/ModelTests/TermTests/TermTests.swift diff --git a/Tests/ModelTests/TermTypeTests.swift b/Tests/ModelTests/TermTests/TermTypeTests.swift similarity index 100% rename from Tests/ModelTests/TermTypeTests.swift rename to Tests/ModelTests/TermTests/TermTypeTests.swift diff --git a/Tests/ModelTests/TransactionInfoStatusTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift similarity index 100% rename from Tests/ModelTests/TransactionInfoStatusTests.swift rename to Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift diff --git a/Tests/ModelTests/TransactionInfoTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift similarity index 100% rename from Tests/ModelTests/TransactionInfoTests.swift rename to Tests/ModelTests/TransactionTests/TransactionInfoTests.swift diff --git a/Tests/ModelTests/TransactionStateTests.swift b/Tests/ModelTests/TransactionTests/TransactionStateTests.swift similarity index 100% rename from Tests/ModelTests/TransactionStateTests.swift rename to Tests/ModelTests/TransactionTests/TransactionStateTests.swift diff --git a/Tests/ModelTests/TransactionTests.swift b/Tests/ModelTests/TransactionTests/TransactionTests.swift similarity index 100% rename from Tests/ModelTests/TransactionTests.swift rename to Tests/ModelTests/TransactionTests/TransactionTests.swift diff --git a/Tests/ModelTests/UserInfoAddressTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift similarity index 100% rename from Tests/ModelTests/UserInfoAddressTests.swift rename to Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift diff --git a/Tests/ModelTests/UserInfoTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoTests.swift similarity index 100% rename from Tests/ModelTests/UserInfoTests.swift rename to Tests/ModelTests/UserIntoTests/UserInfoTests.swift From 70fbdc66a846ebc3182766c71874a148a30c3daf Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Feb 2019 13:11:08 -0600 Subject: [PATCH 005/160] Made all test suites public --- Tests/ConfigTests/EnvironmentTests.swift | 2 +- Tests/ConfigTests/ProviderTests.swift | 4 ++-- Tests/ControllerTests/APITests.swift | 4 ++-- Tests/ControllerTests/ActivitiesTests.swift | 4 ++-- Tests/ControllerTests/AuthenticationTests.swift | 4 ++-- Tests/ControllerTests/BillingAgreementsTests.swift | 4 ++-- Tests/ControllerTests/BillingPlansTests.swift | 4 ++-- Tests/ControllerTests/CustomerDiputesTests.swift | 4 ++-- Tests/ControllerTests/IdentityTests.swift | 4 ++-- Tests/ControllerTests/InvoicesTests.swift | 4 ++-- Tests/ControllerTests/ManagedAccountsTests.swift | 4 ++-- Tests/ControllerTests/OrdersTests.swift | 4 ++-- Tests/ControllerTests/PaymentsTests.swift | 4 ++-- Tests/ControllerTests/TemplatesTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountErrorTests.swift | 4 ++-- .../AccountTests/AccountOwnerRelationshipTests.swift | 4 ++-- .../ModelTests/AccountTests/AccountPermissionEnumTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountPermissionTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountRelationTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountStatusTests.swift | 4 ++-- Tests/ModelTests/AccountTests/AccountTypeTests.swift | 4 ++-- Tests/ModelTests/ActivityTests/ActivityResponseTests.swift | 4 ++-- Tests/ModelTests/ActivityTests/ActivityTests.swift | 4 ++-- Tests/ModelTests/AddressTests/AddressNormalizationTests.swift | 4 ++-- Tests/ModelTests/AddressTests/AddressTests.swift | 4 ++-- Tests/ModelTests/AdjudicationOutcomeTests.swift | 4 ++-- Tests/ModelTests/AgreementStateTests.swift | 4 ++-- .../ModelTests/AppContextTests/AppContextShippingTests.swift | 4 ++-- Tests/ModelTests/AppContextTests/AppContextTests.swift | 4 ++-- Tests/ModelTests/AutoBillTests.swift | 4 ++-- Tests/ModelTests/BalanceResponseTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingAgreementTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingInfoTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingPaymentTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingPlanListTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingPlanStateTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingPlanTests.swift | 4 ++-- Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift | 4 ++-- Tests/ModelTests/BusinessTests/BusinessNameTest.swift | 4 ++-- Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift | 4 ++-- Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift | 2 +- .../BusinessTests/BusinessOwnerAddressTypeTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessTypeTests.swift | 2 +- Tests/ModelTests/BuyerTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureReasonTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureStatusTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardStateTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardTokenTests.swift | 2 +- Tests/ModelTests/CardTests/CreditDebitCodeTests.swift | 2 +- Tests/ModelTests/CarrierTests.swift | 2 +- Tests/ModelTests/ChargeTests/ChargeTests.swift | 2 +- Tests/ModelTests/ChargeTests/ChargeTypeTests.swift | 2 +- Tests/ModelTests/CounterPartyTests.swift | 2 +- Tests/ModelTests/CreatedMerchantResponseTests.swift | 2 +- Tests/ModelTests/CurrencyTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift | 2 +- .../CustomerTests/CustomerServiceMessageTests.swift | 2 +- .../CustomerTests/CustomerServiceMessageTypeTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerServiceTests.swift | 2 +- Tests/ModelTests/DesignationTests.swift | 2 +- Tests/ModelTests/DetailedTests/DetailTests.swift | 2 +- .../ModelTests/DetailedTests/DetailedAmountDetailTests.swift | 2 +- Tests/ModelTests/DetailedTests/DetailedAmountTests.swift | 2 +- Tests/ModelTests/DiscountTests.swift | 2 +- Tests/ModelTests/DisplayPhoneTests.swift | 2 +- Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift | 4 ++-- Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift | 4 ++-- Tests/ModelTests/DisputeTests/DisputeChannelTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeStatusTests.swift | 2 +- Tests/ModelTests/DocumentTests.swift | 2 +- Tests/ModelTests/EmailTests/CCEmailTests.swift | 2 +- Tests/ModelTests/EmailTests/EmailFrequencyTests.swift | 2 +- Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift | 2 +- Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift | 2 +- Tests/ModelTests/EstablishmentTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift | 2 +- Tests/ModelTests/ExtensionsTests.swift | 2 +- Tests/ModelTests/FileAttachmentTests.swift | 2 +- .../FinancialTests/FinancialInstrumentAccountTypeTests.swift | 2 +- .../ModelTests/FinancialTests/FinancialInstrumentTests.swift | 2 +- .../FinancialTests/FinancialInstrumentTypeTests.swift | 2 +- .../ModelTests/FraudTests/FraudManagementFilterIDTests.swift | 2 +- Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift | 2 +- .../FraudTests/FraudManagementFilterTypeTests.swift | 2 +- Tests/ModelTests/FrequencyTests.swift | 2 +- Tests/ModelTests/FundingTests/FundingInstrumentTests.swift | 2 +- Tests/ModelTests/FundingTests/FundingOptionTests.swift | 2 +- Tests/ModelTests/GovernmentBodyTests.swift | 2 +- Tests/ModelTests/IDTests.swift | 2 +- Tests/ModelTests/InitialFailActionTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceListTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceTests.swift | 2 +- Tests/ModelTests/ItemReason.swift | 2 +- Tests/ModelTests/KeyValueTests.swift | 2 +- .../ModelTests/LegalAgreementTests/LegalAgreementTests.swift | 2 +- .../LegalAgreementTests/LegalAgreementTypeTests.swift | 2 +- Tests/ModelTests/LinkDescriptionTests.swift | 2 +- Tests/ModelTests/MerchantTests/MerchantAccountTests.swift | 2 +- Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift | 2 +- Tests/ModelTests/MessageTests/MessagePosterTests.swift | 2 +- Tests/ModelTests/MessageTests/MessageTests.swift | 2 +- Tests/ModelTests/MetadataTests.swift | 2 +- Tests/ModelTests/MethodTests.swift | 2 +- Tests/ModelTests/MoneyTests/MoneyRangeTests.swift | 2 +- Tests/ModelTests/MoneyTests/MoneyTests.swift | 2 +- Tests/ModelTests/NameTests.swift | 2 +- Tests/ModelTests/NewAgreementTests.swift | 2 +- Tests/ModelTests/NotificationOptionTests.swift | 2 +- Tests/ModelTests/OfferTests/OfferTests.swift | 2 +- Tests/ModelTests/OfferTests/OfferTypeTests.swift | 2 +- Tests/ModelTests/OperationTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderIntentTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderItemTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderMetadataTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift | 2 +- .../ModelTests/OrderTests/OrderPaymentDisbursementTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderRedirectsTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitTests.swift | 2 +- Tests/ModelTests/OutcomeCodeTests.swift | 2 +- Tests/ModelTests/OverrideChargeTests.swift | 2 +- Tests/ModelTests/ParticipantTests.swift | 2 +- Tests/ModelTests/PartnerTests/PartnerFeeTests.swift | 2 +- Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift | 2 +- Tests/ModelTests/PatchTests.swift | 2 +- Tests/ModelTests/PayTests/PayeeMetadataTests.swift | 2 +- Tests/ModelTests/PayTests/PayeeTests.swift | 2 +- Tests/ModelTests/PayTests/PayerInfoTests.swift | 2 +- Tests/ModelTests/PayTests/PayerTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentHoldTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentIntentTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentItemListTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentItemTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentListTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift | 2 +- .../ModelTests/PaymentTests/PaymentProtectionTypeTests.swift | 2 +- .../PaymentTests/PaymentReceivingPreferencesTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift | 2 +- .../ModelTests/PaymentTests/PaymentTransactionTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTypeTests.swift | 2 +- Tests/ModelTests/PercentRangeTests.swift | 2 +- Tests/ModelTests/PhoneTests/PhoneNumberTests.swift | 2 +- Tests/ModelTests/PhoneTests/PhoneTypeTests.swift | 2 +- Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift | 2 +- Tests/ModelTests/ProductTests/ProductGrantedPermission.swift | 2 +- Tests/ModelTests/ProductTests/ProductNameTests.swift | 2 +- Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift | 2 +- Tests/ModelTests/QueryParameterTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundDetailTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundStatusTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundTests.swift | 2 +- .../RelatedResourceTests/RelatedProcessorTests.swift | 2 +- .../RelatedResourceAuthorizationTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceCaptureTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceOrderTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceRefundTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceSaleTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationPaymentModeTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationReasonTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationStateTests.swift | 2 +- .../ModelTests/ResourceTests/ResourceCaptureReasonTests.swift | 2 +- .../ModelTests/ResourceTests/ResourceCaptureStateTests.swift | 2 +- .../ResourceTests/ResourceOrderPaymentModeTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift | 2 +- .../ResourceTests/ResourceProcessorAdviceTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift | 2 +- Tests/ModelTests/RoleTests.swift | 2 +- Tests/ModelTests/SaleTests/SaleStatusTests.swift | 2 +- Tests/ModelTests/SaleTests/SaleTests.swift | 2 +- Tests/ModelTests/SaleTests/SalesVenueTests.swift | 2 +- Tests/ModelTests/SaleTests/SellerTests.swift | 2 +- Tests/ModelTests/ShippingTests/ShippingCostsTests.swift | 2 +- Tests/ModelTests/ShippingTests/ShippingInfoTests.swift | 2 +- Tests/ModelTests/SignupOptionsTests.swift | 2 +- Tests/ModelTests/StakeholderTests/StakeholderTests.swift | 2 +- Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift | 2 +- Tests/ModelTests/TaxTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateDataTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateListTests.swift | 2 +- .../ModelTests/TemplateTests/TemplateSettingFieldTests.swift | 2 +- .../TemplateTests/TemplateSettingsMetadataTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateTests.swift | 2 +- Tests/ModelTests/TermTests/TermTests.swift | 2 +- Tests/ModelTests/TermTests/TermTypeTests.swift | 2 +- Tests/ModelTests/TimelessDateTests.swift | 2 +- Tests/ModelTests/TrackingTests.swift | 2 +- .../TransactionTests/TransactionInfoStatusTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionInfoTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionStateTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionTests.swift | 2 +- Tests/ModelTests/UpdateActionTests.swift | 2 +- Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift | 2 +- Tests/ModelTests/UserIntoTests/UserInfoTests.swift | 2 +- Tests/ModelTests/VenueTests.swift | 2 +- Tests/PayPalTests/PayPalTests.swift | 2 +- 246 files changed, 289 insertions(+), 289 deletions(-) diff --git a/Tests/ConfigTests/EnvironmentTests.swift b/Tests/ConfigTests/EnvironmentTests.swift index 6a385d4e..d1817404 100644 --- a/Tests/ConfigTests/EnvironmentTests.swift +++ b/Tests/ConfigTests/EnvironmentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class EnvironmentTests: XCTestCase { +public final class EnvironmentTests: XCTestCase { func testCaseRawValues() { XCTAssertEqual(Environment.production.rawValue, "production") XCTAssertEqual(Environment.sandbox.rawValue, "sandbox") diff --git a/Tests/ConfigTests/ProviderTests.swift b/Tests/ConfigTests/ProviderTests.swift index b8cb14ec..cc657001 100644 --- a/Tests/ConfigTests/ProviderTests.swift +++ b/Tests/ConfigTests/ProviderTests.swift @@ -2,11 +2,11 @@ import XCTest import Vapor @testable import PayPal -final class ProviderTests: XCTestCase { +public final class ProviderTests: XCTestCase { var environment: Vapor.Environment = .testing var app: Application! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/APITests.swift b/Tests/ControllerTests/APITests.swift index 31f620c2..e4dafac2 100644 --- a/Tests/ControllerTests/APITests.swift +++ b/Tests/ControllerTests/APITests.swift @@ -2,11 +2,11 @@ import XCTest import Vapor @testable import PayPal -final class APITests: XCTestCase { +public final class APITests: XCTestCase { var app: Application! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/ActivitiesTests.swift b/Tests/ControllerTests/ActivitiesTests.swift index af45cc99..6910d58f 100644 --- a/Tests/ControllerTests/ActivitiesTests.swift +++ b/Tests/ControllerTests/ActivitiesTests.swift @@ -2,11 +2,11 @@ import XCTest import Vapor @testable import PayPal -final class ActivitiesTests: XCTestCase { +public final class ActivitiesTests: XCTestCase { var app: Application! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/AuthenticationTests.swift b/Tests/ControllerTests/AuthenticationTests.swift index f5df6f63..a2d610e8 100644 --- a/Tests/ControllerTests/AuthenticationTests.swift +++ b/Tests/ControllerTests/AuthenticationTests.swift @@ -2,11 +2,11 @@ import XCTest import Vapor @testable import PayPal -final class AuthenticationTests: XCTestCase { +public final class AuthenticationTests: XCTestCase { var app: Application! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/BillingAgreementsTests.swift b/Tests/ControllerTests/BillingAgreementsTests.swift index b7f60d4f..f43edc6e 100644 --- a/Tests/ControllerTests/BillingAgreementsTests.swift +++ b/Tests/ControllerTests/BillingAgreementsTests.swift @@ -2,12 +2,12 @@ import XCTest import Vapor @testable import PayPal -final class BillingAgreementsTests: XCTestCase { +public final class BillingAgreementsTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/BillingPlansTests.swift b/Tests/ControllerTests/BillingPlansTests.swift index 3b5656d2..264f2499 100644 --- a/Tests/ControllerTests/BillingPlansTests.swift +++ b/Tests/ControllerTests/BillingPlansTests.swift @@ -2,12 +2,12 @@ import XCTest import Vapor @testable import PayPal -final class BillingPlansTests: XCTestCase { +public final class BillingPlansTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/CustomerDiputesTests.swift b/Tests/ControllerTests/CustomerDiputesTests.swift index 68f2b1ea..a224978d 100644 --- a/Tests/ControllerTests/CustomerDiputesTests.swift +++ b/Tests/ControllerTests/CustomerDiputesTests.swift @@ -3,12 +3,12 @@ import Vapor @testable import NIO @testable import PayPal -final class CustomerDisputesTests: XCTestCase { +public final class CustomerDisputesTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/IdentityTests.swift b/Tests/ControllerTests/IdentityTests.swift index 9833344a..cff61606 100644 --- a/Tests/ControllerTests/IdentityTests.swift +++ b/Tests/ControllerTests/IdentityTests.swift @@ -2,11 +2,11 @@ import XCTest import Vapor @testable import PayPal -final class IdentityTests: XCTestCase { +public final class IdentityTests: XCTestCase { var app: Application! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/InvoicesTests.swift b/Tests/ControllerTests/InvoicesTests.swift index f8b14ac6..6a1a076a 100644 --- a/Tests/ControllerTests/InvoicesTests.swift +++ b/Tests/ControllerTests/InvoicesTests.swift @@ -3,12 +3,12 @@ import Vapor import SwiftGD @testable import PayPal -final class InvoicesTests: XCTestCase { +public final class InvoicesTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/ManagedAccountsTests.swift b/Tests/ControllerTests/ManagedAccountsTests.swift index a895f714..19aea151 100644 --- a/Tests/ControllerTests/ManagedAccountsTests.swift +++ b/Tests/ControllerTests/ManagedAccountsTests.swift @@ -2,12 +2,12 @@ import XCTest import Vapor @testable import PayPal -final class ManagedAccountsTests: XCTestCase { +public final class ManagedAccountsTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/OrdersTests.swift b/Tests/ControllerTests/OrdersTests.swift index 084eddd7..d1b98525 100644 --- a/Tests/ControllerTests/OrdersTests.swift +++ b/Tests/ControllerTests/OrdersTests.swift @@ -2,7 +2,7 @@ import XCTest import Vapor @testable import PayPal -final class OrdersTests: XCTestCase { +public final class OrdersTests: XCTestCase { var app: Application! var id: String? @@ -140,7 +140,7 @@ final class OrdersTests: XCTestCase { XCTAssertEqual(order.id, id) } - static var allTests: [(String, (OrdersTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrdersTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoints", testCreateEndpoints), ("testCancelEndpoints", testCancelEndpoints), diff --git a/Tests/ControllerTests/PaymentsTests.swift b/Tests/ControllerTests/PaymentsTests.swift index 4850d9c4..eac8f0b4 100644 --- a/Tests/ControllerTests/PaymentsTests.swift +++ b/Tests/ControllerTests/PaymentsTests.swift @@ -2,13 +2,13 @@ import XCTest import Vapor @testable import PayPal -final class PaymentsTests: XCTestCase { +public final class PaymentsTests: XCTestCase { var id: String! var app: Application! var context: PaymentTestsContext! - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ControllerTests/TemplatesTests.swift b/Tests/ControllerTests/TemplatesTests.swift index 331c4f4e..dca7093e 100644 --- a/Tests/ControllerTests/TemplatesTests.swift +++ b/Tests/ControllerTests/TemplatesTests.swift @@ -2,12 +2,12 @@ import XCTest import Vapor @testable import PayPal -final class TemplatesTests: XCTestCase { +public final class TemplatesTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() diff --git a/Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift b/Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift index 2fa51be2..c541be7a 100644 --- a/Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift +++ b/Tests/ModelTests/AccountTests/AccountErrorDetailTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountErrorDetailTests: XCTestCase { +public final class AccountErrorDetailTests: XCTestCase { func testInit()throws { let details = AccountError.Details(issue: "1028", field: "property", value: "value", description: "Oops") @@ -44,7 +44,7 @@ final class AccountErrorDetailTests: XCTestCase { try XCTAssertEqual(details, decoder.decode(AccountError.Details.self, from: json)) } - static var allTests: [(String, (AccountErrorDetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountErrorDetailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AccountTests/AccountErrorTests.swift b/Tests/ModelTests/AccountTests/AccountErrorTests.swift index 7b7e3958..d900b32f 100644 --- a/Tests/ModelTests/AccountTests/AccountErrorTests.swift +++ b/Tests/ModelTests/AccountTests/AccountErrorTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountErrorTests: XCTestCase { +public final class AccountErrorTests: XCTestCase { func testInit()throws { let error = AccountError(name: "invalidTimezone", message: "Chosen timezone does not appear to exist", debug: "5698", details: []) @@ -41,7 +41,7 @@ final class AccountErrorTests: XCTestCase { XCTAssertEqual(error.information, "https://example.com/errors/5698") } - static var allTests: [(String, (AccountErrorTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountErrorTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift b/Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift index 430d81c0..20353878 100644 --- a/Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift +++ b/Tests/ModelTests/AccountTests/AccountOwnerRelationshipTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountOwnerRelationshipTests: XCTestCase { +public final class AccountOwnerRelationshipTests: XCTestCase { func testInit()throws { let relationship = try AccountOwnerRelationship( name: Name(prefix: nil, given: .init("Abe"), surname: .init("Lincon"), middle: nil, suffix: nil, full: .init("Abe Lincon")), @@ -68,7 +68,7 @@ final class AccountOwnerRelationshipTests: XCTestCase { try XCTAssertEqual(relationship, decoder.decode(AccountOwnerRelationship.self, from: json)) } - static var allTests: [(String, (AccountOwnerRelationshipTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountOwnerRelationshipTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift b/Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift index f83b762a..d7134a37 100644 --- a/Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift +++ b/Tests/ModelTests/AccountTests/AccountPermissionEnumTests.swift @@ -3,7 +3,7 @@ import XCTest private typealias Permission = AccountPermission.Permission -final class AccountPermissionEnumTests: XCTestCase { +public final class AccountPermissionEnumTests: XCTestCase { private struct Account: Codable { let permission: Permission } @@ -60,7 +60,7 @@ final class AccountPermissionEnumTests: XCTestCase { try XCTAssertEqual(decoder.decode(Account.self, from: extendedProProcessing).permission, .extendedProProcessing) } - static var allTests: [(String, (AccountPermissionEnumTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountPermissionEnumTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AccountTests/AccountPermissionTests.swift b/Tests/ModelTests/AccountTests/AccountPermissionTests.swift index b6b487be..c4b69071 100644 --- a/Tests/ModelTests/AccountTests/AccountPermissionTests.swift +++ b/Tests/ModelTests/AccountTests/AccountPermissionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountPermissionTests: XCTestCase { +public final class AccountPermissionTests: XCTestCase { func testInit()throws { let permission = AccountPermission(thirdParty: "FDF4D16C-11C0-4792-A956-6A3A9D8B49C2", permissions: [.directPayment]) @@ -32,7 +32,7 @@ final class AccountPermissionTests: XCTestCase { try XCTAssertEqual(permission, decoder.decode(AccountPermission.self, from: json)) } - static var allTests: [(String, (AccountPermissionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountPermissionTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AccountTests/AccountRelationTests.swift b/Tests/ModelTests/AccountTests/AccountRelationTests.swift index 2752db3f..c02c3a0d 100644 --- a/Tests/ModelTests/AccountTests/AccountRelationTests.swift +++ b/Tests/ModelTests/AccountTests/AccountRelationTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountRelationTests: XCTestCase { +public final class AccountRelationTests: XCTestCase { func testInit()throws { let relation = AccountRelation(type: .partner, payer: "0F1B22C3-C58C-4CC8-AF83-85659455F85F") @@ -30,7 +30,7 @@ final class AccountRelationTests: XCTestCase { try XCTAssertEqual(relation, decoder.decode(AccountRelation.self, from: json)) } - static var allTests: [(String, (AccountRelationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountRelationTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift b/Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift index 5a0fba8d..d7030a9c 100644 --- a/Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift +++ b/Tests/ModelTests/AccountTests/AccountRelationTypeTests.swift @@ -3,7 +3,7 @@ import XCTest typealias RelationType = AccountRelation.RelationType -final class AccountRelationTypeTests: XCTestCase { +public final class AccountRelationTypeTests: XCTestCase { struct Relation: Codable { let type: RelationType } @@ -44,7 +44,7 @@ final class AccountRelationTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Relation.self, from: same).type, .same) } - static var allTests: [(String, (AccountRelationTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountRelationTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AccountTests/AccountStatusTests.swift b/Tests/ModelTests/AccountTests/AccountStatusTests.swift index b9d08680..69c7371b 100644 --- a/Tests/ModelTests/AccountTests/AccountStatusTests.swift +++ b/Tests/ModelTests/AccountTests/AccountStatusTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountStatusTests: XCTestCase { +public final class AccountStatusTests: XCTestCase { struct Account: Codable { let status: AccountStatus } @@ -43,7 +43,7 @@ final class AccountStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Account.self, from: pua).status, .pua) } - static var allTests: [(String, (AccountStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AccountTests/AccountTypeTests.swift b/Tests/ModelTests/AccountTests/AccountTypeTests.swift index 13a172f2..6d029514 100644 --- a/Tests/ModelTests/AccountTests/AccountTypeTests.swift +++ b/Tests/ModelTests/AccountTests/AccountTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AccountTypeTests: XCTestCase { +public final class AccountTypeTests: XCTestCase { struct Account: Codable { let type: UserInfo.AccountType } @@ -43,7 +43,7 @@ final class AccountTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Account.self, from: personal).type, .personal) } - static var allTests: [(String, (AccountTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AccountTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift index 4acf1145..fbb26922 100644 --- a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift @@ -2,7 +2,7 @@ import XCTest @testable import PayPal @available(OSX 10.12, *) -final class ActivityResponseTests: XCTestCase { +public final class ActivityResponseTests: XCTestCase { let response = Activity.Response(items: [ Activity( id: "94C67654-A41B-4421-B0D0-81E6CD587CDB", @@ -117,7 +117,7 @@ final class ActivityResponseTests: XCTestCase { XCTAssertEqual(self.response, decoded) } - static var allTests: [(String, (ActivityResponseTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ActivityResponseTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ActivityTests/ActivityTests.swift b/Tests/ModelTests/ActivityTests/ActivityTests.swift index 12630372..8c9d6cd2 100644 --- a/Tests/ModelTests/ActivityTests/ActivityTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ActivityTests: XCTestCase { +public final class ActivityTests: XCTestCase { let activity = Activity( id: "94C67654-A41B-4421-B0D0-81E6CD587CDB", timeCreated: Date(iso8601: "2018-07-12T14:14:56Z")!, @@ -72,7 +72,7 @@ final class ActivityTests: XCTestCase { XCTAssertEqual(self.activity, decoded) } - static var allTests: [(String, (ActivityTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ActivityTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AddressTests/AddressNormalizationTests.swift b/Tests/ModelTests/AddressTests/AddressNormalizationTests.swift index 567a21b0..96908ae9 100644 --- a/Tests/ModelTests/AddressTests/AddressNormalizationTests.swift +++ b/Tests/ModelTests/AddressTests/AddressNormalizationTests.swift @@ -3,7 +3,7 @@ import XCTest typealias Normalization = Address.Normalization -final class AddressNormalizationTests: XCTestCase { +public final class AddressNormalizationTests: XCTestCase { struct Add: Codable { let norm: Normalization } @@ -46,7 +46,7 @@ final class AddressNormalizationTests: XCTestCase { try XCTAssertEqual(decoder.decode(Add.self, from: unnormalized).norm, .unnormalized) } - static var allTests: [(String, (AddressNormalizationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AddressNormalizationTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AddressTests/AddressTests.swift b/Tests/ModelTests/AddressTests/AddressTests.swift index 50a93aa8..43dc2115 100644 --- a/Tests/ModelTests/AddressTests/AddressTests.swift +++ b/Tests/ModelTests/AddressTests/AddressTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AddressTests: XCTestCase { +public final class AddressTests: XCTestCase { func testInit()throws { let address = Address( recipientName: "Puffin Billy", @@ -113,7 +113,7 @@ final class AddressTests: XCTestCase { ) } - static var allTests: [(String, (AddressTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AddressTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AdjudicationOutcomeTests.swift b/Tests/ModelTests/AdjudicationOutcomeTests.swift index 15fa5449..2d35f399 100644 --- a/Tests/ModelTests/AdjudicationOutcomeTests.swift +++ b/Tests/ModelTests/AdjudicationOutcomeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AdjudicationOutcomeTests: XCTestCase { +public final class AdjudicationOutcomeTests: XCTestCase { struct Adjudication: Codable { let outcome: AdjudicationOutcome } @@ -42,7 +42,7 @@ final class AdjudicationOutcomeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Adjudication.self, from: seller).outcome, .seller) } - static var allTests: [(String, (AdjudicationOutcomeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AdjudicationOutcomeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AgreementStateTests.swift b/Tests/ModelTests/AgreementStateTests.swift index ee310a39..63fe5ea1 100644 --- a/Tests/ModelTests/AgreementStateTests.swift +++ b/Tests/ModelTests/AgreementStateTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AgreementStateTests: XCTestCase { +public final class AgreementStateTests: XCTestCase { struct Agree: Codable { let state: AgreementState } @@ -45,7 +45,7 @@ final class AgreementStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Agree.self, from: expired).state, .expired) } - static var allTests: [(String, (AgreementStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AgreementStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AppContextTests/AppContextShippingTests.swift b/Tests/ModelTests/AppContextTests/AppContextShippingTests.swift index 807706cf..5a8321e4 100644 --- a/Tests/ModelTests/AppContextTests/AppContextShippingTests.swift +++ b/Tests/ModelTests/AppContextTests/AppContextShippingTests.swift @@ -3,7 +3,7 @@ import XCTest typealias AppShipping = AppContext.Shipping -final class AppContextShippingTests: XCTestCase { +public final class AppContextShippingTests: XCTestCase { struct App: Codable { let shipping: AppShipping } @@ -45,7 +45,7 @@ final class AppContextShippingTests: XCTestCase { try XCTAssertEqual(decoder.decode(App.self, from: none).shipping, .none) } - static var allTests: [(String, (AppContextShippingTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AppContextShippingTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/AppContextTests/AppContextTests.swift b/Tests/ModelTests/AppContextTests/AppContextTests.swift index 251c227a..8f979253 100644 --- a/Tests/ModelTests/AppContextTests/AppContextTests.swift +++ b/Tests/ModelTests/AppContextTests/AppContextTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class AppContextTests: XCTestCase { +public final class AppContextTests: XCTestCase { func testInit()throws { let context = try AppContext( brand: .init("Example Inc."), @@ -94,7 +94,7 @@ final class AppContextTests: XCTestCase { )) } - static var allTests: [(String, (AppContextTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AppContextTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/AutoBillTests.swift b/Tests/ModelTests/AutoBillTests.swift index 3aaee23a..eb705b31 100644 --- a/Tests/ModelTests/AutoBillTests.swift +++ b/Tests/ModelTests/AutoBillTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AutoBillTests: XCTestCase { +public final class AutoBillTests: XCTestCase { struct Agreement: Codable { let auto: AutoBill } @@ -42,7 +42,7 @@ final class AutoBillTests: XCTestCase { try XCTAssertEqual(decoder.decode(Agreement.self, from: no).auto, .no) } - static var allTests: [(String, (AutoBillTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AutoBillTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BalanceResponseTests.swift b/Tests/ModelTests/BalanceResponseTests.swift index 8b71c88d..431900e8 100644 --- a/Tests/ModelTests/BalanceResponseTests.swift +++ b/Tests/ModelTests/BalanceResponseTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BalanceResponseTests: XCTestCase { +public final class BalanceResponseTests: XCTestCase { func testDecoding()throws { let json = """ { @@ -27,7 +27,7 @@ final class BalanceResponseTests: XCTestCase { XCTAssertEqual(response.pending, [CurrencyCodeAmount(currency: .usd, value: 5000.00)]) } - static var allTests: [(String, (BalanceResponseTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BalanceResponseTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/BillingTests/BillingAgreementTests.swift b/Tests/ModelTests/BillingTests/BillingAgreementTests.swift index 80e9a27f..6f4ce860 100644 --- a/Tests/ModelTests/BillingTests/BillingAgreementTests.swift +++ b/Tests/ModelTests/BillingTests/BillingAgreementTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BillingAgreementTests: XCTestCase { +public final class BillingAgreementTests: XCTestCase { let now = Date() func testInit()throws { @@ -176,7 +176,7 @@ final class BillingAgreementTests: XCTestCase { try XCTAssertEqual(agreement, decoder.decode(BillingAgreement.self, from: json)) } - static var allTests: [(String, (BillingAgreementTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingAgreementTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BillingTests/BillingInfoTests.swift b/Tests/ModelTests/BillingTests/BillingInfoTests.swift index 73c28ff8..20b32d84 100644 --- a/Tests/ModelTests/BillingTests/BillingInfoTests.swift +++ b/Tests/ModelTests/BillingTests/BillingInfoTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BillingInfoTests: XCTestCase { +public final class BillingInfoTests: XCTestCase { func testInit()throws { let info = try BillingInfo( email: .init("ratigan@thirdceller.com"), @@ -230,7 +230,7 @@ final class BillingInfoTests: XCTestCase { try XCTAssertEqual(info.phone, PhoneNumber(country: .init(1), number: .init(4586901518))) } - static var allTests: [(String, (BillingInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/BillingTests/BillingPaymentTests.swift b/Tests/ModelTests/BillingTests/BillingPaymentTests.swift index 38c16189..c5704f36 100644 --- a/Tests/ModelTests/BillingTests/BillingPaymentTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPaymentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BillingPaymentTests: XCTestCase { +public final class BillingPaymentTests: XCTestCase { func testInit()throws { let payment = try BillingPayment( name: .init("Service Membership"), @@ -92,7 +92,7 @@ final class BillingPaymentTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(BillingPayment.self, from: cyclesError)) } - static var allTests: [(String, (BillingPaymentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPaymentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/BillingTests/BillingPlanListTests.swift b/Tests/ModelTests/BillingTests/BillingPlanListTests.swift index d675a259..e3fbb66a 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanListTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanListTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BillingPlanListTests: XCTestCase { +public final class BillingPlanListTests: XCTestCase { func testInit()throws { let list = try BillingPlan.List(plans: [ BillingPlan( @@ -135,7 +135,7 @@ final class BillingPlanListTests: XCTestCase { )) } - static var allTests: [(String, (BillingPlanListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPlanListTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/BillingTests/BillingPlanStateTests.swift b/Tests/ModelTests/BillingTests/BillingPlanStateTests.swift index e3db247c..d7d8e916 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanStateTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanStateTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BillingPlanStateTests: XCTestCase { +public final class BillingPlanStateTests: XCTestCase { struct Test: Codable { let state: BillingPlan.State } @@ -44,7 +44,7 @@ final class BillingPlanStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Test.self, from: deleted).state, .deleted) } - static var allTests: [(String, (BillingPlanStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPlanStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BillingTests/BillingPlanTests.swift b/Tests/ModelTests/BillingTests/BillingPlanTests.swift index 886e4907..b36f5f28 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BillingPlanTests: XCTestCase { +public final class BillingPlanTests: XCTestCase { func testInit()throws { let plan = try BillingPlan( name: .init("Monthly Water"), @@ -158,7 +158,7 @@ final class BillingPlanTests: XCTestCase { ) } - static var allTests: [(String, (BillingPlanTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPlanTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValueValidation", testValueValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift b/Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift index d605b6cb..a6b2e830 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BillingPlanTypeTests: XCTestCase { +public final class BillingPlanTypeTests: XCTestCase { struct Plan: Codable { let type: BillingPlan.PlanType } @@ -42,7 +42,7 @@ final class BillingPlanTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Plan.self, from: infinate).type, .infinite) } - static var allTests: [(String, (BillingPlanTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPlanTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessNameTest.swift b/Tests/ModelTests/BusinessTests/BusinessNameTest.swift index 20a322e6..1a61e683 100644 --- a/Tests/ModelTests/BusinessTests/BusinessNameTest.swift +++ b/Tests/ModelTests/BusinessTests/BusinessNameTest.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BusinessNameTests: XCTestCase { +public final class BusinessNameTests: XCTestCase { func testInit()throws { let name = try Business.Name(type: .legal, name: .init("Stuff and Nonsense Inc.")) @@ -42,7 +42,7 @@ final class BusinessNameTests: XCTestCase { try XCTAssertEqual(name, decoder.decode(Business.Name.self, from: json)) } - static var allTests: [(String, (BusinessNameTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessNameTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValueValidation", testValueValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift index dfa08520..c746fac7 100644 --- a/Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessNameTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BusinessNameTypeTests: XCTestCase { +public final class BusinessNameTypeTests: XCTestCase { struct BusiName: Codable { let type: Business.Name.NameType } @@ -43,7 +43,7 @@ final class BusinessNameTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(BusiName.self, from: stockTrading).type, .stockTrading) } - static var allTests: [(String, (BusinessNameTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessNameTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift index 9ac089f8..ded288c9 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BusinessOwnerAddressTests: XCTestCase { +public final class BusinessOwnerAddressTests: XCTestCase { func testInit()throws { let address = try BusinessOwner.Address( type: .home, diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift index 08f4e228..8e7449d0 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BusinessOwnerAddressTypeTests: XCTestCase { +public final class BusinessOwnerAddressTypeTests: XCTestCase { struct BOA: Codable { let type: BusinessOwner.Address.AddressType } diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift index b7c2b9f7..cd8ec1ed 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class IdentificationTests: XCTestCase { +public final class IdentificationTests: XCTestCase { func testInit()throws { let id = Identification( type: .driversLicense, diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift index 5470105c..102eebcc 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BusinessOwnerIDTypeTests: XCTestCase { +public final class BusinessOwnerIDTypeTests: XCTestCase { struct ID: Codable { let type: Identification.IDType } diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift index 5c87445e..493fa101 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BusinessOwnerTests: XCTestCase { +public final class BusinessOwnerTests: XCTestCase { let (date, dateStr): (Date, String) = { let now = Date() let str = TimelessDate.formatter.string(from: now) diff --git a/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift index 04802222..bda3e4f8 100644 --- a/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BusinessSubTypeTests: XCTestCase { +public final class BusinessSubTypeTests: XCTestCase { struct Busi: Codable { let type: Business.SubType } diff --git a/Tests/ModelTests/BusinessTests/BusinessTests.swift b/Tests/ModelTests/BusinessTests/BusinessTests.swift index c3efc77b..eda44beb 100644 --- a/Tests/ModelTests/BusinessTests/BusinessTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BusinessTests: XCTestCase { +public final class BusinessTests: XCTestCase { func testInit()throws { let business = try Business( type: .individual, diff --git a/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift index 52ec930b..4d779e06 100644 --- a/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class BusinessTypeTests: XCTestCase { +public final class BusinessTypeTests: XCTestCase { struct Busi: Codable { let type: Business.BusinessType } diff --git a/Tests/ModelTests/BuyerTests.swift b/Tests/ModelTests/BuyerTests.swift index ae4f060e..30a891f5 100644 --- a/Tests/ModelTests/BuyerTests.swift +++ b/Tests/ModelTests/BuyerTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class BuyerTests: XCTestCase { +public final class BuyerTests: XCTestCase { func testInit()throws { let buyer = try Buyer(email: .init("witheringheights@exmaple.com"), name: "Leeli Wingfeather") diff --git a/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift b/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift index 2d39b7d1..4c4f052b 100644 --- a/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift @@ -3,7 +3,7 @@ import XCTest typealias CapReas = Capture.Reason -final class CaptureReasonTests: XCTestCase { +public final class CaptureReasonTests: XCTestCase { struct Cap: Codable { let reason: CapReas } diff --git a/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift b/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift index 1f5c1d47..72614b91 100644 --- a/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift @@ -3,7 +3,7 @@ import XCTest typealias CapStat = Capture.Status -final class CaptureStatusTests: XCTestCase { +public final class CaptureStatusTests: XCTestCase { struct Cap: Codable { let status: CapStat } diff --git a/Tests/ModelTests/CaptureTests/CaptureTests.swift b/Tests/ModelTests/CaptureTests/CaptureTests.swift index 42df564c..fea02a8b 100644 --- a/Tests/ModelTests/CaptureTests/CaptureTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CaptureTests: XCTestCase { +public final class CaptureTests: XCTestCase { func testInit()throws { let capture = Capture( amount: DetailedAmount(currency: .usd, total: 10.00, details: nil), diff --git a/Tests/ModelTests/CardTests/CreditCardStateTests.swift b/Tests/ModelTests/CardTests/CreditCardStateTests.swift index 47087e7b..a467d698 100644 --- a/Tests/ModelTests/CardTests/CreditCardStateTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias CCStaate = CreditCard.State -final class CreditCardStateTests: XCTestCase { +public final class CreditCardStateTests: XCTestCase { private struct CC: Codable { let state: CCStaate } diff --git a/Tests/ModelTests/CardTests/CreditCardTests.swift b/Tests/ModelTests/CardTests/CreditCardTests.swift index 998990b2..32afbb69 100644 --- a/Tests/ModelTests/CardTests/CreditCardTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class CreditCardTests: XCTestCase { +public final class CreditCardTests: XCTestCase { func testInit()throws { let cc = try CreditCard( number: "4953912847443848", diff --git a/Tests/ModelTests/CardTests/CreditCardTokenTests.swift b/Tests/ModelTests/CardTests/CreditCardTokenTests.swift index 0970ee8a..3ea54a62 100644 --- a/Tests/ModelTests/CardTests/CreditCardTokenTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardTokenTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CreditCardTokenTests: XCTestCase { +public final class CreditCardTokenTests: XCTestCase { func testInit()throws { let token = CreditCard.Token(creditCard: "94935F7A-395B-4CAF-AC29-DD6728C55FE6", payer: "93A20FF4-D73D-4F76-B591-932D4B6CA3E1") diff --git a/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift b/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift index 857eba8b..bb0b603c 100644 --- a/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift +++ b/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CreditDebitCodeTests: XCTestCase { +public final class CreditDebitCodeTests: XCTestCase { struct Card: Codable { let code: CreditDebitCode } diff --git a/Tests/ModelTests/CarrierTests.swift b/Tests/ModelTests/CarrierTests.swift index 5a23e73a..5620d048 100644 --- a/Tests/ModelTests/CarrierTests.swift +++ b/Tests/ModelTests/CarrierTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CarrierTests: XCTestCase { +public final class CarrierTests: XCTestCase { struct Shippment: Codable { let carrier: Carrier } diff --git a/Tests/ModelTests/ChargeTests/ChargeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTests.swift index 92cc9e66..66fbfbed 100644 --- a/Tests/ModelTests/ChargeTests/ChargeTests.swift +++ b/Tests/ModelTests/ChargeTests/ChargeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ChargeTests: XCTestCase { +public final class ChargeTests: XCTestCase { func testInit()throws { let charge = Charge(type: .shipping, amount: CurrencyCodeAmount(currency: .usd, value: 314.15)) diff --git a/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift index 1202075f..897ba7cc 100644 --- a/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift +++ b/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ChargeTypeTests: XCTestCase { +public final class ChargeTypeTests: XCTestCase { struct Model: Codable { let type: ChargeType } diff --git a/Tests/ModelTests/CounterPartyTests.swift b/Tests/ModelTests/CounterPartyTests.swift index 052bd67a..e4f64ce8 100644 --- a/Tests/ModelTests/CounterPartyTests.swift +++ b/Tests/ModelTests/CounterPartyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CounterPartyTests: XCTestCase { +public final class CounterPartyTests: XCTestCase { func testInit()throws { let party = CounterParty(email: "54north@exmaple.com", phoneNumber: "314-159-2653", name: "Jonathan Futher") diff --git a/Tests/ModelTests/CreatedMerchantResponseTests.swift b/Tests/ModelTests/CreatedMerchantResponseTests.swift index 32f8ba97..1944d8fa 100644 --- a/Tests/ModelTests/CreatedMerchantResponseTests.swift +++ b/Tests/ModelTests/CreatedMerchantResponseTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CreatedMerchantResponseTests: XCTestCase { +public final class CreatedMerchantResponseTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/CurrencyTests.swift b/Tests/ModelTests/CurrencyTests.swift index 04ecbb95..55544adb 100644 --- a/Tests/ModelTests/CurrencyTests.swift +++ b/Tests/ModelTests/CurrencyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CurrencyTests: XCTestCase { +public final class CurrencyTests: XCTestCase { struct Model: Codable, Equatable { var cur: Currency } diff --git a/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift index f5baa8cf..4bf430dd 100644 --- a/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CustomerDisputeListTests: XCTestCase { +public final class CustomerDisputeListTests: XCTestCase { let date = Date() let due = Date(timeIntervalSinceNow: 60 * 60 * 24) diff --git a/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift index 68c92442..c630e55a 100644 --- a/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CustomerDisputeTests: XCTestCase { +public final class CustomerDisputeTests: XCTestCase { let created = Date() let due = Date(timeIntervalSinceNow: 60 * 60 * 24) diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift index 99cbbf94..edfc2840 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class CustomerServiceMessageTests: XCTestCase { +public final class CustomerServiceMessageTests: XCTestCase { func testInit()throws { let message = try CustomerService.Message( type: .online, diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift index a36c248c..23e777fe 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CustomerServiceMessageTypeTests: XCTestCase { +public final class CustomerServiceMessageTypeTests: XCTestCase { struct CSM: Codable { var type: CustomerService.Message.MessageType } diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift index e5618bd4..8b717af1 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class CustomerServiceTests: XCTestCase { +public final class CustomerServiceTests: XCTestCase { func testInit()throws { let service = try CustomerService( email: .init("address@email.com"), diff --git a/Tests/ModelTests/DesignationTests.swift b/Tests/ModelTests/DesignationTests.swift index b0ad9548..5254c26b 100644 --- a/Tests/ModelTests/DesignationTests.swift +++ b/Tests/ModelTests/DesignationTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DesignationTests: XCTestCase { +public final class DesignationTests: XCTestCase { func testInit()throws { let designation = Business.Designation(title: "CTO", area: "Software Engineering") diff --git a/Tests/ModelTests/DetailedTests/DetailTests.swift b/Tests/ModelTests/DetailedTests/DetailTests.swift index 1d777923..eb0668e6 100644 --- a/Tests/ModelTests/DetailedTests/DetailTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailTests.swift @@ -2,7 +2,7 @@ import XCTest @testable import PayPal @available(OSX 10.12, *) -final class DetailTests: XCTestCase { +public final class DetailTests: XCTestCase { let now = Date().iso8601 let later = Date.distantFuture.iso8601 let oneYear = (Date() + (60 * 60 * 24 * 365)).iso8601 diff --git a/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift index b46896e6..4300c208 100644 --- a/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DetailedAmountDetailTests: XCTestCase { +public final class DetailedAmountDetailTests: XCTestCase { func testInit()throws { let details = DetailedAmount.Detail( subtotal: 134.56, diff --git a/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift index 6f93fd77..e0cdaf35 100644 --- a/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DetailedAmountTests: XCTestCase { +public final class DetailedAmountTests: XCTestCase { func testInit()throws { let details = DetailedAmount.Detail( subtotal: 134.56, diff --git a/Tests/ModelTests/DiscountTests.swift b/Tests/ModelTests/DiscountTests.swift index dfaec66a..a48d4271 100644 --- a/Tests/ModelTests/DiscountTests.swift +++ b/Tests/ModelTests/DiscountTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DiscountTests: XCTestCase { +public final class DiscountTests: XCTestCase { func testInit()throws { let discount = Discount(percent: 15, amount: CurrencyAmount(currency: .usd, value: 1.25)) diff --git a/Tests/ModelTests/DisplayPhoneTests.swift b/Tests/ModelTests/DisplayPhoneTests.swift index e3a8431f..6d536219 100644 --- a/Tests/ModelTests/DisplayPhoneTests.swift +++ b/Tests/ModelTests/DisplayPhoneTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DisplayPhoneTests: XCTestCase { +public final class DisplayPhoneTests: XCTestCase { func testInit()throws { let phone = DisplayPhone(country: .unitedStates, number: "245364984688834") diff --git a/Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift b/Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift index 98e27ea1..ebd795fb 100644 --- a/Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift +++ b/Tests/ModelTests/DisputeTests/AcceptDisputeReasonTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class AcceptDisputeReasonTests: XCTestCase { +public final class AcceptDisputeReasonTests: XCTestCase { struct Accept: Codable { let reason: AcceptDisputeBody.Reason } @@ -46,7 +46,7 @@ final class AcceptDisputeReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Accept.self, from: none).reason, .none) } - static var allTests: [(String, (AcceptDisputeReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AcceptDisputeReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift b/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift index 6228b743..d93980fa 100644 --- a/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift +++ b/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class AcceptDisputeTests: XCTestCase { +public final class AcceptDisputeTests: XCTestCase { func testInit()throws { let body = try AcceptDisputeBody( note: .init("Refund to customer"), @@ -101,7 +101,7 @@ final class AcceptDisputeTests: XCTestCase { try XCTAssertEqual(body, decoder.decode(AcceptDisputeBody.self, from: valid)) } - static var allTests: [(String, (AcceptDisputeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AcceptDisputeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift b/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift index 3a7133e7..125a2c42 100644 --- a/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DisputeChannelTests: XCTestCase { +public final class DisputeChannelTests: XCTestCase { struct Dispute: Codable { let channel: CustomerDispute.Channel } diff --git a/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift b/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift index 7432f3d0..39d7aa61 100644 --- a/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DisputeLifeCycleTests: XCTestCase { +public final class DisputeLifeCycleTests: XCTestCase { struct Dispute: Codable { let stage: CustomerDispute.LifeCycleStage } diff --git a/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift b/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift index b24e27dd..7df374be 100644 --- a/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DisputeOutcomeTests: XCTestCase { +public final class DisputeOutcomeTests: XCTestCase { func testInit()throws { let outcome = CustomerDispute.Outcome(code: .buyer, refunded: CurrencyCodeAmount(currency: .usd, value: 56.72)) diff --git a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift index 82de85ce..af2938ce 100644 --- a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift +++ b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class DisputeResolutionOfferTests: XCTestCase { +public final class DisputeResolutionOfferTests: XCTestCase { func testInit()throws { let offer = try CustomerDispute.ResolutionOffer( note: .init("Offer refund with replacement item."), diff --git a/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift b/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift index a6712de5..f1864227 100644 --- a/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DisputeStatusTests: XCTestCase { +public final class DisputeStatusTests: XCTestCase { struct Request: Codable { let method: PayPal.Method } diff --git a/Tests/ModelTests/DocumentTests.swift b/Tests/ModelTests/DocumentTests.swift index 814b0aec..128078d3 100644 --- a/Tests/ModelTests/DocumentTests.swift +++ b/Tests/ModelTests/DocumentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class DocumentTests: XCTestCase { +public final class DocumentTests: XCTestCase { func testInit()throws { let document = Document(name: "README.md", size: "65kb") diff --git a/Tests/ModelTests/EmailTests/CCEmailTests.swift b/Tests/ModelTests/EmailTests/CCEmailTests.swift index 1a372531..8c4990b6 100644 --- a/Tests/ModelTests/EmailTests/CCEmailTests.swift +++ b/Tests/ModelTests/EmailTests/CCEmailTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class CCEmailTests: XCTestCase { +public final class CCEmailTests: XCTestCase { func testInit()throws { let email = try CCEmail(email: .init("witheringheights@exmaple.com")) diff --git a/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift b/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift index 0bd2f3ab..2a039503 100644 --- a/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift +++ b/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift @@ -3,7 +3,7 @@ import XCTest typealias EmailFrequency = NotificationOptions.EmailFrequency -final class EmailFrequencyTests: XCTestCase { +public final class EmailFrequencyTests: XCTestCase { struct Email: Codable { let frequency: NotificationOptions.EmailFrequency } diff --git a/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift index b15a2cb5..75d5e56c 100644 --- a/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift +++ b/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PayPalAPIErrorTests: XCTestCase { +public final class PayPalAPIErrorTests: XCTestCase { let error = PayPalAPIError( identifier: "INVALID_REQUEST", reason: "Validation for request data failed", diff --git a/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift index ed588cbe..fd72bdbb 100644 --- a/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift +++ b/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PayPalAPIIdentityErrorTests: XCTestCase { +public final class PayPalAPIIdentityErrorTests: XCTestCase { let error = PayPalAPIIdentityError(identifier: "invalid_client", reason: "Client Authentication failed") func testInit()throws { diff --git a/Tests/ModelTests/EstablishmentTests.swift b/Tests/ModelTests/EstablishmentTests.swift index 5e327994..6d70d33c 100644 --- a/Tests/ModelTests/EstablishmentTests.swift +++ b/Tests/ModelTests/EstablishmentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class EstablishmentTests: XCTestCase { +public final class EstablishmentTests: XCTestCase { func testInit()throws { let bank = Establishment(state: .or, country: .unitedStates) diff --git a/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift index 6b038858..34b39b6c 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class EvidenceInfoTests: XCTestCase { +public final class EvidenceInfoTests: XCTestCase { func testInit()throws { let evidence = Evidence.Info( tracking: [ diff --git a/Tests/ModelTests/EvidenceTests/EvidenceTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTests.swift index 67436ac7..d7e13444 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class EvidenceTests: XCTestCase { +public final class EvidenceTests: XCTestCase { func testInit()throws { let evidence = try Evidence( type: .proofOfFulfillment, diff --git a/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift index ec10b22f..4772a0c2 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class EvidenceTypeTests: XCTestCase { +public final class EvidenceTypeTests: XCTestCase { struct Evid: Codable { let type: Evidence.EvidenceType } diff --git a/Tests/ModelTests/ExtensionsTests.swift b/Tests/ModelTests/ExtensionsTests.swift index 083e5391..d05efe0b 100644 --- a/Tests/ModelTests/ExtensionsTests.swift +++ b/Tests/ModelTests/ExtensionsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ExtensionsTests: XCTestCase { +public final class ExtensionsTests: XCTestCase { let extensions = Extensions( paymentProperties: PaymentProperties( creditDebitCode: .credit, diff --git a/Tests/ModelTests/FileAttachmentTests.swift b/Tests/ModelTests/FileAttachmentTests.swift index a1142b73..7ab0b987 100644 --- a/Tests/ModelTests/FileAttachmentTests.swift +++ b/Tests/ModelTests/FileAttachmentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FileAttachmentTests: XCTestCase { +public final class FileAttachmentTests: XCTestCase { func testInit()throws { let file = FileAttachment(name: "photo.jpg", url: "https://avatars3.githubusercontent.com/u/2872298?s=200&v=4") diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift index 9dd3ff2f..74744cea 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift @@ -3,7 +3,7 @@ import XCTest typealias AccountType = FinancialInstrument.AccountType -final class FinancialInstrumentAccountTypeTests: XCTestCase { +public final class FinancialInstrumentAccountTypeTests: XCTestCase { struct Instrument: Codable { let account: AccountType } diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift index 7c20b42a..5a4c11e6 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FinancialInstrumentTests: XCTestCase { +public final class FinancialInstrumentTests: XCTestCase { func testInit()throws { let instrument = FinancialInstrument() diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift index f9378c7c..92f4d0e7 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift @@ -3,7 +3,7 @@ import XCTest typealias InstrumentType = FinancialInstrument.InstrumentType -final class FinancialInstrumentTypeTests: XCTestCase { +public final class FinancialInstrumentTypeTests: XCTestCase { struct Instrument: Codable { let type: InstrumentType } diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift index 142ac988..cccd2915 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias ID = FraudManagementFilter.ID -final class FraudManagementFilterIDTests: XCTestCase { +public final class FraudManagementFilterIDTests: XCTestCase { private struct Filter: Codable { let id: ID } diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift index 2c366885..e730e369 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FraudManagementFilterTests: XCTestCase { +public final class FraudManagementFilterTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift index 020ce14b..38904e19 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Type = FraudManagementFilter.FilterType -final class FraudManagementFilterTypeTests: XCTestCase { +public final class FraudManagementFilterTypeTests: XCTestCase { private struct Instrument: Codable { let type: Type } diff --git a/Tests/ModelTests/FrequencyTests.swift b/Tests/ModelTests/FrequencyTests.swift index 32d004b3..690efa18 100644 --- a/Tests/ModelTests/FrequencyTests.swift +++ b/Tests/ModelTests/FrequencyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FrequencyTests: XCTestCase { +public final class FrequencyTests: XCTestCase { struct Action: Codable { let frequency: Frequency } diff --git a/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift b/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift index a4f4a005..c74476af 100644 --- a/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift +++ b/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FundingInstrumentTests: XCTestCase { +public final class FundingInstrumentTests: XCTestCase { func testInit()throws { let instrument = FundingInstrument(token: .init(creditCard: "0F874884-66E4-4D45-9906-C3E9957BC1FF", payer: nil)) diff --git a/Tests/ModelTests/FundingTests/FundingOptionTests.swift b/Tests/ModelTests/FundingTests/FundingOptionTests.swift index 677b86ee..59f9c1e9 100644 --- a/Tests/ModelTests/FundingTests/FundingOptionTests.swift +++ b/Tests/ModelTests/FundingTests/FundingOptionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class FundingOptionTests: XCTestCase { +public final class FundingOptionTests: XCTestCase { struct Funding: Codable { let option: FundingOption } diff --git a/Tests/ModelTests/GovernmentBodyTests.swift b/Tests/ModelTests/GovernmentBodyTests.swift index 342abd7d..64af9f5d 100644 --- a/Tests/ModelTests/GovernmentBodyTests.swift +++ b/Tests/ModelTests/GovernmentBodyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class GovernmentBodyTests: XCTestCase { +public final class GovernmentBodyTests: XCTestCase { func testInit()throws { let govt = GovernmentBody(name: "value") diff --git a/Tests/ModelTests/IDTests.swift b/Tests/ModelTests/IDTests.swift index 4fa5988a..b7d2c07e 100644 --- a/Tests/ModelTests/IDTests.swift +++ b/Tests/ModelTests/IDTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class IDTests: XCTestCase { +public final class IDTests: XCTestCase { func testInit()throws { let null = ID() let id = ID("P-52603F876DFD4C61") diff --git a/Tests/ModelTests/InitialFailActionTests.swift b/Tests/ModelTests/InitialFailActionTests.swift index 0cf8d437..1b3728f1 100644 --- a/Tests/ModelTests/InitialFailActionTests.swift +++ b/Tests/ModelTests/InitialFailActionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InitialFailActionTests: XCTestCase { +public final class InitialFailActionTests: XCTestCase { struct Agreement: Codable { let action: InitialFailAction } diff --git a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift index aeec384f..94855a3c 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class InvoiceItemTests: XCTestCase { +public final class InvoiceItemTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift index beff55f8..df8e4253 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceListTests: XCTestCase { +public final class InvoiceListTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift index 016873ae..942bec42 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceMeasureTests: XCTestCase { +public final class InvoiceMeasureTests: XCTestCase { struct Inv: Codable { let measure: Invoice.Measure } diff --git a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift index df6a2af0..ba7b70c6 100644 --- a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoicePaymentTests: XCTestCase { +public final class InvoicePaymentTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift index a4d6581e..1d503c5f 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceReminderTests: XCTestCase { +public final class InvoiceReminderTests: XCTestCase { func testInit()throws { let reminder = Invoice.Reminder(subject: "Invoice Not Sent", note: "Please send the money", emails: [.init(email: "payer@example.com")]) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift index 3851dcb3..101410de 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceSearchTests: XCTestCase { +public final class InvoiceSearchTests: XCTestCase { let now = Date() let later = (Date() + 60 * 60 * 24 * 60) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift index 12ff53d7..9c996005 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceStatusTests: XCTestCase { +public final class InvoiceStatusTests: XCTestCase { struct Inv: Codable { let status: Invoice.Status diff --git a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift index 8f1d0631..0a5689d6 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class InvoiceTests: XCTestCase { +public final class InvoiceTests: XCTestCase { let now = Date() var dueStr: String { diff --git a/Tests/ModelTests/ItemReason.swift b/Tests/ModelTests/ItemReason.swift index 8dba7cd6..8ea38f62 100644 --- a/Tests/ModelTests/ItemReason.swift +++ b/Tests/ModelTests/ItemReason.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ItemReasonTests: XCTestCase { +public final class ItemReasonTests: XCTestCase { struct IT: Codable { let reason: Item.Reason } diff --git a/Tests/ModelTests/KeyValueTests.swift b/Tests/ModelTests/KeyValueTests.swift index 70685c8c..e94ada5d 100644 --- a/Tests/ModelTests/KeyValueTests.swift +++ b/Tests/ModelTests/KeyValueTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class KeyValueTests: XCTestCase { +public final class KeyValueTests: XCTestCase { func testInit()throws { let strd = KeyValue(key: "key0", value: "value0") XCTAssertEqual(strd.key, "key0") diff --git a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift index fbd87fea..673bab21 100644 --- a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift +++ b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class LegalAgreementTests: XCTestCase { +public final class LegalAgreementTests: XCTestCase { func testInit()throws { let agreement = LegalAgreement(accepted: false, type: .userAgreement) diff --git a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift index 529b3957..c74ae2af 100644 --- a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift +++ b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift @@ -3,7 +3,7 @@ import XCTest typealias AgreementType = LegalAgreement.AgreementType -final class LegalAgreementTypeTests: XCTestCase { +public final class LegalAgreementTypeTests: XCTestCase { struct Agreement: Codable { let type: AgreementType } diff --git a/Tests/ModelTests/LinkDescriptionTests.swift b/Tests/ModelTests/LinkDescriptionTests.swift index b4755df3..80bf23f2 100644 --- a/Tests/ModelTests/LinkDescriptionTests.swift +++ b/Tests/ModelTests/LinkDescriptionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class LinkDescriptionTests: XCTestCase { +public final class LinkDescriptionTests: XCTestCase { func testInit()throws { let link = LinkDescription(href: "https://choosealicense.com/licenses/mit/", rel: "license", method: .GET) diff --git a/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift b/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift index 7f733773..5f01a545 100644 --- a/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift +++ b/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class MerchantAccountTests: XCTestCase { +public final class MerchantAccountTests: XCTestCase { func testInit()throws { let account = try MerchantAccount( owner: nil, diff --git a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift index 0b8fdb25..cda62ac7 100644 --- a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift +++ b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MerchantPreferancesTests: XCTestCase { +public final class MerchantPreferancesTests: XCTestCase { func testInit()throws { let preferances = MerchantPreferances( setupFee: CurrencyCodeAmount(currency: .usd, value: 0), diff --git a/Tests/ModelTests/MessageTests/MessagePosterTests.swift b/Tests/ModelTests/MessageTests/MessagePosterTests.swift index 8d2819d7..0a0154cc 100644 --- a/Tests/ModelTests/MessageTests/MessagePosterTests.swift +++ b/Tests/ModelTests/MessageTests/MessagePosterTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MessagePosterTests: XCTestCase { +public final class MessagePosterTests: XCTestCase { struct Wall: Codable { let poster: Message.Poster } diff --git a/Tests/ModelTests/MessageTests/MessageTests.swift b/Tests/ModelTests/MessageTests/MessageTests.swift index d733aa3a..ea55d89b 100644 --- a/Tests/ModelTests/MessageTests/MessageTests.swift +++ b/Tests/ModelTests/MessageTests/MessageTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class MessageTests: XCTestCase { +public final class MessageTests: XCTestCase { func testInit()throws { let message = try Message(content: .init("A developer walks into a foo bar and orders a fizz buzz")) diff --git a/Tests/ModelTests/MetadataTests.swift b/Tests/ModelTests/MetadataTests.swift index ea463c9c..7095f205 100644 --- a/Tests/ModelTests/MetadataTests.swift +++ b/Tests/ModelTests/MetadataTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MetadataTests: XCTestCase { +public final class MetadataTests: XCTestCase { func testDecoding()throws { let decoder = JSONDecoder() diff --git a/Tests/ModelTests/MethodTests.swift b/Tests/ModelTests/MethodTests.swift index 3e1b5bc8..d1fb052f 100644 --- a/Tests/ModelTests/MethodTests.swift +++ b/Tests/ModelTests/MethodTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MethodTests: XCTestCase { +public final class MethodTests: XCTestCase { struct Request: Codable { let method: PayPal.Method } diff --git a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift index 5446ea24..f6b63211 100644 --- a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MoneyRangeTests: XCTestCase { +public final class MoneyRangeTests: XCTestCase { func testInit()throws { let range0 = MoneyRange(min: CurrencyCodeAmount(currency: .usd, value: 12.25), max: CurrencyCodeAmount(currency: .usd, value: 50.00)) XCTAssertEqual(range0.minimum, CurrencyCodeAmount(currency: .usd, value: 12.25)) diff --git a/Tests/ModelTests/MoneyTests/MoneyTests.swift b/Tests/ModelTests/MoneyTests/MoneyTests.swift index 444f4f75..8a6cd012 100644 --- a/Tests/ModelTests/MoneyTests/MoneyTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class MoneyTests: XCTestCase { +public final class MoneyTests: XCTestCase { func testInit()throws { let amount = CurrencyAmount(currency: .aud, value: 10.25) diff --git a/Tests/ModelTests/NameTests.swift b/Tests/ModelTests/NameTests.swift index afee9d83..2142bc80 100644 --- a/Tests/ModelTests/NameTests.swift +++ b/Tests/ModelTests/NameTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class NameTests: XCTestCase { +public final class NameTests: XCTestCase { func testInit()throws { let name = try Name( prefix: .init("Sir"), given: .init("Walter"), surname: .init("Scott"), middle: nil, suffix: .init("auth."), diff --git a/Tests/ModelTests/NewAgreementTests.swift b/Tests/ModelTests/NewAgreementTests.swift index 2061a288..711dfd4e 100644 --- a/Tests/ModelTests/NewAgreementTests.swift +++ b/Tests/ModelTests/NewAgreementTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class NewAgreementTests: XCTestCase { +public final class NewAgreementTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/NotificationOptionTests.swift b/Tests/ModelTests/NotificationOptionTests.swift index f2bb962a..a2048798 100644 --- a/Tests/ModelTests/NotificationOptionTests.swift +++ b/Tests/ModelTests/NotificationOptionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class NotificationOptionTests: XCTestCase { +public final class NotificationOptionTests: XCTestCase { func testInit()throws { let null = NotificationOptions() XCTAssertEqual(null.suppressWelcome, nil) diff --git a/Tests/ModelTests/OfferTests/OfferTests.swift b/Tests/ModelTests/OfferTests/OfferTests.swift index d6339efa..27907b2b 100644 --- a/Tests/ModelTests/OfferTests/OfferTests.swift +++ b/Tests/ModelTests/OfferTests/OfferTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OfferTests: XCTestCase { +public final class OfferTests: XCTestCase { func testInit()throws { let offer = Offer(buyerAmount: CurrencyCodeAmount(currency: .usd, value: 10.99), sellerAmount: CurrencyCodeAmount(currency: .usd, value: 10.99), type: .refund) diff --git a/Tests/ModelTests/OfferTests/OfferTypeTests.swift b/Tests/ModelTests/OfferTests/OfferTypeTests.swift index 9988140d..ab6489fb 100644 --- a/Tests/ModelTests/OfferTests/OfferTypeTests.swift +++ b/Tests/ModelTests/OfferTests/OfferTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OfferTypeTests: XCTestCase { +public final class OfferTypeTests: XCTestCase { struct Off: Codable { let type: Offer.OfferType } diff --git a/Tests/ModelTests/OperationTests.swift b/Tests/ModelTests/OperationTests.swift index 7bfad6aa..506e0cf9 100644 --- a/Tests/ModelTests/OperationTests.swift +++ b/Tests/ModelTests/OperationTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OperationTests: XCTestCase { +public final class OperationTests: XCTestCase { struct Patch: Codable { let operation: PayPal.Operation } diff --git a/Tests/ModelTests/OrderTests/OrderIntentTests.swift b/Tests/ModelTests/OrderTests/OrderIntentTests.swift index 8b69cda3..d1787dd3 100644 --- a/Tests/ModelTests/OrderTests/OrderIntentTests.swift +++ b/Tests/ModelTests/OrderTests/OrderIntentTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Intent = Order.Intent -final class OrderIntentTests: XCTestCase { +public final class OrderIntentTests: XCTestCase { private struct Or: Codable { let intent: Intent } diff --git a/Tests/ModelTests/OrderTests/OrderItemTests.swift b/Tests/ModelTests/OrderTests/OrderItemTests.swift index dde550d7..88575dff 100644 --- a/Tests/ModelTests/OrderTests/OrderItemTests.swift +++ b/Tests/ModelTests/OrderTests/OrderItemTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class OrderItemTests: XCTestCase { +public final class OrderItemTests: XCTestCase { func testInit()throws { let item = try Order.Item( sku: .init("FAE11644-19BC-4643-8215-004C829B19C1"), diff --git a/Tests/ModelTests/OrderTests/OrderMetadataTests.swift b/Tests/ModelTests/OrderTests/OrderMetadataTests.swift index 4c1055b1..1528c820 100644 --- a/Tests/ModelTests/OrderTests/OrderMetadataTests.swift +++ b/Tests/ModelTests/OrderTests/OrderMetadataTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderMetadataTests: XCTestCase { +public final class OrderMetadataTests: XCTestCase { func testInit()throws { let metadata = Order.Metadata(data: ["name": "value"]) XCTAssertEqual(metadata.data, ["name": "value"]) diff --git a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift index ec42fdae..134fa527 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class OrderPayerInfoTests: XCTestCase { +public final class OrderPayerInfoTests: XCTestCase { let birthdate = Date() func testInit()throws { diff --git a/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift b/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift index 299fdf0b..6fc19a42 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Method = Order.Payer.Method -final class OrderPaymentMethodTests: XCTestCase { +public final class OrderPaymentMethodTests: XCTestCase { private struct Pay: Codable { let method: Method } diff --git a/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift b/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift index a0f50ee9..651334c6 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Status = Order.Payer.Status -final class OrderPaymentStatusTests: XCTestCase { +public final class OrderPaymentStatusTests: XCTestCase { private struct Pay: Codable { let status: Status } diff --git a/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift index c64274fe..13b4d77c 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Tax = Order.Payer.TaxType -final class OrderPayerTaxTests: XCTestCase { +public final class OrderPayerTaxTests: XCTestCase { private struct Pay: Codable { let tax: Tax } diff --git a/Tests/ModelTests/OrderTests/OrderPayerTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTests.swift index 973141e6..7f30c3eb 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderPayerTests: XCTestCase { +public final class OrderPayerTests: XCTestCase { func testInit()throws { let payer = Order.Payer(method: .creditCard, funding: [], info: .init(email: nil, birthdate: nil, tax: nil, taxType: nil, country: nil, billing: nil)) diff --git a/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift index da7bf7a5..2689e3b4 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderPaymentDetailTests: XCTestCase { +public final class OrderPaymentDetailTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift index bf3d3266..aacd2ec7 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift @@ -3,7 +3,7 @@ import XCTest typealias Disbursement = Order.DisbursementMode -final class OrderPaymentDisbursementTests: XCTestCase { +public final class OrderPaymentDisbursementTests: XCTestCase { struct Or: Codable { let disbursement: Disbursement } diff --git a/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift index 47520b92..8ec9d591 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderPaymentRequestTests: XCTestCase { +public final class OrderPaymentRequestTests: XCTestCase { func testInit()throws { let request = Order.PaymentRequest(disbursement: .instant, payer: Order.Payer(method: nil, funding: nil, info: nil)) diff --git a/Tests/ModelTests/OrderTests/OrderPaymentTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentTests.swift index 4637e90a..7579a8d1 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderPaymentTests: XCTestCase { +public final class OrderPaymentTests: XCTestCase { func testInit()throws { let payment = Order.Payment( captures: [Capture(amount: nil, transaction: nil)], diff --git a/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift b/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift index b5f92c75..33384300 100644 --- a/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift +++ b/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RedirectsTests: XCTestCase { +public final class RedirectsTests: XCTestCase { func testInit()throws { let redirects = Redirects(return: "https://example.com/return", cancel: "https://example.com/cancel") diff --git a/Tests/ModelTests/OrderTests/OrderStatusTests.swift b/Tests/ModelTests/OrderTests/OrderStatusTests.swift index 00b15d4c..c16c0da8 100644 --- a/Tests/ModelTests/OrderTests/OrderStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderStatusTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Status = Order.Status -final class OrderStatusTests: XCTestCase { +public final class OrderStatusTests: XCTestCase { private struct Or: Codable { let status: Status } diff --git a/Tests/ModelTests/OrderTests/OrderTests.swift b/Tests/ModelTests/OrderTests/OrderTests.swift index fe9b7201..4ab8af48 100644 --- a/Tests/ModelTests/OrderTests/OrderTests.swift +++ b/Tests/ModelTests/OrderTests/OrderTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OrderTests: XCTestCase { +public final class OrderTests: XCTestCase { func testInit()throws { let order = Order( intent: .sale, diff --git a/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift b/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift index 6c06054a..b193859d 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift @@ -3,7 +3,7 @@ import XCTest typealias UnitReason = Order.Unit.Reason -final class OrderUnitReasonTests: XCTestCase { +public final class OrderUnitReasonTests: XCTestCase { struct Unit: Codable { let reason: UnitReason } diff --git a/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift b/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift index 1fd3d95e..8086da7f 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift @@ -3,7 +3,7 @@ import XCTest typealias UnitStat = Order.Unit.Status -final class OrderUnitStatusTests: XCTestCase { +public final class OrderUnitStatusTests: XCTestCase { struct Unit: Codable { let status: UnitStat } diff --git a/Tests/ModelTests/OrderTests/OrderUnitTests.swift b/Tests/ModelTests/OrderTests/OrderUnitTests.swift index 427eb779..dbfa0c86 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class OrderUnitTests: XCTestCase { +public final class OrderUnitTests: XCTestCase { func testInit()throws { let payee = Payee(email: "payee@example.com", merchant: "AEDCA9E0-5442-41EF-978A-DEE6DF7DFDA8", metadata: nil) let address = Address( diff --git a/Tests/ModelTests/OutcomeCodeTests.swift b/Tests/ModelTests/OutcomeCodeTests.swift index 64cd661f..ebc98f9e 100644 --- a/Tests/ModelTests/OutcomeCodeTests.swift +++ b/Tests/ModelTests/OutcomeCodeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OutcomeCodeTests: XCTestCase { +public final class OutcomeCodeTests: XCTestCase { struct Out: Codable { let code: CustomerDispute.Outcome.Code } diff --git a/Tests/ModelTests/OverrideChargeTests.swift b/Tests/ModelTests/OverrideChargeTests.swift index ebd86b8a..fbf4aa68 100644 --- a/Tests/ModelTests/OverrideChargeTests.swift +++ b/Tests/ModelTests/OverrideChargeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class OverrideChargeTests: XCTestCase { +public final class OverrideChargeTests: XCTestCase { func testInit()throws { let id = UUID().uuidString let charge = OverrideCharge(id: id, amount: CurrencyCodeAmount(currency: .usd, value: 314.15)) diff --git a/Tests/ModelTests/ParticipantTests.swift b/Tests/ModelTests/ParticipantTests.swift index 7825829d..3acd0e6e 100644 --- a/Tests/ModelTests/ParticipantTests.swift +++ b/Tests/ModelTests/ParticipantTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class InvoiceParticipantTests: XCTestCase { +public final class InvoiceParticipantTests: XCTestCase { func testInit()throws { let participant = try Invoice.Participant(email: .init("participant@example.com")) diff --git a/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift b/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift index f7026c1a..f0bb143b 100644 --- a/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift +++ b/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PartnerFeeTests: XCTestCase { +public final class PartnerFeeTests: XCTestCase { func testInit()throws { let amount = CurrencyAmount(currency: .usd, value: 54.96) let payee = Payee(email: nil, merchant: nil, metadata: nil) diff --git a/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift b/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift index 97cb389a..f9ce56cc 100644 --- a/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift +++ b/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PartnerOptionsTests: XCTestCase { +public final class PartnerOptionsTests: XCTestCase { func testInit()throws { let dict: PartnerOptions = ["key": "value", "key1": "value1"] XCTAssertEqual(dict["key"], "value") diff --git a/Tests/ModelTests/PatchTests.swift b/Tests/ModelTests/PatchTests.swift index 0ae0355a..abfdb314 100644 --- a/Tests/ModelTests/PatchTests.swift +++ b/Tests/ModelTests/PatchTests.swift @@ -2,7 +2,7 @@ import XCTest import JSON @testable import PayPal -final class PatchTests: XCTestCase { +public final class PatchTests: XCTestCase { func testInit()throws { let patchStr = try Patch(operation: .move, path: "/name", value: "Oskar Reteep", from: "/full_name") diff --git a/Tests/ModelTests/PayTests/PayeeMetadataTests.swift b/Tests/ModelTests/PayTests/PayeeMetadataTests.swift index 3465f6e9..40fe64c8 100644 --- a/Tests/ModelTests/PayTests/PayeeMetadataTests.swift +++ b/Tests/ModelTests/PayTests/PayeeMetadataTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PayeeMetadataTests: XCTestCase { +public final class PayeeMetadataTests: XCTestCase { func testInit()throws { let metadata = try Payee.Metadata( email: .init("payee@example.com"), diff --git a/Tests/ModelTests/PayTests/PayeeTests.swift b/Tests/ModelTests/PayTests/PayeeTests.swift index 043e49fd..10f6e8b5 100644 --- a/Tests/ModelTests/PayTests/PayeeTests.swift +++ b/Tests/ModelTests/PayTests/PayeeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PayeeTests: XCTestCase { +public final class PayeeTests: XCTestCase { func testInit()throws { let metadata = try Payee.Metadata( email: .init("payee@example.com"), diff --git a/Tests/ModelTests/PayTests/PayerInfoTests.swift b/Tests/ModelTests/PayTests/PayerInfoTests.swift index dac9b26e..c71f5926 100644 --- a/Tests/ModelTests/PayTests/PayerInfoTests.swift +++ b/Tests/ModelTests/PayTests/PayerInfoTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PayerInfoTests: XCTestCase { +public final class PayerInfoTests: XCTestCase { func testInit()throws { let info = PayerInfo( email: "payer@exmaple.com", diff --git a/Tests/ModelTests/PayTests/PayerTests.swift b/Tests/ModelTests/PayTests/PayerTests.swift index fe7fb5b7..29b61cef 100644 --- a/Tests/ModelTests/PayTests/PayerTests.swift +++ b/Tests/ModelTests/PayTests/PayerTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PayerTests: XCTestCase { +public final class PayerTests: XCTestCase { func testInit()throws { let payer = try Payer( method: .paypal, diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift index 5e3382a5..f8d373f0 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentDetailMethodTests: XCTestCase { +public final class PaymentDetailMethodTests: XCTestCase { struct Detail: Codable { let method: PaymentDetail.Method } diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift index fc3e879e..24df379c 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentDetailTests: XCTestCase { +public final class PaymentDetailTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift index f497d651..2d7fb7d8 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentDetailTypeTests: XCTestCase { +public final class PaymentDetailTypeTests: XCTestCase { struct Detail: Codable { let type: PaymentDetail.DetailType } diff --git a/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift b/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift index c360ef44..e3f93456 100644 --- a/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentExecutorTests: XCTestCase { +public final class PaymentExecutorTests: XCTestCase { func testInit()throws { let executor = Payment.Executor(payer: "payer", amounts: []) diff --git a/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift b/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift index 7364c5f2..71842aaf 100644 --- a/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Hold = Payment.HoldReason -final class PaymentHoldTests: XCTestCase { +public final class PaymentHoldTests: XCTestCase { private struct Pay: Codable { let hold: Hold } diff --git a/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift b/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift index 789f5086..a8d1242f 100644 --- a/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Intent = Payment.Intent -final class PaymentIntentTests: XCTestCase { +public final class PaymentIntentTests: XCTestCase { private struct Pay: Codable { let intent: Intent } diff --git a/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift index 96876eab..9bd8e70f 100644 --- a/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentItemListTests: XCTestCase { +public final class PaymentItemListTests: XCTestCase { let address = Address( recipientName: nil, defaultAddress: nil, diff --git a/Tests/ModelTests/PaymentTests/PaymentItemTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemTests.swift index 14d5b098..39e96212 100644 --- a/Tests/ModelTests/PaymentTests/PaymentItemTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentItemTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentItemTests: XCTestCase { +public final class PaymentItemTests: XCTestCase { func testInit()throws { let item = try Payment.Item( quantity: .init(3), price: .init(2.50), currency: .usd, sku: .init("123456"), name: .init("Foo"), diff --git a/Tests/ModelTests/PaymentTests/PaymentListTests.swift b/Tests/ModelTests/PaymentTests/PaymentListTests.swift index 86b46edc..e0c8888e 100644 --- a/Tests/ModelTests/PaymentTests/PaymentListTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentListTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentListTests: XCTestCase { +public final class PaymentListTests: XCTestCase { func testDecoding()throws { let decoder = JSONDecoder() diff --git a/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift index e7bb05bd..c0dc102a 100644 --- a/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentMethodTests: XCTestCase { +public final class PaymentMethodTests: XCTestCase { struct Pay: Codable { let method: PaymentMethod } diff --git a/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift index cc85cef6..767890a1 100644 --- a/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Method = Payment.Options.Method -final class PaymentOptionsMethodTests: XCTestCase { +public final class PaymentOptionsMethodTests: XCTestCase { private struct Options: Codable { let method: Method } diff --git a/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift index f14522b0..c75ae0bb 100644 --- a/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Protection = RelatedResource.Protection -final class PaymentProtectionTests: XCTestCase { +public final class PaymentProtectionTests: XCTestCase { private struct Sale: Codable { let protection: Protection } diff --git a/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift index 8e624866..6b3012b2 100644 --- a/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Type = RelatedResource.ProtectionType -final class PaymentProtectionTypeTests: XCTestCase { +public final class PaymentProtectionTypeTests: XCTestCase { private struct Protection: Codable { let type: Type } diff --git a/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift b/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift index 9483ca0c..45d47b1c 100644 --- a/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentReceivingPreferencesTests: XCTestCase { +public final class PaymentReceivingPreferencesTests: XCTestCase { func testInit()throws { let preference = try PaymentReceivingPreferences( blockUnconfirmedUSAddress: true, diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift index 47e9ab9b..20c43e70 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentRefundResultTests: XCTestCase { +public final class PaymentRefundResultTests: XCTestCase { func testDecoding()throws { let decoder = JSONDecoder() diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift index d5dd8bb1..76a1a5ea 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = Payment.RefundResult.State -final class PaymentRefundStateTests: XCTestCase { +public final class PaymentRefundStateTests: XCTestCase { private struct Result: Codable { let state: State } diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift index e8f03cc2..3197e223 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentRefundTests: XCTestCase { +public final class PaymentRefundTests: XCTestCase { func testInit()throws { let refund = try Payment.Refund( amount: DetailedAmount(currency: .usd, total: 10.00, details: nil), diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift index 6f202546..a4988ec2 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Mode = RelatedResource.Sale.PaymentMode -final class PaymentSaleModeTests: XCTestCase { +public final class PaymentSaleModeTests: XCTestCase { private struct Sale: Codable { let mode: Mode } diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift index e9e85fad..54124d69 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Reason = RelatedResource.Sale.Reason -final class PaymentSaleReasonTests: XCTestCase { +public final class PaymentSaleReasonTests: XCTestCase { private struct Sale: Codable { let reason: Reason } diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift index 1af667cb..f5543dd1 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = RelatedResource.Sale.State -final class PaymentSaleStateTests: XCTestCase { +public final class PaymentSaleStateTests: XCTestCase { private struct Sale: Codable { let state: State } diff --git a/Tests/ModelTests/PaymentTests/PaymentStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentStateTests.swift index dc3782a3..5d618b56 100644 --- a/Tests/ModelTests/PaymentTests/PaymentStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = Payment.State -final class PaymentStateTests: XCTestCase { +public final class PaymentStateTests: XCTestCase { private struct Pay: Codable { let state: State } diff --git a/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift b/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift index 894edd86..df3725a3 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentSummaryTests: XCTestCase { +public final class PaymentSummaryTests: XCTestCase { func testDecoding()throws { let decoder = JSONDecoder() diff --git a/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift index df2f6ee0..71fd3549 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentTermTypeTests: XCTestCase { +public final class PaymentTermTypeTests: XCTestCase { struct User: Codable { let role: Role } diff --git a/Tests/ModelTests/PaymentTests/PaymentTests.swift b/Tests/ModelTests/PaymentTests/PaymentTests.swift index 66f404f0..108c7b9b 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentTests: XCTestCase { +public final class PaymentTests: XCTestCase { func testInit()throws { let payment = try Payment( intent: .order, diff --git a/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift index 7489ef17..3b6b28b8 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PaymentTransactionTests: XCTestCase { +public final class PaymentTransactionTests: XCTestCase { func testInit()throws { let transaction = try Payment.Transaction( amount: DetailedAmount(currency: .usd, total: 54.56, details: nil), diff --git a/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift index db4a8176..f82b5a21 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentTransactionTypeTests: XCTestCase { +public final class PaymentTransactionTypeTests: XCTestCase { struct Pay: Codable { let type: PaymentType } diff --git a/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift index bee24f50..f919577f 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PaymentTypeTests: XCTestCase { +public final class PaymentTypeTests: XCTestCase { struct Pay: Codable { let type: PaymentType } diff --git a/Tests/ModelTests/PercentRangeTests.swift b/Tests/ModelTests/PercentRangeTests.swift index 37860f29..46479354 100644 --- a/Tests/ModelTests/PercentRangeTests.swift +++ b/Tests/ModelTests/PercentRangeTests.swift @@ -8,7 +8,7 @@ extension PercentRange { } } -final class PercentRangeTests: XCTestCase { +public final class PercentRangeTests: XCTestCase { func testInit()throws { let range = try PercentRange(min: .init(25), max: .init(54)) XCTAssertEqual(range.minimum.value, 25) diff --git a/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift index a32bf958..f0a5475e 100644 --- a/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift +++ b/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class PhoneNumberTests: XCTestCase { +public final class PhoneNumberTests: XCTestCase { func testInit()throws { let number = try PhoneNumber(country: .init(1), number: .init(9963191901)) diff --git a/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift b/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift index 57e76c85..5b7f0107 100644 --- a/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift +++ b/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class PhoneTypeTests: XCTestCase { +public final class PhoneTypeTests: XCTestCase { struct Phone: Codable { let type: PhoneType } diff --git a/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift index 7f7ad927..45309df9 100644 --- a/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift +++ b/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class TypedPhoneNumberTests: XCTestCase { +public final class TypedPhoneNumberTests: XCTestCase { func testInit()throws { let number = try TypedPhoneNumber(type: .home, country: .init(1), nationalNumber: .init(5838954290), extension: .init(777)) diff --git a/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift b/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift index d86f7ce6..3f30ce35 100644 --- a/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift +++ b/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift @@ -3,7 +3,7 @@ import XCTest private typealias Permission = Product.GrantedPermission -final class ProductGrantedPermissionTests: XCTestCase { +public final class ProductGrantedPermissionTests: XCTestCase { private struct Product: Codable { let permission: Permission } diff --git a/Tests/ModelTests/ProductTests/ProductNameTests.swift b/Tests/ModelTests/ProductTests/ProductNameTests.swift index 800aedef..0e5e8585 100644 --- a/Tests/ModelTests/ProductTests/ProductNameTests.swift +++ b/Tests/ModelTests/ProductTests/ProductNameTests.swift @@ -3,7 +3,7 @@ import XCTest private typealias Name = Product.Name -final class ProductNameTests: XCTestCase { +public final class ProductNameTests: XCTestCase { private struct Product: Codable { let name: Name } diff --git a/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift b/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift index 5bcdd19d..96fd0a6e 100644 --- a/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift +++ b/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift @@ -3,7 +3,7 @@ import XCTest private typealias Status = Product.VettingStatus -final class ProductVettingStatusTests: XCTestCase { +public final class ProductVettingStatusTests: XCTestCase { private struct Product: Codable { let status: Status } diff --git a/Tests/ModelTests/QueryParameterTests.swift b/Tests/ModelTests/QueryParameterTests.swift index a19ee7ef..fd4f036c 100644 --- a/Tests/ModelTests/QueryParameterTests.swift +++ b/Tests/ModelTests/QueryParameterTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class QueryParamaterTests: XCTestCase { +public final class QueryParamaterTests: XCTestCase { func testStringContainsCount() { let uno = "unodounotwounothree-fouruno" XCTAssert(uno.contains("uno", times: 4)) diff --git a/Tests/ModelTests/RefundTests/RefundDetailTests.swift b/Tests/ModelTests/RefundTests/RefundDetailTests.swift index fa848ffe..e3b333cf 100644 --- a/Tests/ModelTests/RefundTests/RefundDetailTests.swift +++ b/Tests/ModelTests/RefundTests/RefundDetailTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RefundDetailTests: XCTestCase { +public final class RefundDetailTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/RefundTests/RefundStatusTests.swift b/Tests/ModelTests/RefundTests/RefundStatusTests.swift index 97c0483e..4165bf75 100644 --- a/Tests/ModelTests/RefundTests/RefundStatusTests.swift +++ b/Tests/ModelTests/RefundTests/RefundStatusTests.swift @@ -3,7 +3,7 @@ import XCTest typealias RefStat = Refund.Status -final class RefundStatusTests: XCTestCase { +public final class RefundStatusTests: XCTestCase { struct Ref: Codable { let status: RefStat } diff --git a/Tests/ModelTests/RefundTests/RefundTests.swift b/Tests/ModelTests/RefundTests/RefundTests.swift index 86ce49c0..d4fa9a3b 100644 --- a/Tests/ModelTests/RefundTests/RefundTests.swift +++ b/Tests/ModelTests/RefundTests/RefundTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RefundTests: XCTestCase { +public final class RefundTests: XCTestCase { func testInit()throws { let refund = Refund(amount: DetailedAmount(currency: .usd, total: 10.00, details: nil)) diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift index 5abd09c8..96ed1928 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RelatedProcessorTests: XCTestCase { +public final class RelatedProcessorTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift index 13dd9d5d..9bf83aa0 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RelatedResourceAuthorizationTests: XCTestCase { +public final class RelatedResourceAuthorizationTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift index a8f6960a..c93068c2 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class RelatedResourceCaptureTests: XCTestCase { +public final class RelatedResourceCaptureTests: XCTestCase { func testInit()throws { let capture = try RelatedResource.Capture( amount: DetailedAmount(currency: .usd, total: 67.23, details: nil), diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift index b8fc30aa..5c049126 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RelatedResourceOrderTests: XCTestCase { +public final class RelatedResourceOrderTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift index 2ad3c9e2..915e8648 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class RelatedResourceRefundTests: XCTestCase { +public final class RelatedResourceRefundTests: XCTestCase { func testInit()throws { let refund = try RelatedResource.Refund( amount: DetailedAmount(currency: .usd, total: 67.23, details: nil), diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift index 4d62179e..09390266 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RelatedResourceSaleTests: XCTestCase { +public final class RelatedResourceSaleTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift index ca2f4986..f107225e 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RelatedResourceTests: XCTestCase { +public final class RelatedResourceTests: XCTestCase { func testInit()throws { let resource = RelatedResource( sale: .init(id: "", amount: DetailedAmount(currency: .usd, total: 10.0, details: nil), state: .pending, parent: "10"), diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift index 1cd43fbb..2104d2b6 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Mode = RelatedResource.Authorization.PaymentMode -final class ResourceAuthorizationPaymentModeTests: XCTestCase { +public final class ResourceAuthorizationPaymentModeTests: XCTestCase { private struct Auth: Codable { let mode: Mode } diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift index db3dfb66..b5d3daf3 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Reason = RelatedResource.Authorization.Reason -final class ResourceAuthorizationReasonTests: XCTestCase { +public final class ResourceAuthorizationReasonTests: XCTestCase { private struct Auth: Codable { let reason: Reason } diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift index 4717f4e6..3a65ede0 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = RelatedResource.Authorization.State -final class ResourceAuthorizationStateTests: XCTestCase { +public final class ResourceAuthorizationStateTests: XCTestCase { private struct Auth: Codable { let state: State } diff --git a/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift index af5a1bd4..aac5c25a 100644 --- a/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Reason = RelatedResource.Capture.Reason -final class ResourceCaptureReasonTests: XCTestCase { +public final class ResourceCaptureReasonTests: XCTestCase { private struct Capture: Codable { let reason: Reason } diff --git a/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift index 39d89745..c8fefd70 100644 --- a/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = RelatedResource.Capture.State -final class ResourceCaptureStateTests: XCTestCase { +public final class ResourceCaptureStateTests: XCTestCase { private struct Capture: Codable { let state: State } diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift index 2526cd1c..59606e1e 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Mode = RelatedResource.Order.PaymentMode -final class ResourceOrderPaymentModeTests: XCTestCase { +public final class ResourceOrderPaymentModeTests: XCTestCase { private struct Order: Codable { let mode: Mode } diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift index c7f4f9d0..5f982d9e 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Reason = RelatedResource.Order.Reason -final class ResourceOrderReasonTests: XCTestCase { +public final class ResourceOrderReasonTests: XCTestCase { private struct Order: Codable { let reason: Reason } diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift index b34d1e6c..fa94f83c 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = RelatedResource.Order.State -final class ResourceOrderStateTests: XCTestCase { +public final class ResourceOrderStateTests: XCTestCase { private struct Order: Codable { let state: State } diff --git a/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift b/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift index 5ca54f7e..b898d510 100644 --- a/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias Advice = RelatedResource.ProcessorResponse.AdviceCode -final class ResourceProcessorAdviceTests: XCTestCase { +public final class ResourceProcessorAdviceTests: XCTestCase { private struct Processor: Codable { let advice: Advice } diff --git a/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift index 3a45a8ff..9f923f7c 100644 --- a/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift @@ -3,7 +3,7 @@ import XCTest fileprivate typealias State = RelatedResource.Refund.State -final class ResourceRefundStateTests: XCTestCase { +public final class ResourceRefundStateTests: XCTestCase { private struct Order: Codable { let state: State } diff --git a/Tests/ModelTests/RoleTests.swift b/Tests/ModelTests/RoleTests.swift index b7a0b7dc..2424d47c 100644 --- a/Tests/ModelTests/RoleTests.swift +++ b/Tests/ModelTests/RoleTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class RoleTests: XCTestCase { +public final class RoleTests: XCTestCase { struct User: Codable { let role: Role } diff --git a/Tests/ModelTests/SaleTests/SaleStatusTests.swift b/Tests/ModelTests/SaleTests/SaleStatusTests.swift index e1daaffe..6d675247 100644 --- a/Tests/ModelTests/SaleTests/SaleStatusTests.swift +++ b/Tests/ModelTests/SaleTests/SaleStatusTests.swift @@ -3,7 +3,7 @@ import XCTest typealias SaleStat = Sale.Status -final class SaleStatusTests: XCTestCase { +public final class SaleStatusTests: XCTestCase { struct Sal: Codable { let status: SaleStat } diff --git a/Tests/ModelTests/SaleTests/SaleTests.swift b/Tests/ModelTests/SaleTests/SaleTests.swift index c9bf2bf8..96f3d7bd 100644 --- a/Tests/ModelTests/SaleTests/SaleTests.swift +++ b/Tests/ModelTests/SaleTests/SaleTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class SaleTests: XCTestCase { +public final class SaleTests: XCTestCase { func testInit()throws { let sale = Sale(amount: DetailedAmount(currency: .usd, total: 10.00, details: nil), transaction: CurrencyAmount(currency: .usd, value: 1.00)) diff --git a/Tests/ModelTests/SaleTests/SalesVenueTests.swift b/Tests/ModelTests/SaleTests/SalesVenueTests.swift index 799521c3..827c2cc8 100644 --- a/Tests/ModelTests/SaleTests/SalesVenueTests.swift +++ b/Tests/ModelTests/SaleTests/SalesVenueTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class SalesVenueTests: XCTestCase { +public final class SalesVenueTests: XCTestCase { func testInit()throws { let venue = SalesVenue(type: .ebay, ebayID: "D6013453-B76E-4CDD-A021-DFD31A4031FE", description: "Online Ebay Store") diff --git a/Tests/ModelTests/SaleTests/SellerTests.swift b/Tests/ModelTests/SaleTests/SellerTests.swift index d2130629..a1626399 100644 --- a/Tests/ModelTests/SaleTests/SellerTests.swift +++ b/Tests/ModelTests/SaleTests/SellerTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class SellerTests: XCTestCase { +public final class SellerTests: XCTestCase { func testInit()throws { let seller = try Seller(email: .init("witheringheights@exmaple.com"), name: "Leeli Wingfeather", merchantID: nil) diff --git a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift index 00f207ac..30fa200c 100644 --- a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift +++ b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class ShippingCostsTests: XCTestCase { +public final class ShippingCostsTests: XCTestCase { func testInit()throws { let shipping = ShippingCosts( amount: CurrencyAmount(currency: .usd, value: 2.50), diff --git a/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift b/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift index 0141a136..291da644 100644 --- a/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift +++ b/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class ShippingInfoTests: XCTestCase { +public final class ShippingInfoTests: XCTestCase { func testInit()throws { let info = try ShippingInfo( firstName: .init("Oskar"), diff --git a/Tests/ModelTests/SignupOptionsTests.swift b/Tests/ModelTests/SignupOptionsTests.swift index 63d16e13..819a6a3b 100644 --- a/Tests/ModelTests/SignupOptionsTests.swift +++ b/Tests/ModelTests/SignupOptionsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class SignupOptionsTests: XCTestCase { +public final class SignupOptionsTests: XCTestCase { let web = WebExperiencePreference( partnerLogo: nil, returnURL: nil, diff --git a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift index 69baf111..9f69e0c0 100644 --- a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift +++ b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class StakeholderTests: XCTestCase { +public final class StakeholderTests: XCTestCase { func testInit()throws { let holder = Business.Stakeholder( type: .partner, diff --git a/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift index 11aeb7e8..1d146a88 100644 --- a/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift +++ b/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift @@ -3,7 +3,7 @@ import XCTest typealias StakeholderType = Business.Stakeholder.StakeholderType -final class StakeholderTypeTests: XCTestCase { +public final class StakeholderTypeTests: XCTestCase { struct Holder: Codable { let type: Business.Stakeholder.StakeholderType } diff --git a/Tests/ModelTests/TaxTests.swift b/Tests/ModelTests/TaxTests.swift index 126a2644..b1825e00 100644 --- a/Tests/ModelTests/TaxTests.swift +++ b/Tests/ModelTests/TaxTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class TaxTests: XCTestCase { +public final class TaxTests: XCTestCase { func testInit()throws { let tax = try Tax(name: .init("Sales"), percent: .init(10), amount: CurrencyAmount(currency: .usd, value: 0.59)) diff --git a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift index cd8d65dc..0d1046c1 100644 --- a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class TemplateDataTests: XCTestCase { +public final class TemplateDataTests: XCTestCase { let (now, timlessNow): (Date, String) = { let now = Date() let timeless = TimelessDate.formatter.string(from: now) diff --git a/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift b/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift index 6b9d9e59..79c7fc63 100644 --- a/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateListFieldsTests: XCTestCase { +public final class TemplateListFieldsTests: XCTestCase { struct List: Codable { let field: Template.ListFields } diff --git a/Tests/ModelTests/TemplateTests/TemplateListTests.swift b/Tests/ModelTests/TemplateTests/TemplateListTests.swift index f895dab6..63386f4e 100644 --- a/Tests/ModelTests/TemplateTests/TemplateListTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateListTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateListTests: XCTestCase { +public final class TemplateListTests: XCTestCase { func testInit()throws { let list = Template.List(addresses: [], emails: [], phones: [], templates: []) diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift index 872c9cfe..465139b5 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateSettingFieldTests: XCTestCase { +public final class TemplateSettingFieldTests: XCTestCase { struct Settings: Codable { let field: Template.Settings.Field } diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift index 6d9d8591..17c03768 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateSettingsMetadataTests: XCTestCase { +public final class TemplateSettingsMetadataTests: XCTestCase { func testInit()throws { let metadata = Template.Settings.Metadata(hidden: false) diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift index be72ec92..0dc33664 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateSettingsTests: XCTestCase { +public final class TemplateSettingsTests: XCTestCase { func testInit()throws { let settings = Template.Settings(field: .itemsDescription, preference: .init(hidden: true)) diff --git a/Tests/ModelTests/TemplateTests/TemplateTests.swift b/Tests/ModelTests/TemplateTests/TemplateTests.swift index 934911b0..f19ab4d7 100644 --- a/Tests/ModelTests/TemplateTests/TemplateTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TemplateTests: XCTestCase { +public final class TemplateTests: XCTestCase { func testInit()throws { let template = Template( name: "Hours Template", diff --git a/Tests/ModelTests/TermTests/TermTests.swift b/Tests/ModelTests/TermTests/TermTests.swift index c447d0c8..dd4d7ad3 100644 --- a/Tests/ModelTests/TermTests/TermTests.swift +++ b/Tests/ModelTests/TermTests/TermTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TermTests: XCTestCase { +public final class TermTests: XCTestCase { func testInit()throws { let term = try Term( type: .monthly, diff --git a/Tests/ModelTests/TermTests/TermTypeTests.swift b/Tests/ModelTests/TermTests/TermTypeTests.swift index fcae1ba1..a1a5f9cc 100644 --- a/Tests/ModelTests/TermTests/TermTypeTests.swift +++ b/Tests/ModelTests/TermTests/TermTypeTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TermTypeTests: XCTestCase { +public final class TermTypeTests: XCTestCase { struct TaC: Codable { let type: TermType } diff --git a/Tests/ModelTests/TimelessDateTests.swift b/Tests/ModelTests/TimelessDateTests.swift index 8c10b8b6..ec8e0b6a 100644 --- a/Tests/ModelTests/TimelessDateTests.swift +++ b/Tests/ModelTests/TimelessDateTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TimelessDateTests: XCTestCase { +public final class TimelessDateTests: XCTestCase { func testInit()throws { let epoch = TimelessDate(date: "1970-01-01") let date: TimelessDate = 981_244_800.0 diff --git a/Tests/ModelTests/TrackingTests.swift b/Tests/ModelTests/TrackingTests.swift index 66fd40c2..8cff3b0e 100644 --- a/Tests/ModelTests/TrackingTests.swift +++ b/Tests/ModelTests/TrackingTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TrackingTests: XCTestCase { +public final class TrackingTests: XCTestCase { func testInit()throws { let tracking = Tracking(carrier: .usps, other: nil, url: "https://whoshippedit.com/shippment/9163524667210796186056", number: "9163524667210796186056") diff --git a/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift index 02fa3b52..d44a15ee 100644 --- a/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TransactionInfoStatusTests: XCTestCase { +public final class TransactionInfoStatusTests: XCTestCase { struct Request: Codable { let method: PayPal.Method } diff --git a/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift index fb985c85..a99dce94 100644 --- a/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift @@ -2,7 +2,7 @@ import XCTest import Failable @testable import PayPal -final class TransactionInfoTests: XCTestCase { +public final class TransactionInfoTests: XCTestCase { let now = Date() func testInit()throws { diff --git a/Tests/ModelTests/TransactionTests/TransactionStateTests.swift b/Tests/ModelTests/TransactionTests/TransactionStateTests.swift index cbe3bf22..16c7696d 100644 --- a/Tests/ModelTests/TransactionTests/TransactionStateTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionStateTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TransactionStateTests: XCTestCase { +public final class TransactionStateTests: XCTestCase { struct BillingTransaction: Codable { let state: Transaction.State } diff --git a/Tests/ModelTests/TransactionTests/TransactionTests.swift b/Tests/ModelTests/TransactionTests/TransactionTests.swift index 00a0872a..aa2d70c7 100644 --- a/Tests/ModelTests/TransactionTests/TransactionTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class TransactionTests: XCTestCase { +public final class TransactionTests: XCTestCase { func testInit()throws { let transaction = Transaction( amount: CurrencyCodeAmount(currency: .usd, value: 79.25), diff --git a/Tests/ModelTests/UpdateActionTests.swift b/Tests/ModelTests/UpdateActionTests.swift index f7b3e664..9171a2d8 100644 --- a/Tests/ModelTests/UpdateActionTests.swift +++ b/Tests/ModelTests/UpdateActionTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class UpdateActionTests: XCTestCase { +public final class UpdateActionTests: XCTestCase { struct Update: Codable { let action: UpdateAction } diff --git a/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift index 2eab5167..dc013520 100644 --- a/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift +++ b/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class UserInfoAddressTests: XCTestCase { +public final class UserInfoAddressTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/UserIntoTests/UserInfoTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoTests.swift index 15b418d7..87d868f7 100644 --- a/Tests/ModelTests/UserIntoTests/UserInfoTests.swift +++ b/Tests/ModelTests/UserIntoTests/UserInfoTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class UserInfoTests: XCTestCase { +public final class UserInfoTests: XCTestCase { func testDecoding()throws { let json = """ { diff --git a/Tests/ModelTests/VenueTests.swift b/Tests/ModelTests/VenueTests.swift index dffcb929..70792394 100644 --- a/Tests/ModelTests/VenueTests.swift +++ b/Tests/ModelTests/VenueTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import PayPal -final class VenueTests: XCTestCase { +public final class VenueTests: XCTestCase { struct Prod: Codable { let venue: Venue } diff --git a/Tests/PayPalTests/PayPalTests.swift b/Tests/PayPalTests/PayPalTests.swift index 5dd72d49..8851229d 100644 --- a/Tests/PayPalTests/PayPalTests.swift +++ b/Tests/PayPalTests/PayPalTests.swift @@ -1,6 +1,6 @@ import XCTest @testable import PayPal -final class PayPalTests: XCTestCase { +public final class PayPalTests: XCTestCase { static var allTests: [(String, (PayPalTests) -> ()throws -> ())] = [] } From 6f1596dd6ca0d81eabdc62a4ff47044ce3f80a8e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Feb 2019 13:33:24 -0600 Subject: [PATCH 006/160] Marked access level of OrderTests.setUp method to 'public' --- Tests/ControllerTests/OrdersTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ControllerTests/OrdersTests.swift b/Tests/ControllerTests/OrdersTests.swift index d1b98525..e80f754f 100644 --- a/Tests/ControllerTests/OrdersTests.swift +++ b/Tests/ControllerTests/OrdersTests.swift @@ -7,7 +7,7 @@ public final class OrdersTests: XCTestCase { var app: Application! var id: String? - override func setUp() { + override public func setUp() { super.setUp() setPaypalVars() From 37a20906f908adb65932409cdc1cfe64a668af4d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Feb 2019 13:37:54 -0600 Subject: [PATCH 007/160] Marked all test suite .allTests proeprties as public --- Tests/ConfigTests/EnvironmentTests.swift | 2 +- Tests/ConfigTests/ProviderTests.swift | 2 +- Tests/ControllerTests/APITests.swift | 2 +- Tests/ControllerTests/ActivitiesTests.swift | 2 +- Tests/ControllerTests/AuthenticationTests.swift | 2 +- Tests/ControllerTests/BillingAgreementsTests.swift | 2 +- Tests/ControllerTests/BillingPlansTests.swift | 2 +- Tests/ControllerTests/CustomerDiputesTests.swift | 2 +- Tests/ControllerTests/IdentityTests.swift | 2 +- Tests/ControllerTests/InvoicesTests.swift | 2 +- Tests/ControllerTests/ManagedAccountsTests.swift | 2 +- Tests/ControllerTests/PaymentsTests.swift | 2 +- Tests/ControllerTests/TemplatesTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift | 2 +- .../BusinessTests/BusinessOwnerAddressTypeTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessTests.swift | 2 +- Tests/ModelTests/BusinessTests/BusinessTypeTests.swift | 2 +- Tests/ModelTests/BuyerTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureReasonTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureStatusTests.swift | 2 +- Tests/ModelTests/CaptureTests/CaptureTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardStateTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardTests.swift | 2 +- Tests/ModelTests/CardTests/CreditCardTokenTests.swift | 2 +- Tests/ModelTests/CardTests/CreditDebitCodeTests.swift | 2 +- Tests/ModelTests/CarrierTests.swift | 2 +- Tests/ModelTests/ChargeTests/ChargeTests.swift | 2 +- Tests/ModelTests/ChargeTests/ChargeTypeTests.swift | 2 +- Tests/ModelTests/CounterPartyTests.swift | 2 +- Tests/ModelTests/CreatedMerchantResponseTests.swift | 2 +- Tests/ModelTests/CurrencyTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift | 2 +- .../ModelTests/CustomerTests/CustomerServiceMessageTests.swift | 2 +- .../CustomerTests/CustomerServiceMessageTypeTests.swift | 2 +- Tests/ModelTests/CustomerTests/CustomerServiceTests.swift | 2 +- Tests/ModelTests/DesignationTests.swift | 2 +- Tests/ModelTests/DetailedTests/DetailTests.swift | 2 +- Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift | 2 +- Tests/ModelTests/DetailedTests/DetailedAmountTests.swift | 2 +- Tests/ModelTests/DiscountTests.swift | 2 +- Tests/ModelTests/DisplayPhoneTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeChannelTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift | 2 +- Tests/ModelTests/DisputeTests/DisputeStatusTests.swift | 2 +- Tests/ModelTests/DocumentTests.swift | 2 +- Tests/ModelTests/EmailTests/CCEmailTests.swift | 2 +- Tests/ModelTests/EmailTests/EmailFrequencyTests.swift | 2 +- Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift | 2 +- Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift | 2 +- Tests/ModelTests/EstablishmentTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceTests.swift | 2 +- Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift | 2 +- Tests/ModelTests/ExtensionsTests.swift | 2 +- Tests/ModelTests/FileAttachmentTests.swift | 2 +- .../FinancialTests/FinancialInstrumentAccountTypeTests.swift | 2 +- Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift | 2 +- .../FinancialTests/FinancialInstrumentTypeTests.swift | 2 +- Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift | 2 +- Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift | 2 +- .../ModelTests/FraudTests/FraudManagementFilterTypeTests.swift | 2 +- Tests/ModelTests/FrequencyTests.swift | 2 +- Tests/ModelTests/FundingTests/FundingInstrumentTests.swift | 2 +- Tests/ModelTests/FundingTests/FundingOptionTests.swift | 2 +- Tests/ModelTests/GovernmentBodyTests.swift | 2 +- Tests/ModelTests/IDTests.swift | 2 +- Tests/ModelTests/InitialFailActionTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceListTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift | 2 +- Tests/ModelTests/InvoiceTests/InvoiceTests.swift | 2 +- Tests/ModelTests/ItemReason.swift | 2 +- Tests/ModelTests/KeyValueTests.swift | 2 +- Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift | 2 +- .../LegalAgreementTests/LegalAgreementTypeTests.swift | 2 +- Tests/ModelTests/LinkDescriptionTests.swift | 2 +- Tests/ModelTests/MerchantTests/MerchantAccountTests.swift | 2 +- Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift | 2 +- Tests/ModelTests/MessageTests/MessagePosterTests.swift | 2 +- Tests/ModelTests/MessageTests/MessageTests.swift | 2 +- Tests/ModelTests/MetadataTests.swift | 2 +- Tests/ModelTests/MethodTests.swift | 2 +- Tests/ModelTests/MoneyTests/MoneyRangeTests.swift | 2 +- Tests/ModelTests/MoneyTests/MoneyTests.swift | 2 +- Tests/ModelTests/NameTests.swift | 2 +- Tests/ModelTests/NewAgreementTests.swift | 2 +- Tests/ModelTests/NotificationOptionTests.swift | 2 +- Tests/ModelTests/OfferTests/OfferTests.swift | 2 +- Tests/ModelTests/OfferTests/OfferTypeTests.swift | 2 +- Tests/ModelTests/OperationTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderIntentTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderItemTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderMetadataTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPayerTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderPaymentTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderRedirectsTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift | 2 +- Tests/ModelTests/OrderTests/OrderUnitTests.swift | 2 +- Tests/ModelTests/OutcomeCodeTests.swift | 2 +- Tests/ModelTests/OverrideChargeTests.swift | 2 +- Tests/ModelTests/ParticipantTests.swift | 2 +- Tests/ModelTests/PartnerTests/PartnerFeeTests.swift | 2 +- Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift | 2 +- Tests/ModelTests/PatchTests.swift | 2 +- Tests/ModelTests/PayTests/PayeeMetadataTests.swift | 2 +- Tests/ModelTests/PayTests/PayeeTests.swift | 2 +- Tests/ModelTests/PayTests/PayerInfoTests.swift | 2 +- Tests/ModelTests/PayTests/PayerTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentHoldTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentIntentTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentItemListTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentItemTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentListTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift | 2 +- .../PaymentTests/PaymentReceivingPreferencesTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentRefundTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentStateTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift | 2 +- Tests/ModelTests/PaymentTests/PaymentTypeTests.swift | 2 +- Tests/ModelTests/PercentRangeTests.swift | 2 +- Tests/ModelTests/PhoneTests/PhoneNumberTests.swift | 2 +- Tests/ModelTests/PhoneTests/PhoneTypeTests.swift | 2 +- Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift | 2 +- Tests/ModelTests/ProductTests/ProductGrantedPermission.swift | 2 +- Tests/ModelTests/ProductTests/ProductNameTests.swift | 2 +- Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift | 2 +- Tests/ModelTests/QueryParameterTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundDetailTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundStatusTests.swift | 2 +- Tests/ModelTests/RefundTests/RefundTests.swift | 2 +- .../ModelTests/RelatedResourceTests/RelatedProcessorTests.swift | 2 +- .../RelatedResourceAuthorizationTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceCaptureTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceOrderTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceRefundTests.swift | 2 +- .../RelatedResourceTests/RelatedResourceSaleTests.swift | 2 +- .../ModelTests/RelatedResourceTests/RelatedResourceTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationPaymentModeTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationReasonTests.swift | 2 +- .../ResourceTests/ResourceAuthorizationStateTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift | 2 +- .../ResourceTests/ResourceOrderPaymentModeTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift | 2 +- .../ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift | 2 +- Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift | 2 +- Tests/ModelTests/RoleTests.swift | 2 +- Tests/ModelTests/SaleTests/SaleStatusTests.swift | 2 +- Tests/ModelTests/SaleTests/SaleTests.swift | 2 +- Tests/ModelTests/SaleTests/SalesVenueTests.swift | 2 +- Tests/ModelTests/SaleTests/SellerTests.swift | 2 +- Tests/ModelTests/ShippingTests/ShippingCostsTests.swift | 2 +- Tests/ModelTests/ShippingTests/ShippingInfoTests.swift | 2 +- Tests/ModelTests/SignupOptionsTests.swift | 2 +- Tests/ModelTests/StakeholderTests/StakeholderTests.swift | 2 +- Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift | 2 +- Tests/ModelTests/TaxTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateDataTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateListTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift | 2 +- .../TemplateTests/TemplateSettingsMetadataTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift | 2 +- Tests/ModelTests/TemplateTests/TemplateTests.swift | 2 +- Tests/ModelTests/TermTests/TermTests.swift | 2 +- Tests/ModelTests/TermTests/TermTypeTests.swift | 2 +- Tests/ModelTests/TimelessDateTests.swift | 2 +- Tests/ModelTests/TrackingTests.swift | 2 +- .../TransactionTests/TransactionInfoStatusTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionInfoTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionStateTests.swift | 2 +- Tests/ModelTests/TransactionTests/TransactionTests.swift | 2 +- Tests/ModelTests/UpdateActionTests.swift | 2 +- Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift | 2 +- Tests/ModelTests/UserIntoTests/UserInfoTests.swift | 2 +- Tests/ModelTests/VenueTests.swift | 2 +- Tests/PayPalTests/PayPalTests.swift | 2 +- 215 files changed, 215 insertions(+), 215 deletions(-) diff --git a/Tests/ConfigTests/EnvironmentTests.swift b/Tests/ConfigTests/EnvironmentTests.swift index d1817404..39b52ee2 100644 --- a/Tests/ConfigTests/EnvironmentTests.swift +++ b/Tests/ConfigTests/EnvironmentTests.swift @@ -17,7 +17,7 @@ public final class EnvironmentTests: XCTestCase { XCTAssertEqual(Environment.allCases, [.sandbox, .production]) } - static var allTests: [(String, (EnvironmentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EnvironmentTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testCaseDomains", testCaseDomains), ("testAllCase", testAllCase) diff --git a/Tests/ConfigTests/ProviderTests.swift b/Tests/ConfigTests/ProviderTests.swift index cc657001..e8566877 100644 --- a/Tests/ConfigTests/ProviderTests.swift +++ b/Tests/ConfigTests/ProviderTests.swift @@ -43,7 +43,7 @@ public final class ProviderTests: XCTestCase { self.environment = .testing } - static var allTests: [(String, (ProviderTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ProviderTests) -> ()throws -> ())] = [ ("testBootSucceeds", testBootSucceeds), ("testConfigurationRegistered", testConfigurationRegistered), ("testConfigurationHasExpectedValues", testConfigurationHasExpectedValues) diff --git a/Tests/ControllerTests/APITests.swift b/Tests/ControllerTests/APITests.swift index e4dafac2..936f499a 100644 --- a/Tests/ControllerTests/APITests.swift +++ b/Tests/ControllerTests/APITests.swift @@ -32,7 +32,7 @@ public final class APITests: XCTestCase { XCTAssertNotNil(info.token) } - static var allTests: [(String, (APITests) -> ()throws -> ())] = [ + public static var allTests: [(String, (APITests) -> ()throws -> ())] = [ ("testQueryStringEncoding", testQueryStringEncoding), ("testAPIHelper", testAPIHelper) ] diff --git a/Tests/ControllerTests/ActivitiesTests.swift b/Tests/ControllerTests/ActivitiesTests.swift index 6910d58f..d46a8479 100644 --- a/Tests/ControllerTests/ActivitiesTests.swift +++ b/Tests/ControllerTests/ActivitiesTests.swift @@ -30,7 +30,7 @@ public final class ActivitiesTests: XCTestCase { XCTAssertLessThanOrEqual(queried.items?.count ?? 0, 5) } - static var allTests: [(String, (ActivitiesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ActivitiesTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testActivitiesEndpoint", testActivitiesEndpoint) ] diff --git a/Tests/ControllerTests/AuthenticationTests.swift b/Tests/ControllerTests/AuthenticationTests.swift index a2d610e8..63874920 100644 --- a/Tests/ControllerTests/AuthenticationTests.swift +++ b/Tests/ControllerTests/AuthenticationTests.swift @@ -35,7 +35,7 @@ public final class AuthenticationTests: XCTestCase { XCTAssertEqual(auth.tokenExpired, false) } - static var allTests: [(String, (AuthenticationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (AuthenticationTests) -> ()throws -> ())] = [ ("testTokenExpired", testTokenExpired), ("testAPIAuthentication", testAPIAuthentication) ] diff --git a/Tests/ControllerTests/BillingAgreementsTests.swift b/Tests/ControllerTests/BillingAgreementsTests.swift index f43edc6e..33bee792 100644 --- a/Tests/ControllerTests/BillingAgreementsTests.swift +++ b/Tests/ControllerTests/BillingAgreementsTests.swift @@ -153,7 +153,7 @@ public final class BillingAgreementsTests: XCTestCase { XCTAssertNotEqual(details.id, id) } - static var allTests: [(String, (BillingAgreementsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingAgreementsTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testUpdateEndpoint", testUpdateEndpoint), diff --git a/Tests/ControllerTests/BillingPlansTests.swift b/Tests/ControllerTests/BillingPlansTests.swift index 264f2499..c32c8fee 100644 --- a/Tests/ControllerTests/BillingPlansTests.swift +++ b/Tests/ControllerTests/BillingPlansTests.swift @@ -99,7 +99,7 @@ public final class BillingPlansTests: XCTestCase { XCTAssertEqual(status, .ok) } - static var allTests: [(String, (BillingPlansTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BillingPlansTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testListEndpoint", testListEndpoint), diff --git a/Tests/ControllerTests/CustomerDiputesTests.swift b/Tests/ControllerTests/CustomerDiputesTests.swift index a224978d..b426c7f2 100644 --- a/Tests/ControllerTests/CustomerDiputesTests.swift +++ b/Tests/ControllerTests/CustomerDiputesTests.swift @@ -209,7 +209,7 @@ public final class CustomerDisputesTests: XCTestCase { return File(data: data, filename: name) } - static var allTests: [(String, (CustomerDisputesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerDisputesTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testListEndpoint", testListEndpoint), ("testDetailsEndpoint", testDetailsEndpoint), diff --git a/Tests/ControllerTests/IdentityTests.swift b/Tests/ControllerTests/IdentityTests.swift index cff61606..1a915157 100644 --- a/Tests/ControllerTests/IdentityTests.swift +++ b/Tests/ControllerTests/IdentityTests.swift @@ -27,7 +27,7 @@ public final class IdentityTests: XCTestCase { XCTAssertNotNil(info.id) } - static var allTests: [(String, (IdentityTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (IdentityTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testInfoEndpoint", testInfoEndpoint) ] diff --git a/Tests/ControllerTests/InvoicesTests.swift b/Tests/ControllerTests/InvoicesTests.swift index 6a1a076a..3c5f34be 100644 --- a/Tests/ControllerTests/InvoicesTests.swift +++ b/Tests/ControllerTests/InvoicesTests.swift @@ -296,7 +296,7 @@ public final class InvoicesTests: XCTestCase { XCTAssertEqual(empty.invoices?.count, 0) } - static var allTests: [(String, (InvoicesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoicesTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testListEndpoint", testListEndpoint), diff --git a/Tests/ControllerTests/ManagedAccountsTests.swift b/Tests/ControllerTests/ManagedAccountsTests.swift index 19aea151..fde89dfb 100644 --- a/Tests/ControllerTests/ManagedAccountsTests.swift +++ b/Tests/ControllerTests/ManagedAccountsTests.swift @@ -248,7 +248,7 @@ public final class ManagedAccountsTests: XCTestCase { XCTAssertGreaterThan(instruments.instruments?.count ?? 0, 0) } - static var allTests: [(String, (ManagedAccountsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ManagedAccountsTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testPatchEndpoint", testPatchEndpoint), diff --git a/Tests/ControllerTests/PaymentsTests.swift b/Tests/ControllerTests/PaymentsTests.swift index eac8f0b4..b685c5ef 100644 --- a/Tests/ControllerTests/PaymentsTests.swift +++ b/Tests/ControllerTests/PaymentsTests.swift @@ -259,7 +259,7 @@ public final class PaymentsTests: XCTestCase { XCTAssertEqual(refund.id, id) } - static var allTests: [(String, (PaymentsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentsTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testListEndpoint", testListEndpoint), diff --git a/Tests/ControllerTests/TemplatesTests.swift b/Tests/ControllerTests/TemplatesTests.swift index dca7093e..c89b584d 100644 --- a/Tests/ControllerTests/TemplatesTests.swift +++ b/Tests/ControllerTests/TemplatesTests.swift @@ -161,7 +161,7 @@ public final class TemplatesTests: XCTestCase { XCTAssertEqual(details.id, id) } - static var allTests: [(String, (TemplatesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplatesTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), ("testCreateEndpoint", testCreateEndpoint), ("testListEndpoint", testListEndpoint), diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift index ded288c9..dd177dea 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerAddress.swift @@ -158,7 +158,7 @@ public final class BusinessOwnerAddressTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(BusinessOwner.Address.self, from: state)) } - static var allTests: [(String, (BusinessOwnerAddressTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessOwnerAddressTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValueValidation", testValueValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift index 8e7449d0..b0bb5f3e 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerAddressTypeTests.swift @@ -45,7 +45,7 @@ public final class BusinessOwnerAddressTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(BOA.self, from: home).type, .home) } - static var allTests: [(String, (BusinessOwnerAddressTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessOwnerAddressTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift index cd8ec1ed..308209d0 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerIDTests.swift @@ -92,7 +92,7 @@ public final class IdentificationTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(Identification.self, from: country)) } - static var allTests: [(String, (IdentificationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (IdentificationTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift index 102eebcc..bccc582d 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerIDType.swift @@ -61,7 +61,7 @@ public final class BusinessOwnerIDTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(ID.self, from: valueAddedTaxID).type, .valueAddedTaxID) } - static var allTests: [(String, (BusinessOwnerIDTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessOwnerIDTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift index 493fa101..69ea405b 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift @@ -166,7 +166,7 @@ public final class BusinessOwnerTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(BusinessOwner.self, from: birthdate)) } - static var allTests: [(String, (BusinessOwnerTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessOwnerTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValueValidation", testValueValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift index bda3e4f8..4d4d2e0c 100644 --- a/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessSubTypeTests.swift @@ -52,7 +52,7 @@ public final class BusinessSubTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Busi.self, from: govtEstdStTr).type, .govtEstdStTr) } - static var allTests: [(String, (BusinessSubTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessSubTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessTests.swift b/Tests/ModelTests/BusinessTests/BusinessTests.swift index eda44beb..926428f1 100644 --- a/Tests/ModelTests/BusinessTests/BusinessTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessTests.swift @@ -211,7 +211,7 @@ public final class BusinessTests: XCTestCase { ) } - static var allTests: [(String, (BusinessTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValueValidation", testValueValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift b/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift index 4d779e06..f74c8434 100644 --- a/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessTypeTests.swift @@ -63,7 +63,7 @@ public final class BusinessTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Busi.self, from: otherCorporate).type, .otherCorporate) } - static var allTests: [(String, (BusinessTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BusinessTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/BuyerTests.swift b/Tests/ModelTests/BuyerTests.swift index 30a891f5..f3a0f081 100644 --- a/Tests/ModelTests/BuyerTests.swift +++ b/Tests/ModelTests/BuyerTests.swift @@ -46,7 +46,7 @@ public final class BuyerTests: XCTestCase { try XCTAssertEqual(Buyer(email: .init("witheringheights@exmaple.com"), name: "Leeli Wingfeather"), decoder.decode(Buyer.self, from: json)) } - static var allTests: [(String, (BuyerTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (BuyerTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift b/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift index 4c4f052b..65e426de 100644 --- a/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureReasonTests.swift @@ -58,7 +58,7 @@ public final class CaptureReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Cap.self, from: unconfirmedAddress).reason, .unconfirmedAddress) } - static var allTests: [(String, (CaptureReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CaptureReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift b/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift index 72614b91..8f67d75f 100644 --- a/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureStatusTests.swift @@ -48,7 +48,7 @@ public final class CaptureStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Cap.self, from: partiallyRefunded).status, .partiallyRefunded) } - static var allTests: [(String, (CaptureStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CaptureStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CaptureTests/CaptureTests.swift b/Tests/ModelTests/CaptureTests/CaptureTests.swift index fea02a8b..493ef9c3 100644 --- a/Tests/ModelTests/CaptureTests/CaptureTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureTests.swift @@ -57,7 +57,7 @@ public final class CaptureTests: XCTestCase { XCTAssertEqual(capture.transaction, CurrencyAmount(currency: .usd, value: 1.00)) } - static var allTests: [(String, (CaptureTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CaptureTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/CardTests/CreditCardStateTests.swift b/Tests/ModelTests/CardTests/CreditCardStateTests.swift index a467d698..34418d99 100644 --- a/Tests/ModelTests/CardTests/CreditCardStateTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardStateTests.swift @@ -44,7 +44,7 @@ public final class CreditCardStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(CC.self, from: expired).state, .expired) } - static var allTests: [(String, (CreditCardStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CreditCardStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CardTests/CreditCardTests.swift b/Tests/ModelTests/CardTests/CreditCardTests.swift index 32afbb69..5beefd88 100644 --- a/Tests/ModelTests/CardTests/CreditCardTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardTests.swift @@ -191,7 +191,7 @@ public final class CreditCardTests: XCTestCase { try XCTAssertEqual(cc, decoder.decode(CreditCard.self, from: valid)) } - static var allTests: [(String, (CreditCardTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CreditCardTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CardTests/CreditCardTokenTests.swift b/Tests/ModelTests/CardTests/CreditCardTokenTests.swift index 3ea54a62..1fdbd506 100644 --- a/Tests/ModelTests/CardTests/CreditCardTokenTests.swift +++ b/Tests/ModelTests/CardTests/CreditCardTokenTests.swift @@ -51,7 +51,7 @@ public final class CreditCardTokenTests: XCTestCase { XCTAssertEqual(token.expireYear, 2022) } - static var allTests: [(String, (CreditCardTokenTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CreditCardTokenTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift b/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift index bb0b603c..b0114f42 100644 --- a/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift +++ b/Tests/ModelTests/CardTests/CreditDebitCodeTests.swift @@ -43,7 +43,7 @@ public final class CreditDebitCodeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Card.self, from: all).code, .all) } - static var allTests: [(String, (CreditDebitCodeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CreditDebitCodeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CarrierTests.swift b/Tests/ModelTests/CarrierTests.swift index 5620d048..6c4864a5 100644 --- a/Tests/ModelTests/CarrierTests.swift +++ b/Tests/ModelTests/CarrierTests.swift @@ -175,7 +175,7 @@ public final class CarrierTests: XCTestCase { try XCTAssertEqual(decoder.decode(Shippment.self, from: usps).carrier, .usps) } - static var allTests: [(String, (CarrierTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CarrierTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ChargeTests/ChargeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTests.swift index 66fbfbed..d5c3b0eb 100644 --- a/Tests/ModelTests/ChargeTests/ChargeTests.swift +++ b/Tests/ModelTests/ChargeTests/ChargeTests.swift @@ -34,7 +34,7 @@ public final class ChargeTests: XCTestCase { try XCTAssertEqual(Charge(type: .tax, amount: CurrencyCodeAmount(currency: .eur, value: value)), decoder.decode(Charge.self, from: json)) } - static var allTests: [(String, (ChargeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ChargeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift b/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift index 897ba7cc..d378c985 100644 --- a/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift +++ b/Tests/ModelTests/ChargeTests/ChargeTypeTests.swift @@ -42,7 +42,7 @@ public final class ChargeTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Model.self, from: ship).type, .shipping) } - static var allTests: [(String, (ChargeTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ChargeTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CounterPartyTests.swift b/Tests/ModelTests/CounterPartyTests.swift index e4f64ce8..1a5aff16 100644 --- a/Tests/ModelTests/CounterPartyTests.swift +++ b/Tests/ModelTests/CounterPartyTests.swift @@ -46,7 +46,7 @@ public final class CounterPartyTests: XCTestCase { ) } - static var allTests: [(String, (CounterPartyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CounterPartyTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/CreatedMerchantResponseTests.swift b/Tests/ModelTests/CreatedMerchantResponseTests.swift index 1944d8fa..f9a57ee5 100644 --- a/Tests/ModelTests/CreatedMerchantResponseTests.swift +++ b/Tests/ModelTests/CreatedMerchantResponseTests.swift @@ -23,7 +23,7 @@ public final class CreatedMerchantResponseTests: XCTestCase { try XCTAssertEqual(response.authCode, .init("6C0AB2D4-5668-42E6-B943-9FF9956D860B")) } - static var allTests: [(String, (CreatedMerchantResponseTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CreatedMerchantResponseTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/CurrencyTests.swift b/Tests/ModelTests/CurrencyTests.swift index 55544adb..12e6720a 100644 --- a/Tests/ModelTests/CurrencyTests.swift +++ b/Tests/ModelTests/CurrencyTests.swift @@ -56,7 +56,7 @@ public final class CurrencyTests: XCTestCase { try XCTAssertEqual(decoder.decode(Model.self, from: existing), Model(cur: .zwl)) } - static var allTests: [(String, (CurrencyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CurrencyTests) -> ()throws -> ())] = [ ("testFindByCode", testFindByCode), ("testAllCasesSpeed", testAllCasesSpeed), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift index 4bf430dd..de4c8ea0 100644 --- a/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerDisputeListTests.swift @@ -102,7 +102,7 @@ public final class CustomerDisputeListTests: XCTestCase { ) } - static var allTests: [(String, (CustomerDisputeListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerDisputeListTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift b/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift index c630e55a..235b1605 100644 --- a/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerDisputeTests.swift @@ -139,7 +139,7 @@ public final class CustomerDisputeTests: XCTestCase { XCTAssertEqual(dispute.channel, .internal) } - static var allTests: [(String, (CustomerDisputeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerDisputeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift index edfc2840..f39d9860 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTests.swift @@ -100,7 +100,7 @@ public final class CustomerServiceMessageTests: XCTestCase { try XCTAssertEqual(message, decoder.decode(CustomerService.Message.self, from: json)) } - static var allTests: [(String, (CustomerServiceMessageTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerServiceMessageTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift index 23e777fe..4eacd10c 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceMessageTypeTests.swift @@ -42,7 +42,7 @@ public final class CustomerServiceMessageTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(CSM.self, from: retail).type, .retail) } - static var allTests: [(String, (CustomerServiceMessageTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerServiceMessageTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift b/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift index 8b717af1..6ab9aba3 100644 --- a/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift +++ b/Tests/ModelTests/CustomerTests/CustomerServiceTests.swift @@ -56,7 +56,7 @@ public final class CustomerServiceTests: XCTestCase { try XCTAssertEqual(service, decoder.decode(CustomerService.self, from: json)) } - static var allTests: [(String, (CustomerServiceTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CustomerServiceTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DesignationTests.swift b/Tests/ModelTests/DesignationTests.swift index 5254c26b..805a5b0c 100644 --- a/Tests/ModelTests/DesignationTests.swift +++ b/Tests/ModelTests/DesignationTests.swift @@ -38,7 +38,7 @@ public final class DesignationTests: XCTestCase { try XCTAssertEqual(designation, decoder.decode(Business.Designation.self, from: json)) } - static var allTests: [(String, (DesignationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DesignationTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DetailedTests/DetailTests.swift b/Tests/ModelTests/DetailedTests/DetailTests.swift index eb0668e6..c459e8d7 100644 --- a/Tests/ModelTests/DetailedTests/DetailTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailTests.swift @@ -101,7 +101,7 @@ public final class DetailTests: XCTestCase { XCTAssertEqual(details, decoded) } - static var allTests: [(String, (DetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DetailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift index 4300c208..7d4ca0ae 100644 --- a/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailedAmountDetailTests.swift @@ -122,7 +122,7 @@ public final class DetailedAmountDetailTests: XCTestCase { )) } - static var allTests: [(String, (DetailedAmountDetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DetailedAmountDetailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift b/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift index e0cdaf35..549f5997 100644 --- a/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailedAmountTests.swift @@ -45,7 +45,7 @@ public final class DetailedAmountTests: XCTestCase { try XCTAssertEqual(decoder.decode(DetailedAmount.self, from: json), amount) } - static var allTests: [(String, (DetailedAmountTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DetailedAmountTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DiscountTests.swift b/Tests/ModelTests/DiscountTests.swift index a48d4271..43935e5c 100644 --- a/Tests/ModelTests/DiscountTests.swift +++ b/Tests/ModelTests/DiscountTests.swift @@ -33,7 +33,7 @@ public final class DiscountTests: XCTestCase { try XCTAssertEqual(discount, decoder.decode(Discount.self, from: json)) } - static var allTests: [(String, (DiscountTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DiscountTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DisplayPhoneTests.swift b/Tests/ModelTests/DisplayPhoneTests.swift index 6d536219..bb718d0f 100644 --- a/Tests/ModelTests/DisplayPhoneTests.swift +++ b/Tests/ModelTests/DisplayPhoneTests.swift @@ -44,7 +44,7 @@ public final class DisplayPhoneTests: XCTestCase { try XCTAssertEqual(decoder.decode(DisplayPhone.self, from: json), DisplayPhone(country: .unitedStates, number: "245364984688834")) } - static var allTests: [(String, (DisplayPhoneTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisplayPhoneTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift b/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift index 125a2c42..474a5d5d 100644 --- a/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeChannelTests.swift @@ -42,7 +42,7 @@ public final class DisputeChannelTests: XCTestCase { try XCTAssertEqual(decoder.decode(Dispute.self, from: external).channel, .external) } - static var allTests: [(String, (DisputeChannelTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisputeChannelTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift b/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift index 39d7aa61..575bee61 100644 --- a/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeLifCycleStageTests.swift @@ -44,7 +44,7 @@ public final class DisputeLifeCycleTests: XCTestCase { try XCTAssertEqual(decoder.decode(Dispute.self, from: arbitration).stage, .arbitration) } - static var allTests: [(String, (DisputeLifeCycleTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisputeLifeCycleTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift b/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift index 7df374be..90a13197 100644 --- a/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeOutcomeTests.swift @@ -33,7 +33,7 @@ public final class DisputeOutcomeTests: XCTestCase { try XCTAssertEqual(outcome, decoder.decode(CustomerDispute.Outcome.self, from: json)) } - static var allTests: [(String, (DisputeOutcomeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisputeOutcomeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift index af2938ce..306a268a 100644 --- a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift +++ b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift @@ -116,7 +116,7 @@ public final class DisputeResolutionOfferTests: XCTestCase { )) } - static var allTests: [(String, (DisputeResolutionOfferTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisputeResolutionOfferTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift b/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift index f1864227..104e4d80 100644 --- a/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift +++ b/Tests/ModelTests/DisputeTests/DisputeStatusTests.swift @@ -50,7 +50,7 @@ public final class DisputeStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Dispute.self, from: other).status, .other) } - static var allTests: [(String, (DisputeStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DisputeStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/DocumentTests.swift b/Tests/ModelTests/DocumentTests.swift index 128078d3..f14b18c7 100644 --- a/Tests/ModelTests/DocumentTests.swift +++ b/Tests/ModelTests/DocumentTests.swift @@ -29,7 +29,7 @@ public final class DocumentTests: XCTestCase { try XCTAssertEqual(Document(name: "README.md", size: "65kb"), decoder.decode(Document.self, from: json)) } - static var allTests: [(String, (DocumentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (DocumentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/EmailTests/CCEmailTests.swift b/Tests/ModelTests/EmailTests/CCEmailTests.swift index 8c4990b6..a921b278 100644 --- a/Tests/ModelTests/EmailTests/CCEmailTests.swift +++ b/Tests/ModelTests/EmailTests/CCEmailTests.swift @@ -43,7 +43,7 @@ public final class CCEmailTests: XCTestCase { try XCTAssertEqual(CCEmail(email: .init("witheringheights@exmaple.com")), decoder.decode(CCEmail.self, from: json)) } - static var allTests: [(String, (CCEmailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (CCEmailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift b/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift index 2a039503..e1d45c96 100644 --- a/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift +++ b/Tests/ModelTests/EmailTests/EmailFrequencyTests.swift @@ -44,7 +44,7 @@ public final class EmailFrequencyTests: XCTestCase { try XCTAssertEqual(decoder.decode(Email.self, from: `default`).frequency, .default) } - static var allTests: [(String, (EmailFrequencyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EmailFrequencyTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift index 75d5e56c..495eccf1 100644 --- a/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift +++ b/Tests/ModelTests/ErrorTests/PayPalAPIErrorTests.swift @@ -45,7 +45,7 @@ public final class PayPalAPIErrorTests: XCTestCase { try XCTAssertEqual(self.error, decoder.decode(PayPalAPIError.self, from: valid)) } - static var allTests: [(String, (PayPalAPIErrorTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayPalAPIErrorTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift b/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift index fd72bdbb..b5aac518 100644 --- a/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift +++ b/Tests/ModelTests/ErrorTests/PayPalAPIIdentityErrorTests.swift @@ -36,7 +36,7 @@ public final class PayPalAPIIdentityErrorTests: XCTestCase { try XCTAssertEqual(self.error, decoder.decode(PayPalAPIIdentityError.self, from: valid)) } - static var allTests: [(String, (PayPalAPIIdentityErrorTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayPalAPIIdentityErrorTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/EstablishmentTests.swift b/Tests/ModelTests/EstablishmentTests.swift index 6d70d33c..4963f317 100644 --- a/Tests/ModelTests/EstablishmentTests.swift +++ b/Tests/ModelTests/EstablishmentTests.swift @@ -36,7 +36,7 @@ public final class EstablishmentTests: XCTestCase { try XCTAssertEqual(decoder.decode(Establishment.self, from: json), Establishment(state: .or, country: .unitedStates)) } - static var allTests: [(String, (EstablishmentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EstablishmentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift index 34b39b6c..8133e336 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceInfoTests.swift @@ -67,7 +67,7 @@ public final class EvidenceInfoTests: XCTestCase { try XCTAssertEqual(evidence, decoder.decode(Evidence.Info.self, from: json)) } - static var allTests: [(String, (EvidenceInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EvidenceInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/EvidenceTests/EvidenceTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTests.swift index d7e13444..34364e66 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceTests.swift @@ -121,7 +121,7 @@ public final class EvidenceTests: XCTestCase { try XCTAssertEqual(evidence, decoder.decode(Evidence.self, from: json)) } - static var allTests: [(String, (EvidenceTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EvidenceTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift b/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift index 4772a0c2..4bcf2273 100644 --- a/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift +++ b/Tests/ModelTests/EvidenceTests/EvidenceTypeTests.swift @@ -66,7 +66,7 @@ public final class EvidenceTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Evid.self, from: proofOfDeliverySignature).type, .proofOfDeliverySignature) } - static var allTests: [(String, (EvidenceTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (EvidenceTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ExtensionsTests.swift b/Tests/ModelTests/ExtensionsTests.swift index d05efe0b..5735edad 100644 --- a/Tests/ModelTests/ExtensionsTests.swift +++ b/Tests/ModelTests/ExtensionsTests.swift @@ -86,7 +86,7 @@ public final class ExtensionsTests: XCTestCase { try XCTAssertEqual(self.extensions, decoder.decode(Extensions.self, from: ext)) } - static var allTests: [(String, (ExtensionsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ExtensionsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/FileAttachmentTests.swift b/Tests/ModelTests/FileAttachmentTests.swift index 7ab0b987..9a2468a8 100644 --- a/Tests/ModelTests/FileAttachmentTests.swift +++ b/Tests/ModelTests/FileAttachmentTests.swift @@ -30,7 +30,7 @@ public final class FileAttachmentTests: XCTestCase { try XCTAssertEqual(file, decoder.decode(FileAttachment.self, from: ext)) } - static var allTests: [(String, (FileAttachmentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FileAttachmentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift index 74744cea..22340f5b 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentAccountTypeTests.swift @@ -44,7 +44,7 @@ public final class FinancialInstrumentAccountTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Instrument.self, from: checking).account, .checking) } - static var allTests: [(String, (FinancialInstrumentAccountTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FinancialInstrumentAccountTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift index 5a4c11e6..8d3f5c4b 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentTests.swift @@ -51,7 +51,7 @@ public final class FinancialInstrumentTests: XCTestCase { try XCTAssertEqual(FinancialInstruments(instruments: [FinancialInstrument()]), decoder.decode(FinancialInstruments.self, from: array)) } - static var allTests: [(String, (FinancialInstrumentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FinancialInstrumentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift b/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift index 92f4d0e7..043d8108 100644 --- a/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift +++ b/Tests/ModelTests/FinancialTests/FinancialInstrumentTypeTests.swift @@ -35,7 +35,7 @@ public final class FinancialInstrumentTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Instrument.self, from: bank).type, .bank) } - static var allTests: [(String, (FinancialInstrumentTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FinancialInstrumentTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift index cccd2915..c11b81ed 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterIDTests.swift @@ -62,7 +62,7 @@ public final class FraudManagementFilterIDTests: XCTestCase { try XCTAssertEqual(decoder.decode(Filter.self, from: securityCodeMismatch).id, .securityCodeMismatch) } - static var allTests: [(String, (FraudManagementFilterIDTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FraudManagementFilterIDTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift index e730e369..60475d2a 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterTests.swift @@ -20,7 +20,7 @@ public final class FraudManagementFilterTests: XCTestCase { XCTAssertEqual(filter.description, "Descripted") } - static var allTests: [(String, (FraudManagementFilterTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FraudManagementFilterTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift b/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift index 38904e19..90a12e5f 100644 --- a/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift +++ b/Tests/ModelTests/FraudTests/FraudManagementFilterTypeTests.swift @@ -46,7 +46,7 @@ public final class FraudManagementFilterTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Instrument.self, from: report).type, .report) } - static var allTests: [(String, (FraudManagementFilterTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FraudManagementFilterTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/FrequencyTests.swift b/Tests/ModelTests/FrequencyTests.swift index 690efa18..c5648131 100644 --- a/Tests/ModelTests/FrequencyTests.swift +++ b/Tests/ModelTests/FrequencyTests.swift @@ -44,7 +44,7 @@ public final class FrequencyTests: XCTestCase { try XCTAssertEqual(decoder.decode(Action.self, from: year).frequency, .year) } - static var allTests: [(String, (FrequencyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FrequencyTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift b/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift index c74476af..a2e8c8e8 100644 --- a/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift +++ b/Tests/ModelTests/FundingTests/FundingInstrumentTests.swift @@ -30,7 +30,7 @@ public final class FundingInstrumentTests: XCTestCase { try XCTAssertEqual(instrument, decoder.decode(FundingInstrument.self, from: json)) } - static var allTests: [(String, (FundingInstrumentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FundingInstrumentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/FundingTests/FundingOptionTests.swift b/Tests/ModelTests/FundingTests/FundingOptionTests.swift index 59f9c1e9..ba0c77e6 100644 --- a/Tests/ModelTests/FundingTests/FundingOptionTests.swift +++ b/Tests/ModelTests/FundingTests/FundingOptionTests.swift @@ -42,7 +42,7 @@ public final class FundingOptionTests: XCTestCase { try XCTAssertEqual(decoder.decode(Funding.self, from: instruments).option, .instruments) } - static var allTests: [(String, (FundingOptionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (FundingOptionTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/GovernmentBodyTests.swift b/Tests/ModelTests/GovernmentBodyTests.swift index 64af9f5d..fb47445a 100644 --- a/Tests/ModelTests/GovernmentBodyTests.swift +++ b/Tests/ModelTests/GovernmentBodyTests.swift @@ -26,7 +26,7 @@ public final class GovernmentBodyTests: XCTestCase { try XCTAssertEqual(GovernmentBody(name: "value"), decoder.decode(GovernmentBody.self, from: json)) } - static var allTests: [(String, (GovernmentBodyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (GovernmentBodyTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/IDTests.swift b/Tests/ModelTests/IDTests.swift index b7d2c07e..d165dd88 100644 --- a/Tests/ModelTests/IDTests.swift +++ b/Tests/ModelTests/IDTests.swift @@ -30,7 +30,7 @@ public final class IDTests: XCTestCase { try XCTAssertEqual("P-52603F876DFD4C61", decoder.decode(ID.self, from: mit)) } - static var allTests: [(String, (IDTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (IDTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/InitialFailActionTests.swift b/Tests/ModelTests/InitialFailActionTests.swift index 1b3728f1..6a28da90 100644 --- a/Tests/ModelTests/InitialFailActionTests.swift +++ b/Tests/ModelTests/InitialFailActionTests.swift @@ -42,7 +42,7 @@ public final class InitialFailActionTests: XCTestCase { try XCTAssertEqual(decoder.decode(Agreement.self, from: cont).action, .continue) } - static var allTests: [(String, (InitialFailActionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InitialFailActionTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift index 94855a3c..f0240105 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift @@ -208,7 +208,7 @@ public final class InvoiceItemTests: XCTestCase { try XCTAssertEqual(item, decoder.decode(Invoice.Item.self, from: json)) } - static var allTests: [(String, (InvoiceItemTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceItemTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift index df8e4253..ad6c83c9 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift @@ -105,7 +105,7 @@ public final class InvoiceListTests: XCTestCase { try XCTAssertEqual(list, decoder.decode(InvoiceList.self, from: json)) } - static var allTests: [(String, (InvoiceListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceListTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift index 942bec42..1b28a1cf 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceMeasureTests.swift @@ -43,7 +43,7 @@ public final class InvoiceMeasureTests: XCTestCase { try XCTAssertEqual(decoder.decode(Inv.self, from: quantity).measure, .quantity) } - static var allTests: [(String, (InvoiceMeasureTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceMeasureTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift index ba7b70c6..f5f2f046 100644 --- a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift @@ -50,7 +50,7 @@ public final class InvoicePaymentTests: XCTestCase { try XCTAssertEqual(payment, decoder.decode(Invoice.Payment.self, from: json)) } - static var allTests: [(String, (InvoicePaymentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoicePaymentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift index 1d503c5f..0df7317c 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceReminderTests.swift @@ -47,7 +47,7 @@ public final class InvoiceReminderTests: XCTestCase { try XCTAssertEqual(reminder, decoder.decode(Invoice.Reminder.self, from: json)) } - static var allTests: [(String, (InvoiceReminderTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceReminderTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift index 101410de..a1a0ab7e 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceSearchTests.swift @@ -82,7 +82,7 @@ public final class InvoiceSearchTests: XCTestCase { try XCTAssertEqual(search, decoder.decode(Invoice.Search.self, from: json)) } - static var allTests: [(String, (InvoiceSearchTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceSearchTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift index 9c996005..f9965efc 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceStatusTests.swift @@ -55,7 +55,7 @@ public final class InvoiceStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Inv.self, from: scheduled).status, .scheduled) } - static var allTests: [(String, (InvoiceStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift index 0a5689d6..366ba201 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift @@ -362,7 +362,7 @@ public final class InvoiceTests: XCTestCase { )) } - static var allTests: [(String, (InvoiceTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ItemReason.swift b/Tests/ModelTests/ItemReason.swift index 8ea38f62..7a36e71e 100644 --- a/Tests/ModelTests/ItemReason.swift +++ b/Tests/ModelTests/ItemReason.swift @@ -53,7 +53,7 @@ public final class ItemReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(IT.self, from: reacurringCancelled).reason, .reacurringCancelled) } - static var allTests: [(String, (ItemReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ItemReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/KeyValueTests.swift b/Tests/ModelTests/KeyValueTests.swift index e94ada5d..217ce2d4 100644 --- a/Tests/ModelTests/KeyValueTests.swift +++ b/Tests/ModelTests/KeyValueTests.swift @@ -60,7 +60,7 @@ public final class KeyValueTests: XCTestCase { try XCTAssertEqual(nv, decoder.decode(NameValue.self, from: njson)) } - static var allTests: [(String, (KeyValueTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (KeyValueTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift index 673bab21..ee0021bc 100644 --- a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift +++ b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTests.swift @@ -31,7 +31,7 @@ public final class LegalAgreementTests: XCTestCase { ) } - static var allTests: [(String, (LegalAgreementTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (LegalAgreementTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift index c74ae2af..0a9b1521 100644 --- a/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift +++ b/Tests/ModelTests/LegalAgreementTests/LegalAgreementTypeTests.swift @@ -44,7 +44,7 @@ public final class LegalAgreementTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Agreement.self, from: financialAuthority).type, .financialAuthority) } - static var allTests: [(String, (LegalAgreementTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (LegalAgreementTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/LinkDescriptionTests.swift b/Tests/ModelTests/LinkDescriptionTests.swift index 80bf23f2..b06d0926 100644 --- a/Tests/ModelTests/LinkDescriptionTests.swift +++ b/Tests/ModelTests/LinkDescriptionTests.swift @@ -35,7 +35,7 @@ public final class LinkDescriptionTests: XCTestCase { ) } - static var allTests: [(String, (LinkDescriptionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (LinkDescriptionTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift b/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift index 5f01a545..fe70dff7 100644 --- a/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift +++ b/Tests/ModelTests/MerchantTests/MerchantAccountTests.swift @@ -140,7 +140,7 @@ public final class MerchantAccountTests: XCTestCase { try XCTAssertEqual(account, decoder.decode(MerchantAccount.self, from: json)) } - static var allTests: [(String, (MerchantAccountTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MerchantAccountTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift index cda62ac7..e1e16cea 100644 --- a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift +++ b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift @@ -82,7 +82,7 @@ public final class MerchantPreferancesTests: XCTestCase { try XCTAssertEqual(preferances, decoder.decode(MerchantPreferances.self, from: json)) } - static var allTests: [(String, (MerchantPreferancesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MerchantPreferancesTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/MessageTests/MessagePosterTests.swift b/Tests/ModelTests/MessageTests/MessagePosterTests.swift index 0a0154cc..9e45205a 100644 --- a/Tests/ModelTests/MessageTests/MessagePosterTests.swift +++ b/Tests/ModelTests/MessageTests/MessagePosterTests.swift @@ -42,7 +42,7 @@ public final class MessagePosterTests: XCTestCase { try XCTAssertEqual(decoder.decode(Wall.self, from: seller).poster, .seller) } - static var allTests: [(String, (MessagePosterTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MessagePosterTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/MessageTests/MessageTests.swift b/Tests/ModelTests/MessageTests/MessageTests.swift index ea55d89b..8fa549b1 100644 --- a/Tests/ModelTests/MessageTests/MessageTests.swift +++ b/Tests/ModelTests/MessageTests/MessageTests.swift @@ -61,7 +61,7 @@ public final class MessageTests: XCTestCase { XCTAssertEqual(message.content, "🦄") } - static var allTests: [(String, (MessageTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MessageTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidation", testValidation), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/MetadataTests.swift b/Tests/ModelTests/MetadataTests.swift index 7095f205..eccdb13e 100644 --- a/Tests/ModelTests/MetadataTests.swift +++ b/Tests/ModelTests/MetadataTests.swift @@ -38,7 +38,7 @@ public final class MetadataTests: XCTestCase { XCTAssertEqual(metadata.payerView, "https://vapor.com/invoices/2620EF1C-4F5D-4479-8657-4DA21B56D023") } - static var allTests: [(String, (MetadataTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MetadataTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/MethodTests.swift b/Tests/ModelTests/MethodTests.swift index d1fb052f..e1a9f8df 100644 --- a/Tests/ModelTests/MethodTests.swift +++ b/Tests/ModelTests/MethodTests.swift @@ -49,7 +49,7 @@ public final class MethodTests: XCTestCase { try XCTAssertEqual(decoder.decode(Request.self, from: delete).method, .DELETE) } - static var allTests: [(String, (MethodTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MethodTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift index f6b63211..1cf2c818 100644 --- a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift @@ -41,7 +41,7 @@ public final class MoneyRangeTests: XCTestCase { try XCTAssertEqual(range, decoder.decode(MoneyRange.self, from: json)) } - static var allTests: [(String, (MoneyRangeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MoneyRangeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/MoneyTests/MoneyTests.swift b/Tests/ModelTests/MoneyTests/MoneyTests.swift index 8a6cd012..82aa2152 100644 --- a/Tests/ModelTests/MoneyTests/MoneyTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyTests.swift @@ -50,7 +50,7 @@ public final class MoneyTests: XCTestCase { try XCTAssertEqual(CurrencyCodeAmount(currency: .usd, value: 33), decoder.decode(CurrencyCodeAmount.self, from: valueParse)) } - static var allTests: [(String, (MoneyTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (MoneyTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/NameTests.swift b/Tests/ModelTests/NameTests.swift index 2142bc80..df64f3e9 100644 --- a/Tests/ModelTests/NameTests.swift +++ b/Tests/ModelTests/NameTests.swift @@ -103,7 +103,7 @@ public final class NameTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(Name.self, from: prefix)) } - static var allTests: [(String, (NameTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (NameTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/NewAgreementTests.swift b/Tests/ModelTests/NewAgreementTests.swift index 711dfd4e..a5d5705d 100644 --- a/Tests/ModelTests/NewAgreementTests.swift +++ b/Tests/ModelTests/NewAgreementTests.swift @@ -136,7 +136,7 @@ public final class NewAgreementTests: XCTestCase { try XCTAssertEqual(agreement, decoder.decode(NewAgreement.self, from: json)) } - static var allTests: [(String, (NewAgreementTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (NewAgreementTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/NotificationOptionTests.swift b/Tests/ModelTests/NotificationOptionTests.swift index a2048798..d5643c42 100644 --- a/Tests/ModelTests/NotificationOptionTests.swift +++ b/Tests/ModelTests/NotificationOptionTests.swift @@ -39,7 +39,7 @@ public final class NotificationOptionTests: XCTestCase { try XCTAssertEqual(decoder.decode(NotificationOptions.self, from: json), options) } - static var allTests: [(String, (NotificationOptionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (NotificationOptionTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OfferTests/OfferTests.swift b/Tests/ModelTests/OfferTests/OfferTests.swift index 27907b2b..cedbc262 100644 --- a/Tests/ModelTests/OfferTests/OfferTests.swift +++ b/Tests/ModelTests/OfferTests/OfferTests.swift @@ -41,7 +41,7 @@ public final class OfferTests: XCTestCase { try XCTAssertEqual(decoder.decode(Offer.self, from: json), offer) } - static var allTests: [(String, (OfferTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OfferTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OfferTests/OfferTypeTests.swift b/Tests/ModelTests/OfferTests/OfferTypeTests.swift index ab6489fb..6ba2a3ab 100644 --- a/Tests/ModelTests/OfferTests/OfferTypeTests.swift +++ b/Tests/ModelTests/OfferTests/OfferTypeTests.swift @@ -43,7 +43,7 @@ public final class OfferTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Off.self, from: refund).type, .refund) } - static var allTests: [(String, (OfferTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OfferTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OperationTests.swift b/Tests/ModelTests/OperationTests.swift index 506e0cf9..56fd97aa 100644 --- a/Tests/ModelTests/OperationTests.swift +++ b/Tests/ModelTests/OperationTests.swift @@ -46,7 +46,7 @@ public final class OperationTests: XCTestCase { try XCTAssertEqual(decoder.decode(Patch.self, from: test).operation, .test) } - static var allTests: [(String, (OperationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OperationTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderIntentTests.swift b/Tests/ModelTests/OrderTests/OrderIntentTests.swift index d1787dd3..cab353f5 100644 --- a/Tests/ModelTests/OrderTests/OrderIntentTests.swift +++ b/Tests/ModelTests/OrderTests/OrderIntentTests.swift @@ -45,7 +45,7 @@ public final class OrderIntentTests: XCTestCase { try XCTAssertEqual(decoder.decode(Or.self, from: authorize).intent, .authorize) } - static var allTests: [(String, (OrderIntentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderIntentTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderItemTests.swift b/Tests/ModelTests/OrderTests/OrderItemTests.swift index 88575dff..b93063ce 100644 --- a/Tests/ModelTests/OrderTests/OrderItemTests.swift +++ b/Tests/ModelTests/OrderTests/OrderItemTests.swift @@ -161,7 +161,7 @@ public final class OrderItemTests: XCTestCase { )) } - static var allTests: [(String, (OrderItemTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderItemTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderMetadataTests.swift b/Tests/ModelTests/OrderTests/OrderMetadataTests.swift index 1528c820..193590fb 100644 --- a/Tests/ModelTests/OrderTests/OrderMetadataTests.swift +++ b/Tests/ModelTests/OrderTests/OrderMetadataTests.swift @@ -32,7 +32,7 @@ public final class OrderMetadataTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.Metadata.self, from: json), Order.Metadata(data: ["name": "value"])) } - static var allTests: [(String, (OrderMetadataTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderMetadataTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift index 134fa527..62634ea2 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift @@ -129,7 +129,7 @@ public final class OrderPayerInfoTests: XCTestCase { )) } - static var allTests: [(String, (OrderPayerInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPayerInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift b/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift index 6fc19a42..9673765a 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerMethodTests.swift @@ -48,7 +48,7 @@ public final class OrderPaymentMethodTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: carrier).method, .carrier) } - static var allTests: [(String, (OrderPaymentMethodTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentMethodTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift b/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift index 651334c6..643dcfdb 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerStatusTests.swift @@ -44,7 +44,7 @@ public final class OrderPaymentStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: unverified).status, .unverified) } - static var allTests: [(String, (OrderPaymentStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift index 13b4d77c..de0b38fe 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerTaxTests.swift @@ -44,7 +44,7 @@ public final class OrderPayerTaxTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: cnpj).tax, .cnpj) } - static var allTests: [(String, (OrderPayerTaxTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPayerTaxTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderPayerTests.swift b/Tests/ModelTests/OrderTests/OrderPayerTests.swift index 7f30c3eb..b2a6d0d8 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerTests.swift @@ -37,7 +37,7 @@ public final class OrderPayerTests: XCTestCase { XCTAssertEqual(payer.info, .init(email: nil, birthdate: nil, tax: nil, taxType: nil, country: nil, billing: nil)) } - static var allTests: [(String, (OrderPayerTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPayerTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift index 2689e3b4..137f8686 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentDetailTests.swift @@ -15,7 +15,7 @@ public final class OrderPaymentDetailTests: XCTestCase { XCTAssertEqual(details.disbursement, .instant) } - static var allTests: [(String, (OrderPaymentDetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentDetailTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift index aacd2ec7..bbd60a37 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentDisbursementTests.swift @@ -44,7 +44,7 @@ public final class OrderPaymentDisbursementTests: XCTestCase { try XCTAssertEqual(decoder.decode(Or.self, from: delayed).disbursement, .delayed) } - static var allTests: [(String, (OrderPaymentDisbursementTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentDisbursementTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift index 8ec9d591..cb262ab6 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentRequestTests.swift @@ -31,7 +31,7 @@ public final class OrderPaymentRequestTests: XCTestCase { try XCTAssertEqual(request, decoder.decode(Order.PaymentRequest.self, from: json)) } - static var allTests: [(String, (OrderPaymentRequestTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentRequestTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderPaymentTests.swift b/Tests/ModelTests/OrderTests/OrderPaymentTests.swift index 7579a8d1..6d97ef4e 100644 --- a/Tests/ModelTests/OrderTests/OrderPaymentTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPaymentTests.swift @@ -40,7 +40,7 @@ public final class OrderPaymentTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.Payment.self, from: json), Order.Payment(captures: [], refunds: [], sales: [], authorizations: [])) } - static var allTests: [(String, (OrderPaymentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderPaymentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift b/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift index 33384300..8db2a292 100644 --- a/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift +++ b/Tests/ModelTests/OrderTests/OrderRedirectsTests.swift @@ -30,7 +30,7 @@ public final class RedirectsTests: XCTestCase { try XCTAssertEqual(Redirects(return: "https://example.com/return", cancel: "https://example.com/cancel"), decoder.decode(Redirects.self, from: json)) } - static var allTests: [(String, (RedirectsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RedirectsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderStatusTests.swift b/Tests/ModelTests/OrderTests/OrderStatusTests.swift index c16c0da8..35c4ef8e 100644 --- a/Tests/ModelTests/OrderTests/OrderStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderStatusTests.swift @@ -46,7 +46,7 @@ public final class OrderStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Or.self, from: failed).status, .failed) } - static var allTests: [(String, (OrderStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderTests.swift b/Tests/ModelTests/OrderTests/OrderTests.swift index 4ab8af48..393c26e5 100644 --- a/Tests/ModelTests/OrderTests/OrderTests.swift +++ b/Tests/ModelTests/OrderTests/OrderTests.swift @@ -87,7 +87,7 @@ public final class OrderTests: XCTestCase { XCTAssertEqual(order.context, AppContext()) } - static var allTests: [(String, (OrderTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift b/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift index b193859d..8d37f67c 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitReasonTests.swift @@ -50,7 +50,7 @@ public final class OrderUnitReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Unit.self, from: regulatory).reason, .regulatory) } - static var allTests: [(String, (OrderUnitReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderUnitReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift b/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift index 8086da7f..3545b826 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitStatusTests.swift @@ -47,7 +47,7 @@ public final class OrderUnitStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Unit.self, from: captured).status, .captured) } - static var allTests: [(String, (OrderUnitStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderUnitStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OrderTests/OrderUnitTests.swift b/Tests/ModelTests/OrderTests/OrderUnitTests.swift index dbfa0c86..164c6690 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitTests.swift @@ -224,7 +224,7 @@ public final class OrderUnitTests: XCTestCase { } - static var allTests: [(String, (OrderUnitTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OrderUnitTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OutcomeCodeTests.swift b/Tests/ModelTests/OutcomeCodeTests.swift index ebc98f9e..17f1eb1d 100644 --- a/Tests/ModelTests/OutcomeCodeTests.swift +++ b/Tests/ModelTests/OutcomeCodeTests.swift @@ -46,7 +46,7 @@ public final class OutcomeCodeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Out.self, from: cancelled).code, .cancelled) } - static var allTests: [(String, (OutcomeCodeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OutcomeCodeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/OverrideChargeTests.swift b/Tests/ModelTests/OverrideChargeTests.swift index fbf4aa68..a8d79758 100644 --- a/Tests/ModelTests/OverrideChargeTests.swift +++ b/Tests/ModelTests/OverrideChargeTests.swift @@ -58,7 +58,7 @@ public final class OverrideChargeTests: XCTestCase { ) } - static var allTests: [(String, (OverrideChargeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (OverrideChargeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ParticipantTests.swift b/Tests/ModelTests/ParticipantTests.swift index 3acd0e6e..1ace508f 100644 --- a/Tests/ModelTests/ParticipantTests.swift +++ b/Tests/ModelTests/ParticipantTests.swift @@ -38,7 +38,7 @@ public final class InvoiceParticipantTests: XCTestCase { try XCTAssertEqual(Invoice.Participant(email: .init("participant@example.com")), decoder.decode(Invoice.Participant.self, from: json)) } - static var allTests: [(String, (InvoiceParticipantTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (InvoiceParticipantTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift b/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift index f0bb143b..67385094 100644 --- a/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift +++ b/Tests/ModelTests/PartnerTests/PartnerFeeTests.swift @@ -41,7 +41,7 @@ public final class PartnerFeeTests: XCTestCase { try XCTAssertEqual(fee, decoder.decode(PartnerFee.self, from: json)) } - static var allTests: [(String, (PartnerFeeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PartnerFeeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift b/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift index f9ce56cc..561c1b5e 100644 --- a/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift +++ b/Tests/ModelTests/PartnerTests/PartnerOptionsTests.swift @@ -42,7 +42,7 @@ public final class PartnerOptionsTests: XCTestCase { try XCTAssertEqual(options, decoder.decode(PartnerOptions.self, from: mit)) } - static var allTests: [(String, (PartnerOptionsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PartnerOptionsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PatchTests.swift b/Tests/ModelTests/PatchTests.swift index abfdb314..ca2eeeb0 100644 --- a/Tests/ModelTests/PatchTests.swift +++ b/Tests/ModelTests/PatchTests.swift @@ -57,7 +57,7 @@ public final class PatchTests: XCTestCase { try XCTAssertEqual(patchArr, decoder.decode(Patch.self, from: arrJson)) } - static var allTests: [(String, (PatchTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PatchTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PayTests/PayeeMetadataTests.swift b/Tests/ModelTests/PayTests/PayeeMetadataTests.swift index 40fe64c8..5c30d335 100644 --- a/Tests/ModelTests/PayTests/PayeeMetadataTests.swift +++ b/Tests/ModelTests/PayTests/PayeeMetadataTests.swift @@ -69,7 +69,7 @@ public final class PayeeMetadataTests: XCTestCase { try XCTAssertEqual(metadata, decoder.decode(Payee.Metadata.self, from: json)) } - static var allTests: [(String, (PayeeMetadataTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayeeMetadataTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PayTests/PayeeTests.swift b/Tests/ModelTests/PayTests/PayeeTests.swift index 10f6e8b5..48bd85cf 100644 --- a/Tests/ModelTests/PayTests/PayeeTests.swift +++ b/Tests/ModelTests/PayTests/PayeeTests.swift @@ -56,7 +56,7 @@ public final class PayeeTests: XCTestCase { try XCTAssertEqual(metadata, decoder.decode(Payee.Metadata.self, from: json)) } - static var allTests: [(String, (PayeeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayeeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PayTests/PayerInfoTests.swift b/Tests/ModelTests/PayTests/PayerInfoTests.swift index c71f5926..7dba55e3 100644 --- a/Tests/ModelTests/PayTests/PayerInfoTests.swift +++ b/Tests/ModelTests/PayTests/PayerInfoTests.swift @@ -112,7 +112,7 @@ public final class PayerInfoTests: XCTestCase { try XCTAssertEqual(info, decoder.decode(PayerInfo.self, from: json)) } - static var allTests: [(String, (PayerInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayerInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PayTests/PayerTests.swift b/Tests/ModelTests/PayTests/PayerTests.swift index 29b61cef..ed97cff8 100644 --- a/Tests/ModelTests/PayTests/PayerTests.swift +++ b/Tests/ModelTests/PayTests/PayerTests.swift @@ -193,7 +193,7 @@ public final class PayerTests: XCTestCase { try XCTAssertEqual(payer, decoder.decode(Payer.self, from: json)) } - static var allTests: [(String, (PayerTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PayerTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift index f8d373f0..fe0a3e78 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailMethodTests.swift @@ -48,7 +48,7 @@ public final class PaymentDetailMethodTests: XCTestCase { try XCTAssertEqual(decoder.decode(Detail.self, from: debitCard).method, .debitCard) } - static var allTests: [(String, (PaymentDetailMethodTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentDetailMethodTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift index 24df379c..9c4d61c2 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift @@ -48,7 +48,7 @@ public final class PaymentDetailTests: XCTestCase { try XCTAssertEqual(detail, decoder.decode(PaymentDetail.self, from: json)) } - static var allTests: [(String, (PaymentDetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentDetailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift index 2d7fb7d8..63f7c86a 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailTypeTests.swift @@ -42,7 +42,7 @@ public final class PaymentDetailTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Detail.self, from: external).type, .external) } - static var allTests: [(String, (PaymentDetailTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentDetailTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift b/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift index e3f93456..22ccbc82 100644 --- a/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentExecutorTests.swift @@ -38,7 +38,7 @@ public final class PaymentExecutorTests: XCTestCase { try XCTAssertEqual(executor, decoder.decode(Payment.Executor.self, from: json)) } - static var allTests: [(String, (PaymentExecutorTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentExecutorTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift b/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift index 71842aaf..f540b085 100644 --- a/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentHoldTests.swift @@ -44,7 +44,7 @@ public final class PaymentHoldTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: shipping).hold, .shipping) } - static var allTests: [(String, (PaymentHoldTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentHoldTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift b/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift index a8d1242f..9412c574 100644 --- a/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentIntentTests.swift @@ -45,7 +45,7 @@ public final class PaymentIntentTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: sale).intent, .sale) } - static var allTests: [(String, (PaymentIntentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentIntentTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift index 9bd8e70f..ec9c3ce5 100644 --- a/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentItemListTests.swift @@ -88,7 +88,7 @@ public final class PaymentItemListTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(Payment.ItemList.self, from: phone)) } - static var allTests: [(String, (PaymentItemListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentItemListTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentItemTests.swift b/Tests/ModelTests/PaymentTests/PaymentItemTests.swift index 39e96212..24b1e600 100644 --- a/Tests/ModelTests/PaymentTests/PaymentItemTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentItemTests.swift @@ -85,7 +85,7 @@ public final class PaymentItemTests: XCTestCase { try XCTAssertEqual(item, decoder.decode(Payment.Item.self, from: json)) } - static var allTests: [(String, (PaymentItemTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentItemTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentListTests.swift b/Tests/ModelTests/PaymentTests/PaymentListTests.swift index e0c8888e..7be897a9 100644 --- a/Tests/ModelTests/PaymentTests/PaymentListTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentListTests.swift @@ -25,7 +25,7 @@ public final class PaymentListTests: XCTestCase { XCTAssertEqual(list.count.value, 20) } - static var allTests: [(String, (PaymentListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentListTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift index c0dc102a..5d9f4ee2 100644 --- a/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentMethodTests.swift @@ -42,7 +42,7 @@ public final class PaymentMethodTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: paypal).method, .paypal) } - static var allTests: [(String, (PaymentMethodTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentMethodTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift b/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift index 767890a1..682f8df9 100644 --- a/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentOptionsMethodTests.swift @@ -45,7 +45,7 @@ public final class PaymentOptionsMethodTests: XCTestCase { try XCTAssertEqual(decoder.decode(Options.self, from: unrestricted).method, .unrestricted) } - static var allTests: [(String, (PaymentOptionsMethodTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentOptionsMethodTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift index c75ae0bb..c5f0d434 100644 --- a/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentProtectionTests.swift @@ -45,7 +45,7 @@ public final class PaymentProtectionTests: XCTestCase { try XCTAssertEqual(decoder.decode(Sale.self, from: eligible).protection, .eligible) } - static var allTests: [(String, (PaymentProtectionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentProtectionTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift index 6b3012b2..9c6d34a3 100644 --- a/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentProtectionTypeTests.swift @@ -45,7 +45,7 @@ public final class PaymentProtectionTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Protection.self, from: itemNotReceived).type, .itemNotReceived) } - static var allTests: [(String, (PaymentProtectionTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentProtectionTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift b/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift index 45d47b1c..1860b579 100644 --- a/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentReceivingPreferencesTests.swift @@ -100,7 +100,7 @@ public final class PaymentReceivingPreferencesTests: XCTestCase { try XCTAssertEqual(preference, decoder.decode(PaymentReceivingPreferences.self, from: json)) } - static var allTests: [(String, (PaymentReceivingPreferencesTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentReceivingPreferencesTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift index 20c43e70..2e6deb25 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift @@ -69,7 +69,7 @@ public final class PaymentRefundResultTests: XCTestCase { XCTAssertEqual(refund.custom.value, String(repeating: "c", count: 127)) } - static var allTests: [(String, (PaymentRefundResultTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentRefundResultTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift index 76a1a5ea..1e1c82b2 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundStateTests.swift @@ -46,7 +46,7 @@ public final class PaymentRefundStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Result.self, from: failed).state, .failed) } - static var allTests: [(String, (PaymentRefundStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentRefundStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift index 3197e223..a85c904f 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundTests.swift @@ -82,7 +82,7 @@ public final class PaymentRefundTests: XCTestCase { try XCTAssertEqual(refund, decoder.decode(Payment.Refund.self, from: json)) } - static var allTests: [(String, (PaymentRefundTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentRefundTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift index a4988ec2..3935c420 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleModeTests.swift @@ -46,7 +46,7 @@ public final class PaymentSaleModeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Sale.self, from: echeck).mode, .echeck) } - static var allTests: [(String, (PaymentSaleModeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentSaleModeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift index 54124d69..63fd22bb 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleReasonTests.swift @@ -57,7 +57,7 @@ public final class PaymentSaleReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Sale.self, from: refund).reason, .refund) } - static var allTests: [(String, (PaymentSaleReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentSaleReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift index f5543dd1..1fed16d6 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSaleStateTests.swift @@ -47,7 +47,7 @@ public final class PaymentSaleStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Sale.self, from: refunded).state, .refunded) } - static var allTests: [(String, (PaymentSaleStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentSaleStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentStateTests.swift b/Tests/ModelTests/PaymentTests/PaymentStateTests.swift index 5d618b56..58d0a4a3 100644 --- a/Tests/ModelTests/PaymentTests/PaymentStateTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentStateTests.swift @@ -45,7 +45,7 @@ public final class PaymentStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: created).state, .created) } - static var allTests: [(String, (PaymentStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift b/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift index df3725a3..54ca7f26 100644 --- a/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentSummaryTests.swift @@ -24,7 +24,7 @@ public final class PaymentSummaryTests: XCTestCase { XCTAssertEqual(summary.other, CurrencyAmount(currency: .usd, value: 8.43)) } - static var allTests: [(String, (PaymentSummaryTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentSummaryTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift index 71fd3549..e3831146 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTermTypeTests.swift @@ -53,7 +53,7 @@ public final class PaymentTermTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Term.self, from: noDueDate).type, .noDueDate) } - static var allTests: [(String, (PaymentTermTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentTermTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentTests.swift b/Tests/ModelTests/PaymentTests/PaymentTests.swift index 108c7b9b..365407c7 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTests.swift @@ -111,7 +111,7 @@ public final class PaymentTests: XCTestCase { try XCTAssertThrowsError(decoder.decode(Payment.self, from: note)) } - static var allTests: [(String, (PaymentTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift index 3b6b28b8..20b91dcf 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTransactionTests.swift @@ -133,7 +133,7 @@ public final class PaymentTransactionTests: XCTestCase { XCTAssertEqual(transaction.itemList, .init(items: nil, address: nil, phoneNumber: nil)) } - static var allTests: [(String, (PaymentTransactionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentTransactionTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift index f82b5a21..2ea5cae3 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTransactionTypeTests.swift @@ -47,7 +47,7 @@ public final class PaymentTransactionTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Transaction.self, from: sale).type, .sale) } - static var allTests: [(String, (PaymentTransactionTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentTransactionTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift b/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift index f919577f..20ada189 100644 --- a/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentTypeTests.swift @@ -42,7 +42,7 @@ public final class PaymentTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Pay.self, from: regular).type, .regular) } - static var allTests: [(String, (PaymentTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PaymentTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PercentRangeTests.swift b/Tests/ModelTests/PercentRangeTests.swift index 46479354..f147a3da 100644 --- a/Tests/ModelTests/PercentRangeTests.swift +++ b/Tests/ModelTests/PercentRangeTests.swift @@ -69,7 +69,7 @@ public final class PercentRangeTests: XCTestCase { try XCTAssertEqual(PercentRange(min: .init(25), max: .init(75)), decoder.decode(PercentRange.self, from: json)) } - static var allTests: [(String, (PercentRangeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PercentRangeTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift index f0a5475e..e7979c07 100644 --- a/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift +++ b/Tests/ModelTests/PhoneTests/PhoneNumberTests.swift @@ -49,7 +49,7 @@ public final class PhoneNumberTests: XCTestCase { try XCTAssertEqual(PhoneNumber(country: .init(1), number: .init(9963191901)), decoder.decode(PhoneNumber.self, from: json)) } - static var allTests: [(String, (PhoneNumberTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PhoneNumberTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift b/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift index 5b7f0107..92ccb49c 100644 --- a/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift +++ b/Tests/ModelTests/PhoneTests/PhoneTypeTests.swift @@ -48,7 +48,7 @@ public final class PhoneTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Phone.self, from: work).type, .work) } - static var allTests: [(String, (PhoneTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (PhoneTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift b/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift index 45309df9..fea651e1 100644 --- a/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift +++ b/Tests/ModelTests/PhoneTests/TypedPhoneNumberTests.swift @@ -54,7 +54,7 @@ public final class TypedPhoneNumberTests: XCTestCase { ) } - static var allTests: [(String, (TypedPhoneNumberTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TypedPhoneNumberTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift b/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift index 3f30ce35..6fb16bd5 100644 --- a/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift +++ b/Tests/ModelTests/ProductTests/ProductGrantedPermission.swift @@ -75,7 +75,7 @@ public final class ProductGrantedPermissionTests: XCTestCase { try XCTAssertEqual(decoder.decode(Product.self, from: accountManagementPermission).permission, .accountManagementPermission) } - static var allTests: [(String, (ProductGrantedPermissionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ProductGrantedPermissionTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ProductTests/ProductNameTests.swift b/Tests/ModelTests/ProductTests/ProductNameTests.swift index 0e5e8585..dcb0c6be 100644 --- a/Tests/ModelTests/ProductTests/ProductNameTests.swift +++ b/Tests/ModelTests/ProductTests/ProductNameTests.swift @@ -67,7 +67,7 @@ public final class ProductNameTests: XCTestCase { try XCTAssertEqual(decoder.decode(Product.self, from: hostedSoleSolution).name, .hostedSoleSolution) } - static var allTests: [(String, (ProductNameTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ProductNameTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift b/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift index 96fd0a6e..1bcd9bd4 100644 --- a/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift +++ b/Tests/ModelTests/ProductTests/ProductVettingStatusTests.swift @@ -45,7 +45,7 @@ public final class ProductVettingStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Product.self, from: approved).status, .approved) } - static var allTests: [(String, (ProductVettingStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ProductVettingStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/QueryParameterTests.swift b/Tests/ModelTests/QueryParameterTests.swift index fd4f036c..dd494f50 100644 --- a/Tests/ModelTests/QueryParameterTests.swift +++ b/Tests/ModelTests/QueryParameterTests.swift @@ -82,7 +82,7 @@ public final class QueryParamaterTests: XCTestCase { } } - static var allTests: [(String, (QueryParamaterTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (QueryParamaterTests) -> ()throws -> ())] = [ ("testStringContainsCount", testStringContainsCount), ("testEncoding", testEncoding), ("testEncodingSpeed", testEncodingSpeed) diff --git a/Tests/ModelTests/RefundTests/RefundDetailTests.swift b/Tests/ModelTests/RefundTests/RefundDetailTests.swift index e3b333cf..45e3e674 100644 --- a/Tests/ModelTests/RefundTests/RefundDetailTests.swift +++ b/Tests/ModelTests/RefundTests/RefundDetailTests.swift @@ -47,7 +47,7 @@ public final class RefundDetailTests: XCTestCase { try XCTAssertEqual(detail, decoder.decode(RefundDetail.self, from: json)) } - static var allTests: [(String, (RefundDetailTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RefundDetailTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/RefundTests/RefundStatusTests.swift b/Tests/ModelTests/RefundTests/RefundStatusTests.swift index 4165bf75..f768be24 100644 --- a/Tests/ModelTests/RefundTests/RefundStatusTests.swift +++ b/Tests/ModelTests/RefundTests/RefundStatusTests.swift @@ -45,7 +45,7 @@ public final class RefundStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Ref.self, from: pending).status, .pending) } - static var allTests: [(String, (RefundStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RefundStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/RefundTests/RefundTests.swift b/Tests/ModelTests/RefundTests/RefundTests.swift index d4fa9a3b..4ded4219 100644 --- a/Tests/ModelTests/RefundTests/RefundTests.swift +++ b/Tests/ModelTests/RefundTests/RefundTests.swift @@ -51,7 +51,7 @@ public final class RefundTests: XCTestCase { XCTAssertEqual(refund.amount, DetailedAmount(currency: .usd, total: 10.00, details: nil)) } - static var allTests: [(String, (RefundTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RefundTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift index 96ed1928..af23073e 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedProcessorTests.swift @@ -24,7 +24,7 @@ public final class RelatedProcessorTests: XCTestCase { XCTAssertEqual(processor.vpas, "3326") } - static var allTests: [(String, (RelatedProcessorTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedProcessorTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift index 9bf83aa0..028d7fbd 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceAuthorizationTests.swift @@ -117,7 +117,7 @@ public final class RelatedResourceAuthorizationTests: XCTestCase { XCTAssertEqual(auth.amount, DetailedAmount(currency: .usd, total: 42.31, details: nil)) } - static var allTests: [(String, (RelatedResourceAuthorizationTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceAuthorizationTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift index c93068c2..71cdabd6 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceCaptureTests.swift @@ -130,7 +130,7 @@ public final class RelatedResourceCaptureTests: XCTestCase { } - static var allTests: [(String, (RelatedResourceCaptureTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceCaptureTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift index 5c049126..60a71def 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceOrderTests.swift @@ -93,7 +93,7 @@ public final class RelatedResourceOrderTests: XCTestCase { XCTAssertEqual(sale.amount, DetailedAmount(currency: .usd, total: 645.12, details: nil)) } - static var allTests: [(String, (RelatedResourceOrderTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceOrderTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift index 915e8648..5f2efbd7 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceRefundTests.swift @@ -114,7 +114,7 @@ public final class RelatedResourceRefundTests: XCTestCase { } - static var allTests: [(String, (RelatedResourceRefundTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceRefundTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift index 09390266..8630c310 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift @@ -141,7 +141,7 @@ public final class RelatedResourceSaleTests: XCTestCase { XCTAssertEqual(sale.amount, DetailedAmount(currency: .usd, total: 42.31, details: nil)) } - static var allTests: [(String, (RelatedResourceSaleTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceSaleTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift index f107225e..e63c5985 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift @@ -91,7 +91,7 @@ public final class RelatedResourceTests: XCTestCase { try XCTAssertEqual(resource, decoder.decode(RelatedResource.self, from: json)) } - static var allTests: [(String, (RelatedResourceTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RelatedResourceTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift index 2104d2b6..441760b8 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationPaymentModeTests.swift @@ -34,7 +34,7 @@ public final class ResourceAuthorizationPaymentModeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Auth.self, from: instant).mode, .instant) } - static var allTests: [(String, (ResourceAuthorizationPaymentModeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceAuthorizationPaymentModeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift index b5d3daf3..cb8fb4c2 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationReasonTests.swift @@ -34,7 +34,7 @@ public final class ResourceAuthorizationReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Auth.self, from: authorization).reason, .authorization) } - static var allTests: [(String, (ResourceAuthorizationReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceAuthorizationReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift index 3a65ede0..c265f120 100644 --- a/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceAuthorizationStateTests.swift @@ -48,7 +48,7 @@ public final class ResourceAuthorizationStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Auth.self, from: captured).state, .captured) } - static var allTests: [(String, (ResourceAuthorizationStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceAuthorizationStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift index aac5c25a..4cc0b417 100644 --- a/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceCaptureReasonTests.swift @@ -58,7 +58,7 @@ public final class ResourceCaptureReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Capture.self, from: refund).reason, .refund) } - static var allTests: [(String, (ResourceCaptureReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceCaptureReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift index c8fefd70..92a01e9d 100644 --- a/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceCaptureStateTests.swift @@ -47,7 +47,7 @@ public final class ResourceCaptureStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Capture.self, from: partiallyRefunded).state, .partiallyRefunded) } - static var allTests: [(String, (ResourceCaptureStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceCaptureStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift index 59606e1e..46a3c0a3 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderPaymentModeTests.swift @@ -46,7 +46,7 @@ public final class ResourceOrderPaymentModeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.self, from: echeck).mode, .echeck) } - static var allTests: [(String, (ResourceOrderPaymentModeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceOrderPaymentModeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift index 5f982d9e..295f4225 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderReasonTests.swift @@ -49,7 +49,7 @@ public final class ResourceOrderReasonTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.self, from: regulatory).reason, .regulatory) } - static var allTests: [(String, (ResourceOrderReasonTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceOrderReasonTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift index fa94f83c..6eb1d15d 100644 --- a/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceOrderStateTests.swift @@ -47,7 +47,7 @@ public final class ResourceOrderStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.self, from: captured).state, .captured) } - static var allTests: [(String, (ResourceOrderStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceOrderStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift b/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift index b898d510..a8aee806 100644 --- a/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceProcessorAdviceTests.swift @@ -51,7 +51,7 @@ public final class ResourceProcessorAdviceTests: XCTestCase { try XCTAssertEqual(decoder.decode(Processor.self, from: dontTry).advice, .dontTry) } - static var allTests: [(String, (ResourceProcessorAdviceTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceProcessorAdviceTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift b/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift index 9f923f7c..e8986b1a 100644 --- a/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift +++ b/Tests/ModelTests/ResourceTests/ResourceRefundStateTests.swift @@ -46,7 +46,7 @@ public final class ResourceRefundStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(Order.self, from: failed).state, .failed) } - static var allTests: [(String, (ResourceRefundStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ResourceRefundStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/RoleTests.swift b/Tests/ModelTests/RoleTests.swift index 2424d47c..5b25aabb 100644 --- a/Tests/ModelTests/RoleTests.swift +++ b/Tests/ModelTests/RoleTests.swift @@ -44,7 +44,7 @@ public final class RoleTests: XCTestCase { try XCTAssertEqual(decoder.decode(User.self, from: payer).role, .payer) } - static var allTests: [(String, (RoleTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (RoleTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/SaleTests/SaleStatusTests.swift b/Tests/ModelTests/SaleTests/SaleStatusTests.swift index 6d675247..25bd5260 100644 --- a/Tests/ModelTests/SaleTests/SaleStatusTests.swift +++ b/Tests/ModelTests/SaleTests/SaleStatusTests.swift @@ -47,7 +47,7 @@ public final class SaleStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(Sal.self, from: refunded).status, .refunded) } - static var allTests: [(String, (SaleStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (SaleStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/SaleTests/SaleTests.swift b/Tests/ModelTests/SaleTests/SaleTests.swift index 96f3d7bd..10a1f529 100644 --- a/Tests/ModelTests/SaleTests/SaleTests.swift +++ b/Tests/ModelTests/SaleTests/SaleTests.swift @@ -62,7 +62,7 @@ public final class SaleTests: XCTestCase { XCTAssertEqual(sale.amount, DetailedAmount(currency: .usd, total: 10.00, details: nil)) } - static var allTests: [(String, (SaleTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (SaleTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/SaleTests/SalesVenueTests.swift b/Tests/ModelTests/SaleTests/SalesVenueTests.swift index 827c2cc8..810a639f 100644 --- a/Tests/ModelTests/SaleTests/SalesVenueTests.swift +++ b/Tests/ModelTests/SaleTests/SalesVenueTests.swift @@ -41,7 +41,7 @@ public final class SalesVenueTests: XCTestCase { try XCTAssertEqual(venue, decoder.decode(SalesVenue.self, from: json)) } - static var allTests: [(String, (SalesVenueTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (SalesVenueTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/SaleTests/SellerTests.swift b/Tests/ModelTests/SaleTests/SellerTests.swift index a1626399..4d58d5d4 100644 --- a/Tests/ModelTests/SaleTests/SellerTests.swift +++ b/Tests/ModelTests/SaleTests/SellerTests.swift @@ -54,7 +54,7 @@ public final class SellerTests: XCTestCase { ) } - static var allTests: [(String, (SellerTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (SellerTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift index 30fa200c..b66f77bd 100644 --- a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift +++ b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift @@ -60,7 +60,7 @@ public final class ShippingCostsTests: XCTestCase { try XCTAssertEqual(shipping, decoder.decode(ShippingCosts.self, from: json)) } - static var allTests: [(String, (ShippingCostsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ShippingCostsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift b/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift index 291da644..e6909d99 100644 --- a/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift +++ b/Tests/ModelTests/ShippingTests/ShippingInfoTests.swift @@ -100,7 +100,7 @@ public final class ShippingInfoTests: XCTestCase { try XCTAssertEqual(info, decoder.decode(ShippingInfo.self, from: json)) } - static var allTests: [(String, (ShippingInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (ShippingInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/SignupOptionsTests.swift b/Tests/ModelTests/SignupOptionsTests.swift index 819a6a3b..4c89b1b5 100644 --- a/Tests/ModelTests/SignupOptionsTests.swift +++ b/Tests/ModelTests/SignupOptionsTests.swift @@ -48,7 +48,7 @@ public final class SignupOptionsTests: XCTestCase { try XCTAssertEqual(options, decoder.decode(SignupOptions.self, from: json)) } - static var allTests: [(String, (SignupOptionsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (SignupOptionsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift index 9f69e0c0..7ab90d39 100644 --- a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift +++ b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift @@ -85,7 +85,7 @@ public final class StakeholderTests: XCTestCase { try XCTAssertEqual(holder, decoder.decode(Business.Stakeholder.self, from: json)) } - static var allTests: [(String, (StakeholderTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (StakeholderTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift index 1d146a88..7841b7d7 100644 --- a/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift +++ b/Tests/ModelTests/StakeholderTests/StakeholderTypeTests.swift @@ -52,7 +52,7 @@ public final class StakeholderTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(Holder.self, from: beneficialOwnerBusiness).type, .beneficialOwnerBusiness) } - static var allTests: [(String, (StakeholderTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (StakeholderTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TaxTests.swift b/Tests/ModelTests/TaxTests.swift index b1825e00..61379bc4 100644 --- a/Tests/ModelTests/TaxTests.swift +++ b/Tests/ModelTests/TaxTests.swift @@ -57,7 +57,7 @@ public final class TaxTests: XCTestCase { try XCTAssertEqual(Tax(name: .init("Sales"), percent: .init(10), amount: nil), decoder.decode(Tax.self, from: json)) } - static var allTests: [(String, (TaxTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TaxTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift index 0d1046c1..5d9edaa6 100644 --- a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift @@ -292,7 +292,7 @@ public final class TemplateDataTests: XCTestCase { )) } - static var allTests: [(String, (TemplateDataTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateDataTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testValidations", testValidations), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift b/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift index 79c7fc63..750243cd 100644 --- a/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateListFieldsTests.swift @@ -42,7 +42,7 @@ public final class TemplateListFieldsTests: XCTestCase { try XCTAssertEqual(decoder.decode(List.self, from: all).field, .all) } - static var allTests: [(String, (TemplateListFieldsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateListFieldsTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TemplateTests/TemplateListTests.swift b/Tests/ModelTests/TemplateTests/TemplateListTests.swift index 63386f4e..80dc3e55 100644 --- a/Tests/ModelTests/TemplateTests/TemplateListTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateListTests.swift @@ -43,7 +43,7 @@ public final class TemplateListTests: XCTestCase { try XCTAssertEqual(list, decoder.decode(Template.List.self, from: json)) } - static var allTests: [(String, (TemplateListTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateListTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift index 465139b5..eef71198 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingFieldTests.swift @@ -48,7 +48,7 @@ public final class TemplateSettingFieldTests: XCTestCase { try XCTAssertEqual(decoder.decode(Settings.self, from: custom).field, .custom) } - static var allTests: [(String, (TemplateSettingFieldTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateSettingFieldTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift index 17c03768..1e3eea05 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingsMetadataTests.swift @@ -36,7 +36,7 @@ public final class TemplateSettingsMetadataTests: XCTestCase { try XCTAssertEqual(metadata, decoder.decode(Template.Settings.Metadata.self, from: json)) } - static var allTests: [(String, (TemplateSettingsMetadataTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateSettingsMetadataTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift b/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift index 0dc33664..7f1e1455 100644 --- a/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateSettingsTests.swift @@ -40,7 +40,7 @@ public final class TemplateSettingsTests: XCTestCase { try XCTAssertEqual(settings, decoder.decode(Template.Settings.self, from: json)) } - static var allTests: [(String, (TemplateSettingsTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateSettingsTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TemplateTests/TemplateTests.swift b/Tests/ModelTests/TemplateTests/TemplateTests.swift index f19ab4d7..c41e0dca 100644 --- a/Tests/ModelTests/TemplateTests/TemplateTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateTests.swift @@ -88,7 +88,7 @@ public final class TemplateTests: XCTestCase { try XCTAssertEqual(template, decoder.decode(Template.self, from: json)) } - static var allTests: [(String, (TemplateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TemplateTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TermTests/TermTests.swift b/Tests/ModelTests/TermTests/TermTests.swift index dd4d7ad3..de7323d1 100644 --- a/Tests/ModelTests/TermTests/TermTests.swift +++ b/Tests/ModelTests/TermTests/TermTests.swift @@ -72,7 +72,7 @@ public final class TermTests: XCTestCase { ) } - static var allTests: [(String, (TermTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TermTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TermTests/TermTypeTests.swift b/Tests/ModelTests/TermTests/TermTypeTests.swift index a1a5f9cc..a7b01da2 100644 --- a/Tests/ModelTests/TermTests/TermTypeTests.swift +++ b/Tests/ModelTests/TermTests/TermTypeTests.swift @@ -43,7 +43,7 @@ public final class TermTypeTests: XCTestCase { try XCTAssertEqual(decoder.decode(TaC.self, from: yearly).type, .yearly) } - static var allTests: [(String, (TermTypeTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TermTypeTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TimelessDateTests.swift b/Tests/ModelTests/TimelessDateTests.swift index ec8e0b6a..3797aaaa 100644 --- a/Tests/ModelTests/TimelessDateTests.swift +++ b/Tests/ModelTests/TimelessDateTests.swift @@ -35,7 +35,7 @@ public final class TimelessDateTests: XCTestCase { try XCTAssertEqual(date, decoder.decode(TimelessDate.self, from: json)) } - static var allTests: [(String, (TimelessDateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TimelessDateTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TrackingTests.swift b/Tests/ModelTests/TrackingTests.swift index 8cff3b0e..a2709b01 100644 --- a/Tests/ModelTests/TrackingTests.swift +++ b/Tests/ModelTests/TrackingTests.swift @@ -36,7 +36,7 @@ public final class TrackingTests: XCTestCase { try XCTAssertEqual(tracking, decoder.decode(Tracking.self, from: json)) } - static var allTests: [(String, (TrackingTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TrackingTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift index d44a15ee..17fc2bd8 100644 --- a/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionInfoStatusTests.swift @@ -53,7 +53,7 @@ public final class TransactionInfoStatusTests: XCTestCase { try XCTAssertEqual(decoder.decode(TI.self, from: reversed).status, .reversed) } - static var allTests: [(String, (TransactionInfoStatusTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TransactionInfoStatusTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift b/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift index a99dce94..eed444e4 100644 --- a/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionInfoTests.swift @@ -100,7 +100,7 @@ public final class TransactionInfoTests: XCTestCase { try XCTAssertEqual(transaction, decoder.decode(TransactionInfo.self, from: json)) } - static var allTests: [(String, (TransactionInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TransactionInfoTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/TransactionTests/TransactionStateTests.swift b/Tests/ModelTests/TransactionTests/TransactionStateTests.swift index 16c7696d..68dc8244 100644 --- a/Tests/ModelTests/TransactionTests/TransactionStateTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionStateTests.swift @@ -45,7 +45,7 @@ public final class TransactionStateTests: XCTestCase { try XCTAssertEqual(decoder.decode(BillingTransaction.self, from: denied).state, .denied) } - static var allTests: [(String, (TransactionStateTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TransactionStateTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/TransactionTests/TransactionTests.swift b/Tests/ModelTests/TransactionTests/TransactionTests.swift index aa2d70c7..b8ca6396 100644 --- a/Tests/ModelTests/TransactionTests/TransactionTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionTests.swift @@ -98,7 +98,7 @@ public final class TransactionTests: XCTestCase { XCTAssertEqual(transaction.net, CurrencyCodeAmount(currency: .usd, value: 72.00)) } - static var allTests: [(String, (TransactionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (TransactionTests) -> ()throws -> ())] = [ ("testInit", testInit), ("testEncoding", testEncoding), ("testDecoding", testDecoding) diff --git a/Tests/ModelTests/UpdateActionTests.swift b/Tests/ModelTests/UpdateActionTests.swift index 9171a2d8..a73da080 100644 --- a/Tests/ModelTests/UpdateActionTests.swift +++ b/Tests/ModelTests/UpdateActionTests.swift @@ -42,7 +42,7 @@ public final class UpdateActionTests: XCTestCase { try XCTAssertEqual(decoder.decode(Update.self, from: seller).action, .seller) } - static var allTests: [(String, (UpdateActionTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (UpdateActionTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift index dc013520..aeeaf141 100644 --- a/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift +++ b/Tests/ModelTests/UserIntoTests/UserInfoAddressTests.swift @@ -21,7 +21,7 @@ public final class UserInfoAddressTests: XCTestCase { XCTAssertEqual(address.country, .switzerland) } - static var allTests: [(String, (UserInfoAddressTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (UserInfoAddressTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/UserIntoTests/UserInfoTests.swift b/Tests/ModelTests/UserIntoTests/UserInfoTests.swift index 87d868f7..023c0657 100644 --- a/Tests/ModelTests/UserIntoTests/UserInfoTests.swift +++ b/Tests/ModelTests/UserIntoTests/UserInfoTests.swift @@ -54,7 +54,7 @@ public final class UserInfoTests: XCTestCase { XCTAssertEqual(info.payerID, "P-BCFC8B5AD16874F7") } - static var allTests: [(String, (UserInfoTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (UserInfoTests) -> ()throws -> ())] = [ ("testDecoding", testDecoding) ] } diff --git a/Tests/ModelTests/VenueTests.swift b/Tests/ModelTests/VenueTests.swift index 70792394..dea8394f 100644 --- a/Tests/ModelTests/VenueTests.swift +++ b/Tests/ModelTests/VenueTests.swift @@ -44,7 +44,7 @@ public final class VenueTests: XCTestCase { try XCTAssertEqual(decoder.decode(Prod.self, from: other).venue, .other) } - static var allTests: [(String, (VenueTests) -> ()throws -> ())] = [ + public static var allTests: [(String, (VenueTests) -> ()throws -> ())] = [ ("testCaseRawValues", testCaseRawValues), ("testAllCase", testAllCase), ("testEncoding", testEncoding), diff --git a/Tests/PayPalTests/PayPalTests.swift b/Tests/PayPalTests/PayPalTests.swift index 8851229d..e34ed3fb 100644 --- a/Tests/PayPalTests/PayPalTests.swift +++ b/Tests/PayPalTests/PayPalTests.swift @@ -2,5 +2,5 @@ import XCTest @testable import PayPal public final class PayPalTests: XCTestCase { - static var allTests: [(String, (PayPalTests) -> ()throws -> ())] = [] + public static var allTests: [(String, (PayPalTests) -> ()throws -> ())] = [] } From 3a6723939d0a21151c9ff1d96246ecfb5afebc1b Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 06:43:55 -0600 Subject: [PATCH 008/160] Documented GovernmentBody.init(name:) parameters --- Sources/PayPal/Models/GovernmentBody.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PayPal/Models/GovernmentBody.swift b/Sources/PayPal/Models/GovernmentBody.swift index 2c9cddd1..0f8c80e5 100644 --- a/Sources/PayPal/Models/GovernmentBody.swift +++ b/Sources/PayPal/Models/GovernmentBody.swift @@ -8,7 +8,7 @@ public struct GovernmentBody: Content, Equatable { /// Creates a new `GovernmentBody` instance. /// - /// GovernmentBody(name: "") + /// - parameter name: The name of enabling legislation. public init(name: String?) { self.name = name } From 669209ac469444f2f1752170d7e2bebad1db65c5 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 08:07:24 -0600 Subject: [PATCH 009/160] Changed Template.List.emails property type to a failable String array --- Sources/PayPal/Models/Template/TemplateList.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Sources/PayPal/Models/Template/TemplateList.swift b/Sources/PayPal/Models/Template/TemplateList.swift index be20e2c4..eeb702d9 100644 --- a/Sources/PayPal/Models/Template/TemplateList.swift +++ b/Sources/PayPal/Models/Template/TemplateList.swift @@ -13,7 +13,7 @@ extension Template { public var addresses: [Address]? /// An array of email addresses in the user's PayPal profile. - public var emails: [Email]? + public var emails: Failable<[String]?, NotNilValidate>> /// An array of phone numbers in the user's PayPal profile. public var phones: [PhoneNumber]? @@ -26,7 +26,18 @@ extension Template { /// /// Instead of creating a `TemplateList` with this initializer, you will most likely want to create it /// be decoding it from a JSON response from the PayPal API. - public init(addresses: [Address]?, emails: [Email]?, phones: [PhoneNumber]?, templates: [Template]?) { + /// + /// - Parameters: + /// - addresses: An array of postal addresses in the user's PayPal profile. + /// - emails: An array of email addresses in the user's PayPal profile. + /// - phones: An array of phone numbers in the user's PayPal profile. + /// - temapltes: The details for each template. + public init( + addresses: [Address]?, + emails: Failable<[String]?, NotNilValidate>>, + phones: [PhoneNumber]?, + templates: [Template]? + ) { self.links = nil self.addresses = addresses self.emails = emails From 18614447af627dc560a459acd2036f258e47bcf2 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 08:22:33 -0600 Subject: [PATCH 010/160] Added missing validation to MerchantInfo properties --- .../PayPal/Models/Merchant/MerchantInfo.swift | 60 ++++++++----------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/Sources/PayPal/Models/Merchant/MerchantInfo.swift b/Sources/PayPal/Models/Merchant/MerchantInfo.swift index 73208d66..6be73410 100644 --- a/Sources/PayPal/Models/Merchant/MerchantInfo.swift +++ b/Sources/PayPal/Models/Merchant/MerchantInfo.swift @@ -8,22 +8,22 @@ public struct MerchantInfo: Content, Equatable { /// If you omit this value, notifications are sent from and to the primary email address but do not appear on the invoice. /// /// Maximum length: 260. - public var email: String? + public var email: Failable> /// The merchant's business name. /// /// Maximum length: 100. - public var business: String? + public var business: Failable> /// The merchant's first name. /// /// Maximum length: 256. - public var firstName: String? + public var firstName: Failable> /// The merchant's last name. /// /// Maximum length: 256. - public var lastName: String? + public var lastName: Failable> /// The merchant's address. public var address: Address? @@ -37,53 +37,43 @@ public struct MerchantInfo: Content, Equatable { /// The merchant's website. /// /// Maximum length: 2048. - public var website: String? + public var website: Failable> /// The merchant's tax ID. /// /// Maximum length: 100. - public var taxID: String? + public var taxID: Failable> /// Any additional information, such as business hours. /// /// Maximum length: 40. - public var info: String? + public var info: Failable> /// Creates a new `MerchantInfo` instance. /// - /// MerchantInfo( - /// email: "basil@baker.com", - /// business: "Basil Cases and Mystery", - /// firstName: "Basil", - /// lastName: "Mouse", - /// address: Address( - /// recipientName: nil, - /// defaultAddress: true, - /// line1: "221B Baker Street", - /// line2: nil, - /// city: "London", - /// state: nil, - /// countryCode: "UK", - /// postalCode: "42" - /// ), - /// phone: PhoneNumber(country: "1", number: "9963191901"), - /// fax: PhoneNumber(country: "1", number: "9963191901"), - /// website: nil, - /// taxID: "934-00-2376", - /// info: "He sells cheese. Rich cheese." - /// ) + /// - Parameters: + /// - email: The merchant email address. This email must be listed in the merchant's PayPal profile. + /// - business: The merchant's business name. + /// - firstName: The merchant's first name. + /// - lastName: The merchant's last name. + /// - address: The merchant's address. + /// - phone: The merchant's phone number. + /// - fax: The merchant's fax number. + /// - website: The merchant's website. + /// - taxID: The merchant's tax ID. + /// - info: Any additional information, such as business hours. public init( - email: String?, - business: String?, - firstName: String?, - lastName: String?, + email: Failable>, + business: Failable>, + firstName: Failable>, + lastName: Failable>, address: Address?, phone: PhoneNumber?, fax: PhoneNumber?, - website: String?, - taxID: String?, - info: String? + website: Failable>, + taxID: Failable>, + info: Failable> )throws { self.email = email self.business = business From 735dac7c4e7b4dc03f3e73171ae920f868a89951 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 09:17:56 -0600 Subject: [PATCH 011/160] Created MerchantInfoTests test suite --- Tests/ControllerTests/InvoicesTests.swift | 20 +-- .../InvoiceTests/InvoiceListTests.swift | 20 +-- .../InvoiceTests/InvoiceTests.swift | 40 +++--- .../MerchantTests/MerchantInfoTests.swift | 125 ++++++++++++++++++ .../TemplateTests/TemplateDataTests.swift | 40 +++--- .../TemplateTests/TemplateListTests.swift | 8 +- Tests/PayPalTests/XCTestManifests.swift | 1 + 7 files changed, 190 insertions(+), 64 deletions(-) create mode 100644 Tests/ModelTests/MerchantTests/MerchantInfoTests.swift diff --git a/Tests/ControllerTests/InvoicesTests.swift b/Tests/ControllerTests/InvoicesTests.swift index 3c5f34be..c5bf1c97 100644 --- a/Tests/ControllerTests/InvoicesTests.swift +++ b/Tests/ControllerTests/InvoicesTests.swift @@ -33,14 +33,14 @@ public final class InvoicesTests: XCTestCase { let invoice = try Invoice( number: nil, merchant: MerchantInfo( - email: "dispute@skelpo.com", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("dispute@skelpo.com"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -109,14 +109,14 @@ public final class InvoicesTests: XCTestCase { let invoice = try Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), diff --git a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift index ad6c83c9..d2f14cd8 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceListTests.swift @@ -8,14 +8,14 @@ public final class InvoiceListTests: XCTestCase { let invoice = try Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -48,14 +48,14 @@ public final class InvoiceListTests: XCTestCase { try XCTAssertEqual(list.invoices?.first, Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), diff --git a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift index 366ba201..8219c1f7 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift @@ -15,14 +15,14 @@ public final class InvoiceTests: XCTestCase { let invoice = try Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -79,14 +79,14 @@ public final class InvoiceTests: XCTestCase { try XCTAssertEqual(invoice.custom, CustomAmount(label: nil, amount: .init(CurrencyAmount(currency: .usd, value: 10.00)))) try XCTAssertEqual(invoice.merchant, MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil )) @@ -155,14 +155,14 @@ public final class InvoiceTests: XCTestCase { let invoice = try Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -328,14 +328,14 @@ public final class InvoiceTests: XCTestCase { try XCTAssertEqual(invoice, Invoice( number: nil, merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), diff --git a/Tests/ModelTests/MerchantTests/MerchantInfoTests.swift b/Tests/ModelTests/MerchantTests/MerchantInfoTests.swift new file mode 100644 index 00000000..0903b574 --- /dev/null +++ b/Tests/ModelTests/MerchantTests/MerchantInfoTests.swift @@ -0,0 +1,125 @@ +import XCTest +import Failable +@testable import PayPal + +public final class MerchantInfoTests: XCTestCase { + func testInit()throws { + let info = try MerchantInfo( + email: .init("merchant@exmaple.com"), + business: .init("Merchants & Co."), + firstName: .init("Richard"), + lastName: .init("Smith"), + address: nil, + phone: nil, + fax: nil, + website: .init("https://merchantsand.co"), + taxID: .init("9987-425-1698"), + info: .init("Open 24/7") + ) + + XCTAssertNil(info.address) + XCTAssertNil(info.phone) + XCTAssertNil(info.fax) + XCTAssertEqual(info.email.value, "merchant@exmaple.com") + XCTAssertEqual(info.business.value, "Merchants & Co.") + XCTAssertEqual(info.firstName.value, "Richard") + XCTAssertEqual(info.lastName.value, "Smith") + XCTAssertEqual(info.website.value, "https://merchantsand.co") + XCTAssertEqual(info.taxID.value, "9987-425-1698") + XCTAssertEqual(info.info.value, "Open 24/7") + } + + func testValidations()throws { + var info = try MerchantInfo( + email: nil, business: nil, firstName: nil, lastName: nil, address: nil, phone: nil, fax: nil, website: nil, + taxID: nil, info: nil + ) + + try XCTAssertThrowsError(info.email <~ String(repeating: "e", count: 261)) + try XCTAssertThrowsError(info.business <~ String(repeating: "b", count: 101)) + try XCTAssertThrowsError(info.firstName <~ String(repeating: "f", count: 257)) + try XCTAssertThrowsError(info.lastName <~ String(repeating: "l", count: 257)) + try XCTAssertThrowsError(info.website <~ String(repeating: "w", count: 2049)) + try XCTAssertThrowsError(info.taxID <~ String(repeating: "t", count: 101)) + try XCTAssertThrowsError(info.info <~ String(repeating: "i", count: 41)) + + try info.email <~ String(repeating: "e", count: 260) + try info.business <~ String(repeating: "b", count: 100) + try info.firstName <~ String(repeating: "f", count: 256) + try info.lastName <~ String(repeating: "l", count: 256) + try info.website <~ String(repeating: "w", count: 2048) + try info.taxID <~ String(repeating: "t", count: 100) + try info.info <~ String(repeating: "i", count: 40) + } + + func testEncoding()throws { + let encoder = JSONEncoder() + let info = try MerchantInfo( + email: .init("merchant@exmaple.com"), + business: .init("Merchants & Co."), + firstName: .init("Richard"), + lastName: .init("Smith"), + address: nil, + phone: nil, + fax: nil, + website: .init("https://merchantsand.co"), + taxID: .init("9987-425-1698"), + info: .init("Open 24/7") + ) + let generated = try String(data: encoder.encode(info), encoding: .utf8)! + let json = + "{\"tax_id\":\"9987-425-1698\",\"website\":\"https:\\/\\/merchantsand.co\",\"business_name\":\"Merchants & Co.\"," + + "\"last_name\":\"Smith\",\"email\":\"merchant@exmaple.com\",\"additional_info\":\"Open 24\\/7\",\"first_name\":\"Richard\"}" + + var index = 0 + for (jsonChar, genChar) in zip(json, generated) { + if jsonChar == genChar { index += 1; continue } + XCTAssertEqual(jsonChar, genChar, "values don't match. Failure starts at index \(index)") + break + } + + XCTAssertEqual(generated, json) + } + + func testDecoding()throws { + let decoder = JSONDecoder() + + let json = """ + { + "email": "merchant@exmaple.com", + "business_name": "Merchants & Co.", + "first_name": "Richard", + "last_name": "Smith", + "website": "https://merchantsand.co", + "tax_id": "9987-425-1698", + "additional_info": "Open 24/7" + } + """.data(using: .utf8)! + let info = try MerchantInfo( + email: .init("merchant@exmaple.com"), + business: .init("Merchants & Co."), + firstName: .init("Richard"), + lastName: .init("Smith"), + address: nil, + phone: nil, + fax: nil, + website: .init("https://merchantsand.co"), + taxID: .init("9987-425-1698"), + info: .init("Open 24/7") + ) + + try XCTAssertEqual(info, decoder.decode(MerchantInfo.self, from: json)) + } + + public static var allTests: [(String, (MerchantInfoTests) -> ()throws -> ())] = [ + ("testInit", testInit), + ("testValidations", testValidations), + ("testEncoding", testEncoding), + ("testDecoding", testDecoding) + ] +} + + + + + diff --git a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift index 5d9edaa6..a1edb86e 100644 --- a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift @@ -13,14 +13,14 @@ public final class TemplateDataTests: XCTestCase { func testInit()throws { let data = try Template.Data( merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -65,14 +65,14 @@ public final class TemplateDataTests: XCTestCase { try XCTAssertEqual(data.custom, CustomAmount(label: nil, amount: .init(CurrencyAmount(currency: .usd, value: 10.00)))) try XCTAssertEqual(data.cc, [.init(email: .init("collective@vapor.codes")), .init(email: .init("donator@example.com"))]) try XCTAssertEqual(data.merchant, MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil )) @@ -101,14 +101,14 @@ public final class TemplateDataTests: XCTestCase { let encoder = JSONEncoder() let data = try Template.Data( merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -260,14 +260,14 @@ public final class TemplateDataTests: XCTestCase { try XCTAssertEqual(data, Template.Data( merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), diff --git a/Tests/ModelTests/TemplateTests/TemplateListTests.swift b/Tests/ModelTests/TemplateTests/TemplateListTests.swift index 80dc3e55..0fcaf5f3 100644 --- a/Tests/ModelTests/TemplateTests/TemplateListTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateListTests.swift @@ -3,18 +3,18 @@ import XCTest public final class TemplateListTests: XCTestCase { func testInit()throws { - let list = Template.List(addresses: [], emails: [], phones: [], templates: []) + let list = try Template.List(addresses: [], emails: .init([]), phones: [], templates: []) XCTAssertNil(list.links) XCTAssertEqual(list.addresses, []) - XCTAssertEqual(list.emails, []) + XCTAssertEqual(list.emails.value, []) XCTAssertEqual(list.phones, []) XCTAssertEqual(list.templates, []) } func testEncoding()throws { let encoder = JSONEncoder() - let list = Template.List(addresses: [], emails: [], phones: [], templates: []) + let list = try Template.List(addresses: [], emails: .init([]), phones: [], templates: []) let generated = try String(data: encoder.encode(list), encoding: .utf8)! let json = "{\"templates\":[],\"addresses\":[],\"emails\":[],\"phones\":[]}" @@ -38,7 +38,7 @@ public final class TemplateListTests: XCTestCase { "templates": [] } """.data(using: .utf8)! - let list = Template.List(addresses: [], emails: [], phones: [], templates: []) + let list = try Template.List(addresses: [], emails: .init([]), phones: [], templates: []) try XCTAssertEqual(list, decoder.decode(Template.List.self, from: json)) } diff --git a/Tests/PayPalTests/XCTestManifests.swift b/Tests/PayPalTests/XCTestManifests.swift index f71e57a0..f0873b95 100644 --- a/Tests/PayPalTests/XCTestManifests.swift +++ b/Tests/PayPalTests/XCTestManifests.swift @@ -245,6 +245,7 @@ public func allTests() -> [XCTestCaseEntry] { testCase(ProductNameTests.allCases), testCase(ProductVettingStatusTests.allCases), testCase(ProductGrantedPermissionTests.allCases), + testCase(MerchantInfoTests.allTests), // Controller Tests testCase(APITests.allTests), From 32902079e3ead77fb68841599198e763709c011d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 09:49:11 -0600 Subject: [PATCH 012/160] Added 'passing' comment to ControllerTests test suites that pass --- Tests/ControllerTests/APITests.swift | 1 + Tests/ControllerTests/AuthenticationTests.swift | 1 + Tests/ControllerTests/IdentityTests.swift | 1 + 3 files changed, 3 insertions(+) diff --git a/Tests/ControllerTests/APITests.swift b/Tests/ControllerTests/APITests.swift index 936f499a..72c7d3d0 100644 --- a/Tests/ControllerTests/APITests.swift +++ b/Tests/ControllerTests/APITests.swift @@ -2,6 +2,7 @@ import XCTest import Vapor @testable import PayPal +// MARK: - Passing ✅ public final class APITests: XCTestCase { var app: Application! diff --git a/Tests/ControllerTests/AuthenticationTests.swift b/Tests/ControllerTests/AuthenticationTests.swift index 63874920..ed79fb5b 100644 --- a/Tests/ControllerTests/AuthenticationTests.swift +++ b/Tests/ControllerTests/AuthenticationTests.swift @@ -2,6 +2,7 @@ import XCTest import Vapor @testable import PayPal +// MARK: - Passing ✅ public final class AuthenticationTests: XCTestCase { var app: Application! diff --git a/Tests/ControllerTests/IdentityTests.swift b/Tests/ControllerTests/IdentityTests.swift index 1a915157..01f310bc 100644 --- a/Tests/ControllerTests/IdentityTests.swift +++ b/Tests/ControllerTests/IdentityTests.swift @@ -2,6 +2,7 @@ import XCTest import Vapor @testable import PayPal +// MARK: - Passing ✅ public final class IdentityTests: XCTestCase { var app: Application! From a83652820a15f4af1aaf926bbd77e02e0072850d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 09:49:52 -0600 Subject: [PATCH 013/160] Fix MerchantInfo initializer call in TemplatesTests test suite --- Tests/ControllerTests/TemplatesTests.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Tests/ControllerTests/TemplatesTests.swift b/Tests/ControllerTests/TemplatesTests.swift index c89b584d..7db9c459 100644 --- a/Tests/ControllerTests/TemplatesTests.swift +++ b/Tests/ControllerTests/TemplatesTests.swift @@ -33,14 +33,14 @@ public final class TemplatesTests: XCTestCase { default: true, data: .init( merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), @@ -96,14 +96,14 @@ public final class TemplatesTests: XCTestCase { default: true, data: .init( merchant: MerchantInfo( - email: "hello@vapor.codes", - business: "Qutheory LLC.", - firstName: "Tanner", - lastName: "Nelson", + email: .init("hello@vapor.codes"), + business: .init("Qutheory LLC."), + firstName: .init("Tanner"), + lastName: .init("Nelson"), address: nil, phone: nil, fax: nil, - website: "https://vapor.codes/", + website: .init("https://vapor.codes/"), taxID: nil, info: nil ), From a5755110de699728d8f5c9d8419e0a9d1c541ed5 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 10:07:03 -0600 Subject: [PATCH 014/160] Removed id check from ManagedAccountsTests.testCreateEndpoint test case --- Tests/ControllerTests/ManagedAccountsTests.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Tests/ControllerTests/ManagedAccountsTests.swift b/Tests/ControllerTests/ManagedAccountsTests.swift index fde89dfb..a3d2f60d 100644 --- a/Tests/ControllerTests/ManagedAccountsTests.swift +++ b/Tests/ControllerTests/ManagedAccountsTests.swift @@ -28,11 +28,7 @@ public final class ManagedAccountsTests: XCTestCase { _ = try app.make(ManagedAccounts.self) } - func testCreateEndpoint()throws { - guard let id = self.id else { - throw Abort(.internalServerError, reason: "ID is nil") - } - + func testCreateEndpoint()throws { let paymentPref = PaymentReceivingPreferences( blockUnconfirmedUSAddress: true, blockNonUS: false, From 12b6a4528df8554faf2ed619d3a85e53015ca06a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 10:23:58 -0600 Subject: [PATCH 015/160] Moved BillingPlansTests endpoint test cases into .testEndpoints test case --- .../BillingAgreementsTests.swift | 6 ++-- Tests/ControllerTests/BillingPlansTests.swift | 30 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Tests/ControllerTests/BillingAgreementsTests.swift b/Tests/ControllerTests/BillingAgreementsTests.swift index 33bee792..0db2dc7b 100644 --- a/Tests/ControllerTests/BillingAgreementsTests.swift +++ b/Tests/ControllerTests/BillingAgreementsTests.swift @@ -16,9 +16,9 @@ public final class BillingAgreementsTests: XCTestCase { app = try! Application.testable(services: services) - if self.id == nil { - try! self.testCreateEndpoint() - } +// if self.id == nil { +// try! self.testCreateEndpoint() +// } } func testServiceExists()throws { diff --git a/Tests/ControllerTests/BillingPlansTests.swift b/Tests/ControllerTests/BillingPlansTests.swift index c32c8fee..d2d0ac45 100644 --- a/Tests/ControllerTests/BillingPlansTests.swift +++ b/Tests/ControllerTests/BillingPlansTests.swift @@ -2,6 +2,7 @@ import XCTest import Vapor @testable import PayPal +// MARK: - Passing ✅ public final class BillingPlansTests: XCTestCase { var app: Application! @@ -15,17 +16,21 @@ public final class BillingPlansTests: XCTestCase { try! services.register(PayPalProvider()) app = try! Application.testable(services: services) - - let plans = try! self.app.make(BillingPlans.self) - let list = try! plans.list(parameters: QueryParamaters(totalCountRequired: true)).wait() - self.id = list.plans?.first?.id.value } func testServiceExists()throws { _ = try app.make(BillingPlans.self) } - func testCreateEndpoint()throws { + func testEndpoints()throws { + try self.createEndpoint() + try self.listEndpoint() + try self.updateEndpoint() + try self.detailsEndpoint() + try self.setStateHelper() + } + + func createEndpoint()throws { let plans = try self.app.make(BillingPlans.self) let plan = try BillingPlan( name: .init("Monthly Water"), @@ -54,19 +59,20 @@ public final class BillingPlansTests: XCTestCase { ) let created = try plans.create(with: plan).wait() + self.id = created.id.value XCTAssertEqual(created.name, plan.name) XCTAssertNotNil(created.id) } - func testListEndpoint()throws { + func listEndpoint()throws { let plans = try self.app.make(BillingPlans.self) let list = try plans.list(parameters: QueryParamaters(totalCountRequired: true)).wait() XCTAssertNotNil(list.plans) } - func testUpdateEndpoint()throws { + func updateEndpoint()throws { let plans = try self.app.make(BillingPlans.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get agreement ID to get") @@ -77,7 +83,7 @@ public final class BillingPlansTests: XCTestCase { XCTAssertEqual(status, .ok) } - func testDetailsEndpoint()throws { + func detailsEndpoint()throws { let plans = try self.app.make(BillingPlans.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get agreement ID to get") @@ -88,7 +94,7 @@ public final class BillingPlansTests: XCTestCase { XCTAssert(details.id.value == id) } - func testSetStateHelper()throws { + func setStateHelper()throws { let plans = try self.app.make(BillingPlans.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get agreement ID to get") @@ -101,11 +107,7 @@ public final class BillingPlansTests: XCTestCase { public static var allTests: [(String, (BillingPlansTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), - ("testCreateEndpoint", testCreateEndpoint), - ("testListEndpoint", testListEndpoint), - ("testUpdateEndpoint", testUpdateEndpoint), - ("testDetailsEndpoint", testDetailsEndpoint), - ("testSetStateHelper", testSetStateHelper) + ("testEndpoints", testEndpoints) ] } From 36cb5b8d42a542ed8f345e33a97fc71aa800d2cd Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 11:27:04 -0600 Subject: [PATCH 016/160] Added .firstName, .lastName, and .payment proeprties to CounterParty type --- .../PayPal/Models/Charge/CounterParty.swift | 29 +++++++-- .../ActivityTests/ActivityResponseTests.swift | 10 +++- .../ActivityTests/ActivityTests.swift | 5 +- Tests/ModelTests/CounterPartyTests.swift | 59 ++++++++++++------- 4 files changed, 75 insertions(+), 28 deletions(-) diff --git a/Sources/PayPal/Models/Charge/CounterParty.swift b/Sources/PayPal/Models/Charge/CounterParty.swift index 15241588..8923f677 100644 --- a/Sources/PayPal/Models/Charge/CounterParty.swift +++ b/Sources/PayPal/Models/Charge/CounterParty.swift @@ -9,20 +9,41 @@ public struct CounterParty: Content, Equatable { /// The other party's mobile phone number. public var phoneNumber: String? - /// The other party's name, which is usually the first and last name or the merchant's store name + /// The first name of the counter party. + public var firstName: String? + + /// The last name of the counter part. + public var lastName: String? + + /// The other party's name, which is usually the first and last name or the merchant's store name. public var name: String? - /// Create a new `CounterPart` instance. + /// The ID of the payment that the counter-party's activity is connected to. + public var payment: String? + + /// Create a new `CounterParty` instance. /// - /// CounterParty(email: "once.again@exmaple.com", phoneNumber: "314-159-2653", name: "Hallidy") - public init(email: String?, phoneNumber: String?, name: String?) { + /// - Parameters: + /// - email: The other party's email address. For unregistered users only. + /// - phoneNumber: The other party's mobile phone number. + /// - firstName: The first name of the counter party. + /// - lastName: The last name of the counter part. + /// - name: The other party's name, which is usually the first and last name or the merchant's store name. + /// - payment: The ID of the payment that the counter-party's activity is connected to. + public init(email: String?, phoneNumber: String?, firstName: String?, lastName: String?, name: String?, payment: String?) { self.email = email self.phoneNumber = phoneNumber + self.firstName = firstName + self.lastName = lastName self.name = name + self.payment = payment } enum CodingKeys: String, CodingKey { case email, name case phoneNumber = "phone_number" + case firstName = "first_name" + case lastName = "last_name" + case payment = "payment_id" } } diff --git a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift index fbb26922..53dc30ef 100644 --- a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift @@ -13,7 +13,10 @@ public final class ActivityResponseTests: XCTestCase { counterparty: CounterParty( email: "54north@exmaple.com", phoneNumber: "314-159-2653", - name: "Jonathan Futher" + firstName: nil, + lastName: nil, + name: "Jonathan Futher", + payment: nil ), fee: nil, gross: CurrencyCodeAmount(currency: .usd, value: 19.45), @@ -38,7 +41,10 @@ public final class ActivityResponseTests: XCTestCase { counterparty: CounterParty( email: "54north@exmaple.com", phoneNumber: "314-159-2653", - name: "Jonathan Futher" + firstName: nil, + lastName: nil, + name: "Jonathan Futher", + payment: nil ), fee: nil, gross: CurrencyCodeAmount(currency: .usd, value: 19.45), diff --git a/Tests/ModelTests/ActivityTests/ActivityTests.swift b/Tests/ModelTests/ActivityTests/ActivityTests.swift index 8c9d6cd2..d57fe927 100644 --- a/Tests/ModelTests/ActivityTests/ActivityTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityTests.swift @@ -11,7 +11,10 @@ public final class ActivityTests: XCTestCase { counterparty: CounterParty( email: "54north@exmaple.com", phoneNumber: "314-159-2653", - name: "Jonathan Futher" + firstName: nil, + lastName: nil, + name: "Jonathan Futher", + payment: nil ), fee: nil, gross: CurrencyCodeAmount(currency: .usd, value: 19.45), diff --git a/Tests/ModelTests/CounterPartyTests.swift b/Tests/ModelTests/CounterPartyTests.swift index 1a5aff16..9b766539 100644 --- a/Tests/ModelTests/CounterPartyTests.swift +++ b/Tests/ModelTests/CounterPartyTests.swift @@ -3,47 +3,64 @@ import XCTest public final class CounterPartyTests: XCTestCase { func testInit()throws { - let party = CounterParty(email: "54north@exmaple.com", phoneNumber: "314-159-2653", name: "Jonathan Futher") + let party = CounterParty( + email: "54north@exmaple.com", + phoneNumber: "314-159-2653", + firstName: "Jonathan", + lastName: "Further", + name: "Jonathan Futher", + payment: "8KK76419U6099791A" + ) XCTAssertEqual(party.email, "54north@exmaple.com") XCTAssertEqual(party.phoneNumber, "314-159-2653") + XCTAssertEqual(party.firstName, "Jonathan") + XCTAssertEqual(party.lastName, "Further") XCTAssertEqual(party.name, "Jonathan Futher") + XCTAssertEqual(party.payment, "8KK76419U6099791A") } func testEncoding()throws { let encoder = JSONEncoder() - let license = try String(data: encoder.encode( - CounterParty(email: "54north@exmaple.com", phoneNumber: "314-159-2653", name: "Jonathan Futher") - ), encoding: .utf8) + let party = CounterParty( + email: "54north@exmaple.com", + phoneNumber: "314-159-2653", + firstName: "Jonathan", + lastName: "Further", + name: "Jonathan Futher", + payment: "8KK76419U6099791A" + ) + + let license = try String(data: encoder.encode(party), encoding: .utf8) + let json = + "{\"email\":\"54north@exmaple.com\",\"payment_id\":\"8KK76419U6099791A\",\"last_name\":\"Further\"," + + "\"name\":\"Jonathan Futher\",\"phone_number\":\"314-159-2653\",\"first_name\":\"Jonathan\"}" - XCTAssertEqual(license, "{\"email\":\"54north@exmaple.com\",\"name\":\"Jonathan Futher\",\"phone_number\":\"314-159-2653\"}") + XCTAssertEqual(license, json) } func testDecoding()throws { let decoder = JSONDecoder() - let valid = """ + let json = """ { + "first_name": "Jonathan", + "last_name": "Further", "name": "Jonathan Futher", "email": "54north@exmaple.com", - "phone_number": "314-159-2653" - } - """.data(using: .utf8)! - let keyFail = """ - { - "name": "Jonathan Futher", - "email": "54north@exmaple.com", - "phoneNumber": "314-159-2653" + "phone_number": "314-159-2653", + "payment_id": "8KK76419U6099791A" } """.data(using: .utf8)! - try XCTAssertEqual( - CounterParty(email: "54north@exmaple.com", phoneNumber: nil, name: "Jonathan Futher"), - decoder.decode(CounterParty.self, from: keyFail) - ) - try XCTAssertEqual( - CounterParty(email: "54north@exmaple.com", phoneNumber: "314-159-2653", name: "Jonathan Futher"), - decoder.decode(CounterParty.self, from: valid) + let party = CounterParty( + email: "54north@exmaple.com", + phoneNumber: "314-159-2653", + firstName: "Jonathan", + lastName: "Further", + name: "Jonathan Futher", + payment: "8KK76419U6099791A" ) + try XCTAssertEqual(party, decoder.decode(CounterParty.self, from: json)) } public static var allTests: [(String, (CounterPartyTests) -> ()throws -> ())] = [ From 718068a0b8e5dd6952aea1d53d0da76750eb69dc Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 12:45:41 -0600 Subject: [PATCH 017/160] Removed use of ISO8601DateFormatter in DateFormatter.iso8601 implementation --- Sources/PayPal/Utilities/ISO8601.swift | 26 +++++++-------------- Tests/ControllerTests/ActivitiesTests.swift | 1 + 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Sources/PayPal/Utilities/ISO8601.swift b/Sources/PayPal/Utilities/ISO8601.swift index 17cc2c24..2e2c9f3b 100644 --- a/Sources/PayPal/Utilities/ISO8601.swift +++ b/Sources/PayPal/Utilities/ISO8601.swift @@ -5,17 +5,13 @@ import Foundation extension DateFormatter { /// A formatter for ISO 8601 dates. - public static let iso8601: Formatter = { - if #available(OSX 10.12, *) { - return ISO8601DateFormatter() - } else { - let formatter = DateFormatter() - formatter.calendar = Calendar(identifier: .iso8601) - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - return formatter - } + public static let iso8601: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + return formatter }() } @@ -30,13 +26,7 @@ extension Date { /// /// - Parameter iso8601: The string that has the date. public init?(iso8601: String) { - let converter: ((String) -> Date?)? - if #available(OSX 10.12, *) { - converter = (DateFormatter.iso8601 as? ISO8601DateFormatter)?.date - } else { - converter = (DateFormatter.iso8601 as? DateFormatter)?.date - } - guard let date = converter?(iso8601) else { return nil } + guard let date = DateFormatter.iso8601.date(from: iso8601) else { return nil } self = date } } diff --git a/Tests/ControllerTests/ActivitiesTests.swift b/Tests/ControllerTests/ActivitiesTests.swift index d46a8479..39ded1f8 100644 --- a/Tests/ControllerTests/ActivitiesTests.swift +++ b/Tests/ControllerTests/ActivitiesTests.swift @@ -2,6 +2,7 @@ import XCTest import Vapor @testable import PayPal +// MARK: - Passing ✅ public final class ActivitiesTests: XCTestCase { var app: Application! From 29749b6d4e6ccc2c6a301ddafb3e48aefda65b47 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 4 Mar 2019 16:03:30 -0600 Subject: [PATCH 018/160] Removed un-used test.pdf file --- test.pdf | Bin 28688 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test.pdf diff --git a/test.pdf b/test.pdf deleted file mode 100644 index 52f29de71b549afcd37bffec464bebf2fac6f7e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28688 zcmeFZbyVEXw&07qyVHc=-nhHFyF0-pIKf?l27N2<`-Tx1g`d?>G0Hd(NGi z`)0kh=AYM4UEh*jwX16HU98ppfkH`4f`NsR4S`~FYhoIK6~GK|FtI`4<6~0ubTkJr zDH&UuBY@tW&Fx(QETC2u1SWZNGizfJ2M>TQGpK@{o1GEJ#SGwLV`1dtX4XewQggPp z`>UCenHkjO&-=f3Q!#gOaC0^_cL4zZ8duWU!OaoC#|QX(?!U@Rs-Uv7vAv7qn-Zp; z047mTjhOjIYg2O-NfCg6004nW)WO~rq@fFd?QJLl0R(e#vJ@EcaKik9V%6xIujM6ANY07TTNx9wMtgA+Y&=d{fI>>8WneEP{ zB;nW0I}OsfeHr%j9>AvuU89%FY@-IZOo9=(_@ats+YR5cMXq2XtI1RxS6|0@v4ugz zR3G5$jraPhOR8_oO@>;>#xY&7Y)(dsnz95%<$;vtuYlV+K_xQ2X&H`WIZ5lpDGj{7 z+)v)CU@M4Ix$fPx3}Z{-yZEhHkSQg z2Nw5ml~i>FZ7l+mh&+Hv!NJ+i*cO4w)c9>!QDM;gKZH5{RagRadN708I(8yY|JbG z4mJ(|J0}pp1!M(qvV!V?EC3)k$DhQ`4*b&wWMc;j0zony09KHkJ_3M^3)J$bksb8J z{ig{uD#u>}9IT*O*nr#sE^clB2P-RR7A{cE0^kJIv9p6_WZ?ikbAe{$0suMR#5n;R zENq~9ZU8qkNE3E804J!PgBkc&&H|c+?M)Wc29g80H-H=Xra4Fn(7f!NEFcZJ|7iD? zv$FvKY=3kFwS(s4U||KYasHLFbAbA?zV!j=1ey~F8uKl&1KI!N+@M`}tLI<_C6L@7 zS!OPfJSTt^)bEd;pq=C71nB_;=?v<}#=!+(1?kJq4jTI{2kj_mm)>k$T1?GBQd&&j z*b%_;S48`VWxkom-{$alXkcagr_k^wENyQMvPdOo2UAsZSAd1Jy_xghfec_`ZfR|g zzybuAS)024UHVgJYG>^DXXbyH$Xke20rdy@t0#b37!<9{X%Ltcoz2Xh-|U)NT~rlR zR&{f9v^BST3%<-Cs|A>uTY$y^sjgsb2MS+*#2Eg=1wb7UVn*)HN zsHr(9nu4M_A1F983jp{eK(9Xm^IzKkmNK#UFS-N%5`GIf|DzrB_-C2_p`EFl^V_ZQ zXD|Nf{HBYwz4?D^m!pH@+W>#kzlW|j7yA1s{$KCY+h}jHe;n@L-1{FMiSWlm|Juuc zjWM9zeTycbu*l58jqrBk{8eNCaK_+QeV_R!eVS7tkbI_>*m{dVgLj%CY33`;bc5wk6 zzoxYr=vI1*5pS)Ypnh++qLQ(_gA3>p0CG{#j|l+eJ^+xLfG)kaGMfPCF8pgnpu5f- z2%7XyxcP^5|1tM}F>huzkjTGZjc+0HKkmbmi9HQCFfjkAvy5Y93o{CDGd0>^TZW{; z@cn1Qys-UjmovhZrNV&Qh9=*WGa*>snP0K44c(zUa~BG(b*h>6&8(Sr1umIqBDmjY ztiBK)$!LC`yRmnz*IhkTa9_4>^Ikm@MoqV>DAKbBOK2%|YO15xMQv!XNf?8X^%sPZM>FRf7H*ML-q z)j+qT^ntJjls1wtx<}FwD4L}0p!vQw+T_A5t7X1>0 zB6tT9-<6Vp&dLE2s5ZRlJL~%$U@T8_$`w{ zNr5WL1O&l9r;OO3ki~l@9h1P5VujME5zX_7lA>i78bonmXh0FuU52`b9JyxA_w*s%v-bD z6pAnodc;y7Njx7L=w)qDOnvmV4`Ch9j-T($=BFy)`2MMr$kM)L-oW_oM^KE@?vAwl zI6`&%%4tl1q{k(DXir>Q=Ozd6-pw?@DvWDd&fP^ z6OQ!QsRG-)8+v`Ga_jnrkd+AY}0#w9jr60mpfU=>Ql=?9PHG$0pSbUWAkF? zmQe3_=i5#TP~;inG}XDwX(_*WN<)v@QF4!smA5^3IApLc6W*QUk_mZ!YszNj9UxT9 z#ldl}QeF7={?>Vlr?~yMB-A!nXUlAT;k(Hnl1F}G4g2PGZOzT2!h(%@8*VNxRnu9^ zdTV-4b*2Yu#rk`;0u?Ik6XW0?^YegUPIX(?I_aG5nFHl?)qO$y;6GiW5Zn8m5{KL5 zT&vm}A#^sFdJgc+T=sbfu$~P#AsWG4{CiMf&3l#-?b)zt*9y0WpWJxA+VBRhL|l+C zsVaDnLwk=FHdtEM6uWq}VBR)5`e@gGi5ahU-US<&*YNnF0DbUPfwRB#%EqsbJ7Wx{ zou7Y-Jmwpu#&31Ek4(6ba)H{bRQ@ZIG-EuadB2BV@B3j8d-suVU8($Y9i20{cLF*+ zzmb7;p+t{I-64udr_E;~L%WL`4LGBqN(JL%@6;H(E&jCd!py91r?j-#J5_0LKJ5P@ ztqL*SRz%O_k>5q{U=mxPd7H6&X)B0;mExkeNV9!-KkzHy<8pSX^_AIlcMARIy3~x_ zx-tR>vzAJP>#BYO3m1=7k_F?q`idpdJ`^sjJ5*4}BazmS8Acf3MI4Z)C&Uu!T^H`I zo#MXpcS>1&G7(LLA^!-53WGf=b=uRYMhJi#q)csRRu-#q9PBwus@X2D6&PeIZ6OE?euP3~ZLC zoAe?&46F7|T2@bcZuK!%FpYg_a&BcqyvA{Z2pP7h_~-s*g%)%j+M7C+Ahl|~i1-;w zsAc9dzM=bN*Ow5Jf{+z73bib=Xa3U-E1V^$Ps=K$@()B3N#^#@dpIl3O_9p1jXkLx z!~rSOXv%{u5A_J;wI|G@v?*T|Hw(jd?9)H>s^I;)HEnKf_;Bzu!u(TcD&%qjFMX1< zAb^qVTg~EzhV!wyn$pWgsU72;lDR0(0>OQc!7&la@-`7l_&II$5ADnYbsko0Zy39Y z^QNl?eVBKV40uIMA?-|;CbZy*!$dg=w>5~37OR}D#e7C;U)>CEVPnx9j}XE`%+Lg_ z!56R46sZ9g05rNZ#hPGKt#_i-EZkEenEDY_1>h24Yw_2^wBi+-(^~P%|G{R~ll`l;BX%R)0BqZ9_{C|pK+`wd1xwl+{Ve>{r zA-PiMj#94SV+Xk$>3tFOwsH*R^)=#H`@wTYq@S67K$0druO+R6?*KL+)kJ`fFRLXy z&I*L+(#K7t(F3FJrcl`QN3^^yjWXTbve|0h>NvwAZl|UX*ILX5OF=eiCq7jntNW71 zK6FEyypl6ZtsOFDRTnHdsI@k1f;AlKNaV1Ije=o8K^BSjUDQb3W)@G8sUlX4r`GssTm>WI1tZb9G6I9W92X`-UokFZE)L&apu~>iboO8LeTZ^W8Oo>7vU+)Vw_NIChS z;(`(^!rh)BD;2GAbvQ-x<8JPHHu^I7F6PYqkbTMY3cgKuYSM=?NkFF-Z=Ewq_4>dR0^BM8q^D!@m(8DyU zxs15{l18*y#Asrr{fvy=vWl~tnF9wU z3bwFP1lsfRFdnF3_V3Mbl_mSjfAIn$NYO9|h-q1eg*GL>)4htrjJ^=)(%-YBC z`&<%?Ak6{Wsf|TNNYO1##Jm@%&|7zBq=x?ME46N`Rd(r|C;gSs6cpm(6co_+mBhN7 z#|w>~J(zh5FWop86F@t=W++@ztH;gVlMnL_EB3G3i$N1l2aAF)7mG)n4zJG-G1U>z z3IRzf-D~3q&3)~#i$NGxa>83HkkL3;r69i-QDYk zo$F;p_3CB%a*FdfB}3diM7BS!in{Z=C6&PElTv&Z_p!_!hZ#O*H!rV|0Lw;xk7GZl z?sH4pzKN#DY?3sA-@Z}`rDI+A31iHeLcujeqIP}aozR!*@Izwvm5@8Q5`CNa{opP$ zC0}$YL=kXm2`Ygp3ZwfLCeb{iU!!1kkTookRNFpWbqsLW=|66#WXfTrY{^b!;wHXc zWu`ue5c-Xwy5n`JL;tEn@Q-HGfi^bv{?W%Hu`9=3fMjN(j{}*%^zHZ1H(gHt#yAL^ zS2`2{N0`o=)lcVzR})dv7%T9j7#ff*c`(S1%YeIn;5U(~qz`Tt5asyEGL>MwlvZfN z9uzGu>-#t=5BZfD=*N~7EIcvfqeUKVWO8~JBV=cZYoxvEzdY3W95D9gNaL^+6}zYV zQfRn1FFp7TWalfz=NGwd%|Dk5*pr)Ra}Sixh*1tk@=4Jdfm5uJsy!>Xpx(-z%>)ro ze^0&fXwv$oQPIsikMW_N3%rSaOB9S#^a*-Gtf^b{AkIk&B@~N7h8G4-Qr9zr*V-eJ z!`5c_-7?&b-G}6R7f}X4%b9Ks~G|0zF!G1t&NRgPPQ58#{F=MykR{3(1tWTm3 z&I9;4suP`Ou$m1w{!zT{=l8!7dm;@91N#7%f*-FOw8)&U zpu9gd5z_VjvLL5b}*0STVr$ho*1m(EFnu!Ew=iH`sG5awTvQN;Q$Q zKl2=2rhL(Vsy%orfEAz}KS#ov^C6fill!!twn_sI@*&c?S?YQ-Pkwv)mdnR< zYw8kdozI3T;L|SvuCY}OuZpaQeBhAGf&mBAs7N?xx-sq;Up4LZd8dg!?s9^5Jv?{* z`&jUD*H~)piuh1qsoZOIjb0n&OB>%^rp?*N=2zIP)X)7s+q~$jQaHZ9AKa9Q9?d>! z9+6}aW%Uy+k?rcn7qGg3SBouZA|A%nt&TId{{%ONucl&|qAjHKX^<*=GsC z05`$XMm_%N9Srb0iXj@(V6}ZGss~=`B0kvp0s%(t3Ghs8*)kWZ3?) zepekO_^X=pc(KjeB&yg7krh@jE}PvR30n}|kk|F`gsJy?^L30M>B@{w4WIi`yiTXw zkB)vwMbB^@x6~~(NQngIe86WBvX>Gq5hPdeAagcTqH#IvP6ft?rRH;Dx-&hPBM2u1 zLaHg!5R6GH_Y8GH(?iK0JI+6jed-LQ_V*U_zI9rwVqK?S*$Dd05CTq;S?Z=pii*$i ze{Ol(GQvba{(>a8cD?lb+GV1Hk zy>&X!D7U1n(H64Z*z}bnG@z`tfBkO4y`$>~$^|Ch#`ep=i&hO=)2S5l;jr%lElmf6 zcNOG~(4fgI-hdZdtHKwIhCOh_h1L3fGVs=cfl=Ls)#=Zj6*}U?DCEEUlWS7IINl)? zNLTJ|J0~ia5*{fZzL#7yO;&K1=J~SkoU!}6W^lt;|0VHv3S;8Y-HD*TLni|8!^aWr zUSk|FoGvODh%l>+Kw+iD=36A^j%V1s-{4IOee;bGM}3J&R96?C97%d#oWFJ0*GC)Y zDl^vT#lvEhy^F&!Js-V;)WrDi&3%~1qIWgaaZ6)Hn$~O)!(}%{&}nxTfEm`kIt-QN z`pc{rL*<*;@(Vv8IbeQ6kIy}QKb2OYfNPPbD$(^b3*k1`!Kovx7JJ%MxR>?9f&kpj z+)XUr(Sh9*%_ToiW0=QH62sSmf}&ejtqp>1lhp5)b+K)w<&sreT#bb$gNR=Yd;~wv zY#yRZ@~|$?w8VX3sCq8n?rR}AE-uE5qukG8;IK67$21s_J^gB zb^9Dp4Kd>c!&sd*zh`GZ#x=`VyrNb2?344|_O50dbl6UACo``9&|7u<;Ca&gSY&YB zv5Ibk{-_h{dx2JbfID_+iGH5&~v4bifB!dV46oT#glT_TtwIr}Dh=cgMBw`QA9UG$vm%&zcg zJG)q`kUU_V_`XFEXvAunF*_eZph{}V2ZWu@RB!2RJMI&I6wBF|`F;#0n!#j`McTXP zNaJ@;U2(HB@rA{MVYg`E9phGPR9xi51{{%_I|s5Di~g4ZCW+P!*(W<4_ zze%u1w6FLxF78ZO!m`e46BA5SiD6qMex0RvEYp!-b7pjz8$KV6jm|5C3r3!q!lEp8 zNb~iDcU*UB@OJ z8aRT=41f`BurNknw^+>mv#$*T7~4e|O)0sgrosnaD#ltnAU_*yLUmoeCd6akT9PA7 zwb;cDUSZ(oC|pJxZ^r@uE&RxPwQkoM&h>NO_Wa5i&!@mM>Z?PW^$~x2zN-KSb5zd_ zz}&Qdj~Ur*C>#kIhbtMqvE1SYv!PW!gxg+J=1a>H(Zd>!8I9Nm7m0}udo@Q|t%#z> zAQW48@xJm?#lc-2CNF~p!7XGgBftE7Mk-bWk8nLKxsP_&S%e*du$ohA=2?^Cuh?}4 zBQkP|i4$J$y|6BWpDq~0GLGpx8{;(^i2WK4N*HMx0Ij)9CjKUt8fJRJo`P-zi?*4U zw47y^*kHuyP|rZ$qpkdtJ>%|f4x&t9i3d|k+GWd6bg<)hgW7pxcW7G<%P^hSOUidd zsl0Tj=!Ur#@L#rU2c3%7?5=%Z&kX%ueys}(hGb({1|ZFE+O$bzFbL52y*KC`YG&H* zk=_*V%ryBxLCld8aLNqrNWv8pO$n{Lp-k; zXnVKDH4};pZ1)`|&hGTQ{h_UKbLZgO1)ptqrJBwGbq_fGa-RduK)N5Qwg@qZ25rTy zJTjB}n}nT?H84;Vn0cX79O*vqK+Lb!Q@6f5viIeDJG<}5x^pDGy4Nku1d-9`1vU(# zk?3jAsUQ%KbAq_CKUI0?23ROUmdIMsN2?hWiQ_S26Njw zES4CoHf$rB!;hN4d(F0&z-G-hpR4@;!aoXC-0c*ESmK;r>&yGgz>4B z0C3*LbZ6!taNX|V@uvBvYUsTt;JVhv5p7{Yxz}0J0!Iz7s_IgRCZ!bU`AMbp;sJ;waspqn#=&|!VuKsr5T6d1CEYHK} zg;0^$C*SI*q{up-wx0q!`{L0A^4#&=xl*XtcVsx1R5W1}WjHNZj(u{TdbQ4gV5Nob z3Omfi1wNLDC?CB`#A0E05%5?N@$WZ06`zgMrgCuM%3*}SY4ulUB^>e+$kHS_W41;5 z-1`hSyem&)z9_VJ6FZQ)NInrQFAuq#v``s%-n{2Nc*RD3taFvX+SLezR2PBi!Vp1s zgGLDhYet+7M{w?8({TH7_YA)NDRwijTe%(fQL$}lfUn(UT@~XQtz}pOyiLh#7ptr$ zB#oUwfh128js7kjS98NI915Ra772Np+J`)ZRI7h~(|{jfz>eCR0=~Hi+Z!U;Nnli4 zX!JtOf#Qg#YEMLQ7UMB?J(%?om%el3cpP&g5&A^-V|&{#ySju;GBACH1XRaXWcrB! z$c<7+Bharm4;Vahmp@F5(Ub1DC_V6zx`PabJBYNmJ~l!$6}v-Rj@M=B4kB?UU+^N~ zzELUC``Dggge4<-uzSD=|5vLAZg?XYH8uE0mY(x`s=m*nCi~XAn7fI$<{gM~@3eOW z<6u1S6MQ4xb;;U3li^2cha{MGGo#U8hnsq3luH-Gqj2P}NP_57c6ywnixdFiZ~n*nEWBLWwu=U&bGJQ6jUkk$Q^* zSe1-6_$_lJHrA~B7Y`pL_t2?Fogyq9y&dfWnYBI%$C}mVAm3Hlxk>Hyq2SVcA>%0W zj_d2b8m^&IMMRiqu6Q!fli72>0|o>&d=AK{krjza2;Y3~Q-JZQRbP*a#MoqL{FY$1 zXo9v6?_{&w%u+JT)k2O{e~=!twE7M+Ytz45b;#gi78_19>r*nG2kddk1(!)Of*(ym zt#S9X^)Xb0yi-6QAXJ+?_S$n~Z8EN%=Ugw8drvFUOtRQ@b%>M7)*gSKp)^xLudleKr~fVla!r)(mQDT|6;+DdVY^i3@9VzUioQDWiWEjZw1*GRO^MfC~0R1nzhN zV)yNB^~qM(9HCG%pA--hl<|=(<$#)H>>hlgifLJo_seI3KIi93$u5570Jiqkxw?8g zNm)c*73W;ep zOmb_d(91aA9T06Sko879s4-9lpW z+ZX5egnfq3dGGpRWK77%;)ZNUNc)K6Bu>BIQ%&o>9(El%{f$)^ca0|tvyGnf;|voU zcoiWIoxY}$TlKH)?5{Hvdt>v}hJJTF3Vg_2q~r*qqAT%a2;~WAH9y*IHO#99Y{dB- z5>g8fx+_l8LdtoUku2(aHZAcL^E}cZKROI`_Ej_AHOa33o>?h{40}~;w7ettW*e<> zqg;USqG`@DO*7Y$ zcdX@KIKtBFCA=PN9?hb!ucx#zB)sSw!LE3kxPwVF3X2C` z75L0hNPhIoL;{E@r!-No2Wg6qP#~smDAPJz3zL%qluQ!W4rk9C_7XOWapimt2BS9D zdq4TPx>&2OySghJ1d(=fkV(!oReX0gp1Ymjqt9w?J6IPS(;wZP4dL30_BqU8E@}AW zGt$4sB+$}gE~(JN!e3o)sdsv zQn?dV@`@H}C2rb;udI}Wy*Xj^aLn!qTHqu4l9j+?rKCg9b-M8W>-z;-tiXpB28luy z2Dn^f9Q~|;&6E%5QltpSHd=Aw(W@9r`ggONq<9I5?3A4!#HX-Yht<4Dm;E%Uvf@`s z^;RaP9XCo*3PmV$l&O6Z4AysJwc3suq}M!?|&s#(s67?`L0 zoQv)np;dyMZx>A6r^L{&GcHUpZi3kfip%16n4g}myewr>$ zMWoXp;@(-7&;Ing%ROuC1ILAs3(BGRX5W_b`F5_CstTNGe7%cf}> zI;pDo3ul+~HBkAbryMggu9gVZG!#EkSMrXNGaNS6s~XGG%6{G=h$nd0RHGCEO`jIK z@73&o%FPIeoG5}!clhFs{;}-7=Y+xV3B25Xy=&FgjX{m23q>n2b&nmYdL1wg%^D3!SwSPBLC2*^vOMtvG~wZ_ z`7vv2LV-eI@-aWx2U$)IB~%4uKh9!#;>I$!WOc`;v4u;CAIG-K=QFBBwS7C7 zy~a;nDG}nEVVj+$kW}-Eo!HN_N1SVI_Yvz%;8oTbolh*Gj4L8Peu%i`ew0idD?^S8 zuPKR3NwDKJ^Ewjnz;ESjqf`97;p4;4hOXam6VcYI<0k^mp7XKdXX`JgJrg*C zq8bgfvoTk3ZMeQ$V@F?@4D}JEYcQOrf*Vs_J7NS&hJE{)WZ&bQ&*XO4C+aY2QscD? zm#UM8XxE{(Zk(BWJ(ZE~M+P37-tM6`TA=Fv7C9owXFf*b)&8dXc%j;nZ@Z?8$^m_) z^Aqmq8peBaBzxYuf4q%j-gN3hY>h@dqBD8%QlH5fw!as~FK(K=mLkSb@8PJ&G%lIm zQ1f*r)*Sy6zxVydXF&m;v)mVTLIZ=KE%%1q4)i1=r=__e| zw*_lP)-j+QPXA;zSFgsrrjPYR)`~Nqo{#mg-Z$F_owxzuQKa(=1>+S%MTUZB1F0*$ z{)1w8z^RgLQmGn3{tsK_(pjGFf@Ig_JS2%pHY&#(B|DwOIL)lt z@j6+UGQh3FL#pjZ1)lTHZ&)AM1-@DpdRjTblpmuvmHcc??ub{M@C;paIQv-ddGc4h z@CQV(BtFpwK^LY$2YMHc1jymbYF|k^^&u_p2IjoM7NOnu)^tI+@G%jx^& z0-uF&gEi-luZwfq1s#y2RZ&4uN~Wf{40V2iKeVdQ-ZlMEdEjw}P-KE_chKE5CeZ6C zhTKH&)KDXiR%*nL;}agU=T;bMv!BI_iD@T>Kun)6Y1KZGsgHY~;YU)wWurXxAMtH}b44A?H8z%6P^%mj>vBmvhcn%a zYj15&NxTL-PQ*9iJ+xL)5hf8<95bSm1J?IN3#Rez9rH$!>a1N~ToBGzmD*6U9;G&B za@Ee&XQk=ICb|>rjAY|h`(c$wKEwIk*(nduBRx2WzU;>=`0q0sDxij6oZNgCcwRx_ z+5;cIZW8*1WyxC1jF+l}MN%~t?EL=SPoj~;Q!e**xq|)vA|*?y+TxNvUu|#N}m10*Pd*D!~=>=^OkN~0AE`Z{; zL^R;~`zLdlc2Xt6>f2;63={e9P~$MR;u*J-do?$M;N7wG<1OqH;`5m*^Y+0>7!|Y= zbZ)e6i4=EddS?nt*$FRk_OKPq7|jX=1nM>An9_OM%~N{pQQQ-MqjJW#CNobv4RoIUKkmm#oxZM@Aks*GDBKg2jA{KoeHY-9&5T{<{OT?H z%4ghu2F6C*`dw9zdVT)n)67$L>9P0&q3tBwLln@9d+K9Cpoa6sV4uA(-93)lh;Q)j zhUS!v1p;m82RvS4dH)WbC(L1^#vF|PfJWAJGR%hAE;pDe+UBAzY}9#~=3SV>Z;tX` z`bG87N+yaGRpM;x-Z%J9ll4;MA!Z;jYzheBE=V*JDSbjcG|WYeuFubChqtTU52Pp7 z-+*oo%@IFN?z)2AFBh3!OdAAqQK)Ake_t-n@sSB*Aw+18GRK(I2HL0c+_e@{3B&rp z%JOcLy=D&UmTsHki!wPM;i7m+Jos<3;yf*_>5+3Q(jIqP6MdCMy7Zv7hRkOng0n&w zDUQ)j2)2%}cexINh~C}Bq}DMx_Wec2(vtsK3c#fLz|)cL`{j}{Sw?* z9!1(!-i5nz$B=NA#`a7-rW_bzvc=Nv>*%f3L%$=sLpj^MyF43#(k9ietq{H~QhLuv zxsq^~JU{3@vaS|PBSG^O>k*rYCf@n8bM0lcO!3z|p1cR8N+qiDy;9xTFEj3J=wF4u z4t?$WTKP3!C$mxFyW(RaqwZa}fS920YxoNVBrq7yf^Z3`DLSnmXDhwPplGNlv*^nx z!Ik5c==AC`U{KnP_a}ff$3J&427PGtsRNIiuA9RThq_z|;u3n; zCdq#b(j56P>R{PrbU1g;UlVE=5C1$a02ss;O|L|0MQw_bv}kY2h4mvEG0C&Q^bo=v ze`$gqE(v-jEEslJhAn&>YM7QSjUFLsR;h!4`hyaDdV)S@WmW0vuR~gIb#c{@_By}Y zz|dCfZ}PW6x7*;-kPkf!rP;n_zRwN#v$quwp^G=j*z#^S^%(u*RaxewhAic^&0b3@ z_}Iwg1a#$=>gt>ekITH@kJDU^EYubgVUSXlRwv==kEP+IA+0!1P6#ySt*UD{+11q4 zCn~HwCJhWR^=eEsl6@`uARcFIyhU#sTKkI*VY(XZQ`+lVb4wwzruR5z*fnO=RgwrW zd7Sn`t?X2%kGmrxuJ$GrOW<5JMI1!TpGSLNXXhJ?KDw#9nXWcy`+JGlO^@Q|9~w!K zR|snA~ieM{M`>RltN!Cw6%m8A_LNs`J;56&5Gy$aF5-vrIYGq;lT zkAZQ0OoHBlNtHjt#(45#LlkqPZ%`K9LY!p7D3nR|ORg3lOh(3%4Q4K{5?)2o@uTCZgK&A`Y0@DjylLx$9DF`(ZY9a= zQ{)c>c**Z{vR9!7f_bhp?wN?ApLO97`5Or#;0@KB~VjiCV>c} z4miWYrbc@%?|&CE2fZ?^D+k$3I{2*cZpZR@ml8`RN$ke|9E7Wg84ULj2#jWojv!Ls zkE9=siH*iDp^N!=!-&lOQEYf2Rw~O?3}^fMyQ|!ZePEJ^oZ4`!5l6R9f^Zg2=NXftAK`d`v(?9b;fBO6zLGVwk(ti^W`X}xF zGbse(ZvHSq|B4FzL6`n#s1OL8VPge-`~MFr!~);~Q9hh(AXJEr6~M{@f?`1F4W@a6 zaNaYK=2W$1qecCKxo4M0ER#m(jQ<51lMqJgP^0oFL$b^9`_J2959sEcy%d;eJDxxZctmM8y7A{s#Dfa0qq~vcw63 zfjB_;5;sWyx162(jZy;X2LgTGbbQO%SwT3|8#wgV2Eq$DKx49jAfvaO9khN{kcNLi zBGxzULBP`Akk4Dr{RS9;>N!Bb!(0D9vLM)r4Wth%H>eD1V+SR!w|xTX&kov4HqZ{R za)AJ*Kfn;E4zzdw1u*ol{Ma9Z`OjbN|Nn`h|4YQsA6NSOEdI}tq5qNy{BI#c|M2nu zBX$VL0c2t00uev|3=na#fdC?|HcLWh98w`u%%dbSFU5ZUQthHaF|4eN zR()1wO!emBK~?d~{7>XmdX4u2z(?l2k1fOETk= z8K2FR?P^Pf9>dYxiUiplUVFL`-ub+8t#k%`*3~f7RlhoG;%tvp8h6^CC<}wRVR#V_ zhUsF6tj?ag?7IEhtL#XM`pD1IUfXIjNO$l~1ky0z<<3%#pBd4x?^VJ|32}wjLSw8X zhBGGMAqN@mg1ep|U6+SYiCDywboxbG{#!kXhxxQzb0@;lBAW3l{AU-be!FeHNesf) zgy|9#L)eNW2t_mco*F~4-AG*S(*SiZ<;kC6vBVOZ$4Hm8dGHL$l_s=AaDs}D3qX6) zlf-Z##AmUPBjxj`Lb|BA9(5Q)m?{A_2>z8tnlZwFNFH9^PT|J!Pco*Wq!6rJz2x8) zgYghF@d%{>|G^N6SeOZGn2DlOW0a7DqqHdT$p}SI!!z&4Jmi?Eg{Uae z%81&};1=d1Z3{muQ4WhNmIw}m;~ z3bdB|e&U$VA=>D~ggi`9SG?5`yuEuyF|Rw4IIV3#xA|aR=yv`(ggl`NxsX=m3XonDz2ne7_@pEatnKAYg-rh_Oz*lkP*oSWML_jS%`q7$5a>~^s8 z_p}4_B^#ni6_v-*AFWw#pD;N2%TBfsRdxb|2HaYn$5YB25wmk1p{H#8@o~D$u@xR_ zaUm*obrJPrf6NWfl|5%h6*Uv_Xdc-om$_+xe%w^CMXhLnMIgO`bxpqU@E45s zGF}|?uf5KS1WQ!fFR2d1x&LzHeA~o(vuY~yqRI(T2j=AeLxGB-XZYEG4cZjkKdRNMwOF&&zlnT6qXA|i7@fTeBIka%tSgTOpg&D* zs@Lkj+q!yS!@f_&-84pp$8mFE07#r;z|GL9oyuI~_;Fm*MY$5rlTC4x(Zk-H)1Xh|7VDEqeTC{nY2Jp`qu z0jE2S7BsRcT>;H6Yw+nBFpq-s3jgmyKj|ceKbZT$LA9ooH*CspA3WK(3x++j+pInP zcC9hTlhQU3{va-|4`}>p0O_Tmo& zOQm*=3W;%;Gg1o=?ar`ORuh&24vsX4VHS(fukggI1dALiQqp`0)9oN6^;vidyt`0? zw%Id?2zw#6RRR((U@bOq>FJ!y>(f9U5q7b0N7bx{7vd4p)ncZf<$mJVA3{y!Z7ido zmGd52Tf5|h!;rRJQWb6T8XA;y-PM|H^!+s3$u}5EbDEVerPNR`Me{sUHFw-sZU8u+ z;kk3aABAGDDy7<rsP$DDbrylTQ0tj1YWN;x5 zb)jEnV~EuHo(=q88uvn%JeL^#!%YxF52F0ZDf;?X%s~cZz8C)D*PE=_EQKG~g?9yvOtTywdhtcnb6{NO}fR z0M?{+F)iq!oO9(kTH&%0di|^rWYqK1DN~R}az>ui9uj9%-mGKiJtv3;=B^Es-&Xt| zb{SP0oGHt7!)QDHV{yhGZV!6 zfi+Hv%N9-V2XB&*=!`Bvj_uXgO7Q8|6>m!nRc)p(WRb6R!Bcq4^2mHlc7>W6%SbO! zc={N|1@Dk+4ja1^&=i4bwMga{m2c&@|qPShl7mG%NuJKqH5 z^T~Z3;Y3`ghvM(KVu9t(tw&QA zL;aQ3f#xj=<84Awwaw6dblnsbyaSB5g)|4}NKD7ZGB^k`wYA0Z>Kz3U3!}i)PR@;2 zScml)fgzgs+FdAx09OQkTaj$6wM?8F5ex+x8H!|^r!s=_S(?)KeE>Wy-3;YTC&uKx zh;_rJ$yxLN5t*TePkbYZs{^uKa~bw2*g&RUCg$$n<- z5MXu~N@xqXU$vVMY=`vb?4b9XyEyp%K22P)q6cib^#-@|`z5r1Q_I#B701RJ*RKmI zMuWB|3V|tw49=*66$Iz$@sFplU7GOs7CFuiIx=>--;;+lIy`GLw(&=<#@3uje|?daf?_a1_(l8@H{@w^+>;VGRtHU5)aZ z_c~NJo2n!B=2K#xGju`%W(a4BKlz69b>V(NK$M zBt*3+K=_krpmdJvsy ze_OH~jb+~ZYPmC4q_4JDiAZaK^Cf8X(4HFL9^rK-n-3ljy!WJsq4b_^O{_fPtgy{T zjOvVp{MZ%}_xgk=@O)ct;sv++&Vt}WV4HH#u>nI)1oU6<5D;0U=;+ zy{QO?WGb%LR-f|b^a-i0cisuFQ$C{LWIAWWrwl(19X=;gMojnBu=@N7g#lDqZ?!y! z1=m~ZLFLH#ADAH`rMrg0D8UIKC_Nu{xNj{mZyaVvTHOQ3SW75qH)*HY6BZ%7r%r1maQ+kovu)`SD=r@Ym9zh{vPE9#bg4( zXv-~%W@WwiRXBntVyVz0@!`Flp z4}RW_{6B@Abx>T(+OG-j5ZooW!{APE2@>4h-QC?GKnU*c9^4&*dvJFc+_{sz&pF@y z_NltJYiicaZ@tr9y{7+~Sx-Ov9;9$y;l~N%Jg1kh?u%aJmj{-={bl9#BZ$zui}(F2 zYxAA$3iKn5abiX$#3ha}^ItpzBKo-;8?vhqxpFg5Ef<(A<;*CFdV{0G0Z}Vw^~RZ6_xG?u4#1~oC)fv zNxl%G+{i+yqfIm0wSTRFFb`b88@iYNq?-PVXV9*mW_!m-{BZ{=#5PIKA$kPumT(^IIzqfLa;2H_{ntg zA@zI=b%>$QHAVo#iS7XZOA6=;_I^B^pa65IECo}K63(>4qtXDjE7&ki&mTmvh@5iz z`3U1IygN%F`bhPUy(|vx!dUE*-rxt3687gOyRXQ^w%&H1*9$gPa&`!E$Z#YvLZID^ z8p&tA7@OkbqsQFjzrX^qWctm!LJm~&Uta7a-P65sE0%+86XgyHFj!|4sOX|-c;aw@ z8SZC4hNJ~kFJCwu;@TSZMEv%}FIkJrlPg|F=eFVVZ{Sf9)wet zXx+(UnP5nf5|6q+bcl<=_MJQvQgWCr*jS8S@M0nif?0gUnU}>MW#3~)6q69vmn@53 z$g^r-L4S*dj={EZ9xqd}*!`kstZJF7QfP7G@Vg9IdK{?VVCvp(r?@`AW}@{BwID~o zxzOP0Czg2?%MbkYSEe%{Z&V5#d7Zm{%ne;heI~KnW``@%XK9|bGp;&fQCEXb z_kEuVxF7i|j%|%z`=>rItuRiM$)@Kx4Mu6yil`)OGL!42cX4cxIPLoBfVks!b9y_0 zKW4Ja$4cJkdbM>%!f_5lHDUGG;dL~$h4mnsNKJMx``CtK(?|p^sn~%QGZH|uE|h?# zqFK-38m(7OVd~UR-K9ZN$HM<>_u?AkL^u#;aOQBkFr}Ord;t%Q+*|m8qHcLx)nTme z!yBC7Yl$+_s=&z_6Z4zl^*u_|c#vNPr{8&UV3=gC`lr}M!l-Uoe99zkUZ)RM*;rle zZ!bFt3l&+X8*Cq34untHYEG~$7jNe($kJ7eXm72Y*BFb&s=_*q<>m7)?zM{R4UE6a zZ-``hMN*2HI13*0>IJ;I7f9ghwn_V6Mq!3ecYo3y5}ZJ1-`dk$Ql+vv$>Ouve&!dY z>!EE?cJxwem!|VjQ*)oqt{`O^(}uN^HVU{#MQG^DiqJ)X+0`$-v4oqTh%rWL0oTB7 zK3mp#?q=jd4|=IPBD8hnIW(Ne9%|d)x`>P9?Vt4*Aw;g}7-6TWmbqOa1$?T|9&|ME zwU;azuO6`FgXRpp2sHTsxAr_@&{C*NC;|cnc%c*X$?qE%`#jafaQx9kKGK59dYI4qDYA>yd8XjCgp^o z!3p3C={f4CXiLdby14{|ECi%X^5FMSHcFXlHs2DpB7%xVv!$ndv+tw3ONa?6(W{Ec zCq?TJGx#NU{++zXKayxlWr|7gYSkl_$!RdqFCvX_Sxa=qn^N7lQTyqES%`lKq!fnK z84+~dcDpZ8Qs3Vmg0VMR9aiim0{ z^hbQ3p9(>?AgE~JRdnEv(J_eBC9Wdu@v_HLW%4oK(F9&G^^~hI3M@bMCo63yPFnkB z{l?~MFfSJS_iMx@G6AkRfmVj2RKLyQR~d5a$LTz$6T&Ec?EpeBHg62;rJ^Euns#oT*Zrh@uS zsN_KpqNCHdH=AW>n2;H`MdnY9K!RkSR#8qx-{djq_sD_&u9HPBWqizW%^ zD`DpeK7a<8%Xk?WBJmmZi9sBbXnMt8ffNux@GIKyt%h9*d-OtzJAScy8J+?K(>bf% z@@fPCB>^)CUsX!Sqb}75uYqD(pX{eVhY_GVR8^mfyX*jr z$@W3!_T)Cow7V{jAESKU&mnwLBMszFdi|u|HN_)e0k|L->0ChDX~Xo&W{$K!L{#Zw z>#7QxN~fjQx@EKiMfiz$btL-7ZSDkDe36eL zlojUNCQ4VMVeM|9Utk2bgCC)PZtwS2Gr9qzqe5@lsAusDl?_CrpIS|b0C-; zo9{O?MRe??g9>EhgL-64Y5UTJ5#Nevnx?3aQsjJLHXMqXnQ_8kQ=O*z;*A}r~Pq6KANqCP1`4i5ANo>hAIY`$R9&UhK+~KNoa9JWz-jZ zGFEO_%p;=e{^)J)tf-Gsm;dm+ei*BSP$^rUth&_NPH-IXnmk}Pyg18y12UX^td6& z|GZqBooO^7qK7d2!uG(3d4bItx!6x!19wu3r`1o~XLdOx7DC-Idh zKebU4(UF`OF8PazBAzn9UfQ56gdV!}IUWnF>x_f~EzO0%JFP8gS{RYHx##8jrmyYB#v7xq1>A&@cLKqpznyY`PK?AW3An^G^n|{cwP7GF z9sskZ(lmMa0+lw&>0k@|;pKNR{LF~^uv%*`jT&NKS$`C#EuY%8%lz>kN{5#>o#~{{ zl>>0vOq1x4*XdVw7JYwttS`%P_Bn`iOJa{o9K5ZVN93ZgLB-*;`Zv;0b0;|hSO3O6~Gq!w)WieHEAY?f0{52xFK zOlJbHW;@&qo?X4e<0mFCV9ueJ3^kT!APUo+MAD{tdxBQDNi64e-2&L^4IMJPYX%Y$ z8mmd%o>XsI*3sN>pm-_O&HIq7>+i->)Tew$kI|Gvl?f+x-gPijfZiX55|dV}*VqpY z=MmlKk^5;fGNcUvtLv1NBn21*=dY4^ z`{<1%?ikXIo(yHyH-;gdsyQ&M&i#PbRNT`(wzyg4cj^MHYnIcVjkttz08`xrJOB(i zSc$y%T=p|J&Awc0<|vE{J=!bGv|v=@vc?|-#2IzdQtyWMfp47~2j@PI&qjPMu1QP{ zrqWl9Zl+x!m2F^6=fQ%JXSS^)SeOWEr0ZpoXZvW37>JsoLJOI^qmH-80*E%*0xN$W zzKjjx_OzxZjOAL6)Di^f!SL@E>ti?>;qzA53|01#5^zMqq%J3%4tdU_j(s*J{Q-=} znAv=b9m?P$C}pW1Sbt#6K|w>g;)LKV&fCbi2jG0XJnM2=w}K>niEzk3@m+RVMR4K= z3#veX4kVF*!7*O};^S1vm3ep;!;pb(DzSL*-+$Ru%Q|K@GFgis15%Gz=^w76Qloh~ zL$<(+6*25EhA>Ox1>^(QJsx`7wxbO3jVONezKnP3f2F28MvaT#mm}UR@XNGEl!*iK zdlD3h7bUW}RggFhkaaWh#qi5WyHj0`HOq@9!P|ZmJ|AwngyV&V8g>pmPfg{AG7|!# z|0t+2dnUx!XIwpq$hq?ZUy@3$Oms9K_EhHLSRi6bOg$}7L+jH}iT%_iJ)rSzx$OF} zl815h;DG*Tw$PEtI?7r|emyVLFX`dVYcP#$Ff4YZ_}H`I4qJ_p@;RqedW42{mhyR&uIDRyAwtcJsXZ^>==(VP1i{Mwezs;;7=Exfz{ zdsw`tyqv3@GaR<@%!?(pEKJ}c1n{HWiCTyk2@B2u?}P<6Aa1mMCQ&JGQm9Tz6SV_n z;8~&MlQD%*vZanvu8TXLfjjb=&LaUb0CAR+<#~h@F)M6()06JDcVg!3;%v>{^#1vd zpX$1vX3t)&D0+VH40zH(8FMa8i5)^_tiR^xf`<|NEw{ddB_JPx@r|vu;9@&WNHTO^H`Yw8LBc@-Bc3tc8K?lE-Jv;ML@hn6qp4?~{s`3{63RG|ZFt z@jKd?Ojmxod+qpM&snK6%GY|AEAeLDOQRm;vh-Tq0_FZ%eP*S{bF+; zZQQhYw})mA_HsHkWw-)E49K_8kc}QxyShMC^wMJKt$$syXX%}(Vcc7)4n1WWvFNA% zP~1gMPJB)%5nJu+JU|-}#yEA#CxGS7HHDwgkqQZoLEyY*Noq>L{1t9tG1$kqrvM59 z&2gPSHU=q|KqzuTCv|zoX~|ybgTQOFd!^4t=c}FIO?SLtG!1S5`))|A^i}Vd?2C?{ zUKbH%Rd-TmW2)2rvCy6r`ETYpmRHDfrf8w|+;C+}h(^+o+tD9u;k-ZlW_;l&fpuh) zsVCxNi-^*;4Re+FskWHj9rYZwnRjvFA~2Th9J4n zol*Kd#RGlNnkHACJ2jgJFn;`MAL4We;OYvVTpu}Ul6RhgWpjiT+u?{1MSW9c_(2yB z!Ukxg#jB?5=4d{urj#b0-P+sX|;@ol> zj}=3?c;j+Mp7Wd7J)*$e_Q`#4Cj+YqX`|@~OWcbI5+aIj(k+g~Tm@&?4WpRu;EQ%KGXI3h3RQKQ?r+UBg*3Uc+0vZdGb!a&bhO9%+Cz_wUUU`cAXU ze`v+xX12zkJDjDOBKR^QQ;q5R`BT~_WE|HzGh4AP0@O0QK8(C~_#=%6Fgtn?ce#9U zWYl3JjQAugWAHIr916n*?-YcmHb-qKn>vvIMQUE`%TW_|wuQ*POO09`Z&x6SUIyICt-@D1m6dX&Oe2>gue1%nS4EYz$dK`g5CqqEcK2ikEnd@?syeT@pHOQJXM1ah zP2Ldg;z{R?Qt`samH>zx451FW(pMkgo6l5l-K!`a6ot_{eS6xd>!z~1pHz*AtJjCq zQt-+=GrvHhUg{{753!=TWGljgwJ)}va>Q#UiaUt7rL(!k@`TG!+i{#6uMM#2wmJh% zu}<-u%l%RK$t)wAN`k(K*M0%Ptg?JG>loNOA?|Np2^%oH&APqI0gfHW`1~>GhBtxh zxDrW{`5%5%e^|yk9rpd*xVJ8M(@MShObHq{UkYRtoOZ*ZyZviaWCIw8>xr@)k6Oa>yAo&o|J{clI z+JE-MrC(jr*f>}iKR3one5Gwo(ETA6yweQ}}d7qwftz zXyQ(RW^~jQI9`Ah^~1*9{b;)B;naL7mORv%=W4;I?qPwF^w|HMbUoa`W>2O8eG$ zJTLQXq_W($%rn3}|90CWV!b?ljMe&v5$?Cp{UnzbM;A}ni_!t*Xgx)fNMqQ%Q9uUJ zlh1A8B|gwGkeOp*Ns4vzkl#cj-!Ybb7Mu`tbRJsnWGyDp_1#*U))}bgch5NxC%2S^>{e^)e9lTDcc@ZXdw>Yo=Wi)et&Qb$ zKW=)mq^AtY>n*3YC(7$Hn zc%;$OmouFzqJKb$k$9c3$qkP|$G#?u{oCW!2ZxgZWME%;`BR#^nB5ujczcPgiOI?- z``NYww6;l|yN#;?Bz4!zCGewNTWarSzzxdtq~Ii1+h#}s>~=ZeXq*>~4}C}~7cde7x~y0+rt%{>wwDrz?lJ zp4Sb)V$2n0Y$<;~mP(vRnYClm#m@ zUXOLGq4igCO3g`T&ARvs(&~i1U5qVKm>Mx^%-k;-o#M0Cd}I>Dkp<7(tfd7(G+-U9 zBG#tRtjPP_h<6{%q85KJaeFmc9ETvd{MyLuuZ2P0VEt%jr`r{WuSMy5_c?*~E%?Dg zgZmo#dVCB+Ae`JVRVChV$_*X&$@bH0{!eYU`?d&uQ{Zxkm&Y2C4W|Irhin`;;?w?`u^t+BhwgSM$St--cBX?~H%Yd}#}iOTCm>bMVMe?{ zgTD~Q z;Fd+82`r;sOxy(J`#v01h)PXVVBz#NPiNbqCD9Nyr`2K*WIancNq5xg5r10@Z1;CgzRv{rU2;pS-4S9t& z$2u7BVbq;kN?~6p6|#_eRWK{o%u#_+2SS>#BLO>J&OTo}wiEnJM1l(X7bD-p+Ut<^c0L!+l{<33DzD>IHe7e{6Q;Jt z9m!_P$2}IUX>oWaZGLN(NXnQ@!qd-uF>CPlZaIXzJl%62Ojyf|Iz?K>hCJkma@_x>u<@yD?Ua;SmO3hPPNXf)F*kM& z0L>)CH*Rh)hAsyOOJ}VJ`|#3D**R1i+1Mt&;Io#y78zO3kDCrHt>7Xl;T10?&C6x7 zc9dC|JGq>Vr>#&*l2BUzqSe?xh$1E7FXq(K*^F&wowT`P0KPJ>@74k_IRZznYLLjeRgh2dsaa< z*GBFnv*N;P^{7X=SI$;LSEP z&J5!7N3V9I`I*C^6Qq*l{?j%%0YtX`_Ql z@;}Ii%z*EGR*teHAuao?Vy_3)XgL>dn(I*_g{Oj2iF{*5jXRU=R-BJff)d6OGsR12 z$~(ne!r4Rcq(xD=5^kEu#sda~5*Vo!Cwxds^S+)B;;+u~kRayrN(I%Ej3d$*UrK zqon(Sq!abr{bwz*vS%cnGIBnGnGz5C%ukIRQaH2on&c0{H+J!^<;j}V#KQNpV8xUc z)<`d^ZnI6e%#RF}zS$^AK@3woV9~kwzrJ@`O!*z09$&7qm2yCczu6r$f>qU%S6EW4 z$cNOD3KU3LO@JL^$SloCrvzVS&qBmu;YiT1V=R;gI^?$T9w^YXr+4Ajh-|#W-k&wj zkf#(2U)=C6ScfJXvVk9}`-?*yAP513t@6&_19IzQ-vm*+UfuN)czt3WkO^2B7hou$ zt&ALvbYn=3;PVY7;_8NCX``cMPmA$?pk749FuM-ITbt3#^B6@*h!4clHw@wNhdK~Y z?x>^SV$0Md?+U-j%3)>FwJM9s#ddcJi=5h1lfl=HVRJH$8WF?P9&+(7#Ljv&?8sR- zRA5;(>RIwO2E)kkA$v_Vi#MQlL{^cghFyL_*uV6Bc{snS9T_3JN60iGgSblY0)Lnm z>Q#R_VaP6d*8lZfp@ouQ@rXsN^ke zEu@NwA8c%Gk>}e4W-4uF-k}_#M+*O&@S4{)J>Q{l_u&SCxbkh|>A@x&J{F0Dstq zzsCoO%N*^DT|mMc66&{iFdHxhFi|jZFcL6!Fh(#AkX}awB>Zx=u(K5fd8Mxg-hylp?>n9BGf1!X&x{46-}-09#tedl{%43`)GKSM)Vga7~l From f683e8f66c5418e11020904d973a8b0f85281b3a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 08:04:52 -0600 Subject: [PATCH 019/160] Changed TimelessDate encoding/decoding to use single value containers --- .../BusinessOwner/BusinessOwner.swift | 22 ++++--------------- .../Models/Payer/PaymentPayerInfo.swift | 19 ++++------------ .../Models/Payment/Details/PaymentTerm.swift | 18 +++++---------- Sources/PayPal/Models/TimelessDate.swift | 16 ++++++-------- Tests/ControllerTests/InvoicesTests.swift | 2 +- .../ManagedAccountsTests.swift | 5 ++--- .../BusinessTests/BusinessOwnerTests.swift | 2 +- .../OrderTests/OrderPayerInfoTests.swift | 4 ++-- 8 files changed, 26 insertions(+), 62 deletions(-) diff --git a/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift b/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift index 0ea317db..f21b83d4 100644 --- a/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift +++ b/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift @@ -27,7 +27,7 @@ public struct BusinessOwner: Content, Equatable { /// The account holder's date of birth, in [Internet date and time `full-date` format](https://tools.ietf.org/html/rfc3339#section-5.6). /// Supports `YYYY-MM-dd`. Not required for all countries. - public var birthdate: Date? + public var birthdate: TimelessDate? /// The [language code](https://developer.paypal.com/docs/integration/direct/rest/locale-codes/) for the account holder's preferred language. public var language: Language? @@ -77,25 +77,14 @@ public struct BusinessOwner: Content, Equatable { self.phones = phones self.ids = ids self.occupation = occupation - - if let date = birthdate { - self.birthdate = TimelessDate.formatter.date(from: TimelessDate.formatter.string(from: date)) - } else { - self.birthdate = nil - } + self.birthdate = TimelessDate(birthdate) } /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). public init(from decoder: Decoder)throws { let container = try decoder.container(keyedBy: CodingKeys.self) - if - let birthdate = try container.decodeIfPresent(String.self, forKey: .birthdate), - let date = TimelessDate.formatter.date(from: birthdate) - { - self.birthdate = date - } - + self.birthdate = try container.decodeIfPresent(TimelessDate.self, forKey: .birthdate) self.email = try container.decode(Failable.self, forKey: .email) self.country = try container.decode(Country.self, forKey: .country) self.name = try container.decode(Name.self, forKey: .name) @@ -111,14 +100,11 @@ public struct BusinessOwner: Content, Equatable { public func encode(to encoder: Encoder)throws { var container = encoder.container(keyedBy: CodingKeys.self) - if let date = self.birthdate { - try container.encode(TimelessDate.formatter.string(from: date), forKey: .birthdate) - } - try container.encode(self.email, forKey: .email) try container.encode(self.country, forKey: .country) try container.encode(self.name, forKey: .name) try container.encode(self.addresses, forKey: .addresses) + try container.encodeIfPresent(self.birthdate, forKey: .birthdate) try container.encodeIfPresent(self.relationships, forKey: .relationships) try container.encodeIfPresent(self.language, forKey: .language) try container.encodeIfPresent(self.phones, forKey: .phones) diff --git a/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift b/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift index 00b55418..391fbdab 100644 --- a/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift +++ b/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift @@ -29,7 +29,7 @@ extension Order.Payer { public var email: Optional127String /// The birth date of the payer, in [Internet date format](https://tools.ietf.org/html/rfc3339#section-5.6). - public var birthdate: Date? + public var birthdate: TimelessDate? /// The payer's tax ID. Supported for the PayPal payment method only. /// @@ -71,7 +71,7 @@ extension Order.Payer { self.payer = nil self.email = email - self.birthdate = birthdate + self.birthdate = TimelessDate(birthdate) self.tax = tax self.taxType = taxType self.country = country @@ -82,15 +82,7 @@ extension Order.Payer { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - if - let string = try container.decodeIfPresent(String.self, forKey: .birthdate), - let date = TimelessDate.formatter.date(from: string) - { - self.birthdate = date - } else { - self.birthdate = nil - } - + self.birthdate = try container.decodeIfPresent(TimelessDate.self, forKey: .birthdate) self.salutation = try container.decodeIfPresent(String.self, forKey: .salutation) self.firstname = try container.decodeIfPresent(String.self, forKey: .firstname) self.middlename = try container.decodeIfPresent(String.self, forKey: .middlename) @@ -108,10 +100,7 @@ extension Order.Payer { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) - if let date = self.birthdate { - try container.encode(TimelessDate.formatter.string(from: date), forKey: .birthdate) - } - + try container.encodeIfPresent(self.birthdate, forKey: .birthdate) try container.encodeIfPresent(self.salutation, forKey: .salutation) try container.encodeIfPresent(self.firstname, forKey: .firstname) try container.encodeIfPresent(self.middlename, forKey: .middlename) diff --git a/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift b/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift index 7cdb56b6..abafb3eb 100644 --- a/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift +++ b/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift @@ -8,7 +8,7 @@ public struct PaymentTerm: Content, Equatable { /// The date when the invoice payment is due, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). /// For example, _yyyy-MM-dd z_. - public var due: Date? + public var due: TimelessDate? /// Creates a new `PaymentType` instance. /// @@ -17,20 +17,15 @@ public struct PaymentTerm: Content, Equatable { /// - due: The date when the invoice payment is due, in Internet date and time format. public init(type: TermType?, due: Date?) { self.type = type - self.due = due + self.due = TimelessDate(due) } /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). public init(from decoder: Decoder)throws { let container = try decoder.container(keyedBy: CodingKeys.self) - let dueStr = try container.decode(String.self, forKey: .due) - guard let due = TimelessDate.formatter.date(from: dueStr) else { - throw DecodingError.dataCorruptedError(forKey: .due, in: container, debugDescription: "Date format must be `yyyy-MM-dd`") - } - - self.due = due - self.type = try container.decode(TermType.self, forKey: .type) + self.due = try container.decodeIfPresent(TimelessDate.self, forKey: .due) + self.type = try container.decodeIfPresent(TermType.self, forKey: .type) } /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). @@ -38,10 +33,7 @@ public struct PaymentTerm: Content, Equatable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(self.type, forKey: .type) - - if let due = self.due { - try container.encode(TimelessDate.formatter.string(from: due), forKey: .due) - } + try container.encodeIfPresent(self.due, forKey: .due) } enum CodingKeys: String, CodingKey { diff --git a/Sources/PayPal/Models/TimelessDate.swift b/Sources/PayPal/Models/TimelessDate.swift index 001e4c3f..b27d3f0d 100644 --- a/Sources/PayPal/Models/TimelessDate.swift +++ b/Sources/PayPal/Models/TimelessDate.swift @@ -46,27 +46,25 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). public init(from decoder: Decoder)throws { - if let raw = try decoder.container(keyedBy: CodingKeys.self).decodeIfPresent(String.self, forKey: .date) { + let container = try decoder.singleValueContainer() + if container.decodeNil() { + self.timestamp = nil + } else { + let raw = try container.decode(String.self) guard let date = TimelessDate.formatter.date(from: raw) else { throw PayPalError(status: .badRequest, identifier: "dateFormat", reason: "Expected date to be formatted as `yyyy-mm-dd`") } self.timestamp = date.timeIntervalSince1970 - } else { - self.timestamp = nil } } /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) + var container = encoder.singleValueContainer() if let timestamp = self.timestamp { let date = Date(timeIntervalSince1970: timestamp) let raw = TimelessDate.formatter.string(from: date) - try container.encode(raw, forKey: .date) + try container.encode(raw) } } - - enum CodingKeys: String, CodingKey { - case date = "date_no_time" - } } diff --git a/Tests/ControllerTests/InvoicesTests.swift b/Tests/ControllerTests/InvoicesTests.swift index c5bf1c97..33923f29 100644 --- a/Tests/ControllerTests/InvoicesTests.swift +++ b/Tests/ControllerTests/InvoicesTests.swift @@ -145,7 +145,7 @@ public final class InvoicesTests: XCTestCase { let updated = try invoices.update(invoice: id, with: invoice).wait() XCTAssertEqual(invoice.date?.date, now) - XCTAssertEqual(invoice.payment?.due, now) + XCTAssertEqual(invoice.payment?.due, TimelessDate(now)) XCTAssertEqual(updated.cc?.last?.email, "dont.ater@example.com") } diff --git a/Tests/ControllerTests/ManagedAccountsTests.swift b/Tests/ControllerTests/ManagedAccountsTests.swift index a3d2f60d..5b0a941a 100644 --- a/Tests/ControllerTests/ManagedAccountsTests.swift +++ b/Tests/ControllerTests/ManagedAccountsTests.swift @@ -52,7 +52,7 @@ public final class ManagedAccountsTests: XCTestCase { subCategory: .init("5972"), merchantCategory: .init("4653"), establishedDate: TimelessDate(date: "1882-05-13"), - registrationDate: TimelessDate(date: "1975-04-22"), + registrationDate: TimelessDate(date: "2000-04-22"), disputeEmail: EmailAddress(email: "disputable@exmaple.com"), sales: .init( price: MoneyRange(50...60, currency: .usd), @@ -74,8 +74,7 @@ public final class ManagedAccountsTests: XCTestCase { let owner = try BusinessOwner( email: "business@example.com", name: Name( - prefix: .init("Sir"), given: .init("Walter"), surname: .init("Scott"), middle: nil, suffix: .init("Bart."), - full: .init("Sir Walter Scott") + prefix: .init("Sir"), given: .init("Walter"), surname: .init("Scott"), middle: nil, suffix: .init("Bart."), full: nil ), relationships: [], country: .unitedKingdom, diff --git a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift index 69ea405b..eab32a94 100644 --- a/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessOwnerTests.swift @@ -29,7 +29,7 @@ public final class BusinessOwnerTests: XCTestCase { XCTAssertEqual(owner.relationships, []) XCTAssertEqual(owner.country, .unitedKingdom) XCTAssertEqual(owner.addresses, []) - XCTAssertEqual(owner.birthdate, self.date) + XCTAssertEqual(owner.birthdate, TimelessDate(self.date)) XCTAssertEqual(owner.language, .en_GB) XCTAssertEqual(owner.phones, []) XCTAssertEqual(owner.ids, []) diff --git a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift index 62634ea2..fe1c884d 100644 --- a/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift +++ b/Tests/ModelTests/OrderTests/OrderPayerInfoTests.swift @@ -26,7 +26,7 @@ public final class OrderPayerInfoTests: XCTestCase { XCTAssertNil(info.payer) XCTAssertEqual(info.email.value, "email@example.com") - XCTAssertEqual(info.birthdate, self.birthdate) + XCTAssertEqual(info.birthdate, TimelessDate(self.birthdate)) XCTAssertEqual(info.tax.value, "85323EC0-A9114") XCTAssertEqual(info.taxType, .cpf) XCTAssertEqual(info.country, .unitedStates) @@ -121,7 +121,7 @@ public final class OrderPayerInfoTests: XCTestCase { XCTAssertEqual(info.country, .unitedStates) XCTAssertEqual(info.taxType, .cpf) XCTAssertEqual(info.tax.value, "85323EC0-A9114") - XCTAssertEqual(info.birthdate, Date(timeIntervalSince1970: 1_536_364_800)) + XCTAssertEqual(info.birthdate, TimelessDate(Date(timeIntervalSince1970: 1_536_364_800))) XCTAssertEqual(info.email.value, "email@example.com") XCTAssertEqual(info.billing, Address( recipientName: nil, defaultAddress: nil, line1: "Plum Fairy Ln.", line2: nil, city: "Ginger Planes", state: .le, From 15ace77061d6f7ec0f88d17b2f3ee6c744dc63e4 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 09:26:25 -0600 Subject: [PATCH 020/160] Added missing /customer path element to ManagedAccounts controller .path property --- Sources/PayPal/API/Controllers/ManagedAccounts.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PayPal/API/Controllers/ManagedAccounts.swift b/Sources/PayPal/API/Controllers/ManagedAccounts.swift index c787af67..5e2917ca 100644 --- a/Sources/PayPal/API/Controllers/ManagedAccounts.swift +++ b/Sources/PayPal/API/Controllers/ManagedAccounts.swift @@ -33,7 +33,7 @@ public final class ManagedAccounts: PayPalController { /// See `PayPalController.init(container:)`. public init(container: Container) { self.container = container - self.resource = "partners/merchant-accounts" + self.resource = "customer/partners/merchant-accounts" self.version = try container.make(Configuration.self).version || .v1 } From b22fec57d298fca820f9b5550bbc55d6f4f96474 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 09:44:30 -0600 Subject: [PATCH 021/160] Created BusinessSalesTests test suite --- .../BusinessTests/BusinessSalesTests.swift | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Tests/ModelTests/BusinessTests/BusinessSalesTests.swift diff --git a/Tests/ModelTests/BusinessTests/BusinessSalesTests.swift b/Tests/ModelTests/BusinessTests/BusinessSalesTests.swift new file mode 100644 index 00000000..d16f5e57 --- /dev/null +++ b/Tests/ModelTests/BusinessTests/BusinessSalesTests.swift @@ -0,0 +1,117 @@ +import XCTest +import Failable +@testable import PayPal + +public final class BusinessSalesTests: XCTestCase { + func testInit()throws { + let sales = try Business.Sales( + price: MoneyRange(50...60, currency: .usd), + volume: MoneyRange(50...60, currency: .usd), + venues: [], + website: .init("https://nameless.io"), + online: PercentRange(0...1) + ) + + XCTAssertEqual(sales.price, MoneyRange(50...60, currency: .usd)) + XCTAssertEqual(sales.volume, MoneyRange(50...60, currency: .usd)) + XCTAssertEqual(sales.venues, []) + XCTAssertEqual(sales.website.value, "https://nameless.io") + try XCTAssertEqual(sales.online, PercentRange(0...1)) + } + + func testValueValidation()throws { + var sales = try Business.Sales( + price: MoneyRange(50...60, currency: .usd), + volume: MoneyRange(50...60, currency: .usd), + venues: [], + website: .init("https://nameless.io"), + online: PercentRange(0...1) + ) + + try XCTAssertThrowsError(sales.website <~ String(repeating: "w", count: 256)) + try sales.website <~ String(repeating: "w", count: 255) + + XCTAssertEqual(sales.website.value, String(repeating: "w", count: 255)) + } + + func testEncoding()throws { + let encoder = JSONEncoder() + let sales = try Business.Sales( + price: MoneyRange(50...60, currency: .usd), + volume: MoneyRange(50...60, currency: .usd), + venues: [], + website: .init("https://nameless.io"), + online: PercentRange(0...1) + ) + + let generated = try String(data: encoder.encode(sales), encoding: .utf8)! + let json = + "{\"sales_venues\":[],\"revenue_from_online_sales\":{\"maximum_percent\":1,\"minimum_percent\":0}," + + "\"average_price\":{\"minimum_amount\":{\"value\":\"50\",\"currency_code\":\"USD\"}," + + "\"maximum_amount\":{\"value\":\"60\",\"currency_code\":\"USD\"}},\"website\":\"https:\\/\\/nameless.io\"," + + "\"average_monthly_volume\":{\"minimum_amount\":{\"value\":\"50\",\"currency_code\":\"USD\"}," + + "\"maximum_amount\":{\"value\":\"60\",\"currency_code\":\"USD\"}}}" + + var index = 0 + for (jsonChar, genChar) in zip(json, generated) { + if jsonChar == genChar { index += 1; continue } + XCTAssertEqual(jsonChar, genChar, "values don't match. Failure starts at index \(index)") + break + } + + XCTAssertEqual(generated, json) + } + + func testDecoding()throws { + let decoder = JSONDecoder() + let json = """ + { + "sales_venues": [], + "revenue_from_online_sales": { + "maximum_percent": 1, + "minimum_percent": 0 + }, + "average_price": { + "minimum_amount": { + "value": "50", + "currency_code": "USD" + }, + "maximum_amount": { + "value": "60", + "currency_code": "USD" + } + }, + "website": "https://nameless.io", + "average_monthly_volume": { + "minimum_amount": { + "value": "50", + "currency_code": "USD" + }, + "maximum_amount": { + "value": "60", + "currency_code": "USD" + } + } + } + """.data(using: .utf8)! + + + let sales = try Business.Sales( + price: MoneyRange(50...60, currency: .usd), + volume: MoneyRange(50...60, currency: .usd), + venues: [], + website: .init("https://nameless.io"), + online: PercentRange(0...1) + ) + try XCTAssertEqual(sales, decoder.decode(Business.Sales.self, from: json)) + } + + public static var allTests: [(String, (BusinessSalesTests) -> ()throws -> ())] = [ + ("testInit", testInit), + ("testValueValidation", testValueValidation), + ("testEncoding", testEncoding), + ("testDecoding", testDecoding) + ] +} + + From 57e8c6525ce0f21510d73c17d38de897074965c4 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 09:45:24 -0600 Subject: [PATCH 022/160] PayPal expects Business.Sales.price and .volume currency keys to be 'currency_code' --- Sources/PayPal/Models/Business/BusinessSales.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/PayPal/Models/Business/BusinessSales.swift b/Sources/PayPal/Models/Business/BusinessSales.swift index 864d9730..e89c0c2a 100644 --- a/Sources/PayPal/Models/Business/BusinessSales.swift +++ b/Sources/PayPal/Models/Business/BusinessSales.swift @@ -6,10 +6,10 @@ extension Business { public struct Sales: Content, Equatable { /// The average transaction price. - public var price: MoneyRange? + public var price: MoneyRange? /// The average volume of monthly sales. - public var volume: MoneyRange? + public var volume: MoneyRange? /// An array of sales venues for the business. public var venues: [SalesVenue]? @@ -32,8 +32,8 @@ extension Business { /// - website: The primary URL of the business. /// - online: The percentage of revenue attributable to online sales. public init( - price: MoneyRange?, - volume: MoneyRange?, + price: MoneyRange?, + volume: MoneyRange?, venues: [SalesVenue]?, website: Failable>, online: PercentRange? From 444e46a85b435fe9b88daf31eb90b654e600ff1d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 10:53:15 -0600 Subject: [PATCH 023/160] Updated tests for handling of timeless and ISO8601 dates --- Sources/PayPal/Models/Payer/PaymentPayerInfo.swift | 2 +- Sources/PayPal/Models/TimelessDate.swift | 2 ++ .../ActivityTests/ActivityResponseTests.swift | 8 ++++---- Tests/ModelTests/ActivityTests/ActivityTests.swift | 6 +++--- Tests/ModelTests/OrderTests/OrderTests.swift | 12 +++++++----- .../StakeholderTests/StakeholderTests.swift | 6 ++---- Tests/ModelTests/TimelessDateTests.swift | 10 +++++----- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift b/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift index 391fbdab..1493565e 100644 --- a/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift +++ b/Sources/PayPal/Models/Payer/PaymentPayerInfo.swift @@ -71,7 +71,7 @@ extension Order.Payer { self.payer = nil self.email = email - self.birthdate = TimelessDate(birthdate) + self.birthdate = birthdate.map(TimelessDate.init) self.tax = tax self.taxType = taxType self.country = country diff --git a/Sources/PayPal/Models/TimelessDate.swift b/Sources/PayPal/Models/TimelessDate.swift index b27d3f0d..ae29aeca 100644 --- a/Sources/PayPal/Models/TimelessDate.swift +++ b/Sources/PayPal/Models/TimelessDate.swift @@ -65,6 +65,8 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { let date = Date(timeIntervalSince1970: timestamp) let raw = TimelessDate.formatter.string(from: date) try container.encode(raw) + } else { + try container.encodeNil() } } } diff --git a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift index 53dc30ef..521ba52c 100644 --- a/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityResponseTests.swift @@ -6,7 +6,7 @@ public final class ActivityResponseTests: XCTestCase { let response = Activity.Response(items: [ Activity( id: "94C67654-A41B-4421-B0D0-81E6CD587CDB", - timeCreated: Date(iso8601: "2018-07-12T14:14:56Z")!, + timeCreated: Date(iso8601: "2018-07-12T14:14:56.000Z")!, type: .payment, subtype: nil, status: .pending, @@ -34,7 +34,7 @@ public final class ActivityResponseTests: XCTestCase { XCTAssertEqual(response.items, [ Activity( id: "94C67654-A41B-4421-B0D0-81E6CD587CDB", - timeCreated: Date(iso8601: "2018-07-12T14:14:56Z")!, + timeCreated: Date(iso8601: "2018-07-12T14:14:56.000Z")!, type: .payment, subtype: nil, status: .pending, @@ -63,7 +63,7 @@ public final class ActivityResponseTests: XCTestCase { let generated = try String(data: encoder.encode(self.response), encoding: .utf8)! let json = - "{\"items\":[{\"status\":\"PENDING\",\"id\":\"94C67654-A41B-4421-B0D0-81E6CD587CDB\",\"time_created\":\"2018-07-12T14:14:56Z\"," + + "{\"items\":[{\"status\":\"PENDING\",\"id\":\"94C67654-A41B-4421-B0D0-81E6CD587CDB\",\"time_created\":\"2018-07-12T14:14:56.000Z\"," + "\"activity_type\":\"PAYMENT\",\"gross\":{\"value\":\"19.45\",\"currency_code\":\"USD\"}," + "\"counterparty\":{\"email\":\"54north@exmaple.com\",\"name\":\"Jonathan Futher\",\"phone_number\":\"314-159-2653\"}," + "\"net\":{\"value\":\"19.45\",\"currency_code\":\"USD\"}}],\"links\":" + @@ -90,7 +90,7 @@ public final class ActivityResponseTests: XCTestCase { "items": [ { "id": "94C67654-A41B-4421-B0D0-81E6CD587CDB", - "time_created": "2018-07-12T14:14:56Z", + "time_created": "2018-07-12T14:14:56.000Z", "activity_type": "PAYMENT", "status": "PENDING", "counterparty": { diff --git a/Tests/ModelTests/ActivityTests/ActivityTests.swift b/Tests/ModelTests/ActivityTests/ActivityTests.swift index d57fe927..39d371be 100644 --- a/Tests/ModelTests/ActivityTests/ActivityTests.swift +++ b/Tests/ModelTests/ActivityTests/ActivityTests.swift @@ -4,7 +4,7 @@ import XCTest public final class ActivityTests: XCTestCase { let activity = Activity( id: "94C67654-A41B-4421-B0D0-81E6CD587CDB", - timeCreated: Date(iso8601: "2018-07-12T14:14:56Z")!, + timeCreated: Date(iso8601: "2018-07-12T14:14:56.000Z")!, type: .payment, subtype: nil, status: .pending, @@ -32,7 +32,7 @@ public final class ActivityTests: XCTestCase { let generated = try String(data: encoder.encode(self.activity), encoding: .utf8)! let json = - "{\"status\":\"PENDING\",\"id\":\"94C67654-A41B-4421-B0D0-81E6CD587CDB\",\"time_created\":\"2018-07-12T14:14:56Z\"," + + "{\"status\":\"PENDING\",\"id\":\"94C67654-A41B-4421-B0D0-81E6CD587CDB\",\"time_created\":\"2018-07-12T14:14:56.000Z\"," + "\"activity_type\":\"PAYMENT\",\"gross\":{\"value\":\"19.45\",\"currency_code\":\"USD\"}," + "\"counterparty\":{\"email\":\"54north@exmaple.com\",\"name\":\"Jonathan Futher\",\"phone_number\":\"314-159-2653\"}," + "\"net\":{\"value\":\"19.45\",\"currency_code\":\"USD\"}}" @@ -51,7 +51,7 @@ public final class ActivityTests: XCTestCase { let ext = """ { "id": "94C67654-A41B-4421-B0D0-81E6CD587CDB", - "time_created": "2018-07-12T14:14:56Z", + "time_created": "2018-07-12T14:14:56.000Z", "activity_type": "PAYMENT", "status": "PENDING", "counterparty": { diff --git a/Tests/ModelTests/OrderTests/OrderTests.swift b/Tests/ModelTests/OrderTests/OrderTests.swift index 393c26e5..4455a68d 100644 --- a/Tests/ModelTests/OrderTests/OrderTests.swift +++ b/Tests/ModelTests/OrderTests/OrderTests.swift @@ -36,7 +36,9 @@ public final class OrderTests: XCTestCase { let generated = try String(data: encoder.encode(order), encoding: .utf8)! let json = - "{\"intent\":\"SALE\",\"redirect_urls\":{},\"payment_details\":{},\"purchase_units\":[],\"metadata\":{\"supplementary_data\":[]},\"application_context\":{},\"gross_total_amount\":{\"currency\":\"USD\",\"value\":\"150.78\"}}" + "{\"intent\":\"SALE\",\"redirect_urls\":{},\"payment_details\":{},\"purchase_units\":[]," + + "\"metadata\":{\"supplementary_data\":[]},\"application_context\":{}," + + "\"gross_total_amount\":{\"currency\":\"USD\",\"value\":\"150.78\"}}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -66,8 +68,8 @@ public final class OrderTests: XCTestCase { "purchase_units": [], "intent": "SALE", "status": "CREATED", - "create_time": "2018-09-20T13:17:47+0000", - "update_time": "2018-09-20T13:18:03+0000", + "create_time": "2018-09-20T13:17:47.000Z", + "update_time": "2018-09-20T13:18:03.000Z", "links": [] } """.data(using: .utf8)! @@ -80,8 +82,8 @@ public final class OrderTests: XCTestCase { XCTAssertEqual(order.metadata, Order.Metadata(data: [:])) XCTAssertEqual(order.redirects, Redirects(return: nil, cancel: nil)) XCTAssertEqual(order.status, .created) - XCTAssertEqual(order.created, Date(iso8601: "2018-09-20T13:17:47+0000")) - XCTAssertEqual(order.updated, Date(iso8601: "2018-09-20T13:18:03+0000")) + XCTAssertEqual(order.created, Date(iso8601: "2018-09-20T13:17:47.000Z")) + XCTAssertEqual(order.updated, Date(iso8601: "2018-09-20T13:18:03.000Z")) XCTAssertEqual(order.links, []) XCTAssertEqual(order.total, CurrencyAmount(currency: .usd, value: 150.78)) XCTAssertEqual(order.context, AppContext()) diff --git a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift index 7ab90d39..22045672 100644 --- a/Tests/ModelTests/StakeholderTests/StakeholderTests.swift +++ b/Tests/ModelTests/StakeholderTests/StakeholderTests.swift @@ -39,7 +39,7 @@ public final class StakeholderTests: XCTestCase { ) let generated = try String(data: encoder.encode(holder), encoding: .utf8)! let json = - "{\"phones\":[],\"country_code_of_nationality\":\"US\",\"date_of_birth\":{\"date_no_time\":\"2000-06-18\"},\"addresses\":[]," + + "{\"phones\":[],\"country_code_of_nationality\":\"US\",\"date_of_birth\":\"2000-06-18\",\"addresses\":[]," + "\"identifications\":[],\"type\":\"PARTNER\",\"name\":{},\"place_of_birth\":{\"country_code\":\"US\",\"city\":\"Boston\"}}" var index = 0 @@ -64,9 +64,7 @@ public final class StakeholderTests: XCTestCase { "phones": [], "addresses": [], "name": {}, - "date_of_birth": { - "date_no_time": "2000-06-18" - }, + "date_of_birth": "2000-06-18", "country_code_of_nationality": "US", "type": "PARTNER" } diff --git a/Tests/ModelTests/TimelessDateTests.swift b/Tests/ModelTests/TimelessDateTests.swift index 3797aaaa..eb020b7d 100644 --- a/Tests/ModelTests/TimelessDateTests.swift +++ b/Tests/ModelTests/TimelessDateTests.swift @@ -14,10 +14,10 @@ public final class TimelessDateTests: XCTestCase { func testEncoding()throws { let encoder = JSONEncoder() - let date = TimelessDate(date: "2001-02-04")! + let date = ["date": TimelessDate(date: "2001-02-04")!] let generated = try String(data: encoder.encode(date), encoding: .utf8) - let json = "{\"date_no_time\":\"2001-02-04\"}" + let json = "{\"date\":\"2001-02-04\"}" XCTAssertEqual(generated, json) } @@ -27,12 +27,12 @@ public final class TimelessDateTests: XCTestCase { let json = """ { - "date_no_time": "2001-02-04" + "date": "2001-02-04" } """ - let date = TimelessDate(date: "2001-02-04")! - try XCTAssertEqual(date, decoder.decode(TimelessDate.self, from: json)) + let date = ["date": TimelessDate(date: "2001-02-04")!] + try XCTAssertEqual(date, decoder.decode([String: TimelessDate].self, from: json)) } public static var allTests: [(String, (TimelessDateTests) -> ()throws -> ())] = [ From 92399d6c55c874a5e1261244103f9e94ee5d7849 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 10:56:14 -0600 Subject: [PATCH 024/160] Remove padding 0 from currency values PayPal returns validation error responses if the currency values have 0 padding in the decimal --- Sources/PayPal/Models/Money/Amount.swift | 2 +- .../CustomerDiputesTests.swift | 51 ++++++++++--------- Tests/ModelTests/BalanceResponseTests.swift | 4 +- .../BillingTests/BillingPlanListTests.swift | 4 +- .../BillingTests/BillingPlanTests.swift | 6 +-- .../CaptureTests/CaptureTests.swift | 4 +- .../DetailedTests/DetailTests.swift | 4 +- .../DisputeTests/AcceptDisputeTests.swift | 6 +-- .../DisputeTests/DisputeResolutionOffer.swift | 2 +- .../InvoiceTests/InvoiceItemTests.swift | 2 +- .../InvoiceTests/InvoicePaymentTests.swift | 4 +- .../InvoiceTests/InvoiceTests.swift | 8 +-- .../MerchantPreferancesTests.swift | 2 +- .../MoneyTests/MoneyRangeTests.swift | 4 +- Tests/ModelTests/MoneyTests/MoneyTests.swift | 4 +- .../OrderTests/OrderUnitTests.swift | 4 +- .../PaymentTests/PaymentDetailTests.swift | 4 +- .../PaymentRefundResultTests.swift | 8 +-- .../RefundTests/RefundDetailTests.swift | 4 +- .../RelatedResourceSaleTests.swift | 4 +- .../RelatedResourceTests.swift | 5 +- Tests/ModelTests/SaleTests/SaleTests.swift | 12 ++--- .../ShippingTests/ShippingCostsTests.swift | 6 +-- .../TemplateTests/TemplateDataTests.swift | 8 +-- .../TransactionTests/TransactionTests.swift | 10 ++-- Tests/PayPalTests/XCTestManifests.swift | 1 + 26 files changed, 88 insertions(+), 85 deletions(-) diff --git a/Sources/PayPal/Models/Money/Amount.swift b/Sources/PayPal/Models/Money/Amount.swift index 4dfa5cf7..dcfa46bf 100644 --- a/Sources/PayPal/Models/Money/Amount.swift +++ b/Sources/PayPal/Models/Money/Amount.swift @@ -120,6 +120,6 @@ public struct AmountType: Content, Amount, Equatable where Key: AmountCodin } try container.encode(self.currency, forKey: .currency) - try container.encode(self.currency.string(for: self.value), forKey: .value) + try container.encode(rounded.description, forKey: .value) } } diff --git a/Tests/ControllerTests/CustomerDiputesTests.swift b/Tests/ControllerTests/CustomerDiputesTests.swift index b426c7f2..bcfcfebe 100644 --- a/Tests/ControllerTests/CustomerDiputesTests.swift +++ b/Tests/ControllerTests/CustomerDiputesTests.swift @@ -16,35 +16,45 @@ public final class CustomerDisputesTests: XCTestCase { try! services.register(PayPalProvider()) app = try! Application.testable(services: services) - - let disputes = try! self.app.make(CustomerDisputes.self) - let list = try! disputes.list().wait() - self.id = list.items?.filter { $0.status != .resolved }.first?.id } func testServiceExists()throws { _ = try app.make(CustomerDisputes.self) } - func testListEndpoint()throws { + func testEndpoints()throws { + try self.listEndpoint() + try self.detailsEndpoint() + +// try self.appealEndpoint() +// try self.evidenceEndpoint() +// try self.escalateEndpoint() +// try self.offerEndpoint() +// try self.updateStatusEndpoint() +// try self.messageEndpoint() +// try self.acceptEndpoint() +// try self.settleEndpoint() + } + + func listEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) let list = try disputes.list().wait() + self.id = list.items?.filter { $0.status != .resolved }.first?.id XCTAssertGreaterThan(list.items?.count ?? 0, 0) } - func testDetailsEndpoint()throws { + func detailsEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") } let details = try disputes.details(for: id).wait() - XCTAssertEqual(details.id, id) } - func testAcceptEndpoint()throws { + func acceptEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -63,7 +73,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testSettleEndpoint()throws { + func settleEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -75,7 +85,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testAppealEndpoint()throws { + func appealEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -101,7 +111,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testEscalateEndpoint()throws { + func escalateEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -113,7 +123,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testOfferEndpoint()throws { + func offerEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -132,7 +142,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testEvidenceEndpoint()throws { + func evidenceEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -157,7 +167,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testUpdateStatusEndpoint()throws { + func updateStatusEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -169,7 +179,7 @@ public final class CustomerDisputesTests: XCTestCase { XCTAssertEqual(links.first?.href, "https://api.sandbox.paypal.com/v1/customer/disputes/" + id) } - func testMessageEndpoint()throws { + func messageEndpoint()throws { let disputes = try self.app.make(CustomerDisputes.self) guard let id = self.id else { throw Abort(.internalServerError, reason: "Cannot get dispute ID") @@ -211,15 +221,6 @@ public final class CustomerDisputesTests: XCTestCase { public static var allTests: [(String, (CustomerDisputesTests) -> ()throws -> ())] = [ ("testServiceExists", testServiceExists), - ("testListEndpoint", testListEndpoint), - ("testDetailsEndpoint", testDetailsEndpoint), - ("testAcceptEndpoint", testAcceptEndpoint), - ("testSettleEndpoint", testSettleEndpoint), - ("testAppealEndpoint", testAppealEndpoint), - ("testEscalateEndpoint", testEscalateEndpoint), - ("testOfferEndpoint", testOfferEndpoint), - ("testEvidenceEndpoint", testEvidenceEndpoint), - ("testUpdateStatusEndpoint", testUpdateStatusEndpoint), - ("testMessageEndpoint", testMessageEndpoint) + ("testEndpoints", testEndpoints) ] } diff --git a/Tests/ModelTests/BalanceResponseTests.swift b/Tests/ModelTests/BalanceResponseTests.swift index 431900e8..a4de59ad 100644 --- a/Tests/ModelTests/BalanceResponseTests.swift +++ b/Tests/ModelTests/BalanceResponseTests.swift @@ -9,13 +9,13 @@ public final class BalanceResponseTests: XCTestCase { "available_balances": [ { "currency_code": "USD", - "value": "1000000.00" + "value": "1000000" } ], "pending_balances": [ { "currency_code": "USD", - "value": "5000.00" + "value": "5000" } ] } diff --git a/Tests/ModelTests/BillingTests/BillingPlanListTests.swift b/Tests/ModelTests/BillingTests/BillingPlanListTests.swift index e3fbb66a..cded2c21 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanListTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanListTests.swift @@ -67,7 +67,7 @@ public final class BillingPlanListTests: XCTestCase { ]) let generated = try String(data: encoder.encode(list), encoding: .utf8)! let json = - "{\"plans\":[{\"payment_definitions\":[{\"frequency\":\"MONTH\",\"amount\":{\"currency\":\"USD\",\"value\":\"10.00\"}," + + "{\"plans\":[{\"payment_definitions\":[{\"frequency\":\"MONTH\",\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}," + "\"frequency_interval\":\"1\",\"cycles\":\"0\",\"name\":\"Water Charge\",\"type\":\"REGULAR\"}],\"name\":\"Monthly Water\"," + "\"type\":\"INFINITE\",\"description\":\"Your water payment\"}],\"total_items\":\"1\"}" @@ -94,7 +94,7 @@ public final class BillingPlanListTests: XCTestCase { { "cycles": "0", "amount": { - "value": "10.00", + "value": "10", "currency": "USD" }, "frequency_interval": "1", diff --git a/Tests/ModelTests/BillingTests/BillingPlanTests.swift b/Tests/ModelTests/BillingTests/BillingPlanTests.swift index b36f5f28..68a35f57 100644 --- a/Tests/ModelTests/BillingTests/BillingPlanTests.swift +++ b/Tests/ModelTests/BillingTests/BillingPlanTests.swift @@ -95,9 +95,9 @@ public final class BillingPlanTests: XCTestCase { ) let generated = try String(data: encoder.encode(plan), encoding: .utf8)! let json = - "{\"payment_definitions\":[{\"frequency\":\"MONTH\",\"amount\":{\"currency\":\"USD\",\"value\":\"10.00\"},\"frequency_interval\":\"1\"," + - "\"cycles\":\"0\",\"name\":\"Water Charge\",\"type\":\"REGULAR\"}],\"name\":\"Monthly Water\",\"type\":\"INFINITE\"," + - "\"description\":\"Your water payment\"}" + "{\"payment_definitions\":[{\"frequency\":\"MONTH\",\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}," + + "\"frequency_interval\":\"1\",\"cycles\":\"0\",\"name\":\"Water Charge\",\"type\":\"REGULAR\"}]," + + "\"name\":\"Monthly Water\",\"type\":\"INFINITE\",\"description\":\"Your water payment\"}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { diff --git a/Tests/ModelTests/CaptureTests/CaptureTests.swift b/Tests/ModelTests/CaptureTests/CaptureTests.swift index 493ef9c3..f761cfa2 100644 --- a/Tests/ModelTests/CaptureTests/CaptureTests.swift +++ b/Tests/ModelTests/CaptureTests/CaptureTests.swift @@ -23,7 +23,7 @@ public final class CaptureTests: XCTestCase { transaction: CurrencyAmount(currency: .usd, value: 1.00) ) let generated = try String(data: encoder.encode(capture), encoding: .utf8) - let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"10.00\"},\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"1.00\"}}" + let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"10.00\"},\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"1\"}}" XCTAssertEqual(generated, json) } @@ -42,7 +42,7 @@ public final class CaptureTests: XCTestCase { "currency": "USD" }, "transaction_fee": { - "value": "1.00", + "value": "1", "currency": "USD" } } diff --git a/Tests/ModelTests/DetailedTests/DetailTests.swift b/Tests/ModelTests/DetailedTests/DetailTests.swift index c459e8d7..5fd953bc 100644 --- a/Tests/ModelTests/DetailedTests/DetailTests.swift +++ b/Tests/ModelTests/DetailedTests/DetailTests.swift @@ -48,7 +48,7 @@ public final class DetailTests: XCTestCase { let json = "{\"final_payment_date\":\"\(later)\",\"last_payment_date\":\"\(now)\",\"failed_payment_count\":\"5\"," + "\"cycles_remaining\":\"30\",\"cycles_completed\":\"45\",\"last_payment_amount\":{\"value\":\"19.97\",\"currency_code\":\"USD\"}," + - "\"outstanding_balance\":{\"value\":\"599.00\",\"currency_code\":\"USD\"},\"next_billing_date\":\"\(oneYear)\"}" + "\"outstanding_balance\":{\"value\":\"599\",\"currency_code\":\"USD\"},\"next_billing_date\":\"\(oneYear)\"}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -68,7 +68,7 @@ public final class DetailTests: XCTestCase { { "outstanding_balance": { "currency_code": "USD", - "value": "599.00" + "value": "599" }, "cycles_remaining": "30", "cycles_completed": "45", diff --git a/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift b/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift index d93980fa..9b614a05 100644 --- a/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift +++ b/Tests/ModelTests/DisputeTests/AcceptDisputeTests.swift @@ -53,7 +53,7 @@ public final class AcceptDisputeTests: XCTestCase { let generated = try String(data: encoder.encode(body), encoding: .utf8)! let json = "{\"accept_claim_reason\":\"COMPANY_POLICY\",\"invoice_id\":\"3EC9D031-0DBF-446F-ABC0-31B4A6E0D2B5\"," + - "\"note\":\"Refund to customer\",\"refund_amount\":{\"value\":\"55.50\",\"currency_code\":\"USD\"}}" + "\"note\":\"Refund to customer\",\"refund_amount\":{\"value\":\"55.5\",\"currency_code\":\"USD\"}}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -77,7 +77,7 @@ public final class AcceptDisputeTests: XCTestCase { let valid = """ { "refund_amount": { - "value": "55.50", + "value": "55.5", "currency_code": "USD" }, "invoice_id": "3EC9D031-0DBF-446F-ABC0-31B4A6E0D2B5", @@ -88,7 +88,7 @@ public final class AcceptDisputeTests: XCTestCase { let noteFail = """ { "refund_amount": { - "value": "55.50", + "value": "55.5", "currency_code": "USD" }, "invoice_id": "3EC9D031-0DBF-446F-ABC0-31B4A6E0D2B5", diff --git a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift index 306a268a..700cbb41 100644 --- a/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift +++ b/Tests/ModelTests/DisputeTests/DisputeResolutionOffer.swift @@ -60,7 +60,7 @@ public final class DisputeResolutionOfferTests: XCTestCase { ) let generated = try String(data: encoder.encode(offer), encoding: .utf8)! let json = - "{\"offer_type\":\"REFUND_WITH_REPLACEMENT\",\"offer_amount\":{\"value\":\"23.00\",\"currency_code\":\"USD\"},\"note\":\"Notable note.\"}" + "{\"offer_type\":\"REFUND_WITH_REPLACEMENT\",\"offer_amount\":{\"value\":\"23\",\"currency_code\":\"USD\"},\"note\":\"Notable note.\"}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { diff --git a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift index f0240105..b8097cd4 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceItemTests.swift @@ -109,7 +109,7 @@ public final class InvoiceItemTests: XCTestCase { ) let generated = try String(data: encoder.encode(item), encoding: .utf8)! let json = - "{\"quantity\":3,\"unit_price\":{\"currency\":\"USD\",\"value\":\"50.00\"},\"unit_of_measure\":\"QUANTITY\",\"name\":\"Widget\"," + + "{\"quantity\":3,\"unit_price\":{\"currency\":\"USD\",\"value\":\"50\"},\"unit_of_measure\":\"QUANTITY\",\"name\":\"Widget\"," + "\"description\":\"Round and white, like a ping-pong ball\",\"date\":\"\(self.now.iso8601)\"}" var index = 0 diff --git a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift index f5f2f046..ce6a47bf 100644 --- a/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoicePaymentTests.swift @@ -18,7 +18,7 @@ public final class InvoicePaymentTests: XCTestCase { let payment = Invoice.Payment(method: .cash, amount: CurrencyAmount(currency: .usd, value: 20.00), date: self.now, note: "I got the payment by cash!") let generated = try String(data: encoder.encode(payment), encoding: .utf8)! let json = - "{\"amount\":{\"currency\":\"USD\",\"value\":\"20.00\"},\"method\":\"CASH\",\"note\":\"I got the payment by cash!\"," + + "{\"amount\":{\"currency\":\"USD\",\"value\":\"20\"},\"method\":\"CASH\",\"note\":\"I got the payment by cash!\"," + "\"date\":\"\(self.now.iso8601)\"}" var index = 0 @@ -40,7 +40,7 @@ public final class InvoicePaymentTests: XCTestCase { "method": "CASH", "amount": { "currency": "USD", - "value": "20.00" + "value": "20" }, "date": "\(self.now.iso8601)", "note": "I got the payment by cash!" diff --git a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift index 8219c1f7..cdafa108 100644 --- a/Tests/ModelTests/InvoiceTests/InvoiceTests.swift +++ b/Tests/ModelTests/InvoiceTests/InvoiceTests.swift @@ -192,10 +192,10 @@ public final class InvoiceTests: XCTestCase { "{\"tax_calculated_after_discount\":true,\"invoice_date\":\"\(now.iso8601)\"," + "\"logo_url\":\"https:\\/\\/vapor.codes\\/dist\\/e032390c38279fbdf18ebf0e763eb44f.png\"," + "\"note\":\"Thanks for your donation!\",\"billing_info\":[],\"allow_partial_payment\":false,\"template_id\":\"PayPal system template\"," + - "\"minimum_amount_due\":{\"currency\":\"USD\",\"value\":\"1.00\"},\"merchant_info\":{\"email\":\"hello@vapor.codes\"" + + "\"minimum_amount_due\":{\"currency\":\"USD\",\"value\":\"1\"},\"merchant_info\":{\"email\":\"hello@vapor.codes\"" + ",\"last_name\":\"Nelson\",\"website\":\"https:\\/\\/vapor.codes\\/\",\"business_name\":\"Qutheory LLC.\",\"first_name\":\"Tanner\"}," + "\"cc_info\":[{\"email\":\"collective@vapor.codes\"},{\"email\":\"donator@example.com\"}],\"payment_term\":{" + - "\"due_date\":\"\(self.dueStr)\",\"term_type\":\"DUE_ON_RECEIPT\"},\"custom\":{\"amount\":{\"currency\":\"USD\",\"value\":\"10.00\"}}," + + "\"due_date\":\"\(self.dueStr)\",\"term_type\":\"DUE_ON_RECEIPT\"},\"custom\":{\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}}," + "\"allow_tip\":true,\"reference\":\"PO number\",\"tax_inclusive\":true,\"merchant_memo\":\"Open Collective donation\"}" print(json.count) var index = 0 @@ -221,7 +221,7 @@ public final class InvoiceTests: XCTestCase { "allow_partial_payment": false, "template_id": "PayPal system template", "minimum_amount_due": { - "value": "1.00", + "value": "1", "currency": "USD" }, "merchant_info": { @@ -245,7 +245,7 @@ public final class InvoiceTests: XCTestCase { }, "custom": { "amount": { - "value": "10.00", + "value": "10", "currency": "USD" } }, diff --git a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift index e1e16cea..36c2ac09 100644 --- a/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift +++ b/Tests/ModelTests/MerchantTests/MerchantPreferancesTests.swift @@ -40,7 +40,7 @@ public final class MerchantPreferancesTests: XCTestCase { let json = "{\"max_fail_attempts\":\"0\",\"char_set\":\"UTF-8\",\"initial_fail_amount_action\":\"CONTINUE\"," + "\"cancel_url\":\"https:\\/\\/example.com\\/agreements\",\"return_url\":\"https:\\/\\/example.com\\/agreements\\/latest\"," + - "\"setup_fee\":{\"value\":\"0.00\",\"currency_code\":\"USD\"},\"auto_bill_amount\":\"YES\"}" + "\"setup_fee\":{\"value\":\"0\",\"currency_code\":\"USD\"},\"auto_bill_amount\":\"YES\"}" // JSON is 434 characters long. var index = 0 diff --git a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift index 1cf2c818..eb51b81c 100644 --- a/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyRangeTests.swift @@ -17,7 +17,7 @@ public final class MoneyRangeTests: XCTestCase { let range = MoneyRange(min: CurrencyCodeAmount(currency: .usd, value: 12.25), max: CurrencyCodeAmount(currency: .usd, value: 50.00)) let generated = try String(data: encoder.encode(range), encoding: .utf8) let json = - "{\"minimum_amount\":{\"value\":\"12.25\",\"currency_code\":\"USD\"},\"maximum_amount\":{\"value\":\"50.00\",\"currency_code\":\"USD\"}}" + "{\"minimum_amount\":{\"value\":\"12.25\",\"currency_code\":\"USD\"},\"maximum_amount\":{\"value\":\"50\",\"currency_code\":\"USD\"}}" XCTAssertEqual(json, generated) } @@ -27,7 +27,7 @@ public final class MoneyRangeTests: XCTestCase { let json = """ { "maximum_amount": { - "value": "50.00", + "value": "50", "currency_code": "USD" }, "minimum_amount": { diff --git a/Tests/ModelTests/MoneyTests/MoneyTests.swift b/Tests/ModelTests/MoneyTests/MoneyTests.swift index 82aa2152..a259cfca 100644 --- a/Tests/ModelTests/MoneyTests/MoneyTests.swift +++ b/Tests/ModelTests/MoneyTests/MoneyTests.swift @@ -19,9 +19,9 @@ public final class MoneyTests: XCTestCase { XCTAssertEqual(usd, "{\"value\":\"12.25\",\"currency_code\":\"USD\"}") XCTAssertEqual(xxx, "{\"value\":\"0\",\"currency_code\":\"XXX\"}") - XCTAssertEqual(eur, "{\"value\":\"4.50\",\"currency_code\":\"EUR\"}") + XCTAssertEqual(eur, "{\"value\":\"4.5\",\"currency_code\":\"EUR\"}") - XCTAssertEqual(usdO, "{\"value\":\"0.00\",\"currency_code\":\"USD\"}") + XCTAssertEqual(usdO, "{\"value\":\"0\",\"currency_code\":\"USD\"}") } func testDecoding()throws { diff --git a/Tests/ModelTests/OrderTests/OrderUnitTests.swift b/Tests/ModelTests/OrderTests/OrderUnitTests.swift index 164c6690..975b5d6f 100644 --- a/Tests/ModelTests/OrderTests/OrderUnitTests.swift +++ b/Tests/ModelTests/OrderTests/OrderUnitTests.swift @@ -135,7 +135,7 @@ public final class OrderUnitTests: XCTestCase { "\"invoice_number\":\"B5382984-3B90-4BC4-9F7A-6A6AFA61AC25\",\"metadata\":{\"supplementary_data\":[]},\"payee\":{}," + "\"reference_id\":\"C1C099F2-D7E7-4E19-BBBF-98DD11EA911A\",\"payment_linked_group\":1,\"shipping_address\":{\"country_code\":\"US\"," + "\"line1\":\"1 Infinate Loop\",\"city\":\"Cupertino\",\"postal_code\":\"94024\"},\"custom\":\"C2B9FBFB-B97D-46E4-8553-522C6A25A2FC\"," + - "\"items\":[],\"shipping_method\":\"USPSParcel\",\"partner_fee_details\":{\"amount\":{\"currency\":\"USD\",\"value\":\"2.50\"}," + + "\"items\":[],\"shipping_method\":\"USPSParcel\",\"partner_fee_details\":{\"amount\":{\"currency\":\"USD\",\"value\":\"2.5\"}," + "\"receiver\":{}}}" var index = 0 @@ -194,7 +194,7 @@ public final class OrderUnitTests: XCTestCase { "shipping_method": "USPSParcel", "partner_fee_details": { "amount": { - "value": "2.50", + "value": "2.5", "currency": "USD" }, "receiver": {} diff --git a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift index 9c4d61c2..fa1f99dd 100644 --- a/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentDetailTests.swift @@ -18,7 +18,7 @@ public final class PaymentDetailTests: XCTestCase { let detail = PaymentDetail(date: self.now, method: .cash, note: "Hello World", amount: CurrencyAmount(currency: .usd, value: 4.50)) let generated = try String(data: encoder.encode(detail), encoding: .utf8)! let json = - "{\"amount\":{\"currency\":\"USD\",\"value\":\"4.50\"},\"method\":\"CASH\",\"note\":\"Hello World\",\"date\":\"\(self.now.iso8601)\"}" + "{\"amount\":{\"currency\":\"USD\",\"value\":\"4.5\"},\"method\":\"CASH\",\"note\":\"Hello World\",\"date\":\"\(self.now.iso8601)\"}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -37,7 +37,7 @@ public final class PaymentDetailTests: XCTestCase { { "amount": { "currency": "USD", - "value": "4.50" + "value": "4.5" }, "note": "Hello World", "method": "CASH", diff --git a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift index 2e6deb25..fd3ba225 100644 --- a/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift +++ b/Tests/ModelTests/PaymentTests/PaymentRefundResultTests.swift @@ -9,8 +9,8 @@ public final class PaymentRefundResultTests: XCTestCase { let json = """ { "id": "5CY176817C379973E", - "create_time": "2018-08-15T17:11:32Z", - "update_time": "2018-08-15T17:11:32Z", + "create_time": "2018-08-15T17:11:32.000Z", + "update_time": "2018-08-15T17:11:32.000Z", "state": "completed", "reason": "I don't like it", "amount": { @@ -42,8 +42,8 @@ public final class PaymentRefundResultTests: XCTestCase { var refund = try decoder.decode(Payment.RefundResult.self, from: json) XCTAssertEqual(refund.id, "5CY176817C379973E") - XCTAssertEqual(refund.created, Date(iso8601: "2018-08-15T17:11:32Z")) - XCTAssertEqual(refund.updated, Date(iso8601: "2018-08-15T17:11:32Z")) + XCTAssertEqual(refund.created, Date(iso8601: "2018-08-15T17:11:32.000Z")) + XCTAssertEqual(refund.updated, Date(iso8601: "2018-08-15T17:11:32.000Z")) XCTAssertEqual(refund.state, .completed) XCTAssertEqual(refund.reason, "I don't like it") XCTAssertEqual(refund.sale, "2MU78835H4515710F") diff --git a/Tests/ModelTests/RefundTests/RefundDetailTests.swift b/Tests/ModelTests/RefundTests/RefundDetailTests.swift index 45e3e674..f6f05595 100644 --- a/Tests/ModelTests/RefundTests/RefundDetailTests.swift +++ b/Tests/ModelTests/RefundTests/RefundDetailTests.swift @@ -18,7 +18,7 @@ public final class RefundDetailTests: XCTestCase { let encoder = JSONEncoder() let detail = RefundDetail(date: self.now, note: "Hello World", amount: CurrencyAmount(currency: .usd, value: 4.50)) let generated = try String(data: encoder.encode(detail), encoding: .utf8)! - let json = "{\"date\":\"\(self.now.iso8601)\",\"amount\":{\"currency\":\"USD\",\"value\":\"4.50\"},\"note\":\"Hello World\"}" + let json = "{\"date\":\"\(self.now.iso8601)\",\"amount\":{\"currency\":\"USD\",\"value\":\"4.5\"},\"note\":\"Hello World\"}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -37,7 +37,7 @@ public final class RefundDetailTests: XCTestCase { { "amount": { "currency": "USD", - "value": "4.50" + "value": "4.5" }, "note": "Hello World", "date": "\(self.now.iso8601)" diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift index 8630c310..822434cd 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceSaleTests.swift @@ -46,7 +46,7 @@ public final class RelatedResourceSaleTests: XCTestCase { ) let generated = try String(data: encoder.encode(sale), encoding: .utf8)! - let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"42.31\"},\"id\":\"9FF17892-49F8-47C9-8117-7662F889DAEA\",\"exchange_rate\":\"0.0\",\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"0.31\"},\"receivable_amount\":{\"currency\":\"USD\",\"value\":\"42.00\"},\"fmf_details\":{\"filter_id\":\"BILLING_OR_SHIPPING_ADDRESS_MISMATCH\",\"name\":\"Name\",\"description\":\"Desc.\",\"filter_type\":\"DENY\"},\"create_time\":\"\(self.now.iso8601)\",\"parent_payment\":\"E7FBF930-B0F3-4514-B1DD-810BDCD6541F\",\"state\":\"pending\",\"processor_response\":{\"avs_code\":\"e\",\"response_code\":\"6399\",\"advice_code\":\"01_NEW_ACCOUNT_INFORMATION\",\"cvv_code\":\"h\",\"eci_submitted\":\"152823\",\"vpas\":\"stat\"}}" + let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"42.31\"},\"id\":\"9FF17892-49F8-47C9-8117-7662F889DAEA\",\"exchange_rate\":\"0.0\",\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"0.31\"},\"receivable_amount\":{\"currency\":\"USD\",\"value\":\"42\"},\"fmf_details\":{\"filter_id\":\"BILLING_OR_SHIPPING_ADDRESS_MISMATCH\",\"name\":\"Name\",\"description\":\"Desc.\",\"filter_type\":\"DENY\"},\"create_time\":\"\(self.now.iso8601)\",\"parent_payment\":\"E7FBF930-B0F3-4514-B1DD-810BDCD6541F\",\"state\":\"pending\",\"processor_response\":{\"avs_code\":\"e\",\"response_code\":\"6399\",\"advice_code\":\"01_NEW_ACCOUNT_INFORMATION\",\"cvv_code\":\"h\",\"eci_submitted\":\"152823\",\"vpas\":\"stat\"}}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -85,7 +85,7 @@ public final class RelatedResourceSaleTests: XCTestCase { }, "receivable_amount": { "currency": "USD", - "value": "42.00" + "value": "42" }, "exchange_rate": "0.0", "fmf_details": { diff --git a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift index e63c5985..b0e0369e 100644 --- a/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift +++ b/Tests/ModelTests/RelatedResourceTests/RelatedResourceTests.swift @@ -3,8 +3,9 @@ import XCTest public final class RelatedResourceTests: XCTestCase { func testInit()throws { + let now = Date() let resource = RelatedResource( - sale: .init(id: "", amount: DetailedAmount(currency: .usd, total: 10.0, details: nil), state: .pending, parent: "10"), + sale: .init(id: "", amount: DetailedAmount(currency: .usd, total: 10.0, details: nil), state: .pending, parent: "10", created: now), authorization: .init(amount: DetailedAmount(currency: .usd, total: 10, details: nil), fmf: nil, processor: nil), order: .init(amount: DetailedAmount(currency: .usd, total: 10, details: nil), fmf: nil), capture: .init(amount: nil, isFinal: nil, invoice: nil, transaction: nil, payerNote: nil), @@ -17,7 +18,7 @@ public final class RelatedResourceTests: XCTestCase { XCTAssertEqual(resource.authorization, .init(amount: DetailedAmount(currency: .usd, total: 10, details: nil), fmf: nil, processor: nil)) XCTAssertEqual( resource.sale, - .init(id: "", amount: DetailedAmount(currency: .usd, total: 10, details: nil), state: .pending, parent: "10") + .init(id: "", amount: DetailedAmount(currency: .usd, total: 10, details: nil), state: .pending, parent: "10", created: now) ) } diff --git a/Tests/ModelTests/SaleTests/SaleTests.swift b/Tests/ModelTests/SaleTests/SaleTests.swift index 10a1f529..b973e915 100644 --- a/Tests/ModelTests/SaleTests/SaleTests.swift +++ b/Tests/ModelTests/SaleTests/SaleTests.swift @@ -18,7 +18,7 @@ public final class SaleTests: XCTestCase { let encoder = JSONEncoder() let sale = Sale(amount: DetailedAmount(currency: .usd, total: 10.00, details: nil), transaction: CurrencyAmount(currency: .usd, value: 1.00)) let generated = try String(data: encoder.encode(sale), encoding: .utf8)! - let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"10.00\"},\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"1.00\"}}" + let json = "{\"amount\":{\"currency\":\"USD\",\"total\":\"10.00\"},\"transaction_fee\":{\"currency\":\"USD\",\"value\":\"1\"}}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -41,12 +41,12 @@ public final class SaleTests: XCTestCase { "currency": "USD" }, "transaction_fee": { - "value": "1.00", + "value": "1", "currency": "USD" }, "status": "PENDING", - "create_time": "2018-09-18T21:22:51+0000", - "update_time": "2018-09-18T21:23:25+0000", + "create_time": "2018-09-18T21:22:51.000Z", + "update_time": "2018-09-18T21:23:25.000Z", "links": [] } """.data(using: .utf8)! @@ -55,8 +55,8 @@ public final class SaleTests: XCTestCase { XCTAssertEqual(sale.id, "259CEDEE-4A03-45A0-B088-B6A318544619") XCTAssertEqual(sale.status, .pending) - XCTAssertEqual(sale.created, Date(iso8601: "2018-09-18T21:22:51+0000")) - XCTAssertEqual(sale.updated, Date(iso8601: "2018-09-18T21:23:25+0000")) + XCTAssertEqual(sale.created, Date(iso8601: "2018-09-18T21:22:51.000Z")) + XCTAssertEqual(sale.updated, Date(iso8601: "2018-09-18T21:23:25.000Z")) XCTAssertEqual(sale.links, []) XCTAssertEqual(sale.transaction, CurrencyAmount(currency: .usd, value: 1.00)) XCTAssertEqual(sale.amount, DetailedAmount(currency: .usd, total: 10.00, details: nil)) diff --git a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift index b66f77bd..211bb0ff 100644 --- a/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift +++ b/Tests/ModelTests/ShippingTests/ShippingCostsTests.swift @@ -20,8 +20,8 @@ public final class ShippingCostsTests: XCTestCase { ) let generated = try String(data: encoder.encode(shipping), encoding: .utf8)! let json = - "{\"amount\":{\"currency\":\"USD\",\"value\":\"2.50\"},\"tax\":{\"name\":\"Shipping\",\"percent\":7.5,\"amount\":{\"currency\":\"USD\"," + - "\"value\":\"0.18\"}}}" + "{\"amount\":{\"currency\":\"USD\",\"value\":\"2.5\"},\"tax\":{\"name\":\"Shipping\"," + + "\"percent\":7.5,\"amount\":{\"currency\":\"USD\",\"value\":\"0.18\"}}}" var index = 0 for (jsonChar, genChar) in zip(json, generated) { @@ -51,7 +51,7 @@ public final class ShippingCostsTests: XCTestCase { } }, "amount": { - "value": "2.50", + "value": "2.5", "currency": "USD" } } diff --git a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift index a1edb86e..aaa29824 100644 --- a/Tests/ModelTests/TemplateTests/TemplateDataTests.swift +++ b/Tests/ModelTests/TemplateTests/TemplateDataTests.swift @@ -135,11 +135,11 @@ public final class TemplateDataTests: XCTestCase { let json = "{\"tax_calculated_after_discount\":true,\"logo_url\":\"https:\\/\\/vapor.codes\\/dist\\/e032390c38279fbdf18ebf0e763eb44f.png\"," + "\"note\":\"Thanks for your donation!\",\"billing_info\":[],\"allow_partial_payment\":false," + - "\"minimum_amount_due\":{\"currency\":\"USD\",\"value\":\"1.00\"},\"merchant_info\":{\"email\":\"hello@vapor.codes\"" + + "\"minimum_amount_due\":{\"currency\":\"USD\",\"value\":\"1\"},\"merchant_info\":{\"email\":\"hello@vapor.codes\"" + ",\"last_name\":\"Nelson\",\"website\":\"https:\\/\\/vapor.codes\\/\",\"business_name\":\"Qutheory LLC.\",\"first_name\":\"Tanner\"}," + "\"cc_info\":[{\"email\":\"collective@vapor.codes\"},{\"email\":\"donator@example.com\"}],\"payment_term\":{" + "\"due_date\":\"\(self.timlessNow)\",\"term_type\":\"DUE_ON_RECEIPT\"}," + - "\"custom\":{\"amount\":{\"currency\":\"USD\",\"value\":\"10.00\"}},\"attachments\":[{\"name\":\"photo.jpg\"," + + "\"custom\":{\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}},\"attachments\":[{\"name\":\"photo.jpg\"," + "\"url\":\"https:\\/\\/avatars3.githubusercontent.com\\/u\\/2872298?s=200&v=4\"}],\"reference\":\"PO number\",\"tax_inclusive\":true," + "\"merchant_memo\":\"Open Collective donation\"}" @@ -165,7 +165,7 @@ public final class TemplateDataTests: XCTestCase { "billing_info": [], "allow_partial_payment": false, "minimum_amount_due": { - "value": "1.00", + "value": "1", "currency": "USD" }, "merchant_info": { @@ -189,7 +189,7 @@ public final class TemplateDataTests: XCTestCase { }, "custom": { "amount": { - "value": "10.00", + "value": "10", "currency": "USD" } }, diff --git a/Tests/ModelTests/TransactionTests/TransactionTests.swift b/Tests/ModelTests/TransactionTests/TransactionTests.swift index b8ca6396..0ca9d6a6 100644 --- a/Tests/ModelTests/TransactionTests/TransactionTests.swift +++ b/Tests/ModelTests/TransactionTests/TransactionTests.swift @@ -32,7 +32,7 @@ public final class TransactionTests: XCTestCase { let generated = try String(data: encoder.encode(transaction), encoding: .utf8) let json = "{\"amount\":{\"value\":\"79.25\",\"currency_code\":\"USD\"},\"fee_amount\":{\"value\":\"7.25\",\"currency_code\":\"USD\"}," + - "\"net_amount\":{\"value\":\"72.00\",\"currency_code\":\"USD\"}}" + "\"net_amount\":{\"value\":\"72\",\"currency_code\":\"USD\"}}" XCTAssertEqual(generated, json) } @@ -43,7 +43,7 @@ public final class TransactionTests: XCTestCase { { "net_amount": { "currency_code": "USD", - "value": "72.00" + "value": "72" }, "fee_amount": { "currency_code": "USD", @@ -62,11 +62,11 @@ public final class TransactionTests: XCTestCase { "transaction_type": "Recurring Payment", "payer_email": "3E6F6A01-BB46-440E-B41D-9C2D611041E8", "payer_name": "Skelpo Inc.", - "time_stamp": "2018-07-23T17:24:48Z", + "time_stamp": "2018-07-23T17:24:48.000Z", "time_zone": "CDT", "net_amount": { "currency_code": "USD", - "value": "72.00" + "value": "72" }, "fee_amount": { "currency_code": "USD", @@ -91,7 +91,7 @@ public final class TransactionTests: XCTestCase { XCTAssertEqual(transaction.type, "Recurring Payment") XCTAssertEqual(transaction.email, "3E6F6A01-BB46-440E-B41D-9C2D611041E8") XCTAssertEqual(transaction.name, "Skelpo Inc.") - XCTAssertEqual(transaction.timestamp, Date(iso8601: "2018-07-23T17:24:48Z")!) + XCTAssertEqual(transaction.timestamp, Date(iso8601: "2018-07-23T17:24:48.000Z")!) XCTAssertEqual(transaction.timezone, "CDT") XCTAssertEqual(transaction.amount, CurrencyCodeAmount(currency: .usd, value: 79.25)) XCTAssertEqual(transaction.fee, CurrencyCodeAmount(currency: .usd, value: 7.25)) diff --git a/Tests/PayPalTests/XCTestManifests.swift b/Tests/PayPalTests/XCTestManifests.swift index f0873b95..c3ae9597 100644 --- a/Tests/PayPalTests/XCTestManifests.swift +++ b/Tests/PayPalTests/XCTestManifests.swift @@ -246,6 +246,7 @@ public func allTests() -> [XCTestCaseEntry] { testCase(ProductVettingStatusTests.allCases), testCase(ProductGrantedPermissionTests.allCases), testCase(MerchantInfoTests.allTests), + testCase(BusinessSalesTests.allTests), // Controller Tests testCase(APITests.allTests), From 482d2f5c65a7801c651ff5b4b61874b736fec829 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 11:09:41 -0600 Subject: [PATCH 025/160] Changed Business.disputeEmail property type from a nested email object to a failable string --- Sources/PayPal/Models/Business/Business.swift | 4 ++-- Tests/ModelTests/BusinessTests/BusinessTests.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/PayPal/Models/Business/Business.swift b/Sources/PayPal/Models/Business/Business.swift index f9ff7841..17b6ff2a 100644 --- a/Sources/PayPal/Models/Business/Business.swift +++ b/Sources/PayPal/Models/Business/Business.swift @@ -52,7 +52,7 @@ public struct Business: Content, Equatable { /// The email address to which to send disputes, in [Simple Mail Transfer Protocol](https://www.ietf.org/rfc/rfc5321.txt) as defined in RFC 5321 /// or in [Internet Message Format](https://www.ietf.org/rfc/rfc5322.txt) as defined in RFC 5322. Does not support Unicode email addresses. - public var disputeEmail: EmailAddress? + public var disputeEmail: Failable> /// The details of business sales. public var sales: Sales? @@ -112,7 +112,7 @@ public struct Business: Content, Equatable { merchantCategory: Failable>>, establishedDate: TimelessDate?, registrationDate: TimelessDate?, - disputeEmail: EmailAddress?, + disputeEmail: Failable>, sales: Sales?, customerService: CustomerService?, addresses: [Address], diff --git a/Tests/ModelTests/BusinessTests/BusinessTests.swift b/Tests/ModelTests/BusinessTests/BusinessTests.swift index 926428f1..87510086 100644 --- a/Tests/ModelTests/BusinessTests/BusinessTests.swift +++ b/Tests/ModelTests/BusinessTests/BusinessTests.swift @@ -17,7 +17,7 @@ public final class BusinessTests: XCTestCase { merchantCategory: .init("4653"), establishedDate: TimelessDate(date: "1882-05-13"), registrationDate: TimelessDate(date: "1975-04-22"), - disputeEmail: EmailAddress(email: "disputable@exmaple.com"), + disputeEmail: .init("disputable@exmaple.com"), sales: .init( price: MoneyRange(50...60, currency: .usd), volume: MoneyRange(50...60, currency: .usd), @@ -53,7 +53,7 @@ public final class BusinessTests: XCTestCase { XCTAssertEqual(business.establishment, Establishment(state: .ks, country: .unitedStates)) XCTAssertEqual(business.establishedDate, TimelessDate(date: "1882-05-13")) XCTAssertEqual(business.registrationDate, TimelessDate(date: "1975-04-22")) - try XCTAssertEqual(business.disputeEmail, EmailAddress(email: .init("disputable@exmaple.com"))) + XCTAssertEqual(business.disputeEmail.value, .init("disputable@exmaple.com")) try XCTAssertEqual(business.sales, Business.Sales.init( price: MoneyRange(50...60, currency: .usd), volume: MoneyRange(50...60, currency: .usd), From f7f338122e009c94f3bbf47ea0e319c737d41b8b Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 11:22:13 -0600 Subject: [PATCH 026/160] Updated call to Business initializer in ManagedAccountsTests.testCreateEndpoint test case for API changes --- Tests/ControllerTests/ManagedAccountsTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/ControllerTests/ManagedAccountsTests.swift b/Tests/ControllerTests/ManagedAccountsTests.swift index 5b0a941a..73ef1beb 100644 --- a/Tests/ControllerTests/ManagedAccountsTests.swift +++ b/Tests/ControllerTests/ManagedAccountsTests.swift @@ -42,7 +42,7 @@ public final class ManagedAccountsTests: XCTestCase { ) let business = try Business( type: .individual, - subType: .unselected, + subType: .assoIncorporated, government: GovernmentBody(name: ""), establishment: Establishment(state: .ks, country: .unitedStates), names: [], @@ -53,7 +53,7 @@ public final class ManagedAccountsTests: XCTestCase { merchantCategory: .init("4653"), establishedDate: TimelessDate(date: "1882-05-13"), registrationDate: TimelessDate(date: "2000-04-22"), - disputeEmail: EmailAddress(email: "disputable@exmaple.com"), + disputeEmail: .init("disputable@exmaple.com"), sales: .init( price: MoneyRange(50...60, currency: .usd), volume: MoneyRange(50...60, currency: .usd), @@ -101,7 +101,7 @@ public final class ManagedAccountsTests: XCTestCase { partnerTaxReporting: false, signupOptions: nil, errors: nil, - financialInstruments: FinancialInstruments(instruments: [FinancialInstrument(accountType: .checking)]) + financialInstruments: nil ) let accounts = try self.app.make(ManagedAccounts.self) @@ -152,7 +152,7 @@ public final class ManagedAccountsTests: XCTestCase { merchantCategory: .init("4653"), establishedDate: TimelessDate(date: "1882-05-13"), registrationDate: TimelessDate(date: "1975-04-22"), - disputeEmail: EmailAddress(email: "disputable@exmaple.com"), + disputeEmail: .init("disputable@exmaple.com"), sales: .init( price: MoneyRange(50...60, currency: .usd), volume: MoneyRange(50...60, currency: .usd), From f42795d75be919104e4be67291b3124347c6ed2e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 11:38:23 -0600 Subject: [PATCH 027/160] Documented ISO8601 date code --- Sources/PayPal/Utilities/ISO8601.swift | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Sources/PayPal/Utilities/ISO8601.swift b/Sources/PayPal/Utilities/ISO8601.swift index 2e2c9f3b..7a9154bc 100644 --- a/Sources/PayPal/Utilities/ISO8601.swift +++ b/Sources/PayPal/Utilities/ISO8601.swift @@ -5,6 +5,11 @@ import Foundation extension DateFormatter { /// A formatter for ISO 8601 dates. + /// + /// The date format pattern is `yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX`, so a `Date` instance + /// converted to a string will look something like this: + /// + /// "2019-03-04T11:28:36.000Z" public static let iso8601: DateFormatter = { let formatter = DateFormatter() formatter.calendar = Calendar(identifier: .iso8601) @@ -31,15 +36,29 @@ extension Date { } } +/// A `Date` container that encodes/decodes the instance as an ISO8601 string. public struct ISO8601Date: Codable, Hashable { + + /// The `Date` instance that the `ISO8601Date` instance wraps. public let date: Date + + /// The string that the `date` property was decoded from. public let raw: String? + /// Creates a new `ISO8601Date` instance from a `Date`. + /// + /// - Parameter date: The `Date` instance to wrap. public init(_ date: Date) { self.date = date self.raw = nil } + /// Creates a new `ISOL8601Date` instance from a formatted date string. + /// + /// If a `Date` instance cannnot be created from the string passed in, `nil` will be returned from the initializer. + /// + /// - Parameter string: The string to decode the `Date` from. + /// This is also the value that the `raw` property will be set to. public init?(string: String) { guard let date = Date(iso8601: string) else { return nil @@ -49,6 +68,7 @@ public struct ISO8601Date: Codable, Hashable { self.raw = string } + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). public init(from decoder: Decoder)throws { let decoder = try decoder.singleValueContainer() let raw = try decoder.decode(String.self) @@ -60,11 +80,13 @@ public struct ISO8601Date: Codable, Hashable { self.date = date } + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). public func encode(to encoder: Encoder)throws { var container = encoder.singleValueContainer() try container.encode(self.date.iso8601) } + /// See [`Equatable.==(lhs:rhs:)`](https://developer.apple.com/documentation/swift/equatable/1539854). public static func ==(lhs: ISO8601Date, rhs: ISO8601Date) -> Bool { let lRaw = lhs.raw ?? lhs.date.iso8601 let rRaw = rhs.raw ?? rhs.date.iso8601 @@ -73,6 +95,13 @@ public struct ISO8601Date: Codable, Hashable { } } +/// Compares the ISO8601 string of the date wrapped by a `ISO8601Date` instance and another `Date` instance. +/// +/// - Parameters: +/// - lhs: The `ISO8601Date` instance check against the `Date` on the right. +/// - rhs: The `Date` instance to check against the instance wrapped by the `ISO8601Date`. +/// +/// - Returns: A boolean indicating whether the ISO8601 strings of the `Date` instances match or not. public func ==(lhs: ISO8601Date, rhs: Date) -> Bool { return lhs.date.iso8601 == rhs.iso8601 } From e677ce0186972ed073c5d4bfb3c5aed30a633ab8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 13:12:47 -0600 Subject: [PATCH 028/160] Removed .container property from PayPalClient service --- Sources/PayPal/API/Authentication.swift | 11 +-- .../API/Controllers/CustomerDisputes.swift | 4 +- Sources/PayPal/API/PayPalClient.swift | 84 ++++++++++++++-- Sources/PayPal/Utilities/PayPalRequest.swift | 95 ------------------- 4 files changed, 84 insertions(+), 110 deletions(-) delete mode 100644 Sources/PayPal/Utilities/PayPalRequest.swift diff --git a/Sources/PayPal/API/Authentication.swift b/Sources/PayPal/API/Authentication.swift index 377f1f16..0ae53923 100644 --- a/Sources/PayPal/API/Authentication.swift +++ b/Sources/PayPal/API/Authentication.swift @@ -55,15 +55,15 @@ extension PayPalClient { /// /// - Returns: A void future that can be used to get notified when the auth information has been fetched and stored. public func authenticate() -> Future { - return Future.flatMap(on: self.container) { () -> Future in - let config = try self.container.make(Configuration.self) + return Future.flatMap(on: self.client.container) { () -> Future in + let config = try self.client.container.make(Configuration.self) let credentials = "\(config.id):\(config.secret)" let encoded = Data(credentials.utf8).base64EncodedString() let headers: HTTPHeaders = ["Accept": "application/json", "Accept-Language": "en_US", "Authorization": "Basic \(encoded)"] - let request = try self.container.paypal(.POST, "v1/oauth2/token", headers: headers, auth: false, body: ["grant_type": "client_credentials"]) - return try self.container.client().send(request) + let request = try self.request(.POST, "v1/oauth2/token", headers: headers, auth: false, body: ["grant_type": "client_credentials"]) + return self.client.send(request) }.flatMap(to: AuthResponse.self) { response in if !(200...299).contains(response.http.status.code) { return try response.content.decode(PayPalAPIIdentityError.self).map { error in throw error } @@ -72,8 +72,7 @@ extension PayPalClient { return try response.content.decode(AuthResponse.self) }.map(to: Void.self) { data in - let auth = try self.container.make(AuthInfo.self) - data.populate(auth) + data.populate(self.auth) } } } diff --git a/Sources/PayPal/API/Controllers/CustomerDisputes.swift b/Sources/PayPal/API/Controllers/CustomerDisputes.swift index b7627b41..beecdbf4 100644 --- a/Sources/PayPal/API/Controllers/CustomerDisputes.swift +++ b/Sources/PayPal/API/Controllers/CustomerDisputes.swift @@ -213,7 +213,7 @@ public final class CustomerDisputes: PayPalController { /// - Returns: An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). /// If an error response was sent back instead, it gets converted to a Swift error and the future wraps that instead. public func evidence(for disputeID: String, file: File, evidences: [Evidence]) -> Future<[LinkDescription]> { - return Future.flatMap(on: self.container) { () -> Future<[LinkDescription]> in + return self.client { client -> Future<[LinkDescription]> in guard let ext = file.ext, ext == "jpg" || ext == "gif" || ext == "png" || ext == "pdf" else { throw PayPalError(status: .badRequest, identifier: "invalidExtension", reason: "File type must be JPG, GIF, PNG, or PDF") @@ -222,7 +222,7 @@ public final class CustomerDisputes: PayPalController { let json = try MultipartPart(data: JSONEncoder().encode(evidences), headers: ["Content-Type": "application/json"]) let body: [String: MultipartPartConvertible] = ["input": json, "file1": file] - let request: Request = try self.container.paypal(.POST, self.path + disputeID + "/provide-evidence", body: nil as [Int]?) + let request: Request = try client.request(.POST, self.path + disputeID + "/provide-evidence", body: nil as [Int]?) try request.content.encode(body.parts(), as: .related) let response = try self.container.client().send(request) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index 6781019d..4c5fce36 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -3,22 +3,63 @@ import Vapor /// An interface for the PayPal REST API. public final class PayPalClient: ServiceType { - /// The current container that the service instance is connected to. - public let container: Container + /// The client object used to send requests to the PayPal API. + internal let client: Client + + /// The data used to authenticate with the PayPal API. + public internal(set) var auth: AuthInfo + + /// The PayPal environment to send the requests to. + public internal(set) var environment: Environment /// Creates a new PayPal client with a given container. /// /// - Note: Instead of calling this initializer, you should register the /// provider and call `container.make(PayPalClient.self)`. - public init(container: Container) { - self.container = container + public init(client: Client) { + self.client = client + self.auth = AuthInfo() + self.environment = .sandbox } /// Creates a new instance of the service for the supplied `Container`. /// /// See `ServiceFactory` for more information. public static func makeService(for worker: Container) throws -> Self { - return self.init(container: worker) + return try self.init(client: worker.make()) + } + + public func request( + _ method: HTTPMethod, + _ path: String, + parameters: QueryParamaters = QueryParamaters(), + headers: HTTPHeaders = [:], + auth: Bool = true, + body: Body? + )throws -> Request where Body: Encodable { + let querystring = parameters.encode() + let path = self.environment.domain + "/" + path + (querystring == "" ? "" : "?" + querystring) + + let http = HTTPRequest(method: method, url: path, headers: headers) + let request = Request(http: http, using: self.client.container) + + if auth { + guard let type = self.auth.type, let token = self.auth.token else { + throw Abort( + .internalServerError, + reason: "Attempted to make a PayPal request that requires auth before authenticating." + ) + } + + request.http.headers.replaceOrAdd(name: .authorization, value: type + " " + token) + } + + if let body = body { + let contentType: MediaType = auth ? .json : .urlEncodedForm + try request.content.encode(body, as: contentType) + } + + return request } /// Sends a request to the PayPal REST API, using the configured environment. @@ -40,7 +81,36 @@ public final class PayPalClient: ServiceType { body: Body?, as response: Result.Type = Result.self ) -> Future where Body: Content, Result: Content { - return self.container.paypal(method, path, parameters: parameters, headers: headers, body: body, as: Result.self) + let authentication: EventLoopFuture + if self.auth.tokenExpired { + authentication = self.authenticate() + } else { + authentication = self.client.container.future() + } + + return authentication.flatMap { () -> EventLoopFuture in + let request = try self.request(method, path, parameters: parameters, headers: headers, auth: true, body: body) + return self.client.send(request) + }.flatMap { response -> EventLoopFuture in + if !(200...299).contains(response.http.status.code) { + guard response.http.headers.firstValue(name: .contentType) == "application/json" else { + let body = response.http.body.data ?? Data() + let error = String(data: body, encoding: .utf8) + throw Abort(response.http.status, reason: error) + } + + return try response.content.decode(PayPalAPIError.self).catchFlatMap { _ in + return try response.content.decode(PayPalAPIIdentityError.self).map { error in throw error } + }.map { error in + throw error + } + } + + if Result.self is HTTPStatus.Type { + return self.client.container.future(response.http.status as! Result) + } + return try response.content.decode(Result.self) + } } /// Sends a request to the PayPal REST API, using the configured environment. @@ -59,7 +129,7 @@ public final class PayPalClient: ServiceType { headers: HTTPHeaders = [:], as response: Result.Type = Result.self ) -> Future where Result: Content { - return self.container.paypal(method, path, parameters: parameters, headers: headers, as: Result.self) + return self.send(method, path, parameters: parameters, headers: headers, body: nil as [String: String]?, as: Result.self) } /// Sends a `GET` request to the PayPal REST API, using the configured environment. diff --git a/Sources/PayPal/Utilities/PayPalRequest.swift b/Sources/PayPal/Utilities/PayPalRequest.swift deleted file mode 100644 index 51b1ed5a..00000000 --- a/Sources/PayPal/Utilities/PayPalRequest.swift +++ /dev/null @@ -1,95 +0,0 @@ -import Vapor - -extension Container { - func paypal( - _ method: HTTPMethod, - _ path: String, - parameters: QueryParamaters = QueryParamaters(), - headers: HTTPHeaders = [:], - auth: Bool = true, - body: Body? = nil - )throws -> Request where Body: Content { - let config = try self.make(Configuration.self) - let querystring = parameters.encode() - let path = config.environment.domain + "/" + path + (querystring == "" ? "" : "?" + querystring) - - var http = HTTPRequest(method: method, url: path, headers: headers) - if auth { - let auth = try self.make(AuthInfo.self) - guard let type = auth.type, let token = auth.token else { - throw Abort(.internalServerError, reason: "Attempted to make a PayPal request that requires auth before authenticating.") - } - - http.headers.replaceOrAdd(name: .authorization, value: type + " " + token) - } - - let request = Request(http: http, using: self) - if let body = body { - let contentType: MediaType = auth ? .json : .urlEncodedForm - try request.content.encode(body, as: contentType) - } - return request - } - - func paypal( - _ method: HTTPMethod, - _ path: String, - parameters: QueryParamaters = QueryParamaters(), - headers: HTTPHeaders = [:], - body: Body?, - as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { - #if DEBUG - var req: Request? - #endif - - return Future.flatMap(on: self) { () -> Future in - if try self.make(AuthInfo.self).tokenExpired == true { - return try self.make(PayPalClient.self).authenticate() - } else { - return self.future() - } - }.flatMap(to: Response.self) { - let request = try self.paypal(method, path, parameters: parameters, headers: headers, auth: true, body: body) - - #if DEBUG - if Env.get("PAYPAL_LOG_API_ERROR") == "TRUE" { req = request } - #endif - - return try self.client().send(request) - }.flatMap(to: Result.self) { response in - if !(200...299).contains(response.http.status.code) { - #if DEBUG - if Env.get("PAYPAL_LOG_API_ERROR") == "TRUE" { print(req!, "\n\n", response) } - #endif - - guard response.http.headers.firstValue(name: .contentType) == "application/json" else { - let body = response.http.body.data ?? Data() - let error = String(data: body, encoding: .utf8) - throw Abort(response.http.status, reason: error) - } - - return try response.content.decode(PayPalAPIError.self).catchFlatMap { _ in - return try response.content.decode(PayPalAPIIdentityError.self).map { error in throw error } - }.map { error in - throw error - } - } - - if Result.self is HTTPStatus.Type { - return self.future(response.http.status as! Result) - } - return try response.content.decode(Result.self) - } - } - - func paypal( - _ method: HTTPMethod, - _ path: String, - parameters: QueryParamaters = QueryParamaters(), - headers: HTTPHeaders = [:], - as response: Result.Type = Result.self - ) -> Future where Result: Content { - return self.paypal(method, path, parameters: parameters, headers: headers, body: nil as [String: String]?, as: Result.self) - } -} From 781cb26e6980668c142795c3e312e8c808897613 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:15:36 -0600 Subject: [PATCH 029/160] Added .v2 case to Version enum --- Sources/PayPal/Config/Versions.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/PayPal/Config/Versions.swift b/Sources/PayPal/Config/Versions.swift index 0abdb22a..1130c5e5 100644 --- a/Sources/PayPal/Config/Versions.swift +++ b/Sources/PayPal/Config/Versions.swift @@ -3,4 +3,7 @@ public enum Version: String, Hashable, CaseIterable, Codable { /// Version 1. case v1 = "1" + + /// Version 2. + case v2 = "2" } From 540860874709fe5ed61df0adb487ec6cca52c14a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:28:13 -0600 Subject: [PATCH 030/160] Added 'env' parameter to PayPalClient initializer --- Sources/PayPal/API/PayPalClient.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index 4c5fce36..5899d795 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -16,17 +16,17 @@ public final class PayPalClient: ServiceType { /// /// - Note: Instead of calling this initializer, you should register the /// provider and call `container.make(PayPalClient.self)`. - public init(client: Client) { + public init(client: Client, env: Environment) { + self.environment = env self.client = client self.auth = AuthInfo() - self.environment = .sandbox } /// Creates a new instance of the service for the supplied `Container`. /// /// See `ServiceFactory` for more information. public static func makeService(for worker: Container) throws -> Self { - return try self.init(client: worker.make()) + return try self.init(client: worker.make(), env: worker.make(Configuration.self).environment) } public func request( From 26aaacc38776de8ecd4e7614f7d16b2b79ccb239 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:29:11 -0600 Subject: [PATCH 031/160] Created API class --- Sources/PayPal/API/API.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Sources/PayPal/API/API.swift diff --git a/Sources/PayPal/API/API.swift b/Sources/PayPal/API/API.swift new file mode 100644 index 00000000..2bdacdf0 --- /dev/null +++ b/Sources/PayPal/API/API.swift @@ -0,0 +1,13 @@ +import Vapor + +public final class API { + let client: PayPalClient + + public init(client: Client, environment: Environment) { + self.client = PayPalClient(client: client, env: environment) + } + + public init(client: PayPalClient) { + self.client = client + } +} From 48c447ccf06b17db9b6675895c05774ac89652ef Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:39:51 -0600 Subject: [PATCH 032/160] Documented API class --- Sources/PayPal/API/API.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/PayPal/API/API.swift b/Sources/PayPal/API/API.swift index 2bdacdf0..190f6aa7 100644 --- a/Sources/PayPal/API/API.swift +++ b/Sources/PayPal/API/API.swift @@ -1,12 +1,23 @@ import Vapor +/// The wrapper for the whole PayPal REST API. public final class API { - let client: PayPalClient + /// The client used to send requests to PayPal. + public let client: PayPalClient + + /// Creates a new `API` instance with the dependencies for the `PayPalClient` instance. + /// + /// - Parameters: + /// - client: The `Client` instance that the `PayPalClient` instance uses to send requests. + /// - environment: The PayPal environment to send requests to. public init(client: Client, environment: Environment) { self.client = PayPalClient(client: client, env: environment) } + /// Creates a new `API` instance with the `PayPalClient` instance to use. + /// + /// - Parameter client: The `PayPalClient` instance that will be used to send requests to the PayPal API. public init(client: PayPalClient) { self.client = client } From 9c36b209524d9519b1b4a93ba9266a4a26aaeb08 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:40:42 -0600 Subject: [PATCH 033/160] Created PayPalV1 and PayPalV2 targets --- Package.swift | 2 ++ Sources/V1/V1.swift | 11 +++++++++++ Sources/V2/V2.swift | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 Sources/V1/V1.swift create mode 100644 Sources/V2/V2.swift diff --git a/Package.swift b/Package.swift index 3f139443..b91dcb4c 100644 --- a/Package.swift +++ b/Package.swift @@ -16,6 +16,8 @@ let package = Package( ], targets: [ .target(name: "PayPal", dependencies: ["Vapor", "JSON", "Failable", "Countries"]), + .target(name: "PayPalV1", dependencies: ["Vapor", "PayPal"], path: "Sources/V1"), + .target(name: "PayPalV2", dependencies: ["Vapor", "PayPal"], path: "Sources/V2"), .target(name: "TestUtilities", dependencies: ["PayPal", "Vapor"]), .testTarget(name: "ConfigTests", dependencies: ["PayPal", "TestUtilities"]), diff --git a/Sources/V1/V1.swift b/Sources/V1/V1.swift new file mode 100644 index 00000000..a78ce439 --- /dev/null +++ b/Sources/V1/V1.swift @@ -0,0 +1,11 @@ +import PayPal + +extension API { + public var v1: V1 { + return V1() + } +} + +public struct V1 { + +} diff --git a/Sources/V2/V2.swift b/Sources/V2/V2.swift new file mode 100644 index 00000000..a1f9d79a --- /dev/null +++ b/Sources/V2/V2.swift @@ -0,0 +1,11 @@ +import PayPal + +extension API { + public var v2: V2 { + return V2() + } +} + +public struct V2 { + +} From 80af221790e3ee9782339b44736395da253eac15 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:47:16 -0600 Subject: [PATCH 034/160] Documented PayPalClient.request(_:_:parameters:headers:auth:body:) method --- Sources/PayPal/API/PayPalClient.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index 5899d795..b55fce0a 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -29,6 +29,18 @@ public final class PayPalClient: ServiceType { return try self.init(client: worker.make(), env: worker.make(Configuration.self).environment) } + /// A helper to create requests that will be sent to the PayPal REST API. + /// + /// Besides creating a `Request` instance with the data passed in, this method will also add + /// the authentication header if authorization in desired. + /// + /// - Parameters: + /// - method: The HTTP of the request. + /// - path: The resource path for the request. The domain for the client's environment is appended to + /// the front of this string the create the full URL. + /// - headers: Any headers to send in the request, besides the any that are automatically added. + /// - auth: A boolean flag indicating whether the request should have an authorization header or not. + /// - body: The body of the request. public func request( _ method: HTTPMethod, _ path: String, From a3c6b9099cab252c5375516810f6ccc5041ca343 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:52:33 -0600 Subject: [PATCH 035/160] Export PayPal module from PayPalV1 and PayPalV2 targets --- Sources/V1/V1.swift | 2 +- Sources/V2/V2.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/V1/V1.swift b/Sources/V1/V1.swift index a78ce439..17cd7702 100644 --- a/Sources/V1/V1.swift +++ b/Sources/V1/V1.swift @@ -1,4 +1,4 @@ -import PayPal +@_exported import PayPal extension API { public var v1: V1 { diff --git a/Sources/V2/V2.swift b/Sources/V2/V2.swift index a1f9d79a..4beac93a 100644 --- a/Sources/V2/V2.swift +++ b/Sources/V2/V2.swift @@ -1,4 +1,4 @@ -import PayPal +@_exported import PayPal extension API { public var v2: V2 { From cef327cfffdb60624bb295c66718ae998d677006 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 15:59:46 -0600 Subject: [PATCH 036/160] Documented V1 and V2 classes and API.v1 and .v2 properties --- Sources/V1/V1.swift | 12 +++++++++++- Sources/V2/V2.swift | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Sources/V1/V1.swift b/Sources/V1/V1.swift index 17cd7702..472ff90a 100644 --- a/Sources/V1/V1.swift +++ b/Sources/V1/V1.swift @@ -1,11 +1,21 @@ @_exported import PayPal extension API { + + /// Version 1 of the PayPal API resources. public var v1: V1 { - return V1() + return V1(client: self.client) } } +/// A container for the controllers for version 1 of the PayPal API resources. public struct V1 { + /// The client used to send requests to PayPal. + internal let client: PayPalClient + + /// Creates a new `V1` instance with the `PayPalClient` instance it will use. + internal init(client: PayPalClient) { + self.client = client + } } diff --git a/Sources/V2/V2.swift b/Sources/V2/V2.swift index 4beac93a..7d38b437 100644 --- a/Sources/V2/V2.swift +++ b/Sources/V2/V2.swift @@ -1,11 +1,21 @@ @_exported import PayPal extension API { + + /// Version 2 of the PayPal API resources. public var v2: V2 { - return V2() + return V2(client: self.client) } } +/// A container for the controllers for version 2 of the PayPal API resources. public struct V2 { + /// The client used to send requests to PayPal. + internal let client: PayPalClient + + /// Creates a new `V2` instance with the `PayPalClient` instance it will use. + internal init(client: PayPalClient) { + self.client = client + } } From c27e97d2606685bd86113a59e1cafb32649e8891 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 16:16:21 -0600 Subject: [PATCH 037/160] Created VersionedController protocol --- Sources/PayPal/API/Controller.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/PayPal/API/Controller.swift b/Sources/PayPal/API/Controller.swift index eae80394..43a85f5c 100644 --- a/Sources/PayPal/API/Controller.swift +++ b/Sources/PayPal/API/Controller.swift @@ -50,3 +50,17 @@ extension PayPalController { } } } + +// TODO: - Renamed protocol to PayPalController. + +/// A controller that handles a versioned resource of the PayPal API. +public protocol VersionedController { + + /// The `PayPalClient` instance used to send requests to the PayPal API. + var client: PayPalClient { get } + + /// Creates a new instance of `Self` with the `PayPalClient` instance that will be used by it. + /// + /// - Parameter client: The `PayPalClient` instance to send requests with. + init(client: PayPalClient) +} From 79dd35534c5c6e45b0a462e921e0228b38f319d6 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 16:27:20 -0600 Subject: [PATCH 038/160] Created Payments controller class --- Sources/V2/Controllers/Payments.swift | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Sources/V2/Controllers/Payments.swift diff --git a/Sources/V2/Controllers/Payments.swift b/Sources/V2/Controllers/Payments.swift new file mode 100644 index 00000000..3cfa09cc --- /dev/null +++ b/Sources/V2/Controllers/Payments.swift @@ -0,0 +1,28 @@ +import PayPal + +/// Call the Payments API to authorize payments, capture authorized payments, refund payments that have already been captured, +/// and show payment information. Use the Payments API in conjunction with the +/// [Orders API](https://developer.paypal.com/docs/api/orders/v2/). For more information, +/// see the [PayPal Checkout Overview](https://developer.paypal.com/docs/checkout/). +/// +/// # Authorizations +/// +/// Use the `/authorizations` resource to show details for, capture payment for, reauthorize, and void authorized payments. +/// +/// # Captures +/// +/// Use the `/captures` resource to show details for and refund a captured payment. +/// +/// # Refunds +/// +/// Use the `/refunds` resource to show refund details. +public final class Payments: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + } +} From 2d0efef3177ea15647d1d7afba6f86ec2ee92b09 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 5 Mar 2019 16:27:52 -0600 Subject: [PATCH 039/160] Created V2.payments property --- Sources/V2/V2.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/V2/V2.swift b/Sources/V2/V2.swift index 7d38b437..99e0f3e1 100644 --- a/Sources/V2/V2.swift +++ b/Sources/V2/V2.swift @@ -18,4 +18,10 @@ public struct V2 { internal init(client: PayPalClient) { self.client = client } + + + /// The controller for the `/v2/payments` resource. + public var payments: Payments { + return Payments(client: self.client) + } } From 821a21a0b23d9e83e5562a7f034b7463b882805a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 07:32:49 -0600 Subject: [PATCH 040/160] Created Payments.Authorizations controller --- Sources/V2/Controllers/Payments.swift | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/V2/Controllers/Payments.swift b/Sources/V2/Controllers/Payments.swift index 3cfa09cc..f38d18db 100644 --- a/Sources/V2/Controllers/Payments.swift +++ b/Sources/V2/Controllers/Payments.swift @@ -25,4 +25,24 @@ public final class Payments: VersionedController { public init(client: PayPalClient) { self.client = client } + + /// The controller for the `/payments/authorizations` resource. + public var authorizations: Authorizations { + return Authorizations(client: self.client) + } +} + +extension Payments { + + /// The controller for the `/authorizations` resource of the Payments PayPal API. + public final class Authorizations: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + } + } } From 25055d9f5f390995da50904154f206d4dfb97f1b Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 07:43:01 -0600 Subject: [PATCH 041/160] Changed PayPalClient generic method type conformance from to --- Sources/PayPal/API/PayPalClient.swift | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index b55fce0a..cbaeb363 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -92,7 +92,7 @@ public final class PayPalClient: ServiceType { headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { let authentication: EventLoopFuture if self.auth.tokenExpired { authentication = self.authenticate() @@ -140,7 +140,7 @@ public final class PayPalClient: ServiceType { parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(method, path, parameters: parameters, headers: headers, body: nil as [String: String]?, as: Result.self) } @@ -156,7 +156,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func get( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { return self.send(.GET, path, parameters: parameters, headers: headers, body: body, as: Result.self) } @@ -170,7 +170,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func get( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(.GET, path, parameters: parameters, headers: headers, as: Result.self) } @@ -186,7 +186,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func post( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { return self.send(.POST, path, parameters: parameters, headers: headers, body: body, as: Result.self) } @@ -200,7 +200,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func post( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(.POST, path, parameters: parameters, headers: headers, as: Result.self) } @@ -216,7 +216,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func put( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { return self.send(.PUT, path, parameters: parameters, headers: headers, body: body, as: Result.self) } @@ -230,7 +230,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func put( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(.PUT, path, parameters: parameters, headers: headers, as: Result.self) } @@ -246,7 +246,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func patch( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { return self.send(.PATCH, path, parameters: parameters, headers: headers, body: body, as: Result.self) } @@ -260,7 +260,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func patch( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(.PATCH, path, parameters: parameters, headers: headers, as: Result.self) } @@ -276,7 +276,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func delete( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], body: Body?, as response: Result.Type = Result.self - ) -> Future where Body: Content, Result: Content { + ) -> Future where Body: Encodable, Result: Decodable { return self.send(.DELETE, path, parameters: parameters, headers: headers, body: body, as: Result.self) } @@ -290,7 +290,7 @@ public final class PayPalClient: ServiceType { /// - Returns: The endpoint's response, encoded to the `Result` type. public func delete( _ path: String, parameters: QueryParamaters = QueryParamaters(), headers: HTTPHeaders = [:], as response: Result.Type = Result.self - ) -> Future where Result: Content { + ) -> Future where Result: Decodable { return self.send(.DELETE, path, parameters: parameters, headers: headers, as: Result.self) } } From 84e8570155726b8872e11015ee35289fab9f6fb8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 08:12:40 -0600 Subject: [PATCH 042/160] Added .version property to PayPalClient class --- Sources/PayPal/API/PayPalClient.swift | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index cbaeb363..ebfa69bf 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -6,19 +6,23 @@ public final class PayPalClient: ServiceType { /// The client object used to send requests to the PayPal API. internal let client: Client - /// The data used to authenticate with the PayPal API. - public internal(set) var auth: AuthInfo + /// The PayPal API version that the client will be used on. + public let version: Version /// The PayPal environment to send the requests to. - public internal(set) var environment: Environment + public let environment: Environment + + /// The data used to authenticate with the PayPal API. + public internal(set) var auth: AuthInfo /// Creates a new PayPal client with a given container. /// /// - Note: Instead of calling this initializer, you should register the /// provider and call `container.make(PayPalClient.self)`. - public init(client: Client, env: Environment) { - self.environment = env + public init(client: Client, version: Version, env: Environment) { self.client = client + self.version = version + self.environment = env self.auth = AuthInfo() } @@ -26,7 +30,8 @@ public final class PayPalClient: ServiceType { /// /// See `ServiceFactory` for more information. public static func makeService(for worker: Container) throws -> Self { - return try self.init(client: worker.make(), env: worker.make(Configuration.self).environment) + let config = try worker.make(Configuration.self) + return try self.init(client: worker.make(), version: config.version, env: config.environment) } /// A helper to create requests that will be sent to the PayPal REST API. From 21e34a72243f2ff698884ec8f47870bbf049eda7 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 08:17:32 -0600 Subject: [PATCH 043/160] Cache API URL in PayPalClient.root property --- Sources/PayPal/API/PayPalClient.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index ebfa69bf..510dd734 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -6,6 +6,9 @@ public final class PayPalClient: ServiceType { /// The client object used to send requests to the PayPal API. internal let client: Client + /// The root URL (domain and API version) of all API calls. + internal let root: String + /// The PayPal API version that the client will be used on. public let version: Version @@ -24,6 +27,8 @@ public final class PayPalClient: ServiceType { self.version = version self.environment = env self.auth = AuthInfo() + + self.root = self.environment.domain + "/v" + self.version.rawValue + "/" } /// Creates a new instance of the service for the supplied `Container`. @@ -55,7 +60,7 @@ public final class PayPalClient: ServiceType { body: Body? )throws -> Request where Body: Encodable { let querystring = parameters.encode() - let path = self.environment.domain + "/" + path + (querystring == "" ? "" : "?" + querystring) + let path = self.root + path + (querystring == "" ? "" : "?" + querystring) let http = HTTPRequest(method: method, url: path, headers: headers) let request = Request(http: http, using: self.client.container) From f46ebf134ac3761601d557cda070bb167c65cf59 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 08:26:11 -0600 Subject: [PATCH 044/160] Added .resource property and .path extension property to VersionedController protocol --- Sources/PayPal/API/Controller.swift | 11 +++++++++++ Sources/V2/Controllers/Payments.swift | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/Sources/PayPal/API/Controller.swift b/Sources/PayPal/API/Controller.swift index 43a85f5c..0066cc3e 100644 --- a/Sources/PayPal/API/Controller.swift +++ b/Sources/PayPal/API/Controller.swift @@ -59,8 +59,19 @@ public protocol VersionedController { /// The `PayPalClient` instance used to send requests to the PayPal API. var client: PayPalClient { get } + /// The path components for the API resource that the controller interacts with. + var resource: [String] { get } + /// Creates a new instance of `Self` with the `PayPalClient` instance that will be used by it. /// /// - Parameter client: The `PayPalClient` instance to send requests with. init(client: PayPalClient) } + +extension VersionedController { + + /// The resource elements joined togeather as a URL path. + public var path: String { + return self.resource.joined(separator: "/") + "/" + } +} diff --git a/Sources/V2/Controllers/Payments.swift b/Sources/V2/Controllers/Payments.swift index f38d18db..47b9ce9a 100644 --- a/Sources/V2/Controllers/Payments.swift +++ b/Sources/V2/Controllers/Payments.swift @@ -1,4 +1,5 @@ import PayPal +import NIO /// Call the Payments API to authorize payments, capture authorized payments, refund payments that have already been captured, /// and show payment information. Use the Payments API in conjunction with the @@ -21,9 +22,13 @@ public final class Payments: VersionedController { /// See `VersionedController.client` public let client: PayPalClient + /// See `VersionedController.resource`. + public let resource: [String] + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client + self.resource = ["payments"] } /// The controller for the `/payments/authorizations` resource. @@ -40,9 +45,13 @@ extension Payments { /// See `VersionedController.client` public let client: PayPalClient + /// See `VersionedController.resource`. + public let resource: [String] + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client + self.resource = ["payments", "authorizations"] } } } From 864aa3b6cda5753cc2e8925b1fbf9a5116e5640a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 08:30:15 -0600 Subject: [PATCH 045/160] Assert correct client versions in V1 and V2 initializers --- Sources/V1/V1.swift | 1 + Sources/V2/V2.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/Sources/V1/V1.swift b/Sources/V1/V1.swift index 472ff90a..edfaac8f 100644 --- a/Sources/V1/V1.swift +++ b/Sources/V1/V1.swift @@ -16,6 +16,7 @@ public struct V1 { /// Creates a new `V1` instance with the `PayPalClient` instance it will use. internal init(client: PayPalClient) { + assert(client.version == .v1, "Make sure your PayPalClient instance is configured with the correct API version") self.client = client } } diff --git a/Sources/V2/V2.swift b/Sources/V2/V2.swift index 99e0f3e1..9a4b2526 100644 --- a/Sources/V2/V2.swift +++ b/Sources/V2/V2.swift @@ -16,6 +16,7 @@ public struct V2 { /// Creates a new `V2` instance with the `PayPalClient` instance it will use. internal init(client: PayPalClient) { + assert(client.version == .v2, "Make sure your PayPalClient instance is configured with the correct API version") self.client = client } From 3a9cb0781f3b2610b604593feebace677df1a91f Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 6 Mar 2019 08:30:55 -0600 Subject: [PATCH 046/160] Added 'version' parameter to API(client:environment:) initializer --- Sources/PayPal/API/API.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/PayPal/API/API.swift b/Sources/PayPal/API/API.swift index 190f6aa7..ba7172cd 100644 --- a/Sources/PayPal/API/API.swift +++ b/Sources/PayPal/API/API.swift @@ -11,8 +11,8 @@ public final class API { /// - Parameters: /// - client: The `Client` instance that the `PayPalClient` instance uses to send requests. /// - environment: The PayPal environment to send requests to. - public init(client: Client, environment: Environment) { - self.client = PayPalClient(client: client, env: environment) + public init(client: Client, version: Version, environment: Environment) { + self.client = PayPalClient(client: client, version: version, env: environment) } /// Creates a new `API` instance with the `PayPalClient` instance to use. From 9b1f62f5ee9f5ddc612549d8f118076ca4d9a695 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 06:33:56 -0500 Subject: [PATCH 047/160] Fixed whitespacing in PayPalClient.send(_:_:parameters:headers:body:as:) .map call --- Sources/PayPal/API/PayPalClient.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/PayPal/API/PayPalClient.swift b/Sources/PayPal/API/PayPalClient.swift index 510dd734..4e899a88 100644 --- a/Sources/PayPal/API/PayPalClient.swift +++ b/Sources/PayPal/API/PayPalClient.swift @@ -123,8 +123,8 @@ public final class PayPalClient: ServiceType { return try response.content.decode(PayPalAPIError.self).catchFlatMap { _ in return try response.content.decode(PayPalAPIIdentityError.self).map { error in throw error } - }.map { error in - throw error + }.map { error in + throw error } } From 1f49a9730165f50b8eaa461bf7574299e2b081fe Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 06:43:29 -0500 Subject: [PATCH 048/160] Moved Payments.Authorizations controller to /Controllers/Payments/Authorizations.swift file --- .../Controllers/Payments/Authorizations.swift | 20 +++++++++++++++++++ .../Controllers/{ => Payments}/Payments.swift | 19 ------------------ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 Sources/V2/Controllers/Payments/Authorizations.swift rename Sources/V2/Controllers/{ => Payments}/Payments.swift (69%) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift new file mode 100644 index 00000000..5cb68747 --- /dev/null +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -0,0 +1,20 @@ +import Vapor + +extension Payments { + + /// The controller for the `/authorizations` resource of the Payments PayPal API. + public final class Authorizations: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["payments", "authorizations"] + } + } +} diff --git a/Sources/V2/Controllers/Payments.swift b/Sources/V2/Controllers/Payments/Payments.swift similarity index 69% rename from Sources/V2/Controllers/Payments.swift rename to Sources/V2/Controllers/Payments/Payments.swift index 47b9ce9a..3cb534d6 100644 --- a/Sources/V2/Controllers/Payments.swift +++ b/Sources/V2/Controllers/Payments/Payments.swift @@ -36,22 +36,3 @@ public final class Payments: VersionedController { return Authorizations(client: self.client) } } - -extension Payments { - - /// The controller for the `/authorizations` resource of the Payments PayPal API. - public final class Authorizations: VersionedController { - - /// See `VersionedController.client` - public let client: PayPalClient - - /// See `VersionedController.resource`. - public let resource: [String] - - /// See `VersionedController.init(client:)`. - public init(client: PayPalClient) { - self.client = client - self.resource = ["payments", "authorizations"] - } - } -} From 4f6113823798158998922a32961f1d625752df6a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 06:55:44 -0500 Subject: [PATCH 049/160] Created Authorization.Status enum --- .../Payment/Authorization/Authorization.swift | 3 +++ .../Authorization/AuthorizationState.swift | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Sources/V2/Models/Payment/Authorization/Authorization.swift create mode 100644 Sources/V2/Models/Payment/Authorization/AuthorizationState.swift diff --git a/Sources/V2/Models/Payment/Authorization/Authorization.swift b/Sources/V2/Models/Payment/Authorization/Authorization.swift new file mode 100644 index 00000000..37e89ae9 --- /dev/null +++ b/Sources/V2/Models/Payment/Authorization/Authorization.swift @@ -0,0 +1,3 @@ +public struct Authorization: Codable { + +} diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift new file mode 100644 index 00000000..b5274f60 --- /dev/null +++ b/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift @@ -0,0 +1,26 @@ +extension Authorization { + + /// The possible statuses for an authorized payment. + public enum Status: String, Hashable, Codable, CaseIterable { + /// The authorized payment is created. No captured payments have been made for this authorized payment. + case created = "CREATED" + + /// The authorized payment has one or more captures against it. + /// The sum of these captured payments is greater than the amount of the original authorized payment. + case captured = "CAPTURED" + + /// PayPal cannot authorize funds for this authorized payment. + case denied = "DENIED" + + /// The authorized payment has expired. + case expired = "EXPIRED" + + /// A captured payment was made for the authorized payment for an amount that is less + /// than the amount of the original authorized payment. + case partiallyCaptured = "PARTIALLY_CAPTURED" + + /// The authorized payment was voided. No more captured payments can be made against this authorized payment. + case voided = "VOIDED" + + } +} From dd7a2d01945fc8d0f83092f764b643fab1269ce9 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 06:57:38 -0500 Subject: [PATCH 050/160] Added ModelVersions.md to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 02c08753..40714785 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store +ModelVersions.md + /.build /Packages /*.xcodeproj From 66156738aeb1cf843054610137762df1e9c006e3 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 07:24:54 -0500 Subject: [PATCH 051/160] Created SellerProtection.Status enum --- .../Models/Payment/Seller/SellerProtection.swift | 3 +++ .../Payment/Seller/SellerProtectionStatus.swift | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Sources/V2/Models/Payment/Seller/SellerProtection.swift create mode 100644 Sources/V2/Models/Payment/Seller/SellerProtectionStatus.swift diff --git a/Sources/V2/Models/Payment/Seller/SellerProtection.swift b/Sources/V2/Models/Payment/Seller/SellerProtection.swift new file mode 100644 index 00000000..e0b5dd7d --- /dev/null +++ b/Sources/V2/Models/Payment/Seller/SellerProtection.swift @@ -0,0 +1,3 @@ +public struct SellerProtection: Codable { + +} diff --git a/Sources/V2/Models/Payment/Seller/SellerProtectionStatus.swift b/Sources/V2/Models/Payment/Seller/SellerProtectionStatus.swift new file mode 100644 index 00000000..bd873852 --- /dev/null +++ b/Sources/V2/Models/Payment/Seller/SellerProtectionStatus.swift @@ -0,0 +1,15 @@ +extension SellerProtection { + + /// The transaction eligibility statuses for seller protection. + public enum Status: String, Hashable, Codable, CaseIterable { + /// Your PayPal balance remains intact if the customer claims that he or she did not + /// receive an item or the account holder claims that he or she did not authorize the payment. + case eligible = "ELIGIBLE" + + /// Your PayPal balance remains intact if the customer claims that he or she did not receive an item. + case partiallyEligible = "PARTIALLY_ELIGIBLE" + + /// This transaction is not eligible for seller protection. + case notEligible = "NOT_ELIGIBLE" + } +} From 962af48fc772924c7b9b19b2b558dea3c95f4d5f Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 07:27:07 -0500 Subject: [PATCH 052/160] Created SellerProtection.DisputeCategories enum --- .../V2/Models/Payment/Seller/SellerProtection.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/V2/Models/Payment/Seller/SellerProtection.swift b/Sources/V2/Models/Payment/Seller/SellerProtection.swift index e0b5dd7d..06639440 100644 --- a/Sources/V2/Models/Payment/Seller/SellerProtection.swift +++ b/Sources/V2/Models/Payment/Seller/SellerProtection.swift @@ -1,3 +1,15 @@ public struct SellerProtection: Codable { } + +extension SellerProtection { + + /// The dispute conditions that can be covered by a transaction. + public enum DisputeCategories: String, Hashable, Codable, CaseIterable { + /// The payer paid for an item that he or she did not receive. + case itemNotReceived = "ITEM_NOT_RECEIVED" + + /// The payer did not authorize the payment. + case unauthorizedTransaction = "UNAUTHORIZED_TRANSACTION" + } +} From e6ee3fbd3b889e9fe896855fcc7f38b3f5e754e5 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 07:32:42 -0500 Subject: [PATCH 053/160] Created SellerProtection struct --- .../Payment/Seller/SellerProtection.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Sources/V2/Models/Payment/Seller/SellerProtection.swift b/Sources/V2/Models/Payment/Seller/SellerProtection.swift index 06639440..577e5557 100644 --- a/Sources/V2/Models/Payment/Seller/SellerProtection.swift +++ b/Sources/V2/Models/Payment/Seller/SellerProtection.swift @@ -1,5 +1,30 @@ +/// A transcation's protection level. +/// +/// This will be defined for a transaction by the +/// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). public struct SellerProtection: Codable { + /// Indicates whether the transaction is eligible for seller protection. For information, + /// see [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let status: Status? + + /// An array of conditions that are covered for the transaction. + public let disputes: [DisputeCategories]? + + /// Creates a new `SellerProtection` instance + /// + /// - Parameters: + /// - status: Indicates whether the transaction is eligible for seller protection. + /// - disputes: An array of conditions that are covered for the transaction. + public init(status: Status?, disputes: [DisputeCategories]?) { + self.status = status + self.disputes = disputes + } + + internal enum CodingKeys: String, CodingKey { + case status + case disputes = "dispute_categories" + } } extension SellerProtection { From 4fd0cf6b3841b4b41897736c5b333573411191e8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 19 Mar 2019 09:07:29 -0500 Subject: [PATCH 054/160] Created Authorization struct --- .../Payment/Authorization/Authorization.swift | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Sources/V2/Models/Payment/Authorization/Authorization.swift b/Sources/V2/Models/Payment/Authorization/Authorization.swift index 37e89ae9..ed7b671a 100644 --- a/Sources/V2/Models/Payment/Authorization/Authorization.swift +++ b/Sources/V2/Models/Payment/Authorization/Authorization.swift @@ -1,3 +1,64 @@ +/// The details of an authorized payment. public struct Authorization: Codable { + /// The status for the authorized payment. + public let status: Status? + /// The PayPal-generated ID for the authorized payment. + public let id: String? + + /// The amount for this authorized payment. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: String? + + /// The level of protection offered as defined by + /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let sellerProtection: SellerProtection? + + /// The date and time when the authorized payment expires, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let expiration: ISO8601Date? + + /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + + /// The date and time when the transaction occurred, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let created: ISO8601Date? + + /// The date and time when the transaction was last updated, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let updated: ISO8601Date? + + public init( + status: Status?, + amount: CurrencyCodeAmount?, + invoice: String?, + sellerProtection: SellerProtection?, + expiration: ISO8601Date?, + links: [LinkDescription]?, + created: ISO8601Date?, + updated: ISO8601Date? + ) { + self.id = nil + self.status = status + self.amount = amount + self.invoice = invoice + self.sellerProtection = sellerProtection + self.expiration = expiration + self.links = links + self.created = created + self.updated = updated + } + + enum CodingKeys: String, CodingKey { + case status, id, amount, links + case invoice = "invoice_id" + case sellerProtection = "seller_protection" + case expiration = "expiration_time" + case created = "create_time" + case updated = "update_time" + } } From 88b1d533eb9a31ad61f8ee5a913fb97a31a9886e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 27 Mar 2019 11:25:39 -0500 Subject: [PATCH 055/160] Documented Authorization initializer --- .../Models/Payment/Authorization/Authorization.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V2/Models/Payment/Authorization/Authorization.swift b/Sources/V2/Models/Payment/Authorization/Authorization.swift index ed7b671a..76d48152 100644 --- a/Sources/V2/Models/Payment/Authorization/Authorization.swift +++ b/Sources/V2/Models/Payment/Authorization/Authorization.swift @@ -32,6 +32,17 @@ public struct Authorization: Codable { /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). public let updated: ISO8601Date? + /// Creates a new `Authorization` instance. + /// + /// - Parameters: + /// - status: The status for the authorized payment. + /// - amount: The PayPal-generated ID for the authorized payment. + /// - invoice: The amount for this authorized payment. + /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. + /// - expiration: The date and time when the authorized payment expires. + /// - links: An array of related HATEOAS links. + /// - created: The date and time when the transaction occurred. + /// - updated: The date and time when the transaction was last updated. public init( status: Status?, amount: CurrencyCodeAmount?, From 16fa191ae4e5b2ea2825ddf4c691c83197c58ff9 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 07:49:46 -0500 Subject: [PATCH 056/160] Update all dependencies to latest versions --- Package.resolved | 48 ++++++++++++++++++++++++------------------------ Package.swift | 10 +++++----- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Package.resolved b/Package.resolved index 93d2747a..5c9d175d 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/vapor/console.git", "state": { "branch": null, - "revision": "d6cf07af59ae63cd95c4b5f98cf1f25627750fd1", - "version": "3.1.0" + "revision": "74cfbea629d4aac34a97cead2447a6870af1950b", + "version": "3.1.1" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/vapor/core.git", "state": { "branch": null, - "revision": "33e6b1a5fe0cfd06353022fe03a8da7bf7a1fb01", - "version": "3.6.0" + "revision": "727ae2905ebdca162c5da5bfe187c406555859e2", + "version": "3.7.3" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/skelpo/Countries.git", "state": { "branch": null, - "revision": "95962a77438b5c949f9d812a700cbabbefcf15da", - "version": "0.9.1" + "revision": "b240c113f6035426bf04332119cf98d825e1b0a6", + "version": "1.0.0" } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/skelpo/Failable.git", "state": { "branch": null, - "revision": "34dde6d29991ddfc583d71d81e6ad90aac3fe2e5", - "version": "0.3.0" + "revision": "b488d50046d35243a67860bd8499bfc7fe1b8428", + "version": "0.4.0" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/vapor/http.git", "state": { "branch": null, - "revision": "b57005e0de30ba36372ac41bfce1ac12b2bc3272", - "version": "3.1.8" + "revision": "8da7d475a1a060714766d9ad4b24eb0dae243aab", + "version": "3.1.11" } }, { @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/skelpo/JSON.git", "state": { "branch": null, - "revision": "59167bee35bfeb588d76f54b6fd50d797d3be980", - "version": "0.13.1" + "revision": "521263ef8c57f41cbbd75a7bc2c1a49916af4054", + "version": "1.0.0" } }, { @@ -105,8 +105,8 @@ "repositoryURL": "https://github.com/vapor/service.git", "state": { "branch": null, - "revision": "4907311d7d7f609365982fa302b8b17ffdeb46da", - "version": "1.0.1" + "revision": "fa5b5de62bd68bcde9a69933f31319e46c7275fb", + "version": "1.0.2" } }, { @@ -114,8 +114,8 @@ "repositoryURL": "https://github.com/apple/swift-nio.git", "state": { "branch": null, - "revision": "98434c1f1d687ff5a24d2cabfbd19b5c7d2d7a2f", - "version": "1.13.0" + "revision": "29a9f2aca71c8afb07e291336f1789337ce235dd", + "version": "1.13.2" } }, { @@ -159,8 +159,8 @@ "repositoryURL": "https://github.com/vapor/template-kit.git", "state": { "branch": null, - "revision": "aff2d6fc65bfd04579b0201b31a8d6720239c1cf", - "version": "1.1.1" + "revision": "4b1073d74be9f5c6a5bc63a07a84e83efec26229", + "version": "1.1.2" } }, { @@ -168,8 +168,8 @@ "repositoryURL": "https://github.com/vapor/url-encoded-form.git", "state": { "branch": null, - "revision": "932024f363ee5ff59059cf7d67194a1c271d3d0c", - "version": "1.0.5" + "revision": "82d8d63bdb76b6dd8febe916c639ab8608dbbaed", + "version": "1.0.6" } }, { @@ -186,8 +186,8 @@ "repositoryURL": "https://github.com/vapor/vapor.git", "state": { "branch": null, - "revision": "6c7284681c3432fee29c268babf954be6816cbfb", - "version": "3.2.2" + "revision": "c86ada59b31c69f08a6abd4f776537cba48d5df6", + "version": "3.3.0" } }, { @@ -195,8 +195,8 @@ "repositoryURL": "https://github.com/vapor/websocket.git", "state": { "branch": null, - "revision": "21eb4773e25a8ff96fe347a31fe106900a69fa6a", - "version": "1.1.1" + "revision": "d85e5b6dce4d04065865f77385fc3324f98178f6", + "version": "1.1.2" } } ] diff --git a/Package.swift b/Package.swift index b91dcb4c..1ac542cb 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.0 import PackageDescription @@ -8,10 +8,10 @@ let package = Package( .library(name: "PayPal", targets: ["PayPal"]), ], dependencies: [ - .package(url: "https://github.com/skelpo/Countries.git", from: "0.9.1"), - .package(url: "https://github.com/skelpo/Failable.git", from: "0.2.0"), - .package(url: "https://github.com/vapor/vapor.git", from: "3.1.0"), - .package(url: "https://github.com/skelpo/JSON.git", from: "0.13.1"), + .package(url: "https://github.com/skelpo/Countries.git", from: "1.0.0"), + .package(url: "https://github.com/skelpo/Failable.git", from: "0.4.0"), + .package(url: "https://github.com/vapor/vapor.git", from: "3.3.0"), + .package(url: "https://github.com/skelpo/JSON.git", from: "1.0.0"), .package(url: "https://github.com/twostraws/SwiftGD.git", from: "2.2.0") ], targets: [ From 25405bcef17511d0c2a03ef3add59c5cbff3a2ac Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 08:00:10 -0500 Subject: [PATCH 057/160] Created PayeeBase struct --- Sources/V2/Models/Payment/PayeeBase.swift | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Sources/V2/Models/Payment/PayeeBase.swift diff --git a/Sources/V2/Models/Payment/PayeeBase.swift b/Sources/V2/Models/Payment/PayeeBase.swift new file mode 100644 index 00000000..3d08e44b --- /dev/null +++ b/Sources/V2/Models/Payment/PayeeBase.swift @@ -0,0 +1,43 @@ +import Failable + +/// The recipient of the fee for a transaction. +public struct PayeeBase: Codable { + + /// The email address of merchant. + public let email: Failable> + + /// The encrypted PayPal account ID of the merchant. + public let merchant: Failable> + + /// Creates a new `PayeeBase` instance. + /// + /// - Parameters: + /// - email: The email address of merchant. + /// - merchant: The encrypted PayPal account ID of the merchant. + public init( + email: Failable>, + merchant: Failable> + ) { + self.email = email + self.merchant = merchant + } + + enum CodingKeys: String, CodingKey { + case email = "email_address" + case merchant = "merchant_id" + } +} + +/// A validation for the `PayeeBase.email` property value. +public struct MerchantEmailValidation: RegexValidation { + + /// See `RegexValidation.pattern`. + public static var pattern: String = #"(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"# +} + +/// A validation for the `PayeeBase.merchant` property value. +public struct MerchantIDValidation: RegexValidation { + + /// See `RegexValidation.pattern`. + public static var pattern: String = #"^[2-9A-HJ-NP-Z]{13}$"# +} From 4c4d96641a22ca0f6431f679e5aeb38ecaa7b77d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 08:06:20 -0500 Subject: [PATCH 058/160] Created PlatformFee struct --- Sources/V2/Models/Payment/PlatformFee.swift | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Sources/V2/Models/Payment/PlatformFee.swift diff --git a/Sources/V2/Models/Payment/PlatformFee.swift b/Sources/V2/Models/Payment/PlatformFee.swift new file mode 100644 index 00000000..9f466c7c --- /dev/null +++ b/Sources/V2/Models/Payment/PlatformFee.swift @@ -0,0 +1,21 @@ +import PayPal + +/// A fee, commission, tip, or donation. +public struct PlatformFee: Codable { + + /// The fee for a transaction. + public let amount: CurrencyCodeAmount + + /// The recipient of the fee for this transaction. If you omit this value, the default is the API caller. + public let payee: PayeeBase? + + /// Creates a new `PlatformFee` instance. + /// + /// - Parameters: + /// - amount: The fee for a transaction. + /// - payee: The recipient of the fee for this transaction. + public init(amount: CurrencyCodeAmount, payee: PayeeBase? = nil) { + self.amount = amount + self.payee = payee + } +} From 66f321a8619cea4b43c3ea203c333f08e85ab7ea Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 08:48:44 -0500 Subject: [PATCH 059/160] Created PaymentInstruction struct --- .../Models/Payment/PaymentInstruction.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Sources/V2/Models/Payment/PaymentInstruction.swift diff --git a/Sources/V2/Models/Payment/PaymentInstruction.swift b/Sources/V2/Models/Payment/PaymentInstruction.swift new file mode 100644 index 00000000..e9926d6f --- /dev/null +++ b/Sources/V2/Models/Payment/PaymentInstruction.swift @@ -0,0 +1,27 @@ +import PayPal + +/// Additional payment instructions for PayPal for Partner customers. +/// Enables features for partners and marketplaces, such as delayed disbursement and collection of a platform fee. +public struct PaymentInstruction: Codable { + + /// An array of various fees, commissions, tips, or donations. + public var fees: [PlatformFee]? + + /// The funds that are held on behalf of the merchant. + public var disbursement: Order.DisbursementMode? + + /// Creates a new `PaymentInstruction` instance. + /// + /// - Parameters: + /// - fees: An array of various fees, commissions, tips, or donations. + /// - disbursement: The funds that are held on behalf of the merchant. Defaults to `.instant`. + public init(fees: [PlatformFee]?, disbursement: Order.DisbursementMode? = .instant) { + self.fees = fees + self.disbursement = disbursement + } + + enum CodingKeys: String, CodingKey { + case fees = "platform_fees" + case disbursement = "disbursement_mode" + } +} From 2d1f71216a934e7bac46eab04671210d6ca8c83c Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 09:07:07 -0500 Subject: [PATCH 060/160] Created Authorization.Capture struct --- .../Authorization/AuthorizationCapture.swift | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift new file mode 100644 index 00000000..6a1cf36e --- /dev/null +++ b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift @@ -0,0 +1,53 @@ +import PayPal + +extension Authorization { + + /// A capture for an authorized payment. + public struct Capture: Codable { + + /// The amount to capture. To capture a portion of the full authorized amount, specify an amount. + /// If amount is not specified, the full authorized amount is captured. The amount must be a positive number + /// and in the same currency as the authorization against which the payment is being captured. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: Optional127String + + /// Indicates whether you can make additional captures against the authorized payment. + /// Set to true if you do not intend to capture additional payments against the authorization. + /// Set to false if you intend to capture additional payments against the authorization. + public let final: Bool? + + /// Any additional payment instructions for PayPal for Partner customers. + /// Enables features for partners and marketplaces, such as delayed disbursement and collection of a platform fee. + /// Applies during order creation for captured payments or during capture of authorized payments. + public let instruction: PaymentInstruction? + + /// Creates a new `Authorization.Capture` instance. + /// + /// - Parameters: + /// - amount: The amount to capture. + /// - invoice: The API caller-provided external invoice number for this order. + /// - final: Indicates whether you can make additional captures against the authorized payment. Defaults to `false`. + /// - instruction: Any additional payment instructions for PayPal for Partner customers. + public init( + amount: CurrencyCodeAmount?, + invoice: Optional127String, + final: Bool? = false, + instruction: PaymentInstruction? + ) { + self.amount = amount + self.invoice = invoice + self.final = final + self.instruction = instruction + } + + enum CodingKeys: String, CodingKey { + case amount + case invoice = "invoice_id" + case final = "final_capture" + case instruction = "payment_instruction" + } + } +} From c9df392d76701ce0b72f4c584c1b2c980bd7929a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 10:20:00 -0500 Subject: [PATCH 061/160] Created Authorization.StatusDetails enum --- .../Authorization/AuthorizationState.swift | 26 -------- .../Authorization/AuthorizationStatus.swift | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 26 deletions(-) delete mode 100644 Sources/V2/Models/Payment/Authorization/AuthorizationState.swift create mode 100644 Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift deleted file mode 100644 index b5274f60..00000000 --- a/Sources/V2/Models/Payment/Authorization/AuthorizationState.swift +++ /dev/null @@ -1,26 +0,0 @@ -extension Authorization { - - /// The possible statuses for an authorized payment. - public enum Status: String, Hashable, Codable, CaseIterable { - /// The authorized payment is created. No captured payments have been made for this authorized payment. - case created = "CREATED" - - /// The authorized payment has one or more captures against it. - /// The sum of these captured payments is greater than the amount of the original authorized payment. - case captured = "CAPTURED" - - /// PayPal cannot authorize funds for this authorized payment. - case denied = "DENIED" - - /// The authorized payment has expired. - case expired = "EXPIRED" - - /// A captured payment was made for the authorized payment for an amount that is less - /// than the amount of the original authorized payment. - case partiallyCaptured = "PARTIALLY_CAPTURED" - - /// The authorized payment was voided. No more captured payments can be made against this authorized payment. - case voided = "VOIDED" - - } -} diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift new file mode 100644 index 00000000..ddc97b08 --- /dev/null +++ b/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift @@ -0,0 +1,66 @@ +extension Authorization { + + /// The possible statuses for an authorized payment. + public enum Status: String, Hashable, Codable, CaseIterable { + /// The authorized payment is created. No captured payments have been made for this authorized payment. + case created = "CREATED" + + /// The authorized payment has one or more captures against it. + /// The sum of these captured payments is greater than the amount of the original authorized payment. + case captured = "CAPTURED" + + /// PayPal cannot authorize funds for this authorized payment. + case denied = "DENIED" + + /// The authorized payment has expired. + case expired = "EXPIRED" + + /// A captured payment was made for the authorized payment for an amount that is less + /// than the amount of the original authorized payment. + case partiallyCaptured = "PARTIALLY_CAPTURED" + + /// The authorized payment was voided. No more captured payments can be made against this authorized payment. + case voided = "VOIDED" + } + + /// The reason why a captured payment status is `PENDING` or `DENIED`. + public enum StatusDetails: String, Hashable, Codable, CaseIterable { + /// The payer initiated a dispute for this captured payment with PayPal. + case buyerComplaint = "BUYER_COMPLAINT" + + /// The captured funds were reversed in response to the payer disputing this captured payment + /// with the issuer of the financial instrument used to pay for this captured payment. + case chargeback = "CHARGEBACK" + + /// The payer paid by an eCheck that has not yet cleared. + case echeck = "ECHECK" + + /// Visit your online account. In your **Account Overview**, accept and deny this payment. + case internationalWithdrawal = "INTERNATIONAL_WITHDRAWAL" + + /// No additional specific reason can be provided. For more information about this captured payment, + /// visit your account online or contact PayPal. + case other = "OTHER" + + /// The captured payment is pending manual review. + case pendingReview = "PENDING_REVIEW" + + /// The payee has not yet set up appropriate receiving preferences for their account. + /// For more information about how to accept or deny this payment, visit your account online. + /// This reason is typically offered in scenarios such as when the currency of the captured payment + /// is different from the primary holding currency of the payee. + case waitingManualAction = "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION" + + /// The captured funds were refunded. + case refunded = "REFUNDED" + + /// The payer must send the funds for this captured payment. This code generally appears for manual EFTs. + case awaitingFunding = "TRANSACTION_APPROVED_AWAITING_FUNDING" + + /// The payee does not have a PayPal account. + case unilateral = "UNILATERAL" + + /// The payee's PayPal account is not verified. + case verificationRequired = "VERIFICATION_REQUIRED" + } +} From 5ba0eea96ead8cc62134c3228f37393c0b7c6f81 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 11:03:43 -0500 Subject: [PATCH 062/160] Created ExchangeRate struct --- Sources/V2/Models/Payment/ExchangeRate.swift | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Sources/V2/Models/Payment/ExchangeRate.swift diff --git a/Sources/V2/Models/Payment/ExchangeRate.swift b/Sources/V2/Models/Payment/ExchangeRate.swift new file mode 100644 index 00000000..c6d9bc79 --- /dev/null +++ b/Sources/V2/Models/Payment/ExchangeRate.swift @@ -0,0 +1,39 @@ +import Foundation +import PayPal + +/// Defines a relationship between two different currencies, where the value is equal to 1 unit of the source currency. +/// +/// If you where going to represent the exchange rate between `USD` and `EUR`, it might look like this: +/// +/// // Rate from Mar 28, 2019, 3:48 PM UTC +/// ExchangeRate(source: .usd, target: .eur, value: 0.89) +public struct ExchangeRate: Codable { + + /// The source currency from which to convert an amount. + public let source: Currency? + + /// The target currency into which to convert an amount. + public let target: Currency? + + /// The target currency amount. Equivalent to one unit of the source currency. + /// Formatted as integer or decimal value with one to 15 digits to the right of the decimal point. + public let value: Decimal? + + /// Creates a new `ExchangeRate` instance. + /// + /// - Parameters: + /// - source: The source currency from which to convert an amount. + /// - target: The target currency into which to convert an amount. + /// - value: The target currency amount. + public init(source: Currency?, target: Currency?, value: Decimal?) { + self.source = source + self.target = target + self.value = value + } + + enum CodingKeys: String, CodingKey { + case source = "source_currency" + case target = "target_currency" + case value + } +} From bca1465872db49dc4cc4019df2d6e8fde21d9c23 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 11:12:10 -0500 Subject: [PATCH 063/160] Created SellerReceivableBreakdown struct --- .../Seller/SellerReceivableBreakdown.swift | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Sources/V2/Models/Payment/Seller/SellerReceivableBreakdown.swift diff --git a/Sources/V2/Models/Payment/Seller/SellerReceivableBreakdown.swift b/Sources/V2/Models/Payment/Seller/SellerReceivableBreakdown.swift new file mode 100644 index 00000000..44c5e6e2 --- /dev/null +++ b/Sources/V2/Models/Payment/Seller/SellerReceivableBreakdown.swift @@ -0,0 +1,62 @@ +import PayPal + +/// The detailed breakdown of a captured payment. +public struct SellerReceivableBreakdown: Codable { + + /// The amount for this captured payment. + public let gross: CurrencyCodeAmount? + + /// The applicable fee for this captured payment. + public let fee: CurrencyCodeAmount? + + /// The net amount that the payee receives for this captured payment in their PayPal account. + /// The net amount is computed as `gross_amount` minus the `paypal_fee` minus the `platform_fees`. + public let net: CurrencyCodeAmount? + + /// The net amount that is credited to the payee's PayPal account. + /// Returned only when the currency of the captured payment is different from the currency of the PayPal account + /// where the payee wants to credit the funds. The amount is computed as `net_amount` times `exchange_rate`. + public let receivable: CurrencyCodeAmount? + + /// The exchange rate that determines the amount that is credited to the payee's PayPal account. + /// Returned when the currency of the captured payment is different from the currency of the PayPal account + /// where the payee wants to credit the funds. + public let exchangeRate: ExchangeRate? + + /// An array of platform or partner fees, commissions, or brokerage fees that associated with the captured payment. + public let fees: [PlatformFee]? + + /// Creates a new `SellerReceivableBreakdown` instance. + /// + /// - Parameters: + /// - gross: The amount for this captured payment. + /// - fee: The applicable fee for this captured payment. + /// - net: The net amount that the payee receives for this captured payment in their PayPal account. + /// - receivable: The net amount that is credited to the payee's PayPal account. + /// - exchangeRate: The exchange rate that determines the amount that is credited to the payee's PayPal account. + /// - fees: Platform or partner fees, commissions, or brokerage fees that associated with a captured payment. + public init( + gross: CurrencyCodeAmount?, + fee: CurrencyCodeAmount?, + net: CurrencyCodeAmount?, + receivable: CurrencyCodeAmount?, + exchangeRate: ExchangeRate?, + fees: [PlatformFee]? + ) { + self.gross = gross + self.fee = fee + self.net = net + self.receivable = receivable + self.exchangeRate = exchangeRate + self.fees = fees + } + + enum CodingKeys: String, CodingKey { + case gross = "gross_amount" + case fee = "paypal_fee" + case net = "net_amount" + case receivable = "receivable_amount" + case exchangeRate = "exchange_rate" + case fees = "platform_fees" + } +} From 75548be1ae52097a4a4a2bb3273d57d5bde49bd8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 11:16:34 -0500 Subject: [PATCH 064/160] Created Authorization.Captured struct --- .../Authorization/AuthorizationCapture.swift | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift index 6a1cf36e..94b42193 100644 --- a/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift +++ b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift @@ -50,4 +50,99 @@ extension Authorization { case instruction = "payment_instruction" } } + + /// A captured authorized payment. + public struct Captured: Codable { + /// The status for the authorized payment. + public let status: Status? + + /// The details of the captured payment status. + public let statusDetails: StatusDetails? + + /// The PayPal-generated ID for the authorized payment. + public let id: String? + + /// The amount for this authorized payment. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: String? + + /// The level of protection offered as defined by + /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let sellerProtection: SellerProtection? + + /// Indicates whether you can make additional captures against the authorized payment. + /// Set to `true` if you do not intend to capture additional payments against the authorization. + /// Set to `false` if you intend to capture additional payments against the authorization. + public let `final`: Bool? + + /// The detailed breakdown of the captured payment. + public let breakdown: SellerReceivableBreakdown? + + /// The funds that are held on behalf of the merchant. + public let disbursement: Order.DisbursementMode? + + /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + + /// The date and time when the transaction occurred, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let created: ISO8601Date? + + /// The date and time when the transaction was last updated, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let updated: ISO8601Date? + + /// Creates a new `Authorization` instance. + /// + /// - Parameters: + /// - status: The status for the authorized payment. + /// - amount: The PayPal-generated ID for the authorized payment. + /// - invoice: The amount for this authorized payment. + /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. + /// - expiration: The date and time when the authorized payment expires. + /// - links: An array of related HATEOAS links. + /// - created: The date and time when the transaction occurred. + /// - updated: The date and time when the transaction was last updated. + public init( + status: Status?, + statusDetails: StatusDetails?, + amount: CurrencyCodeAmount?, + invoice: String?, + sellerProtection: SellerProtection?, + `final`: Bool?, + breakdown: SellerReceivableBreakdown?, + disbursement: Order.DisbursementMode?, + links: [LinkDescription]?, + created: ISO8601Date?, + updated: ISO8601Date? + ) { + self.id = nil + self.status = status + self.statusDetails = statusDetails + self.amount = amount + self.invoice = invoice + self.sellerProtection = sellerProtection + self.`final` = `final` + self.breakdown = breakdown + self.disbursement = disbursement + self.links = links + self.created = created + self.updated = updated + } + + enum CodingKeys: String, CodingKey { + case status, id, amount, links + case statusDetails = "status_details" + case invoice = "invoice_id" + case sellerProtection = "seller_protection" + case `final` = "final_capture" + case breakdown = "seller_receivable_breakdown" + case disbursement = "disbursement_mode" + case created = "create_time" + case updated = "update_time" + } + } } From 39be95b53f97fa1006fcce9612a1fc1a1332d7fd Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:07:01 -0500 Subject: [PATCH 065/160] Created Capture.Refund struct --- .../V2/Models/Payment/Capture/Capture.swift | 1 + .../Payment/Capture/CaptureRefund.swift | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Sources/V2/Models/Payment/Capture/Capture.swift create mode 100644 Sources/V2/Models/Payment/Capture/CaptureRefund.swift diff --git a/Sources/V2/Models/Payment/Capture/Capture.swift b/Sources/V2/Models/Payment/Capture/Capture.swift new file mode 100644 index 00000000..21dc9140 --- /dev/null +++ b/Sources/V2/Models/Payment/Capture/Capture.swift @@ -0,0 +1 @@ +public struct Capture {} diff --git a/Sources/V2/Models/Payment/Capture/CaptureRefund.swift b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift new file mode 100644 index 00000000..75fd669a --- /dev/null +++ b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift @@ -0,0 +1,42 @@ +import PayPal + +extension Capture { + + /// A refund for a captured payment. + public struct Refund: Codable { + + /// The amount to refund. To refund a portion of the captured amount, specify an amount. + /// If amount is not specified, an amount equal to captured amount - previous refunds is refunded. + /// The amount must be a positive number and in the same currency as the one in which the payment was captured. + public var amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public var invoice: Optional127String + + /// The reason for the refund. Appears in both the payer's transaction history and the emails that the payer receives. + public var note: Failable> + + /// Creates a new `Capture.Refund` instance. + /// + /// - Parameters: + /// - amount: The amount to refund. If `nil`, a full refund is made. + /// - invoice: The API caller-provided external invoice number for this order. + /// - note: The reason for the refund. + public init( + amount: CurrencyCodeAmount?, + invoice: Optional127String, + note: Failable> + ) { + self.amount = amount + self.invoice = invoice + self.note = note + } + + enum CodingKeys: String, CodingKey { + case amount + case invoice = "invoice_id" + case note = "note_to_payer" + } + } +} From 03f15ba966b165ef8013ba1879aa62925c651509 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:10:59 -0500 Subject: [PATCH 066/160] Renamed Authorization.Status and .StatusDetails enums to PaymentStatus and PaymentStatusDetails --- .../Authorization/AuthorizationStatus.swift | 66 ------------------- .../Models/Payment/Status/PaymentStatus.swift | 63 ++++++++++++++++++ 2 files changed, 63 insertions(+), 66 deletions(-) delete mode 100644 Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift create mode 100644 Sources/V2/Models/Payment/Status/PaymentStatus.swift diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift deleted file mode 100644 index ddc97b08..00000000 --- a/Sources/V2/Models/Payment/Authorization/AuthorizationStatus.swift +++ /dev/null @@ -1,66 +0,0 @@ -extension Authorization { - - /// The possible statuses for an authorized payment. - public enum Status: String, Hashable, Codable, CaseIterable { - /// The authorized payment is created. No captured payments have been made for this authorized payment. - case created = "CREATED" - - /// The authorized payment has one or more captures against it. - /// The sum of these captured payments is greater than the amount of the original authorized payment. - case captured = "CAPTURED" - - /// PayPal cannot authorize funds for this authorized payment. - case denied = "DENIED" - - /// The authorized payment has expired. - case expired = "EXPIRED" - - /// A captured payment was made for the authorized payment for an amount that is less - /// than the amount of the original authorized payment. - case partiallyCaptured = "PARTIALLY_CAPTURED" - - /// The authorized payment was voided. No more captured payments can be made against this authorized payment. - case voided = "VOIDED" - } - - /// The reason why a captured payment status is `PENDING` or `DENIED`. - public enum StatusDetails: String, Hashable, Codable, CaseIterable { - /// The payer initiated a dispute for this captured payment with PayPal. - case buyerComplaint = "BUYER_COMPLAINT" - - /// The captured funds were reversed in response to the payer disputing this captured payment - /// with the issuer of the financial instrument used to pay for this captured payment. - case chargeback = "CHARGEBACK" - - /// The payer paid by an eCheck that has not yet cleared. - case echeck = "ECHECK" - - /// Visit your online account. In your **Account Overview**, accept and deny this payment. - case internationalWithdrawal = "INTERNATIONAL_WITHDRAWAL" - - /// No additional specific reason can be provided. For more information about this captured payment, - /// visit your account online or contact PayPal. - case other = "OTHER" - - /// The captured payment is pending manual review. - case pendingReview = "PENDING_REVIEW" - - /// The payee has not yet set up appropriate receiving preferences for their account. - /// For more information about how to accept or deny this payment, visit your account online. - /// This reason is typically offered in scenarios such as when the currency of the captured payment - /// is different from the primary holding currency of the payee. - case waitingManualAction = "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION" - - /// The captured funds were refunded. - case refunded = "REFUNDED" - - /// The payer must send the funds for this captured payment. This code generally appears for manual EFTs. - case awaitingFunding = "TRANSACTION_APPROVED_AWAITING_FUNDING" - - /// The payee does not have a PayPal account. - case unilateral = "UNILATERAL" - - /// The payee's PayPal account is not verified. - case verificationRequired = "VERIFICATION_REQUIRED" - } -} diff --git a/Sources/V2/Models/Payment/Status/PaymentStatus.swift b/Sources/V2/Models/Payment/Status/PaymentStatus.swift new file mode 100644 index 00000000..e2a48ee5 --- /dev/null +++ b/Sources/V2/Models/Payment/Status/PaymentStatus.swift @@ -0,0 +1,63 @@ +/// The possible statuses for an authorized payment. +public enum PaymentStatus: String, Hashable, Codable, CaseIterable { + /// The authorized payment is created. No captured payments have been made for this authorized payment. + case created = "CREATED" + + /// The authorized payment has one or more captures against it. + /// The sum of these captured payments is greater than the amount of the original authorized payment. + case captured = "CAPTURED" + + /// PayPal cannot authorize funds for this authorized payment. + case denied = "DENIED" + + /// The authorized payment has expired. + case expired = "EXPIRED" + + /// A captured payment was made for the authorized payment for an amount that is less + /// than the amount of the original authorized payment. + case partiallyCaptured = "PARTIALLY_CAPTURED" + + /// The authorized payment was voided. No more captured payments can be made against this authorized payment. + case voided = "VOIDED" +} + +/// The reason why a captured payment status is `PENDING` or `DENIED`. +public enum PaymentStatusDetails: String, Hashable, Codable, CaseIterable { + /// The payer initiated a dispute for this captured payment with PayPal. + case buyerComplaint = "BUYER_COMPLAINT" + + /// The captured funds were reversed in response to the payer disputing this captured payment + /// with the issuer of the financial instrument used to pay for this captured payment. + case chargeback = "CHARGEBACK" + + /// The payer paid by an eCheck that has not yet cleared. + case echeck = "ECHECK" + + /// Visit your online account. In your **Account Overview**, accept and deny this payment. + case internationalWithdrawal = "INTERNATIONAL_WITHDRAWAL" + + /// No additional specific reason can be provided. For more information about this captured payment, + /// visit your account online or contact PayPal. + case other = "OTHER" + + /// The captured payment is pending manual review. + case pendingReview = "PENDING_REVIEW" + + /// The payee has not yet set up appropriate receiving preferences for their account. + /// For more information about how to accept or deny this payment, visit your account online. + /// This reason is typically offered in scenarios such as when the currency of the captured payment + /// is different from the primary holding currency of the payee. + case waitingManualAction = "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION" + + /// The captured funds were refunded. + case refunded = "REFUNDED" + + /// The payer must send the funds for this captured payment. This code generally appears for manual EFTs. + case awaitingFunding = "TRANSACTION_APPROVED_AWAITING_FUNDING" + + /// The payee does not have a PayPal account. + case unilateral = "UNILATERAL" + + /// The payee's PayPal account is not verified. + case verificationRequired = "VERIFICATION_REQUIRED" +} From 05f1d7400b02df2adf7353ce161d62cb8941c6a7 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:11:47 -0500 Subject: [PATCH 067/160] Changed Authorization.status type from Authorization.Status to PaymentStatus --- Sources/V2/Models/Payment/Authorization/Authorization.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/V2/Models/Payment/Authorization/Authorization.swift b/Sources/V2/Models/Payment/Authorization/Authorization.swift index 76d48152..f83cdcb1 100644 --- a/Sources/V2/Models/Payment/Authorization/Authorization.swift +++ b/Sources/V2/Models/Payment/Authorization/Authorization.swift @@ -1,7 +1,7 @@ /// The details of an authorized payment. public struct Authorization: Codable { /// The status for the authorized payment. - public let status: Status? + public let status: PaymentStatus? /// The PayPal-generated ID for the authorized payment. public let id: String? @@ -44,7 +44,7 @@ public struct Authorization: Codable { /// - created: The date and time when the transaction occurred. /// - updated: The date and time when the transaction was last updated. public init( - status: Status?, + status: PaymentStatus?, amount: CurrencyCodeAmount?, invoice: String?, sellerProtection: SellerProtection?, From 8be0560fae1a0c242045bb069723a95ade5bed53 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:12:19 -0500 Subject: [PATCH 068/160] Chnaged Authorization.Captured type to Capture type --- .../Authorization/AuthorizationCapture.swift | 95 ------------------ .../V2/Models/Payment/Capture/Capture.swift | 97 ++++++++++++++++++- 2 files changed, 96 insertions(+), 96 deletions(-) diff --git a/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift index 94b42193..6a1cf36e 100644 --- a/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift +++ b/Sources/V2/Models/Payment/Authorization/AuthorizationCapture.swift @@ -50,99 +50,4 @@ extension Authorization { case instruction = "payment_instruction" } } - - /// A captured authorized payment. - public struct Captured: Codable { - /// The status for the authorized payment. - public let status: Status? - - /// The details of the captured payment status. - public let statusDetails: StatusDetails? - - /// The PayPal-generated ID for the authorized payment. - public let id: String? - - /// The amount for this authorized payment. - public let amount: CurrencyCodeAmount? - - /// The API caller-provided external invoice number for this order. - /// Appears in both the payer's transaction history and the emails that the payer receives. - public let invoice: String? - - /// The level of protection offered as defined by - /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). - public let sellerProtection: SellerProtection? - - /// Indicates whether you can make additional captures against the authorized payment. - /// Set to `true` if you do not intend to capture additional payments against the authorization. - /// Set to `false` if you intend to capture additional payments against the authorization. - public let `final`: Bool? - - /// The detailed breakdown of the captured payment. - public let breakdown: SellerReceivableBreakdown? - - /// The funds that are held on behalf of the merchant. - public let disbursement: Order.DisbursementMode? - - /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). - public let links: [LinkDescription]? - - /// The date and time when the transaction occurred, - /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - public let created: ISO8601Date? - - /// The date and time when the transaction was last updated, - /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - public let updated: ISO8601Date? - - /// Creates a new `Authorization` instance. - /// - /// - Parameters: - /// - status: The status for the authorized payment. - /// - amount: The PayPal-generated ID for the authorized payment. - /// - invoice: The amount for this authorized payment. - /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. - /// - expiration: The date and time when the authorized payment expires. - /// - links: An array of related HATEOAS links. - /// - created: The date and time when the transaction occurred. - /// - updated: The date and time when the transaction was last updated. - public init( - status: Status?, - statusDetails: StatusDetails?, - amount: CurrencyCodeAmount?, - invoice: String?, - sellerProtection: SellerProtection?, - `final`: Bool?, - breakdown: SellerReceivableBreakdown?, - disbursement: Order.DisbursementMode?, - links: [LinkDescription]?, - created: ISO8601Date?, - updated: ISO8601Date? - ) { - self.id = nil - self.status = status - self.statusDetails = statusDetails - self.amount = amount - self.invoice = invoice - self.sellerProtection = sellerProtection - self.`final` = `final` - self.breakdown = breakdown - self.disbursement = disbursement - self.links = links - self.created = created - self.updated = updated - } - - enum CodingKeys: String, CodingKey { - case status, id, amount, links - case statusDetails = "status_details" - case invoice = "invoice_id" - case sellerProtection = "seller_protection" - case `final` = "final_capture" - case breakdown = "seller_receivable_breakdown" - case disbursement = "disbursement_mode" - case created = "create_time" - case updated = "update_time" - } - } } diff --git a/Sources/V2/Models/Payment/Capture/Capture.swift b/Sources/V2/Models/Payment/Capture/Capture.swift index 21dc9140..ef77db57 100644 --- a/Sources/V2/Models/Payment/Capture/Capture.swift +++ b/Sources/V2/Models/Payment/Capture/Capture.swift @@ -1 +1,96 @@ -public struct Capture {} +import PayPal + +/// A captured payment. +public struct Capture { + /// The status for the authorized payment. + public let status: PaymentStatus? + + /// The details of the captured payment status. + public let statusDetails: PaymentStatusDetails? + + /// The PayPal-generated ID for the authorized payment. + public let id: String? + + /// The amount for this authorized payment. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: String? + + /// The level of protection offered as defined by + /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let sellerProtection: SellerProtection? + + /// Indicates whether you can make additional captures against the authorized payment. + /// Set to `true` if you do not intend to capture additional payments against the authorization. + /// Set to `false` if you intend to capture additional payments against the authorization. + public let `final`: Bool? + + /// The detailed breakdown of the captured payment. + public let breakdown: SellerReceivableBreakdown? + + /// The funds that are held on behalf of the merchant. + public let disbursement: Order.DisbursementMode? + + /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + + /// The date and time when the transaction occurred, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let created: ISO8601Date? + + /// The date and time when the transaction was last updated, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let updated: ISO8601Date? + + /// Creates a new `Authorization` instance. + /// + /// - Parameters: + /// - status: The status for the authorized payment. + /// - amount: The PayPal-generated ID for the authorized payment. + /// - invoice: The amount for this authorized payment. + /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. + /// - expiration: The date and time when the authorized payment expires. + /// - links: An array of related HATEOAS links. + /// - created: The date and time when the transaction occurred. + /// - updated: The date and time when the transaction was last updated. + public init( + status: PaymentStatus?, + statusDetails: PaymentStatusDetails?, + amount: CurrencyCodeAmount?, + invoice: String?, + sellerProtection: SellerProtection?, + `final`: Bool?, + breakdown: SellerReceivableBreakdown?, + disbursement: Order.DisbursementMode?, + links: [LinkDescription]?, + created: ISO8601Date?, + updated: ISO8601Date? + ) { + self.id = nil + self.status = status + self.statusDetails = statusDetails + self.amount = amount + self.invoice = invoice + self.sellerProtection = sellerProtection + self.`final` = `final` + self.breakdown = breakdown + self.disbursement = disbursement + self.links = links + self.created = created + self.updated = updated + } + + enum CodingKeys: String, CodingKey { + case status, id, amount, links + case statusDetails = "status_details" + case invoice = "invoice_id" + case sellerProtection = "seller_protection" + case `final` = "final_capture" + case breakdown = "seller_receivable_breakdown" + case disbursement = "disbursement_mode" + case created = "create_time" + case updated = "update_time" + } +} From 0719701f137b6c1afd8b8be48167612f33268f82 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:13:43 -0500 Subject: [PATCH 069/160] Conformed Capture struct to Codable protocol --- Sources/V2/Models/Payment/Capture/Capture.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/V2/Models/Payment/Capture/Capture.swift b/Sources/V2/Models/Payment/Capture/Capture.swift index ef77db57..14fe3e39 100644 --- a/Sources/V2/Models/Payment/Capture/Capture.swift +++ b/Sources/V2/Models/Payment/Capture/Capture.swift @@ -1,7 +1,7 @@ import PayPal /// A captured payment. -public struct Capture { +public struct Capture: Codable { /// The status for the authorized payment. public let status: PaymentStatus? From 94379e67a6e3e767ff8aac473a8807d914005013 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:32:06 -0500 Subject: [PATCH 070/160] Created Capture.Refunded struct --- .../Payment/Capture/CaptureRefund.swift | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/Sources/V2/Models/Payment/Capture/CaptureRefund.swift b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift index 75fd669a..26f7766f 100644 --- a/Sources/V2/Models/Payment/Capture/CaptureRefund.swift +++ b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift @@ -39,4 +39,87 @@ extension Capture { case note = "note_to_payer" } } + + /// A captured payment. + public struct Refunded: Codable { + /// The status for the authorized payment. + public let status: PaymentStatus? + + /// The details of the captured payment status. + public let statusDetails: PaymentStatusDetails? + + /// The PayPal-generated ID for the authorized payment. + public let id: String? + + /// The amount for this authorized payment. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: String? + + /// The reason for the refund. Appears in both the payer's transaction history and the emails that the payer receives. + public let note: String? + + /// The level of protection offered as defined by + /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let sellerProtection: SellerProtection? + + /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + + /// The date and time when the transaction occurred, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let created: ISO8601Date? + + /// The date and time when the transaction was last updated, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let updated: ISO8601Date? + + /// Creates a new `Authorization` instance. + /// + /// - Parameters: + /// - status: The status for the authorized payment. + /// - amount: The PayPal-generated ID for the authorized payment. + /// - invoice: The amount for this authorized payment. + /// - note: The reason for the refund. + /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. + /// - expiration: The date and time when the authorized payment expires. + /// - links: An array of related HATEOAS links. + /// - created: The date and time when the transaction occurred. + /// - updated: The date and time when the transaction was last updated. + public init( + status: PaymentStatus?, + statusDetails: PaymentStatusDetails?, + amount: CurrencyCodeAmount?, + invoice: String?, + note: String?, + sellerProtection: SellerProtection?, + links: [LinkDescription]?, + created: ISO8601Date?, + updated: ISO8601Date? + ) { + self.id = nil + self.status = status + self.statusDetails = statusDetails + self.amount = amount + self.invoice = invoice + self.note = note + self.sellerProtection = sellerProtection + self.links = links + self.created = created + self.updated = updated + } + + enum CodingKeys: String, CodingKey { + case status, id, amount, links + case statusDetails = "status_details" + case invoice = "invoice_id" + case note = "note_to_payer" + case sellerProtection = "seller_protection" + case created = "create_time" + case updated = "update_time" + } + } + } From 841778ffd4782cbfde2233c3baab18062b931cd4 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:33:24 -0500 Subject: [PATCH 071/160] Added doumentation for 'final', 'breakdown', and 'disbursement' parameters in Capture initializer --- Sources/V2/Models/Payment/Capture/Capture.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/Payment/Capture/Capture.swift b/Sources/V2/Models/Payment/Capture/Capture.swift index 14fe3e39..6ce099c6 100644 --- a/Sources/V2/Models/Payment/Capture/Capture.swift +++ b/Sources/V2/Models/Payment/Capture/Capture.swift @@ -51,7 +51,9 @@ public struct Capture: Codable { /// - amount: The PayPal-generated ID for the authorized payment. /// - invoice: The amount for this authorized payment. /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. - /// - expiration: The date and time when the authorized payment expires. + /// - final: Indicates whether you can make additional captures against the authorized payment. + /// - breakdown: The detailed breakdown of the captured payment. + /// - disbursement: The funds that are held on behalf of the merchant. /// - links: An array of related HATEOAS links. /// - created: The date and time when the transaction occurred. /// - updated: The date and time when the transaction was last updated. From f7e567031ebd7ba8550fea66d65b12074434447a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:36:16 -0500 Subject: [PATCH 072/160] Changed Capture.Refunded struct to Refund struct --- .../Payment/Capture/CaptureRefund.swift | 83 ------------------- Sources/V2/Models/Payment/Refund/Refund.swift | 83 +++++++++++++++++++ 2 files changed, 83 insertions(+), 83 deletions(-) create mode 100644 Sources/V2/Models/Payment/Refund/Refund.swift diff --git a/Sources/V2/Models/Payment/Capture/CaptureRefund.swift b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift index 26f7766f..75fd669a 100644 --- a/Sources/V2/Models/Payment/Capture/CaptureRefund.swift +++ b/Sources/V2/Models/Payment/Capture/CaptureRefund.swift @@ -39,87 +39,4 @@ extension Capture { case note = "note_to_payer" } } - - /// A captured payment. - public struct Refunded: Codable { - /// The status for the authorized payment. - public let status: PaymentStatus? - - /// The details of the captured payment status. - public let statusDetails: PaymentStatusDetails? - - /// The PayPal-generated ID for the authorized payment. - public let id: String? - - /// The amount for this authorized payment. - public let amount: CurrencyCodeAmount? - - /// The API caller-provided external invoice number for this order. - /// Appears in both the payer's transaction history and the emails that the payer receives. - public let invoice: String? - - /// The reason for the refund. Appears in both the payer's transaction history and the emails that the payer receives. - public let note: String? - - /// The level of protection offered as defined by - /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). - public let sellerProtection: SellerProtection? - - /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). - public let links: [LinkDescription]? - - /// The date and time when the transaction occurred, - /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - public let created: ISO8601Date? - - /// The date and time when the transaction was last updated, - /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - public let updated: ISO8601Date? - - /// Creates a new `Authorization` instance. - /// - /// - Parameters: - /// - status: The status for the authorized payment. - /// - amount: The PayPal-generated ID for the authorized payment. - /// - invoice: The amount for this authorized payment. - /// - note: The reason for the refund. - /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. - /// - expiration: The date and time when the authorized payment expires. - /// - links: An array of related HATEOAS links. - /// - created: The date and time when the transaction occurred. - /// - updated: The date and time when the transaction was last updated. - public init( - status: PaymentStatus?, - statusDetails: PaymentStatusDetails?, - amount: CurrencyCodeAmount?, - invoice: String?, - note: String?, - sellerProtection: SellerProtection?, - links: [LinkDescription]?, - created: ISO8601Date?, - updated: ISO8601Date? - ) { - self.id = nil - self.status = status - self.statusDetails = statusDetails - self.amount = amount - self.invoice = invoice - self.note = note - self.sellerProtection = sellerProtection - self.links = links - self.created = created - self.updated = updated - } - - enum CodingKeys: String, CodingKey { - case status, id, amount, links - case statusDetails = "status_details" - case invoice = "invoice_id" - case note = "note_to_payer" - case sellerProtection = "seller_protection" - case created = "create_time" - case updated = "update_time" - } - } - } diff --git a/Sources/V2/Models/Payment/Refund/Refund.swift b/Sources/V2/Models/Payment/Refund/Refund.swift new file mode 100644 index 00000000..35883da4 --- /dev/null +++ b/Sources/V2/Models/Payment/Refund/Refund.swift @@ -0,0 +1,83 @@ +import PayPal + +/// A refunded payment. +public struct Refund: Codable { + /// The status for the authorized payment. + public let status: PaymentStatus? + + /// The details of the captured payment status. + public let statusDetails: PaymentStatusDetails? + + /// The PayPal-generated ID for the authorized payment. + public let id: String? + + /// The amount for this authorized payment. + public let amount: CurrencyCodeAmount? + + /// The API caller-provided external invoice number for this order. + /// Appears in both the payer's transaction history and the emails that the payer receives. + public let invoice: String? + + /// The reason for the refund. Appears in both the payer's transaction history and the emails that the payer receives. + public let note: String? + + /// The level of protection offered as defined by + /// [PayPal Seller Protection for Merchants](https://www.paypal.com/us/webapps/mpp/security/seller-protection). + public let sellerProtection: SellerProtection? + + /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + + /// The date and time when the transaction occurred, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let created: ISO8601Date? + + /// The date and time when the transaction was last updated, + /// in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + public let updated: ISO8601Date? + + /// Creates a new `Authorization` instance. + /// + /// - Parameters: + /// - status: The status for the authorized payment. + /// - amount: The PayPal-generated ID for the authorized payment. + /// - invoice: The amount for this authorized payment. + /// - note: The reason for the refund. + /// - sellerProtection: The level of protection offered as defined by PayPal Seller Protection for Merchants. + /// - expiration: The date and time when the authorized payment expires. + /// - links: An array of related HATEOAS links. + /// - created: The date and time when the transaction occurred. + /// - updated: The date and time when the transaction was last updated. + public init( + status: PaymentStatus?, + statusDetails: PaymentStatusDetails?, + amount: CurrencyCodeAmount?, + invoice: String?, + note: String?, + sellerProtection: SellerProtection?, + links: [LinkDescription]?, + created: ISO8601Date?, + updated: ISO8601Date? + ) { + self.id = nil + self.status = status + self.statusDetails = statusDetails + self.amount = amount + self.invoice = invoice + self.note = note + self.sellerProtection = sellerProtection + self.links = links + self.created = created + self.updated = updated + } + + enum CodingKeys: String, CodingKey { + case status, id, amount, links + case statusDetails = "status_details" + case invoice = "invoice_id" + case note = "note_to_payer" + case sellerProtection = "seller_protection" + case created = "create_time" + case updated = "update_time" + } +} From 0d06ba275a62a174b1ae1df485c54fcfc1f5d093 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 12:42:58 -0500 Subject: [PATCH 073/160] Created Payments.Authorizations.get(_:) method --- Sources/V2/Controllers/Payments/Authorizations.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index 5cb68747..cc595d83 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -16,5 +16,15 @@ extension Payments { self.client = client self.resource = ["payments", "authorizations"] } + + /// Shows details for an authorized payment, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows authorization details. + /// + /// - Parameter authorization: The ID of the authorized payment for which to show details. + /// - Returns: The authorization details for the ID passed in. + public func get(_ authorization: String) -> EventLoopFuture { + return self.client.get(self.path + authorization, as: Authorization.self) + } } } From 70bf391f1774d3c23d73ac42f93d8c33f367f2cb Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 13:34:12 -0500 Subject: [PATCH 074/160] Created Payments.Authorizations.ResponseReturn enum and .capture(_:capture:prefer:requestID:) method --- .../Controllers/Payments/Authorizations.swift | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index cc595d83..27b72173 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -1,3 +1,4 @@ +import PayPal import Vapor extension Payments { @@ -22,9 +23,47 @@ extension Payments { /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows authorization details. /// /// - Parameter authorization: The ID of the authorized payment for which to show details. - /// - Returns: The authorization details for the ID passed in. + /// - Returns: The authorization details for the ID passed in, wrapped in an `EventLoopFuture`. public func get(_ authorization: String) -> EventLoopFuture { return self.client.get(self.path + authorization, as: Authorization.self) } + + /// Captures an authorized payment, by ID. + /// + /// A successful request returns the HTTP 201 Created status code + /// and a JSON response body that shows captured payment details. + /// + /// - Parameters: + /// - authorization: The PayPal-generated ID for the authorized payment to capture. + /// - capture: The capture information for the payment, which will be the body for the request. + /// - prefer: The preferred server response upon successful completion of the request. + /// - requestID: A unique user-generated ID that the server stores for a period of time. + /// Use this header to enforce idempotency on REST API POST calls. + /// + /// - Returns: The captured payment, wrapped in an `EventLoopFuture`. + public func capture( + _ authorization: String, + capture: Authorization.Capture, + prefer: ResponseReturn = .minimal, + requestID: String? = nil + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Prefer": prefer.rawValue] + if let request = requestID { + headers.add(name: "PayPal-Request-Id", value: request) + } + + return self.client.post(self.path + authorization, headers: headers, body: capture, as: Capture.self) + } + + /// The preferred server response upon successful completion of a request. + public enum ResponseReturn: String { + + /// The server returns a minimal response to optimize communication between the API caller and the server. + /// A minimal response includes the `id`, `status` and HATEOAS links. + case minimal = "return=minimal" + + /// The server returns a complete resource representation, including the current state of the resource. + case representation = "return=representation" + } } } From ddada1712c11af2d47202223faecc9ba3da2edeb Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 13:49:46 -0500 Subject: [PATCH 075/160] Created Payments.Authorizations.reauthorize(_:amount:prefer:requestID:) method. Fixed .capture endpoint called --- .../Controllers/Payments/Authorizations.swift | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index 27b72173..f94bbd49 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -52,7 +52,53 @@ extension Payments { headers.add(name: "PayPal-Request-Id", value: request) } - return self.client.post(self.path + authorization, headers: headers, body: capture, as: Capture.self) + return self.client.post(self.path + authorization + "/capture", headers: headers, body: capture, as: Capture.self) + } + + /// Reauthorizes an authorized PayPal account payment, by ID. To ensure that funds are still available, + /// reauthorize a payment after its initial three-day honor period expires. + /// You can reauthorize a payment only once from days four to 29. + /// + /// If 30 days have transpired since the date of the original authorization, + /// you must create an authorized payment instead of reauthorizing the original authorized payment. + /// + /// A reauthorized payment itself has a new honor period of three days. + /// + /// You can reauthorize an authorized payment once for up to 115% of the original authorized amount, + /// not to exceed an increase of $75 USD. + /// + /// Supports only the `amount` request parameter. + /// + /// - Note: This request is currently not supported for Partner use cases. + /// + /// A successful request returns the HTTP 201 Created status code and + /// a JSON response body that shows the reauthorized payment details. + /// + /// - Parameters: + /// - authorization: The PayPal-generated ID for the authorized payment to reauthorize. + /// - amount: The amount to reauthorize for an authorized payment. + /// - prefer: The preferred server response upon successful completion of the request. + /// - requestID: A unique user-generated ID that the server stores for a period of time. + /// Use this header to enforce idempotency on REST API POST calls. + /// + /// - Returns: The reauthorizaed payment, wrapped in an `EventLoopFuture`. + public func reauthorize( + _ authorization: String, + amount: CurrencyCodeAmount, + prefer: ResponseReturn = .minimal, + requestID: String? = nil + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Prefer": prefer.rawValue] + if let request = requestID { + headers.add(name: "PayPal-Request-Id", value: request) + } + + return self.client.post( + self.path + authorization + "/reauthorize", + headers: headers, + body: amount, + as: Authorization.self + ) } /// The preferred server response upon successful completion of a request. From f3b61b1756bc7d1474ea8cccc6823d6d3f2d3045 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 13:52:58 -0500 Subject: [PATCH 076/160] Created Payments.Authorizations.void(_:) method. --- Sources/V2/Controllers/Payments/Authorizations.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index f94bbd49..31f8f0a3 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -101,6 +101,17 @@ extension Payments { ) } + /// Voids, or cancels, an authorized payment, by ID. + /// You cannot void an authorized payment that has been fully captured. + /// + /// A successful request returns the HTTP 204 No Content status code with no JSON response body. + /// + /// - Parameter authorization: The PayPal-generated ID for the authorized payment to void. + /// - Returns: An empty `EventLoopFuture` that succeedes if the API response gives a success code. + public func void(_ authorization: String) -> EventLoopFuture { + return self.client.post(self.path + authorization + "/void", as: HTTPStatus.self).transform(to: ()) + } + /// The preferred server response upon successful completion of a request. public enum ResponseReturn: String { From acc903ae056d633ea9cdaab78751cd12bd6c4c1d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 14:13:10 -0500 Subject: [PATCH 077/160] Created Payments.Captures controller --- .../V2/Controllers/Payments/Captures.swift | 20 +++++++++++++++++++ .../V2/Controllers/Payments/Payments.swift | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 Sources/V2/Controllers/Payments/Captures.swift diff --git a/Sources/V2/Controllers/Payments/Captures.swift b/Sources/V2/Controllers/Payments/Captures.swift new file mode 100644 index 00000000..4b089be7 --- /dev/null +++ b/Sources/V2/Controllers/Payments/Captures.swift @@ -0,0 +1,20 @@ +import Vapor + +extension Payments { + + /// The controller for the `/captures` resource of the Payments PayPal API. + public final class Captures: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["payments", "captures"] + } + } +} diff --git a/Sources/V2/Controllers/Payments/Payments.swift b/Sources/V2/Controllers/Payments/Payments.swift index 3cb534d6..f0a285cb 100644 --- a/Sources/V2/Controllers/Payments/Payments.swift +++ b/Sources/V2/Controllers/Payments/Payments.swift @@ -35,4 +35,9 @@ public final class Payments: VersionedController { public var authorizations: Authorizations { return Authorizations(client: self.client) } + + /// The controller for the `/payments/captures` resource. + public var captures: Captures { + return Captures(client: self.client) + } } From eef85ae6f3296cbf8ec955c16ee6a173c1332345 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 14:15:43 -0500 Subject: [PATCH 078/160] Created Payments.Captures.get(_:) method --- Sources/V2/Controllers/Payments/Captures.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V2/Controllers/Payments/Captures.swift b/Sources/V2/Controllers/Payments/Captures.swift index 4b089be7..1ee2613a 100644 --- a/Sources/V2/Controllers/Payments/Captures.swift +++ b/Sources/V2/Controllers/Payments/Captures.swift @@ -16,5 +16,16 @@ extension Payments { self.client = client self.resource = ["payments", "captures"] } + + /// Shows details for a captured payment, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and + /// a JSON response body that shows captured payment details. + /// + /// - Parameter capture: The PayPal-generated ID for the captured payment for which to show details. + /// - Returns: The captured payment for the ID, wrapped in an `EventLoopFuture`. + public func get(_ capture: String) -> EventLoopFuture { + return self.client.get(self.path + capture, as: Capture.self) + } } } From 4cae1431f212b1032e2db21eb9a315a6a0bae7dc Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 14:21:59 -0500 Subject: [PATCH 079/160] Created Payments.Captures.refund(_:refund:prefer:requestID:) method --- .../Controllers/Payments/Authorizations.swift | 11 -------- .../V2/Controllers/Payments/Captures.swift | 27 +++++++++++++++++++ .../V2/Controllers/Payments/Payments.swift | 11 ++++++++ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index 31f8f0a3..ae1e72da 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -111,16 +111,5 @@ extension Payments { public func void(_ authorization: String) -> EventLoopFuture { return self.client.post(self.path + authorization + "/void", as: HTTPStatus.self).transform(to: ()) } - - /// The preferred server response upon successful completion of a request. - public enum ResponseReturn: String { - - /// The server returns a minimal response to optimize communication between the API caller and the server. - /// A minimal response includes the `id`, `status` and HATEOAS links. - case minimal = "return=minimal" - - /// The server returns a complete resource representation, including the current state of the resource. - case representation = "return=representation" - } } } diff --git a/Sources/V2/Controllers/Payments/Captures.swift b/Sources/V2/Controllers/Payments/Captures.swift index 1ee2613a..b880835a 100644 --- a/Sources/V2/Controllers/Payments/Captures.swift +++ b/Sources/V2/Controllers/Payments/Captures.swift @@ -27,5 +27,32 @@ extension Payments { public func get(_ capture: String) -> EventLoopFuture { return self.client.get(self.path + capture, as: Capture.self) } + + /// Refunds a captured payment, by ID. For a full refund, include an empty payload in the JSON request body. + /// For a partial refund, include an `amount` object in the JSON request body. + /// + /// A successful request returns the HTTP 201 Created status code and a JSON response body that shows refund details. + /// + /// - Parameters: + /// - capture: The PayPal-generated ID for the captured payment to refund. + /// - refund: The refund data for the API. This will be the request body. + /// - prefer: The preferred server response upon successful completion of the request. + /// - requestID: A unique user-generated ID that the server stores for a period of time. + /// Use this header to enforce idempotency on REST API POST calls. + /// + /// - Returns: The refunded payment, wrapped in an `EventLoopFuture`. + public func refund( + _ capture: String, + refund: Capture.Refund? = nil, + prefer: ResponseReturn = .minimal, + requestID: String? = nil + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Prefer": prefer.rawValue] + if let request = requestID { + headers.add(name: "PayPal-Request-Id", value: request) + } + + return self.client.post(self.path + capture + "/refund", headers: headers, body: refund, as: Refund.self) + } } } diff --git a/Sources/V2/Controllers/Payments/Payments.swift b/Sources/V2/Controllers/Payments/Payments.swift index f0a285cb..90fc552a 100644 --- a/Sources/V2/Controllers/Payments/Payments.swift +++ b/Sources/V2/Controllers/Payments/Payments.swift @@ -40,4 +40,15 @@ public final class Payments: VersionedController { public var captures: Captures { return Captures(client: self.client) } + + /// The preferred server response upon successful completion of a request. + public enum ResponseReturn: String { + + /// The server returns a minimal response to optimize communication between the API caller and the server. + /// A minimal response includes the `id`, `status` and HATEOAS links. + case minimal = "return=minimal" + + /// The server returns a complete resource representation, including the current state of the resource. + case representation = "return=representation" + } } From 08ec0335c5a6fa268acbdeb7dcfc41882edf9d6d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 14:31:03 -0500 Subject: [PATCH 080/160] Created Payments.Refunds controller --- .../V2/Controllers/Payments/Payments.swift | 5 +++++ Sources/V2/Controllers/Payments/Refunds.swift | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Sources/V2/Controllers/Payments/Refunds.swift diff --git a/Sources/V2/Controllers/Payments/Payments.swift b/Sources/V2/Controllers/Payments/Payments.swift index 90fc552a..3b949560 100644 --- a/Sources/V2/Controllers/Payments/Payments.swift +++ b/Sources/V2/Controllers/Payments/Payments.swift @@ -41,6 +41,11 @@ public final class Payments: VersionedController { return Captures(client: self.client) } + /// The controller for the `/payments/refunds` resource. + public var refunds: Refunds { + return Refunds(client: self.client) + } + /// The preferred server response upon successful completion of a request. public enum ResponseReturn: String { diff --git a/Sources/V2/Controllers/Payments/Refunds.swift b/Sources/V2/Controllers/Payments/Refunds.swift new file mode 100644 index 00000000..dfdbfaff --- /dev/null +++ b/Sources/V2/Controllers/Payments/Refunds.swift @@ -0,0 +1,20 @@ +import Vapor + +extension Payments { + + /// The controller for the `/refunds` resource of the Payments PayPal API. + public final class Refunds: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["payments", "refunds"] + } + } +} From a8fa52c740779b3f51b0729796c33e984a85383e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 14:34:38 -0500 Subject: [PATCH 081/160] Created Payments.Refunds.get(_:) method --- Sources/V2/Controllers/Payments/Refunds.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V2/Controllers/Payments/Refunds.swift b/Sources/V2/Controllers/Payments/Refunds.swift index dfdbfaff..43f03b28 100644 --- a/Sources/V2/Controllers/Payments/Refunds.swift +++ b/Sources/V2/Controllers/Payments/Refunds.swift @@ -16,5 +16,15 @@ extension Payments { self.client = client self.resource = ["payments", "refunds"] } + + /// Shows details for a refund, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows refund details. + /// + /// - Parameter refund: The PayPal-generated ID for the refund for which to show details. + /// - Returns: The refund for the given ID, wrapped in an `EventLoopFuture`. + public func get(_ refund: String) -> EventLoopFuture { + return self.client.get(self.path + refund, as: Refund.self) + } } } From 6f66084231a4c6d395a0a3a9cc38b6fdbb8b67a8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:16:39 -0500 Subject: [PATCH 082/160] Renamed ResponseReturn to PreferResponse --- Sources/V2/Controllers/Payments/Authorizations.swift | 4 ++-- Sources/V2/Controllers/Payments/Captures.swift | 2 +- Sources/V2/Controllers/Payments/Payments.swift | 11 ----------- Sources/V2/Models/PreferResponse.swift | 10 ++++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 Sources/V2/Models/PreferResponse.swift diff --git a/Sources/V2/Controllers/Payments/Authorizations.swift b/Sources/V2/Controllers/Payments/Authorizations.swift index ae1e72da..35077b45 100644 --- a/Sources/V2/Controllers/Payments/Authorizations.swift +++ b/Sources/V2/Controllers/Payments/Authorizations.swift @@ -44,7 +44,7 @@ extension Payments { public func capture( _ authorization: String, capture: Authorization.Capture, - prefer: ResponseReturn = .minimal, + prefer: PreferResponse = .minimal, requestID: String? = nil ) -> EventLoopFuture { var headers: HTTPHeaders = ["Prefer": prefer.rawValue] @@ -85,7 +85,7 @@ extension Payments { public func reauthorize( _ authorization: String, amount: CurrencyCodeAmount, - prefer: ResponseReturn = .minimal, + prefer: PreferResponse = .minimal, requestID: String? = nil ) -> EventLoopFuture { var headers: HTTPHeaders = ["Prefer": prefer.rawValue] diff --git a/Sources/V2/Controllers/Payments/Captures.swift b/Sources/V2/Controllers/Payments/Captures.swift index b880835a..b2b79641 100644 --- a/Sources/V2/Controllers/Payments/Captures.swift +++ b/Sources/V2/Controllers/Payments/Captures.swift @@ -44,7 +44,7 @@ extension Payments { public func refund( _ capture: String, refund: Capture.Refund? = nil, - prefer: ResponseReturn = .minimal, + prefer: PreferResponse = .minimal, requestID: String? = nil ) -> EventLoopFuture { var headers: HTTPHeaders = ["Prefer": prefer.rawValue] diff --git a/Sources/V2/Controllers/Payments/Payments.swift b/Sources/V2/Controllers/Payments/Payments.swift index 3b949560..976583b4 100644 --- a/Sources/V2/Controllers/Payments/Payments.swift +++ b/Sources/V2/Controllers/Payments/Payments.swift @@ -45,15 +45,4 @@ public final class Payments: VersionedController { public var refunds: Refunds { return Refunds(client: self.client) } - - /// The preferred server response upon successful completion of a request. - public enum ResponseReturn: String { - - /// The server returns a minimal response to optimize communication between the API caller and the server. - /// A minimal response includes the `id`, `status` and HATEOAS links. - case minimal = "return=minimal" - - /// The server returns a complete resource representation, including the current state of the resource. - case representation = "return=representation" - } } diff --git a/Sources/V2/Models/PreferResponse.swift b/Sources/V2/Models/PreferResponse.swift new file mode 100644 index 00000000..7619ed1a --- /dev/null +++ b/Sources/V2/Models/PreferResponse.swift @@ -0,0 +1,10 @@ +/// The preferred server response upon successful completion of a request. +public enum PreferResponse: String { + + /// The server returns a minimal response to optimize communication between the API caller and the server. + /// A minimal response includes the `id`, `status` and HATEOAS links. + case minimal = "return=minimal" + + /// The server returns a complete resource representation, including the current state of the resource. + case representation = "return=representation" +} From c4b6c7b0bb00047cfbb3de15dfc59fd7c313fa9e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:18:35 -0500 Subject: [PATCH 083/160] Created empty Order struct --- Sources/V2/Models/Order/Order.swift | 1 + 1 file changed, 1 insertion(+) create mode 100644 Sources/V2/Models/Order/Order.swift diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift new file mode 100644 index 00000000..a12e58ba --- /dev/null +++ b/Sources/V2/Models/Order/Order.swift @@ -0,0 +1 @@ +public struct Order: Codable { } From 0c80bcf56a3c2332d70af68b9458a13b7a41c84a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:23:59 -0500 Subject: [PATCH 084/160] Created Order.Intent enum --- Sources/V2/Models/Order/Order.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift index a12e58ba..5d46e17d 100644 --- a/Sources/V2/Models/Order/Order.swift +++ b/Sources/V2/Models/Order/Order.swift @@ -1 +1,17 @@ public struct Order: Codable { } + +extension Order { + + /// The intent to either capture payment immediately or authorize a payment for an order after order creation. + public enum Intent: String, Codable, Hashable, CaseIterable { + + /// The merchant intends to capture payment immediately after the customer makes a payment. + case capture = "CAPTURE" + + /// The merchant intends to authorize a payment and place funds on hold after the customer makes a payment. + /// Authorized payments are guaranteed for up to three days but are available to capture for up to 29 days. + /// After the three-day honor period, the original authorized payment expires and you must re-authorize the payment. + /// You must make a separate request to capture payments on demand. + case authorize = "AUTHORIZE" + } +} From 0130d7f1140521db09d095e9f5ed2ed2d921f4ee Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:31:08 -0500 Subject: [PATCH 085/160] Created Order.Status enum --- Sources/V2/Models/Order/OrderStatus.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Sources/V2/Models/Order/OrderStatus.swift diff --git a/Sources/V2/Models/Order/OrderStatus.swift b/Sources/V2/Models/Order/OrderStatus.swift new file mode 100644 index 00000000..2057f5dc --- /dev/null +++ b/Sources/V2/Models/Order/OrderStatus.swift @@ -0,0 +1,23 @@ +extension Order { + + /// The status of an order. + public enum Status: String, Hashable, Codable, CaseIterable { + + /// The order was created with the specified context. + case CREATED + + /// The order was saved and persisted. The order status continues to be in progress until + /// a capture is made with `final_capture = true` for all purchase units within the order. + case SAVED + + /// The customer approved the payment through the PayPal wallet or another form of guest or unbranded payment. + /// For example, a card, bank account, or so on. + case APPROVED + + /// All purchase units in the order are voided. + case VOIDED + + /// The payment was authorized or the authorized payment was captured for the order. + case COMPLETED + } +} From df96f3e7ca1983a993b8174a1ddabc5cc91f3c6b Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:33:34 -0500 Subject: [PATCH 086/160] Moved /Payment/PayeeBase.swift to /Payee directory --- Sources/V2/Models/{Payment => Payee}/PayeeBase.swift | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Sources/V2/Models/{Payment => Payee}/PayeeBase.swift (100%) diff --git a/Sources/V2/Models/Payment/PayeeBase.swift b/Sources/V2/Models/Payee/PayeeBase.swift similarity index 100% rename from Sources/V2/Models/Payment/PayeeBase.swift rename to Sources/V2/Models/Payee/PayeeBase.swift From 59fc004af404cbf5cb4f5041bcd3274905523fd6 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 28 Mar 2019 15:40:12 -0500 Subject: [PATCH 087/160] Replaced Order.DisbursementMode with DisbursementMode enum --- Sources/V2/Models/Payment/Capture/Capture.swift | 6 +++--- Sources/V2/Models/Payment/DisbursementMode.swift | 11 +++++++++++ Sources/V2/Models/Payment/PaymentInstruction.swift | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 Sources/V2/Models/Payment/DisbursementMode.swift diff --git a/Sources/V2/Models/Payment/Capture/Capture.swift b/Sources/V2/Models/Payment/Capture/Capture.swift index 6ce099c6..90826aaf 100644 --- a/Sources/V2/Models/Payment/Capture/Capture.swift +++ b/Sources/V2/Models/Payment/Capture/Capture.swift @@ -31,7 +31,7 @@ public struct Capture: Codable { public let breakdown: SellerReceivableBreakdown? /// The funds that are held on behalf of the merchant. - public let disbursement: Order.DisbursementMode? + public let disbursement: DisbursementMode? /// An array of related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). public let links: [LinkDescription]? @@ -65,11 +65,11 @@ public struct Capture: Codable { sellerProtection: SellerProtection?, `final`: Bool?, breakdown: SellerReceivableBreakdown?, - disbursement: Order.DisbursementMode?, + disbursement: DisbursementMode?, links: [LinkDescription]?, created: ISO8601Date?, updated: ISO8601Date? - ) { + ) { self.id = nil self.status = status self.statusDetails = statusDetails diff --git a/Sources/V2/Models/Payment/DisbursementMode.swift b/Sources/V2/Models/Payment/DisbursementMode.swift new file mode 100644 index 00000000..ebe6f866 --- /dev/null +++ b/Sources/V2/Models/Payment/DisbursementMode.swift @@ -0,0 +1,11 @@ +/// Funds that are held on behalf of the merchant. +public enum DisbursementMode: String, Hashable, Codable, CaseIterable { + + /// The funds are released to the merchant immediately. + case instant = "INSTANT" + + /// The funds are held for a finite number of days. The actual duration depends on the region and type of integration. + /// You can release the funds through a referenced payout. + /// Otherwise, the funds disbursed automatically after the specified duration. + case delayed = "DELAYED" +} diff --git a/Sources/V2/Models/Payment/PaymentInstruction.swift b/Sources/V2/Models/Payment/PaymentInstruction.swift index e9926d6f..016b0e39 100644 --- a/Sources/V2/Models/Payment/PaymentInstruction.swift +++ b/Sources/V2/Models/Payment/PaymentInstruction.swift @@ -8,14 +8,14 @@ public struct PaymentInstruction: Codable { public var fees: [PlatformFee]? /// The funds that are held on behalf of the merchant. - public var disbursement: Order.DisbursementMode? + public var disbursement: DisbursementMode? /// Creates a new `PaymentInstruction` instance. /// /// - Parameters: /// - fees: An array of various fees, commissions, tips, or donations. /// - disbursement: The funds that are held on behalf of the merchant. Defaults to `.instant`. - public init(fees: [PlatformFee]?, disbursement: Order.DisbursementMode? = .instant) { + public init(fees: [PlatformFee]?, disbursement: DisbursementMode? = .instant) { self.fees = fees self.disbursement = disbursement } From 82aac76263335caf512d106a0510b94789f2ae36 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 07:30:43 -0500 Subject: [PATCH 088/160] Created Order.Item struct and Order.ItemCategory enum --- Sources/V2/Models/Order/OrderItem.swift | 91 +++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Sources/V2/Models/Order/OrderItem.swift diff --git a/Sources/V2/Models/Order/OrderItem.swift b/Sources/V2/Models/Order/OrderItem.swift new file mode 100644 index 00000000..7e95e898 --- /dev/null +++ b/Sources/V2/Models/Order/OrderItem.swift @@ -0,0 +1,91 @@ +import Failable +import PayPal + +extension Order { + + /// https://developer.paypal.com/docs/api/orders/v2/#definition-item + public struct Item: Codable { + + /// The item name or title. + public var name: Failable + + /// The item price or rate per unit. If you specify `unit_amount`, `purchase_units[].amount.breakdown.item_total` + /// is required. Must equal `unit_amount * quantity` for all items. + public var amount: CurrencyCodeAmount + + /// The item tax for each unit. If `tax` is specified, `purchase_units[].amount.breakdown.tax_total` is required. + /// Must equal `tax * quantity` for all items. + public var tax: CurrencyCodeAmount? + + /// The item quantity. + public var quantity: Failable> + + /// The detailed item description. + public var description: Optional127String + + /// The stock keeping unit (SKU) for the item. + public var sku: Optional127String + + /// The item category type. + public var category: ItemCategory? + + /// Creates a new `Order.Item` instance. + /// + /// - Parameters: + /// - name: The item name or title. + /// - amount: The item price or rate per unit. + /// - tax: The item tax for each unit. + /// - quantity: The item quantity. + /// - description: The detailed item description. + /// - sku: The stock keeping unit (SKU) for the item. + /// - category: The item category type. + public init( + name: Failable, + amount: CurrencyCodeAmount, + tax: CurrencyCodeAmount?, + quantity: Failable>, + description: Optional127String, + sku: Optional127String, + category: ItemCategory? + ) { + self.name = name + self.amount = amount + self.tax = tax + self.quantity = quantity + self.description = description + self.sku = sku + self.category = category + } + + /// The validator for the `Order.Item.name` property value. + public struct NameLength: LengthValidation { + + /// See `Validation.Supported`. + public typealias Supported = String + + /// See `LengthValidation.minLength`. + /// + /// The minimum valid string length is 1. + public static var minLength: Int = 1 + + /// See `LengthValidation.maxLength`. + /// + /// The maximum valid string length is 127. + public static var maxLength: Int = 127 + } + + enum CodingKeys: String, CodingKey { + case name, tax, quantity, description, sku, category + case amount = "unit_amount" + } + } + + public enum ItemCategory: String, Hashable, Codable, CaseIterable { + + /// Goods that are stored, delivered, and used in their electronic format. + case digital = "DIGITAL_GOODS" + + /// A tangible item that can be shipped with proof of delivery. + case physical = "PHYSICAL_GOODS" + } +} From d42dc27ef0640451d35ddc4e4591404b6adfca59 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 07:52:39 -0500 Subject: [PATCH 089/160] Fixed Order.Item doc block Like, really. That link _might_ be useful, but the actual description of the type is better. --- Sources/V2/Models/Order/OrderItem.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/OrderItem.swift b/Sources/V2/Models/Order/OrderItem.swift index 7e95e898..edfcf619 100644 --- a/Sources/V2/Models/Order/OrderItem.swift +++ b/Sources/V2/Models/Order/OrderItem.swift @@ -3,7 +3,7 @@ import PayPal extension Order { - /// https://developer.paypal.com/docs/api/orders/v2/#definition-item + /// An item that a customer is purchasing from a merchant. public struct Item: Codable { /// The item name or title. From 9d3d8233ca55114997787cf2b12d311ded296260 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 09:06:52 -0500 Subject: [PATCH 090/160] Created Payer.Name struct --- Sources/V2/Models/Order/Payer/Payer.swift | 1 + Sources/V2/Models/Order/Payer/PayerName.swift | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Sources/V2/Models/Order/Payer/Payer.swift create mode 100644 Sources/V2/Models/Order/Payer/PayerName.swift diff --git a/Sources/V2/Models/Order/Payer/Payer.swift b/Sources/V2/Models/Order/Payer/Payer.swift new file mode 100644 index 00000000..ea54c78f --- /dev/null +++ b/Sources/V2/Models/Order/Payer/Payer.swift @@ -0,0 +1 @@ +public struct Payer {} diff --git a/Sources/V2/Models/Order/Payer/PayerName.swift b/Sources/V2/Models/Order/Payer/PayerName.swift new file mode 100644 index 00000000..0d6ec5ca --- /dev/null +++ b/Sources/V2/Models/Order/Payer/PayerName.swift @@ -0,0 +1,34 @@ +import PayPal + +extension Payer { + + /// The name of a payer. Supports only the `given_name` and `surname` properties + public struct Name: Codable { + + /// When the party is a person, the party's given, or first, name. + public var given: Failable> + + /// When the party is a person, the party's surname or family name. Also known as the last name. + /// Required when the party is a person. Use also to store multiple surnames including the matronymic, + /// or mother's, surname. + public var surname: Failable> + + /// Creates a new `Payer.Name` instance. + /// + /// - Parameters: + /// - given: When the party is a person, the party's given, or first, name. + /// - surname: When the party is a person, the party's surname or family name. + public init( + given: Failable>, + surname: Failable> + ) { + self.given = given + self.surname = surname + } + + enum CodingKeys: String, CodingKey { + case given = "given_name" + case surname + } + } +} From 34da9535e5c9b49a4f6c9bcd04b0cf011a768bb9 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 09:38:55 -0500 Subject: [PATCH 091/160] Created Phone struct with validation types --- Sources/V2/Models/Order/Phone/Phone.swift | 87 +++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Sources/V2/Models/Order/Phone/Phone.swift diff --git a/Sources/V2/Models/Order/Phone/Phone.swift b/Sources/V2/Models/Order/Phone/Phone.swift new file mode 100644 index 00000000..6e805b0d --- /dev/null +++ b/Sources/V2/Models/Order/Phone/Phone.swift @@ -0,0 +1,87 @@ +import Failable + +/// The phone number of a customer, merchant, or organization. +public struct Phone: Codable { + + /// The country calling code (CC), in its canonical international + /// [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the + /// national number must not be greater than 15 digits. The national number consists of a national + /// destination code (NDC) and subscriber number (SN). + public var country: Failable + + /// The national number, in its canonical international + /// [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country + /// calling code (CC) and the national number must not be greater than 15 digits. The national number consists + /// of a national destination code (NDC) and subscriber number (SN). + public var national: Failable + + /// The extension number. + public var `extension`: Failable> + + /// Creates a new `Phone` instance. + /// + /// - Parameters: + /// - country: The country calling code (CC), in its canonical international E.164 numbering plan format. + /// - national: The national number, in its canonical international E.164 numbering plan format + /// - extension: The extension number. + public init( + country: Failable, + national: Failable, + `extension`: Failable> + ) { + self.country = country + self.national = national + self.extension = `extension` + } + + /// The validation for the `Phone.country` property value. + public struct CountryCode: InRangeValidation { + + /// See `Validation.Supported`. + public typealias Supported = Int + + /// See `InRangeValidation.min`. + /// + /// The minumum allowed value is `0`. + public static let min: Int? = 0 + + /// See `InRangeValidation.max`. + /// + /// The minumum allowed value is `999`. + public static let max: Int? = 999 + } + + /// The validation for the `Phone.national` property value. + public struct NationalNumber: InRangeValidation { + + /// See `Validation.Supported`. + public typealias Supported = Int + + /// See `InRangeValidation.min`. + /// + /// The minumum allowed value is `0`. + public static let min: Int? = 0 + + /// See `InRangeValidation.max`. + /// + /// The minumum allowed value is `99,999,999,999,999`. + public static let max: Int? = 99_999_999_999_999 + } + + /// The validation for the `Phone.extension` property value. + public struct ExtensionNumber: InRangeValidation { + + /// See `Validation.Supported`. + public typealias Supported = Int + + /// See `InRangeValidation.min`. + /// + /// The minumum allowed value is `0`. + public static let min: Int? = 0 + + /// See `InRangeValidation.max`. + /// + /// The minumum allowed value is `999,999,999,999,999`. + public static let max: Int? = 999_999_999_999_999 + } +} From 8c8129b27ff2300b55da0d85c751de380e335332 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 09:44:22 -0500 Subject: [PATCH 092/160] Created PhoneType enum --- Sources/V2/Models/Order/Phone/PhoneType.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Sources/V2/Models/Order/Phone/PhoneType.swift diff --git a/Sources/V2/Models/Order/Phone/PhoneType.swift b/Sources/V2/Models/Order/Phone/PhoneType.swift new file mode 100644 index 00000000..72b490ab --- /dev/null +++ b/Sources/V2/Models/Order/Phone/PhoneType.swift @@ -0,0 +1,18 @@ +/// The type of phone that a phone number is connected to. +public enum PhoneType: String, Hashable, Codable, CaseIterable { + + /// `FAX` type. + case fax = "FAX" + + /// `HOME` type. + case home = "HOME" + + /// `MOBILE` type. + case mobile = "MOBILE" + + /// `OTHER` type. + case other = "OTHER" + + /// `PAGER` type. + case pager = "PAGER" +} From d0c52372850fecf10fac0e41b916e74118aa38ad Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 09:59:00 -0500 Subject: [PATCH 093/160] Created TypedPhone struct --- Sources/V2/Models/Order/Phone/PhoneType.swift | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Sources/V2/Models/Order/Phone/PhoneType.swift b/Sources/V2/Models/Order/Phone/PhoneType.swift index 72b490ab..0c4daa7e 100644 --- a/Sources/V2/Models/Order/Phone/PhoneType.swift +++ b/Sources/V2/Models/Order/Phone/PhoneType.swift @@ -1,3 +1,5 @@ +import Failable + /// The type of phone that a phone number is connected to. public enum PhoneType: String, Hashable, Codable, CaseIterable { @@ -16,3 +18,56 @@ public enum PhoneType: String, Hashable, Codable, CaseIterable { /// `PAGER` type. case pager = "PAGER" } + +public struct TypedPhone: Codable { + + /// The phone type. + public var type: PhoneType? + + /// The national number, in its canonical international + /// [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country + /// calling code (CC) and the national number must not be greater than 15 digits. The national number + /// consists of a national destination code (NDC) and subscriber number (SN). + public var national: Failable + + /// Creates a new `TypedPhone` instance. + /// + /// - Parameters: + /// - type: The phone type. + /// - national: The national number, in its canonical international E.164 numbering plan format + public init(type: PhoneType?, national: Failable) { + self.type = type + self.national = national + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decodeIfPresent(PhoneType.self, forKey: .type) + + let number = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: .number) + guard let int = try Int(number.decode(String.self, forKey: .national)) else { + throw DecodingError.dataCorruptedError( + forKey: CodingKeys.national, + in: number, + debugDescription: "`phone_number.national_number` string value must be convertible to an int" + ) + } + self.national = try Failable(int) + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.type, forKey: .type) + + var number = container.nestedContainer(keyedBy: CodingKeys.self, forKey: .number) + try number.encode(String(describing: self.national.value), forKey: .national) + } + + enum CodingKeys: String, CodingKey { + case type = "phone_type" + case number = "phone_number" + case national = "national_number" + } +} From c1fcfee00593c41c89dad5ead8b80c13f02769b4 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 29 Mar 2019 10:09:23 -0500 Subject: [PATCH 094/160] Added doc block to TypedPhone struct signature --- Sources/V2/Models/Order/Phone/PhoneType.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/V2/Models/Order/Phone/PhoneType.swift b/Sources/V2/Models/Order/Phone/PhoneType.swift index 0c4daa7e..813037ce 100644 --- a/Sources/V2/Models/Order/Phone/PhoneType.swift +++ b/Sources/V2/Models/Order/Phone/PhoneType.swift @@ -19,6 +19,7 @@ public enum PhoneType: String, Hashable, Codable, CaseIterable { case pager = "PAGER" } +/// A phone number that has a specified phone type it is connected to. public struct TypedPhone: Codable { /// The phone type. @@ -28,6 +29,8 @@ public struct TypedPhone: Codable { /// [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country /// calling code (CC) and the national number must not be greater than 15 digits. The national number /// consists of a national destination code (NDC) and subscriber number (SN). + /// + /// - Note: To be compatible with the PayPal API, this value is encoded/decoded as a `String`. public var national: Failable /// Creates a new `TypedPhone` instance. From ad94a83fb15df43876effa9e960e04071ed99579 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 07:15:58 -0500 Subject: [PATCH 095/160] Added custom coding keys to Phone struct --- Sources/V2/Models/Order/Phone/Phone.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/Phone/Phone.swift b/Sources/V2/Models/Order/Phone/Phone.swift index 6e805b0d..4b8ca3a8 100644 --- a/Sources/V2/Models/Order/Phone/Phone.swift +++ b/Sources/V2/Models/Order/Phone/Phone.swift @@ -22,7 +22,7 @@ public struct Phone: Codable { /// /// - Parameters: /// - country: The country calling code (CC), in its canonical international E.164 numbering plan format. - /// - national: The national number, in its canonical international E.164 numbering plan format + /// - national: The national number, in its canonical international E.164 numbering plan format. /// - extension: The extension number. public init( country: Failable, @@ -84,4 +84,10 @@ public struct Phone: Codable { /// The minumum allowed value is `999,999,999,999,999`. public static let max: Int? = 999_999_999_999_999 } + + enum CodingKeys: String, CodingKey { + case country = "country_code" + case national = "national_number" + case `extension` = "extension_number" + } } From 913514516cb83d27bc987cc8c88bcb813b92c1bf Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 07:35:02 -0500 Subject: [PATCH 096/160] Created TaxInfo struct and TaxType enum --- Sources/V2/Models/Order/Payer/TaxInfo.swift | 47 +++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Sources/V2/Models/Order/Payer/TaxInfo.swift diff --git a/Sources/V2/Models/Order/Payer/TaxInfo.swift b/Sources/V2/Models/Order/Payer/TaxInfo.swift new file mode 100644 index 00000000..e99c79e2 --- /dev/null +++ b/Sources/V2/Models/Order/Payer/TaxInfo.swift @@ -0,0 +1,47 @@ +import Failable +import PayPal + +/// The tax information for a payer, typically in an order. +public struct TaxInfo: Codable { + + /// The customer's tax ID. Supported for the PayPal payment method only. Typically, + /// the tax ID is 11 characters long for individuals and 14 characters long for businesses. + public let id: Failable + + /// The customer's tax ID type. Supported for the PayPal payment method only. + public let type: TaxType + + /// Creates a new `TaxInfo` instance. + /// + /// - Parameters: + /// - id: The customer's tax ID. + /// - type: The customer's tax ID type. + public init(id: Failable, type: TaxType) { + self.id = id + self.type = type + } + + /// The validator for the `TaxInfo.id` property value. + public struct ID: StringLengthValidation { + + /// See `StringLengthValidation.maxLength`. + /// + /// The maximum length of a string is 14 characters. + public static let maxLength: Int = 14 + } + + enum CodingKeys: String, CodingKey { + case id = "tax_id" + case type = "tax_id_type" + } +} + +/// The type of ID for a `TaxInfo` instance. +public enum TaxType: String, Hashable, CaseIterable, Codable { + + /// The individual tax ID type. + case cff = "BR_CPF" + + /// The business tax ID type. + case cnpj = "BR_CNPJ" +} From d4956e95d724644731f35525bb5dc5e64edfdf00 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 09:03:31 -0500 Subject: [PATCH 097/160] Made TimelessDate date formatter thread safe by placing it in a ThreadSafeVariable --- Sources/PayPal/Models/TimelessDate.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Sources/PayPal/Models/TimelessDate.swift b/Sources/PayPal/Models/TimelessDate.swift index ae29aeca..aee75bda 100644 --- a/Sources/PayPal/Models/TimelessDate.swift +++ b/Sources/PayPal/Models/TimelessDate.swift @@ -3,15 +3,19 @@ import Vapor /// The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, /// such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { - internal static let formatter: DateFormatter = { + internal static let threadSafeFormatter: ThreadSpecificVariable = { let formatter = DateFormatter() formatter.calendar = Calendar(identifier: .iso8601) formatter.locale = Locale(identifier: "en_US_POSIX") formatter.timeZone = TimeZone(secondsFromGMT: 0) formatter.dateFormat = "yyyy-MM-dd" - return formatter + return ThreadSpecificVariable(value: formatter) }() + internal static var formatter: DateFormatter? { + return self.threadSafeFormatter.currentValue + } + /// The UNIX timestamp for the date being represented. /// /// This timestamp is converted to a date and then formated for encoding and decoding. @@ -28,7 +32,7 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { /// /// - Parameter date: The date representation, formatted as `yyyy-mm-dd`. public init?(date: String?) { - guard let string = date, let date = TimelessDate.formatter.date(from: string) else { return nil } + guard let string = date, let date = TimelessDate.formatter?.date(from: string) else { return nil } self.timestamp = date.timeIntervalSince1970 } @@ -51,7 +55,7 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { self.timestamp = nil } else { let raw = try container.decode(String.self) - guard let date = TimelessDate.formatter.date(from: raw) else { + guard let date = TimelessDate.formatter?.date(from: raw) else { throw PayPalError(status: .badRequest, identifier: "dateFormat", reason: "Expected date to be formatted as `yyyy-mm-dd`") } self.timestamp = date.timeIntervalSince1970 @@ -63,7 +67,7 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { var container = encoder.singleValueContainer() if let timestamp = self.timestamp { let date = Date(timeIntervalSince1970: timestamp) - let raw = TimelessDate.formatter.string(from: date) + let raw = TimelessDate.formatter?.string(from: date) try container.encode(raw) } else { try container.encodeNil() From d0fa91df2946592c497c1ae85c8b3ad71280051a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 10:57:36 -0500 Subject: [PATCH 098/160] Store Date in TimelessDate instead of TimeInterval --- .../BusinessOwner/BusinessOwner.swift | 2 +- .../Models/Payment/Details/PaymentTerm.swift | 2 +- Sources/PayPal/Models/TimelessDate.swift | 47 +++++++++---------- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift b/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift index f21b83d4..24024a47 100644 --- a/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift +++ b/Sources/PayPal/Models/Business/BusinessOwner/BusinessOwner.swift @@ -77,7 +77,7 @@ public struct BusinessOwner: Content, Equatable { self.phones = phones self.ids = ids self.occupation = occupation - self.birthdate = TimelessDate(birthdate) + self.birthdate = birthdate.map(TimelessDate.init) } /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). diff --git a/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift b/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift index abafb3eb..ec7d72dd 100644 --- a/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift +++ b/Sources/PayPal/Models/Payment/Details/PaymentTerm.swift @@ -17,7 +17,7 @@ public struct PaymentTerm: Content, Equatable { /// - due: The date when the invoice payment is due, in Internet date and time format. public init(type: TermType?, due: Date?) { self.type = type - self.due = TimelessDate(due) + self.due = due.map(TimelessDate.init) } /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). diff --git a/Sources/PayPal/Models/TimelessDate.swift b/Sources/PayPal/Models/TimelessDate.swift index aee75bda..2a87a890 100644 --- a/Sources/PayPal/Models/TimelessDate.swift +++ b/Sources/PayPal/Models/TimelessDate.swift @@ -16,24 +16,22 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { return self.threadSafeFormatter.currentValue } - /// The UNIX timestamp for the date being represented. - /// - /// This timestamp is converted to a date and then formated for encoding and decoding. - public var timestamp: TimeInterval? + /// The underlying data for the date. + public var date: Date /// Creates a new `TimelessDate` instance from a `Date`. /// - /// - Parameter date: The `Date` instance to get the timestamp from. - public init(_ date: Date?) { - self.timestamp = date?.timeIntervalSince1970 + /// - Parameter date: The `Date` instance. + public init(_ date: Date) { + self.date = Calendar(identifier: .iso8601).date(bySettingHour: 0, minute: 0, second: 0, of: date) ?? date } /// Creates a new `TimelessDate` instance from a `String`. /// /// - Parameter date: The date representation, formatted as `yyyy-mm-dd`. - public init?(date: String?) { - guard let string = date, let date = TimelessDate.formatter?.date(from: string) else { return nil } - self.timestamp = date.timeIntervalSince1970 + public init?(string: String) { + guard let date = TimelessDate.formatter?.date(from: string) else { return nil } + self.date = date } /// Creates a new `TimelessDate` instance from a `TimeInterval` (`Double`) instance. @@ -45,32 +43,29 @@ public struct TimelessDate: Content, Equatable, ExpressibleByFloatLiteral { /// /// - Parameter floatLiteral: The timestamp to use for the date. public init(floatLiteral value: TimeInterval) { - self.timestamp = value + self.date = Date(timeIntervalSince1970: value) } /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). public init(from decoder: Decoder)throws { let container = try decoder.singleValueContainer() - if container.decodeNil() { - self.timestamp = nil - } else { - let raw = try container.decode(String.self) - guard let date = TimelessDate.formatter?.date(from: raw) else { - throw PayPalError(status: .badRequest, identifier: "dateFormat", reason: "Expected date to be formatted as `yyyy-mm-dd`") - } - self.timestamp = date.timeIntervalSince1970 + let raw = try container.decode(String.self) + + guard let date = TimelessDate.formatter?.date(from: raw) else { + throw PayPalError( + status: .badRequest, + identifier: "dateFormat", + reason: "Expected date to be formatted as `yyyy-mm-dd`" + ) } + self.date = date } /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). public func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - if let timestamp = self.timestamp { - let date = Date(timeIntervalSince1970: timestamp) - let raw = TimelessDate.formatter?.string(from: date) - try container.encode(raw) - } else { - try container.encodeNil() - } + + let raw = TimelessDate.formatter?.string(from: self.date) + try container.encode(raw) } } From 77337edcee81bfb495503e4295e8cc1769d45d43 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 11:55:53 -0500 Subject: [PATCH 099/160] Created Payer.Address struct --- Sources/V2/Models/Order/Payer/Address.swift | 74 +++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Sources/V2/Models/Order/Payer/Address.swift diff --git a/Sources/V2/Models/Order/Payer/Address.swift b/Sources/V2/Models/Order/Payer/Address.swift new file mode 100644 index 00000000..da4ea2ae --- /dev/null +++ b/Sources/V2/Models/Order/Payer/Address.swift @@ -0,0 +1,74 @@ +import Countries +import PayPal + +extension Payer { + + /// Address of the payer party in an order. + public struct Address: Codable { + + /// The first line of the address. For example, number or street. For example, `173 Drury Lane`. + /// Required for data entry and compliance and risk checks. Must contain the full address. + public var line1: Failable> + + /// The second line of the address. For example, suite or apartment number. + public var line2: Failable> + + /// The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. + /// Format for postal delivery. For example, CA and not California. Value, by country, is: + /// - UK. A county. + /// - US. A state. + /// - Canada. A province. + /// - Japan. A prefecture. + /// - Switzerland. A kanton. + public var admin1: Failable> + + /// A city, town, or village. Smaller than admin_area_level_1. + public var admin2: Failable> + + /// The postal code, which is the zip code or equivalent. Typically required for countries with a + /// postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code). + public var postalCode: Failable> + + /// The [two-character ISO 3166-1 code](https://developer.paypal.com/docs/integration/direct/rest/country-codes/) + /// that identifies the country or region. + /// + /// - Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. + /// Use the C2 country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, + /// and cross-border transactions. + public var country: Country + + /// Creates a new `Payer.Address` instance. + /// + /// - Parameters: + /// - line1: The first line of the address. + /// - line2: The second line of the address. + /// - admin1: The highest level sub-division in a country. + /// - admin2: A city, town, or village. + /// - postalCode: The postal code, which is the zip code or equivalent. + /// - country: The two-character ISO 3166-1 code that identifies the country or region. + public init( + line1: Failable>, + line2: Failable>, + admin1: Failable>, + admin2: Failable>, + postalCode: Failable>, + country: Country + ) { + self.line1 = line1 + self.line2 = line2 + self.admin1 = admin1 + self.admin2 = admin2 + self.postalCode = postalCode + self.country = country + } + + enum CodingKeys: String, CodingKey { + case line1 = "address_line_1" + case line2 = "address_line_2" + case admin1 = "admin_area_1" + case admin2 = "admin_area_2" + case postalCode = "postal_code" + case country = "country_code" + } + } +} From e445e2eaedd73fdd21ba0af7479a35b6f6804853 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 12:22:41 -0500 Subject: [PATCH 100/160] Renamed MerchantEmailValidation to EmailValidation and MerchantIDValidation to IDValidation --- Sources/V2/Models/Payee/PayeeBase.swift | 22 ++++------------------ Sources/V2/Utilities/Validations.swift | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 Sources/V2/Utilities/Validations.swift diff --git a/Sources/V2/Models/Payee/PayeeBase.swift b/Sources/V2/Models/Payee/PayeeBase.swift index 3d08e44b..24843c3c 100644 --- a/Sources/V2/Models/Payee/PayeeBase.swift +++ b/Sources/V2/Models/Payee/PayeeBase.swift @@ -4,10 +4,10 @@ import Failable public struct PayeeBase: Codable { /// The email address of merchant. - public let email: Failable> + public let email: Failable> /// The encrypted PayPal account ID of the merchant. - public let merchant: Failable> + public let merchant: Failable> /// Creates a new `PayeeBase` instance. /// @@ -15,8 +15,8 @@ public struct PayeeBase: Codable { /// - email: The email address of merchant. /// - merchant: The encrypted PayPal account ID of the merchant. public init( - email: Failable>, - merchant: Failable> + email: Failable>, + merchant: Failable> ) { self.email = email self.merchant = merchant @@ -27,17 +27,3 @@ public struct PayeeBase: Codable { case merchant = "merchant_id" } } - -/// A validation for the `PayeeBase.email` property value. -public struct MerchantEmailValidation: RegexValidation { - - /// See `RegexValidation.pattern`. - public static var pattern: String = #"(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"# -} - -/// A validation for the `PayeeBase.merchant` property value. -public struct MerchantIDValidation: RegexValidation { - - /// See `RegexValidation.pattern`. - public static var pattern: String = #"^[2-9A-HJ-NP-Z]{13}$"# -} diff --git a/Sources/V2/Utilities/Validations.swift b/Sources/V2/Utilities/Validations.swift new file mode 100644 index 00000000..5a51ea2c --- /dev/null +++ b/Sources/V2/Utilities/Validations.swift @@ -0,0 +1,15 @@ +import Failable + +/// A validation for email addresses for v2 of the PayPal REST API. +public struct EmailValidation: RegexValidation { + + /// See `RegexValidation.pattern`. + public static var pattern: String = #"(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"# +} + +/// A validation for the `PayeeBase.merchant` property value. +public struct IDValidation: RegexValidation { + + /// See `RegexValidation.pattern`. + public static var pattern: String = #"^[2-9A-HJ-NP-Z]{13}$"# +} From 34c4a0c8e96034e1c0bd516b8f98c8ca7012c24c Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 12:47:57 -0500 Subject: [PATCH 101/160] Created Payer struct --- Sources/V2/Models/Order/Payer/Payer.swift | 67 ++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/Payer/Payer.swift b/Sources/V2/Models/Order/Payer/Payer.swift index ea54c78f..e45303cc 100644 --- a/Sources/V2/Models/Order/Payer/Payer.swift +++ b/Sources/V2/Models/Order/Payer/Payer.swift @@ -1 +1,66 @@ -public struct Payer {} +import Failable +import PayPal + +/// The customer who approves and pays for an order. +public struct Payer: Codable { + + /// The name of the payer. Supports only the `given_name` and `surname` properties. + public var name: Name? + + /// The email address of the payer. + public var email: Failable> + + /// The PayPal assigned ID for the payer. + public var payer: Failable> + + /// The phone number of the customer. Available only when you enable the **Contact Telephone Number** option in the + /// [Profile & Settings](https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-website-payments) for the + /// merchant's PayPal account. The `phone.phone_number` supports only `national_number`. + public var phone: Phone? + + /// The birth date of the payer in `YYYY-MM-DD` format. + public var birthdate: TimelessDate? + + /// The tax information of the payer. Required only for Brazilian payer's. Both `tax_id` and `tax_id_type` are required. + public var tax: TaxInfo? + + /// The address of the payer. Supports only the `address_line_1`, `address_line_2`, `admin_area_1`, `admin_area_2`, + /// `postal_code`, and `country_code` properties. Also referred to as the billing address of the customer. + public var address: Address? + + /// Creates a new `Payer` instance. + /// + /// - Parameters: + /// - name: The name of the payer. + /// - email: The email address of the payer. + /// - payer: The PayPal assigned ID for the payer. + /// - phone: The phone number of the customer. + /// - birthdate: The birth date of the payer in `YYYY-MM-DD` format. + /// - tax: The tax information of the payer. + /// - address: The address of the payer. + public init( + name: Name?, + email: Failable>, + payer: Failable>, + phone: Phone?, + birthdate: TimelessDate?, + tax: TaxInfo?, + address: Address? + ) { + self.name = name + self.email = email + self.payer = payer + self.phone = phone + self.birthdate = birthdate + self.tax = tax + self.address = address + } + + enum CodingKeys: String, CodingKey { + case name, phone, address + case email = "email_address" + case payer = "payer_id" + case birthdate = "birth_date" + case tax = "tax_info" + } +} From a26155b5355aa12c2a37609654737ad3872ee802 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 15:45:23 -0500 Subject: [PATCH 102/160] Changed Payer.Address struct to Address --- Sources/V2/Models/Address.swift | 71 ++++++++++++++++++++ Sources/V2/Models/Order/Payer/Address.swift | 74 --------------------- 2 files changed, 71 insertions(+), 74 deletions(-) create mode 100644 Sources/V2/Models/Address.swift delete mode 100644 Sources/V2/Models/Order/Payer/Address.swift diff --git a/Sources/V2/Models/Address.swift b/Sources/V2/Models/Address.swift new file mode 100644 index 00000000..7fa4b2c0 --- /dev/null +++ b/Sources/V2/Models/Address.swift @@ -0,0 +1,71 @@ +import Countries +import PayPal + +/// Address of the payer party in an order. +public struct Address: Codable { + + /// The first line of the address. For example, number or street. For example, `173 Drury Lane`. + /// Required for data entry and compliance and risk checks. Must contain the full address. + public var line1: Failable> + + /// The second line of the address. For example, suite or apartment number. + public var line2: Failable> + + /// The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. + /// Format for postal delivery. For example, CA and not California. Value, by country, is: + /// - UK. A county. + /// - US. A state. + /// - Canada. A province. + /// - Japan. A prefecture. + /// - Switzerland. A kanton. + public var admin1: Failable> + + /// A city, town, or village. Smaller than admin_area_level_1. + public var admin2: Failable> + + /// The postal code, which is the zip code or equivalent. Typically required for countries with a + /// postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code). + public var postalCode: Failable> + + /// The [two-character ISO 3166-1 code](https://developer.paypal.com/docs/integration/direct/rest/country-codes/) + /// that identifies the country or region. + /// + /// - Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. + /// Use the C2 country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, + /// and cross-border transactions. + public var country: Country + + /// Creates a new `Payer.Address` instance. + /// + /// - Parameters: + /// - line1: The first line of the address. + /// - line2: The second line of the address. + /// - admin1: The highest level sub-division in a country. + /// - admin2: A city, town, or village. + /// - postalCode: The postal code, which is the zip code or equivalent. + /// - country: The two-character ISO 3166-1 code that identifies the country or region. + public init( + line1: Failable>, + line2: Failable>, + admin1: Failable>, + admin2: Failable>, + postalCode: Failable>, + country: Country + ) { + self.line1 = line1 + self.line2 = line2 + self.admin1 = admin1 + self.admin2 = admin2 + self.postalCode = postalCode + self.country = country + } + + enum CodingKeys: String, CodingKey { + case line1 = "address_line_1" + case line2 = "address_line_2" + case admin1 = "admin_area_1" + case admin2 = "admin_area_2" + case postalCode = "postal_code" + case country = "country_code" + } +} diff --git a/Sources/V2/Models/Order/Payer/Address.swift b/Sources/V2/Models/Order/Payer/Address.swift deleted file mode 100644 index da4ea2ae..00000000 --- a/Sources/V2/Models/Order/Payer/Address.swift +++ /dev/null @@ -1,74 +0,0 @@ -import Countries -import PayPal - -extension Payer { - - /// Address of the payer party in an order. - public struct Address: Codable { - - /// The first line of the address. For example, number or street. For example, `173 Drury Lane`. - /// Required for data entry and compliance and risk checks. Must contain the full address. - public var line1: Failable> - - /// The second line of the address. For example, suite or apartment number. - public var line2: Failable> - - /// The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. - /// Format for postal delivery. For example, CA and not California. Value, by country, is: - /// - UK. A county. - /// - US. A state. - /// - Canada. A province. - /// - Japan. A prefecture. - /// - Switzerland. A kanton. - public var admin1: Failable> - - /// A city, town, or village. Smaller than admin_area_level_1. - public var admin2: Failable> - - /// The postal code, which is the zip code or equivalent. Typically required for countries with a - /// postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code). - public var postalCode: Failable> - - /// The [two-character ISO 3166-1 code](https://developer.paypal.com/docs/integration/direct/rest/country-codes/) - /// that identifies the country or region. - /// - /// - Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. - /// Use the C2 country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, - /// and cross-border transactions. - public var country: Country - - /// Creates a new `Payer.Address` instance. - /// - /// - Parameters: - /// - line1: The first line of the address. - /// - line2: The second line of the address. - /// - admin1: The highest level sub-division in a country. - /// - admin2: A city, town, or village. - /// - postalCode: The postal code, which is the zip code or equivalent. - /// - country: The two-character ISO 3166-1 code that identifies the country or region. - public init( - line1: Failable>, - line2: Failable>, - admin1: Failable>, - admin2: Failable>, - postalCode: Failable>, - country: Country - ) { - self.line1 = line1 - self.line2 = line2 - self.admin1 = admin1 - self.admin2 = admin2 - self.postalCode = postalCode - self.country = country - } - - enum CodingKeys: String, CodingKey { - case line1 = "address_line_1" - case line2 = "address_line_2" - case admin1 = "admin_area_1" - case admin2 = "admin_area_2" - case postalCode = "postal_code" - case country = "country_code" - } - } -} From ccee4e2ca1a359f94417f07f03a5798954be7e2d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 1 Apr 2019 16:40:16 -0500 Subject: [PATCH 103/160] Created PurchaseUnit.Shipping struct --- .../Order/PurchaseUnit/PurchaseUnit.swift | 1 + .../Models/Order/PurchaseUnit/Shipping.swift | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift create mode 100644 Sources/V2/Models/Order/PurchaseUnit/Shipping.swift diff --git a/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift b/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift new file mode 100644 index 00000000..0ac73bea --- /dev/null +++ b/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift @@ -0,0 +1 @@ +public struct PurchaseUnit: Codable {} diff --git a/Sources/V2/Models/Order/PurchaseUnit/Shipping.swift b/Sources/V2/Models/Order/PurchaseUnit/Shipping.swift new file mode 100644 index 00000000..cb6b160b --- /dev/null +++ b/Sources/V2/Models/Order/PurchaseUnit/Shipping.swift @@ -0,0 +1,26 @@ +import PayPal + +extension PurchaseUnit { + + /// The name and address of the person to ship items to. + public struct Shipping: Codable { + + /// The name of the person to whom to ship the items. + public var name: Failable> + + /// The address of the person to whom to ship the items. Supports only the `address_line_1`, `address_line_2`, + /// `admin_area_1`, `admin_area_2`, `postal_code`, and `country_code` properties. + public var address: Address? + + /// Creates a new `PurchaseUnit.Shipping` inctance. + /// + /// - Parameters: + /// - name: The name of the person to whom to ship the items. + /// - address: The address of the person to whom to ship the items. + public init(name: Failable>, address: Address?) { + self.name = name + self.address = address + } + } + +} From f0fb3b5897f4cfc487795f22cf3c4b1a55210545 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 08:16:26 -0500 Subject: [PATCH 104/160] Created DetailedAmount struct --- Sources/V2/Models/DetailedAmount.swift | 132 +++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 Sources/V2/Models/DetailedAmount.swift diff --git a/Sources/V2/Models/DetailedAmount.swift b/Sources/V2/Models/DetailedAmount.swift new file mode 100644 index 00000000..257e543e --- /dev/null +++ b/Sources/V2/Models/DetailedAmount.swift @@ -0,0 +1,132 @@ +import Foundation +import PayPal + +/// A currency amount with a breakdown that provides details about shipping, handling, tax, etc. +public struct DetailedAmount: Codable { + + /// The [three-character ISO-4217 currency code](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/) + /// that identifies the currency. + public var currency: Currency + + /// The amount of the given currency to represent. + /// + /// The value, which might be: + /// - An integer for currencies like `JPY` that are not typically fractional. + /// - A decimal fraction for currencies like `TND` that are subdivided into thousandths. + /// + /// For the required number of decimal places for a currency code, see + /// [Currency Codes](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/). + public var value: Decimal + + /// The breakdown of the amount. Breakdown provides details such as total item amount, total tax amount, shipping, + /// handling, insurance, and discounts, if any. + public var breakdown: Breakdown? + + /// Creates a new `DetailedAmount` instance. + /// + /// - Parameters: + /// - currency: The three-character ISO-4217 currency code that identifies the currency. + /// - value: The amount of the given currency to represent. + /// - breakdown: The breakdown of the amount. + public init(currency: Currency, value: Decimal, breakdown: Breakdown?) { + self.currency = currency + self.value = value + self.breakdown = breakdown + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let value = try container.decode(String.self, forKey: .value) + guard let decimal = Decimal(string: value) else { + throw DecodingError.dataCorruptedError( + forKey: .value, + in: container, + debugDescription: "`value` string must be convertible to a decimal type" + ) + } + + self.currency = try container.decode(Currency.self, forKey: .currency) + self.breakdown = try container.decode(Breakdown.self, forKey: .breakdown) + self.value = decimal + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + /// + /// This implementation rounds the `value` property before encoding it as a string. + /// The actual `value` property is not modified. + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + var rounded: Decimal = self.value + + if let exponent = self.currency.e { + var value: Decimal = self.value + NSDecimalRound(&rounded, &value, exponent, .bankers) + } + + try container.encode(self.currency, forKey: .currency) + try container.encode(self.breakdown, forKey: .breakdown) + try container.encode(rounded.description, forKey: .value) + } + + /// The breakdown of the amount of a purchase unit in an order. + public struct Breakdown: Codable { + + /// The subtotal for all items. Required if the request includes `purchase_units[].items[].unit_amount`. + /// Must equal the sum of `(items[].unit_amount * items[].quantity)` for all items. + public var total: CurrencyCodeAmount? + + /// The shipping fee for all items within a given `purchase_unit`. + public var shipping: CurrencyCodeAmount? + + /// The handling fee for all items within a given `purchase_unit`. + public var handling: CurrencyCodeAmount? + + /// The total tax for all items. Required if the request includes `purchase_units.items.tax`. + /// Must equal the sum of `(items[].tax * items[].quantity)` for all items. + public var tax: CurrencyCodeAmount? + + /// The insurance fee for all items within a given `purchase_unit`. + public var insurance: CurrencyCodeAmount? + + /// The shipping discount for all items within a given `purchase_unit`. + public var shippingDiscount: CurrencyCodeAmount? + + /// Creates a new `DetailedAmount.Breakdown` instance. + /// + /// - Parameters: + /// - total: The subtotal for all items. + /// - shipping: The shipping fee for all items within a given `purchase_unit`. + /// - handling: The handling fee for all items within a given `purchase_unit`. + /// - tax: The total tax for all items. + /// - insurance: The insurance fee for all items within a given `purchase_unit`. + /// - shippingDiscount: The shipping discount for all items within a given `purchase_unit`. + public init( + total: CurrencyCodeAmount?, + shipping: CurrencyCodeAmount?, + handling: CurrencyCodeAmount?, + tax: CurrencyCodeAmount?, + insurance: CurrencyCodeAmount?, + shippingDiscount: CurrencyCodeAmount? + ) { + self.total = total + self.shipping = shipping + self.handling = handling + self.tax = tax + self.insurance = insurance + self.shippingDiscount = shippingDiscount + } + + enum CodingKeys: String, CodingKey { + case shipping, handling, insurance + case total = "item_total" + case tax = "tax_total" + case shippingDiscount = "shipping_discount" + } + } + + enum CodingKeys: String, CodingKey { + case value, breakdown + case currency = "currency_code" + } +} From 46111e163bfffe31ade49fdf0112c4d7f71f6156 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 08:18:04 -0500 Subject: [PATCH 105/160] Created PurchaseUnit struct --- .../Order/PurchaseUnit/PurchaseUnit.swift | 110 +++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift b/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift index 0ac73bea..70e8c3b3 100644 --- a/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift +++ b/Sources/V2/Models/Order/PurchaseUnit/PurchaseUnit.swift @@ -1 +1,109 @@ -public struct PurchaseUnit: Codable {} +import Failable +import PayPal + +/// The payment information for an order. +public struct PurchaseUnit: Codable { + + /// The ID for the purchase unit. Required for multiple `purchase_units` or if an order must be updated by using `PATCH`. + /// If you omit the `reference_id` for an order with one purchase unit, PayPal sets the `reference_id` to `default`. + public var reference: Failable> + + /// The total order amount with an optional breakdown that provides details, such as the total item amount, + /// total tax amount, shipping, handling, insurance, and discounts, if any. + /// + /// If you specify `amount.breakdown`, the amount equals `item_total` plus `tax_total` plus `shipping` plus `handling` + /// plus `insurance` minus `shipping_discount`. + /// + /// The amount must be a positive number. For listed of supported currencies and decimal precision, + /// see the PayPal REST APIs [Currency Codes](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/). + public var amount: DetailedAmount + + /// The merchant who receives payment for this transaction. + public var payee: PayeeBase? + + /// Any additional payment instructions for PayPal for Partner customers. Enables features for partners and marketplaces, + /// such as delayed disbursement and collection of a platform fee. Applies during order creation for captured payments + /// or during capture of authorized payments. + public var paymentInstruction: PaymentInstruction? + + /// The purchase description. + public var description: Optional127String + + /// The API caller-provided external ID. Used to reconcile client transactions with PayPal transactions. + /// Appears in transaction and settlement reports but is not visible to the payer. + public var customID: Optional127String + + /// The API caller-provided external invoice number for this order. Appears in both the payer's transaction history + /// and the emails that the payer receives. + public var invoice: Optional127String + + /// The payment descriptor on the customer's credit card statement of account transactions. + /// + /// The maximum length of the soft descriptor is 22 characters. Of this, the PayPal prefix uses eight characters + /// (PAYPAL *) of the data format. Thus, the maximum length of the soft descriptor information that you can pass + /// in this field is: + /// + /// 22 - length() - length( + 1) + /// + /// For example, assume the following conditions: + /// - The PayPal prefix toggle is "PAYPAL *". + /// - The merchant descriptor set in the Profile is VENMO. + /// - The soft descriptor is passed in as JanesFlowerGifts LLC. + /// + /// PAYPAL *VENMO JanesFlo + /// + /// If the total length of the soft_descriptor exceeds 22 characters, the overflow will be truncated. + public var softDescriptor: Failable> + + /// An array of items that the customer is purchasing from the merchant. + public var items: [Order.Item]? + + /// The name and address of the person to whom to ship the items. + public var shipping: Shipping? + + /// Creates a new `PurchaseUnit` instance. + /// + /// - Parameters: + /// - reference: The ID for the purchase unit. + /// - amount: The total order amount with an optional breakdown that provides details. + /// - payee: The merchant who receives payment for this transaction. + /// - paymentInstruction: Any additional payment instructions for PayPal for Partner customers. + /// - description: The purchase description. + /// - customID: The API caller-provided external ID. + /// - invoice: The API caller-provided external invoice number for this order. + /// - softDescriptor: The payment descriptor on the customer's credit card statement of account transactions. + /// - items: An array of items that the customer is purchasing from the merchant. + /// - shipping: The name and address of the person to whom to ship the items. + public init( + reference: Failable>, + amount: DetailedAmount, + payee: PayeeBase?, + paymentInstruction: PaymentInstruction?, + description: Optional127String, + customID: Optional127String, + invoice: Optional127String, + softDescriptor: Failable>, + items: [Order.Item]?, + shipping: Shipping? + ) { + self.reference = reference + self.amount = amount + self.payee = payee + self.paymentInstruction = paymentInstruction + self.description = description + self.customID = customID + self.invoice = invoice + self.softDescriptor = softDescriptor + self.items = items + self.shipping = shipping + } + + enum CodingKeys: String, CodingKey { + case amount, payee, description, items, shipping + case reference = "reference_id" + case paymentInstruction = "payment_instruction" + case customID = "custom_id" + case invoice = "invoice_id" + case softDescriptor = "soft_descriptor" + } +} From fb9a42f763398df1e2489c1ee25335c5b90969c3 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 09:50:35 -0500 Subject: [PATCH 106/160] Created PaymentMethod struct with PayerSelected and PayeePrefered sub-enums --- .../ApplicationContext/PaymentMethod.swift | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Sources/V2/Models/ApplicationContext/PaymentMethod.swift diff --git a/Sources/V2/Models/ApplicationContext/PaymentMethod.swift b/Sources/V2/Models/ApplicationContext/PaymentMethod.swift new file mode 100644 index 00000000..87ec5734 --- /dev/null +++ b/Sources/V2/Models/ApplicationContext/PaymentMethod.swift @@ -0,0 +1,35 @@ +/// The customer and merchant payment preferences for a given app context. +public struct PaymentMethod: Codable { + + /// The customer-selected payment method on the merchant site. + public var payer: PayerSelected? + + /// The merchant-preferred payment sources. + public var payee: PayeePrefered? + + public init(payer: PayerSelected?, payee: PayeePrefered? = .unrestricted) { + self.payer = payer + self.payee = payee + } + + /// The customer-selected payment methods. + public enum PayerSelected: String, Hashable, CaseIterable, Codable { + + /// When payer chooses PayPal Credit as the payment method. + case credit = "PAYPAL_CREDIT" + + /// When payer chooses PayPal as the payment method + case paypal = "PAYPAL" + } + + /// The merchant-preferred payment sources. + public enum PayeePrefered: String, Hashable, CaseIterable, Codable { + + /// (Default) Accepts any type of payment from the customer. + case unrestricted = "UNRESTRICTED" + + /// Accepts only immediate payment from the customer. For example, credit card, PayPal balance, or instant ACH. + /// Ensures that at the time of capture, the payment does not have the `pending` status. + case immediate = "IMMEDIATE_PAYMENT_REQUIRED" + } +} From fb8921e7bf04e51cab6db523df1a2f7a15d7e12d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 10:54:04 -0500 Subject: [PATCH 107/160] Created AppContext struct --- .../ApplicationContext/AppContext.swift | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Sources/V2/Models/ApplicationContext/AppContext.swift diff --git a/Sources/V2/Models/ApplicationContext/AppContext.swift b/Sources/V2/Models/ApplicationContext/AppContext.swift new file mode 100644 index 00000000..421d0311 --- /dev/null +++ b/Sources/V2/Models/ApplicationContext/AppContext.swift @@ -0,0 +1,121 @@ +import Failable +import PayPal + +/// Used to customize the payer's experience during the approval process for a PayPal payment. +public struct AppContext: Codable { + + /// The label that overrides the business name in the PayPal account on the PayPal site. + public var brand: Optional127String + + /// The BCP 47-formatted locale of pages that the PayPal payment experience shows. PayPal supports a five-character code. + /// For example, `da-DK`, `he-IL`, `id-ID`, `ja-JP`, `no-NO`, `pt-BR`, `ru-RU`, `sv-SE`, `th-TH`, `zh-CN`, or `zh-HK`. + public var locale: Failable> + + /// The type of landing page to show on the PayPal site for customer checkout. + public var landingPage: LandingPage? + + /// The shipping preference: + /// - Displays the shipping address to the customer. + /// - Enables the customer to choose an address on the PayPal site. + /// - Restricts the customer from changing the address during the payment-approval process. + public var shipping: ShippingPreference? + + /// Configures a **Continue** or **Pay Now** checkout flow. + public var userAction: UserAction? + + /// The customer and merchant payment preferences. + public var payment: PaymentMethod? + + /// The URL where the customer is redirected after the customer approves the payment. + public var `return`: String? + + /// The URL where the customer is redirected after the customer cancels the payment. + public var cancel: String? + + + /// Creates a new `AppContext` instance. + /// + /// - Parameters: + /// - brand: The label that overrides the business name in the PayPal account on the PayPal site. + /// - locale: The BCP 47-formatted locale of pages that the PayPal payment experience shows. + /// - landingPage: The type of landing page to show on the PayPal site for customer checkout. Defaults to `.login`. + /// - shipping: The shipping preference: + /// - Displays the shipping address to the customer. + /// - Enables the customer to choose an address on the PayPal site. + /// - Restricts the customer from changing the address during the payment-approval process. + /// Detaults to `.fromFile`. + /// - userAction: Configures a **Continue** or **Pay Now** checkout flow. + /// - payment: The customer and merchant payment preferences. + /// - return: The URL where the customer is redirected after the customer approves the payment. + /// - cancel: The URL where the customer is redirected after the customer cancels the payment. + public init( + brand: Optional127String, + locale: Failable>, + landingPage: LandingPage? = .login, + shipping: ShippingPreference? = .fromFile, + userAction: UserAction?, + payment: PaymentMethod?, + `return`: String?, + cancel: String? + ) { + self.brand = brand + self.locale = locale + self.landingPage = landingPage + self.shipping = shipping + self.userAction = userAction + self.payment = payment + self.`return` = `return` + self.cancel = cancel + } + + /// The options for what type of landing page to show on the PayPal site for customer checkout. + public enum LandingPage: String, Hashable, CaseIterable, Codable { + + /// (Default) When the customer clicks **PayPal Checkout**, the customer is redirected to a page + /// to log in to PayPal and approve the payment. + case login = "LOGIN" + + /// When the customer clicks **PayPal Checkout**, the customer is redirected to a page to enter credit + /// or debit card and other relevant billing information required to complete the purchase. + case billing = "BILLING" + } + + /// The shipping preferance options for a given app context. + public enum ShippingPreference: String, Hashable, CaseIterable, Codable { + + /// (Default) Use the customer-provided shipping address on the PayPal site. + case fromFile = "GET_FROM_FILE" + + /// Redact the shipping address from the PayPal site. Recommended for digital goods. + case none = "NO_SHIPPING" + + /// Use the merchant-provided address. The customer cannot change this address on the PayPal site. + case provided = "SET_PROVIDED_ADDRESS" + } + + + /// The configuration options for a **Continue** or **Pay Now** checkout flow. + public enum UserAction: String, Hashable, CaseIterable, Codable { + + /// (Default) After you redirect the customer to the PayPal payment page, a **Continue** button appears. + /// Use this option when the final amount is not known when the checkout flow is initiated and you want + /// to redirect the customer to the merchant page without processing the payment. + case `continue` = "CONTINUE" + + /// After you redirect the customer to the PayPal payment page, a **Pay Now** button appears. + /// Use this option when the final amount is known when the checkout is initiated and you want to + /// process the payment immediately when the customer clicks **Pay Now**. + case payNow = "PAY_NOW" + } + + enum CodingKeys: String, CodingKey { + case locale + case brand = "brand_name" + case landingPage = "landing_page" + case shipping = "shipping_preference" + case userAction = "user_action" + case payment = "payment_method" + case `return` = "return_url" + case cancel = "cancel_url" + } +} From d1a7a82ea6b0c7a49bed5abb986db882792facd0 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 11:12:13 -0500 Subject: [PATCH 108/160] Created Order struct --- Sources/V2/Models/Order/Order.swift | 60 ++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift index 5d46e17d..92b2280f 100644 --- a/Sources/V2/Models/Order/Order.swift +++ b/Sources/V2/Models/Order/Order.swift @@ -1,4 +1,62 @@ -public struct Order: Codable { } +import Foundation +import PayPal + +/// And order object from PayPal. +public struct Order: Codable { + + /// The intent to either capture payment immediately or authorize a payment for an order after order creation. + public var intent: Intent? + + /// The customer who approves and pays for the order. The customer is also known as the payer. + public var payer: Payer? + + /// An array of purchase units. Each purchase unit establishes a contract between a customer and merchant. + /// Each purchase unit represents either a full or partial order that the customer intends to purchase from the merchant. + public var purchaseUnits: [PurchaseUnit]? + + /// The date and time when the transaction occurred. + public let created: Date? + + /// The date and time when the transaction was last updated. + public let updated: Date? + + /// The ID of the order. + public let id: String? + + /// The order status. + public let status: Status? + + /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + /// To complete payer approval, use the `approve` link with the `GET` method. + public let links: [LinkDescription]? + + /// Creates a new `Order` instance. + /// + /// - Parameters: + /// - intent: The intent to either capture payment immediately or authorize a payment for an order after order creation. + /// - payer: The customer who approves and pays for the order. The customer is also known as the payer. + /// - purchaseUnits: An array of purchase units. Each purchase unit establishes a contract between a customer and + /// merchant. Each purchase unit represents either a full or partial order that the customer intends to purchase + /// from the merchant. + public init(intent: Intent?, payer: Payer?, purchaseUnits: [PurchaseUnit]?) { + self.intent = intent + self.payer = payer + self.purchaseUnits = purchaseUnits + + self.created = nil + self.updated = nil + self.id = nil + self.status = nil + self.links = nil + } + + enum CodingKeys: String, CodingKey { + case intent, payer, id, status, links + case purchaseUnits = "purchase_units" + case created = "create_time" + case updated = "update_time" + } +} extension Order { From ed1229537fb26e60a106bcb8dbfce7c1cdb59a7d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 11:17:10 -0500 Subject: [PATCH 109/160] Created Order.Request struct --- Sources/V2/Models/Order/Order.swift | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift index 92b2280f..b2096cc2 100644 --- a/Sources/V2/Models/Order/Order.swift +++ b/Sources/V2/Models/Order/Order.swift @@ -50,6 +50,45 @@ public struct Order: Codable { self.links = nil } + /// The request structure to create a new `Order`. + struct Request: Codable { + + /// The intent to either capture payment immediately or authorize a payment for an order after order creation. + public var intent: Intent + + /// The customer who approves and pays for the order. The customer is also known as the payer. + public var payer: Payer? + + /// An array of purchase units. At present only 1 purchase_unit is supported. Each purchase unit establishes a + /// contract between a payer and the payee. Each purchase unit represents either a full or partial order that + /// the payer intends to purchase from the payee. + public var purchaseUnits: [PurchaseUnit] + + /// Customize the payer experience during the approval process for the payment with PayPal. + public var context: AppContext? + + /// Creates a new `Order.Request` instance. + /// + /// - Parameters: + /// - intent: The intent to either capture payment immediately or + /// authorize a payment for an order after order creation. + /// - payer: The customer who approves and pays for the order. + /// - purchaseUnits: An array of purchase units. + /// - context: Customize the payer experience during the approval process for the payment with PayPal. + public init (intent: Intent, payer: Payer?, purchaseUnits: [PurchaseUnit], context: AppContext?) { + self.intent = intent + self.payer = payer + self.purchaseUnits = purchaseUnits + self.context = context + } + + enum CodingKeys: String, CodingKey { + case intent, payer + case purchaseUnits = "purchase_units" + case context = "application_context" + } + } + enum CodingKeys: String, CodingKey { case intent, payer, id, status, links case purchaseUnits = "purchase_units" From 3f264eacd01c1d3056b016d785ef3394a8f6c920 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 15:28:37 -0500 Subject: [PATCH 110/160] Created YearMonthDate struct --- Sources/V2/Utilities/YearMonthDate.swift | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Sources/V2/Utilities/YearMonthDate.swift diff --git a/Sources/V2/Utilities/YearMonthDate.swift b/Sources/V2/Utilities/YearMonthDate.swift new file mode 100644 index 00000000..a474ed0e --- /dev/null +++ b/Sources/V2/Utilities/YearMonthDate.swift @@ -0,0 +1,68 @@ +import Foundation +import PayPal +import NIO + +/// A date that only contains year and month information, like a credit card expiration date. +public struct YearMonthDate: Codable { + internal static let typeSafeFormatter: ThreadSpecificVariable = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM" + return ThreadSpecificVariable(value: formatter) + }() + + internal static var formatter: DateFormatter? { + return YearMonthDate.typeSafeFormatter.currentValue + } + + /// The underlying date instance. + public var date: Date + + /// Creates a new `YearMonthDate` instance from a `Date`. + /// + /// - Parameter date: The `Date` instance to initialize from. The date that will be stored will have all + /// information except that year and month removed, so `2019-04-02 20:16:53 +0000` becomes `2019-04-01 00:00:00 +0000`. + public init(_ date: Date) { + var calendar = Calendar(identifier: .iso8601) + calendar.timeZone = TimeZone(secondsFromGMT: 0) ?? calendar.timeZone + self.date = calendar.date(from: calendar.dateComponents([.year, .month], from: date)) ?? date + } + + /// Creates a new `YearMonthDate` instance from a `String` containg that date information. + /// + /// - Parameter string: The string with the date information, using the `yyyy-MM` format. + /// If a date cannot be extracted from the string, the initializer will return `nil`. + public init?(string: String) { + guard let date = YearMonthDate.formatter?.date(from: string) else { return nil } + self.date = date + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder)throws { + let string = try decoder.singleValueContainer().decode(String.self) + guard let date = YearMonthDate.formatter?.date(from: string) else { + throw DecodingError.typeMismatch( + Date.self, + DecodingError.Context(codingPath: [], debugDescription: "Cannot get date from string `\(string)`") + ) + } + + self.date = date + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + public func encode(to encoder: Encoder)throws { + var container = encoder.singleValueContainer() + guard let string = YearMonthDate.formatter?.string(from: date) else { + throw PayPalError( + status: .internalServerError, + identifier: "missingFormatter", + reason: "No date formatter has been initialized for the current thread for `YearMonthDate`" + ) + } + + try container.encode(string) + } +} From fc3b3e0a62c6ed0d329f3437676bb528dbbfb515 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Tue, 2 Apr 2019 16:24:51 -0500 Subject: [PATCH 111/160] Created PaymentSource.Card struct and .CardType enum --- Sources/V2/Models/PaymentSource/Card.swift | 139 ++++++++++++++++++ .../Models/PaymentSource/PaymentSource.swift | 1 + 2 files changed, 140 insertions(+) create mode 100644 Sources/V2/Models/PaymentSource/Card.swift create mode 100644 Sources/V2/Models/PaymentSource/PaymentSource.swift diff --git a/Sources/V2/Models/PaymentSource/Card.swift b/Sources/V2/Models/PaymentSource/Card.swift new file mode 100644 index 00000000..b614902b --- /dev/null +++ b/Sources/V2/Models/PaymentSource/Card.swift @@ -0,0 +1,139 @@ +import PayPal + +extension PaymentSource { + + /// A payment card used to fund a transaction. This can be a credit card or a debit card. + public struct Card: Codable { + + /// The PayPal-generated ID for the card. + public let id: String? + + /// The last digits of the payment card. + public let suffix: Failable> + + /// The card brand or network. Typically used in the response. + public let type: CardType? + + /// The card holder's name as it appears on the card. + public var name: Optional300String + + /// The primary account number (PAN) for the payment card. + public var number: Failable + + /// The card expiration year and month. + public var expiry: YearMonthDate + + /// The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. + public var securityCode: Failable> + + /// The billing address for this card. Supports only the `address_line_1`, `address_line_2`, `admin_area_1`, + /// `admin_area_2`, `postal_code`, and `country_code` properties. + public var billing: Address? + + /// Creates a new `PaymentSource.Card` instance. + /// + /// - Parameters: + /// - name: The card holder's name as it appears on the card. + /// - number: The primary account number (PAN) for the payment card. + /// - expiry: The card expiration year and month. + /// - securityCode: The three- or four-digit security code of the card. + public init( + name: Optional300String, + number: Failable, + expiry: YearMonthDate, + securityCode: Failable>, + billing: Address? + ) { + self.id = nil + self.suffix = nil + self.type = nil + + self.name = name + self.number = number + self.expiry = expiry + self.securityCode = securityCode + self.billing = billing + } + + /// The validator for the `PaymentSource.Card.number` property value. + public struct Number: RegexValidation { + + /// See `RegexValidator.patter`. + public static let pattern: String = #"^\d{13,19}$"# + } + + /// The validator for the `PaymentSource.Card.securityCode` property value. + public struct SecurityCode: RegexValidation { + + /// See `RegexValidator.patter`. + public static let pattern: String = "[0-9]{3,4}" + } + + /// The validator for the `PaymentSource.Card.suffix` property, + public struct Suffix: RegexValidation { + + /// See `RegexValidator.patter`. + public static let pattern: String = "[0-9]{2,}" + } + + enum CodingKeys: String, CodingKey { + case id, name, number, expiry + case suffix = "last_digits" + case type = "card_type" + case securityCode = "security_code" + case billing = "billing_address" + } + } + + /// The valid card brand or network options for a `PaymentSource.Card` instance. + public enum CardType: String, Hashable, CaseIterable, Codable { + + /// Visa card. + case visa = "VISA" + + /// MasterCard card. + case mastercard = "MASTERCARD" + + /// Discover card. + case discover = "DISCOVER" + + /// American Express card. + case amex = "AMEX" + + /// Solo debit card. + case solo = "SOLO" + + /// Japan Credit Bureau card. + case jcb = "JCB" + + /// Military Star card. + case star = "STAR" + + /// Delta Airlines card. + case delta = "DELTA" + + /// Switch credit card. + case `switch` = "SWITCH" + + /// Maestro credit card. + case maestro = "MAESTRO" + + /// Carte Bancaire (CB) credit card. + case cbNationale = "CB_NATIONALE" + + /// Configoga credit card. + case configoga = "CONFIGOGA" + + /// Confidis credit card. + case confidis = "CONFIDIS" + + /// Visa Electron credit card. + case electron = "ELECTRON" + + /// Cetelem credit card. + case cetelem = "CETELEM" + + /// China union pay credit card. + case chinaUnionPay = "CHINA_UNION_PAY" + } +} diff --git a/Sources/V2/Models/PaymentSource/PaymentSource.swift b/Sources/V2/Models/PaymentSource/PaymentSource.swift new file mode 100644 index 00000000..74b5e908 --- /dev/null +++ b/Sources/V2/Models/PaymentSource/PaymentSource.swift @@ -0,0 +1 @@ +public struct PaymentSource: Codable { } From a024f65f850e75f9399bb22d5de32b702e65a2ef Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 07:37:45 -0500 Subject: [PATCH 112/160] Created PaymentSource.Token struct and .TokenType enum --- Sources/V2/Models/PaymentSource/Token.swift | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Sources/V2/Models/PaymentSource/Token.swift diff --git a/Sources/V2/Models/PaymentSource/Token.swift b/Sources/V2/Models/PaymentSource/Token.swift new file mode 100644 index 00000000..f01b73ee --- /dev/null +++ b/Sources/V2/Models/PaymentSource/Token.swift @@ -0,0 +1,51 @@ +import Failable + +extension PaymentSource { + + /// A tokenized payment source to fund a payment. + public struct Token: Codable { + + /// The PayPal-generated ID for the token. + public var id: Failable + + /// The tokenization method that was used to generate the ID. + public var type: TokenType + + /// Creates a new `PaymentSource.Token` instance. + /// + /// - Parameters: + /// - id: The PayPal-generated ID for the token. + /// - type: The tokenization method that was used to generate the ID. + public init(id: Failable, type: TokenType) { + self.id = id + self.type = type + } + + /// The validation for the `PaymentSource.Token.id` property value. + public struct ID: LengthValidation { + + /// See `Validation.Suppoorted`. + public typealias Supported = String + + /// See `LengthValidation.minLength`. + public static var minLength: Int = 1 + + /// See `LengthValidation.maxLength`. + public static var maxLength: Int = 255 + } + } + + /// The tokenization method that was used to generate the ID for a `PaymentSource.Token` instance. + public enum TokenType: String, Hashable, CaseIterable, Codable { + + /// A secure, one-time-use reference to a payment source, such as payment card, PayPal account, and so on. + case nonce = "NONCE" + + /// The payment method token, which is a reference to a transactional payment source. + /// Typically stored on the merchant's server. + case paymentMethod = "PAYMENT_METHOD_TOKEN" + + /// The PayPal billing agreement ID. References an approved recurring payment for goods or services. + case billingAgreement = "BILLING_AGREEMENT" + } +} From b05bfa634b489f2503022bee52c1fe3408ab7ca1 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 07:44:54 -0500 Subject: [PATCH 113/160] Created PaymentSource struct --- .../Models/PaymentSource/PaymentSource.swift | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/V2/Models/PaymentSource/PaymentSource.swift b/Sources/V2/Models/PaymentSource/PaymentSource.swift index 74b5e908..48d3da6d 100644 --- a/Sources/V2/Models/PaymentSource/PaymentSource.swift +++ b/Sources/V2/Models/PaymentSource/PaymentSource.swift @@ -1 +1,19 @@ -public struct PaymentSource: Codable { } +/// The source of payment for a transaction, which can be a token or a card. +public struct PaymentSource: Codable { + + /// The payment card to use to fund a payment. Can be a credit or debit card. + public var card: Card? + + /// The tokenized payment source to fund a payment. + public var token: Token? + + /// Creates a new `PaymentSource` instance. + /// + /// - Parameters: + /// - card: The payment card to use to fund a payment. + /// - token: The tokenized payment source to fund a payment. + public init(card: Card?, token: Token?) { + self.card = card + self.token = token + } +} From 2008840eea33a2a521bb9717d8a1aebe6b66b38d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 07:50:33 -0500 Subject: [PATCH 114/160] Changed Order.Request access level to public --- Sources/V2/Models/Order/Order.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift index b2096cc2..bee878d3 100644 --- a/Sources/V2/Models/Order/Order.swift +++ b/Sources/V2/Models/Order/Order.swift @@ -51,7 +51,7 @@ public struct Order: Codable { } /// The request structure to create a new `Order`. - struct Request: Codable { + public struct Request: Codable { /// The intent to either capture payment immediately or authorize a payment for an order after order creation. public var intent: Intent From a2f76c6347c52b1f0a13be8d5bebffae79740bac Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 08:00:28 -0500 Subject: [PATCH 115/160] Created Orders VersionedController class --- Sources/V2/Controllers/Orders/Orders.swift | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Sources/V2/Controllers/Orders/Orders.swift diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift new file mode 100644 index 00000000..ae9ebc8b --- /dev/null +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -0,0 +1,23 @@ +import PayPal +import Vapor + +/// Use the Orders API to create, update, show details for, authorize and capture payments for, save, and void orders. +/// For more information, see the [PayPal Checkout Overview](https://developer.paypal.com/docs/checkout/). +/// +/// # Orders +/// +/// Use the `/orders` resource to create, update, show details for, and authorize and capture payments for orders. +public final class Orders: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["checkout", "orders"] + } +} From 7a7041ece72c34acc168a2ea08a9f9a2a560404a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 08:01:03 -0500 Subject: [PATCH 116/160] Created Orders.create(order:attribution:prefer:) method --- Sources/V2/Controllers/Orders/Orders.swift | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift index ae9ebc8b..65b4a886 100644 --- a/Sources/V2/Controllers/Orders/Orders.swift +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -20,4 +20,27 @@ public final class Orders: VersionedController { self.client = client self.resource = ["checkout", "orders"] } + + /// Creates an order. Supports orders with only one purchase unit. + /// + /// A successful request returns the HTTP 201 Created status code and a JSON response body that includes by default a + /// minimal response with the ID, status, and HATEOAS links. If you require the complete order resource representation, + /// you must pass the `.representation` value to the `prefer` parameter. This header value is not the default. + /// + /// - Parameters: + /// - order: The request body. This information is used to create an `Order` object. + /// - attribution: Identifies the caller as a PayPal partner. + /// - prefer: The value of the `Prefer` header. Defaults to `.minimal`. + /// + /// - Returns: The `Order` object created by PayPal, wrapped in an `EventLoopFuture`. + public func create( + order: Order.Request, attribution: String? = nil, prefer: PreferResponse = .minimal + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Content-Type": MediaType.json.serialize(), "Prefer": prefer.rawValue] + if let attribution = attribution { + headers.add(name: .paypalAttribution, value: attribution) + } + + return self.client.post(self.path, headers: headers, body: order, as: Order.self) + } } From b6e06aa1b23c96fe95bfa70e6805ce66a35da204 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 08:17:23 -0500 Subject: [PATCH 117/160] Created Orders.update(order:with:) method --- Sources/V2/Controllers/Orders/Orders.swift | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift index 65b4a886..d87d1340 100644 --- a/Sources/V2/Controllers/Orders/Orders.swift +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -43,4 +43,37 @@ public final class Orders: VersionedController { return self.client.post(self.path, headers: headers, body: order, as: Order.self) } + + /// Updates an order with the `CREATED` or `APPROVED` status. You cannot update an order with the `COMPLETED` status. + /// + /// To make an update, you must provide a `reference_id`. If you omit a `reference_id` for an order with one purchase unit, + /// PayPal defaults to a `reference_id` of `1`, which enables you to use a path: + /// + /// "path": "/purchase_units/@reference_id=='1'/{attribute-or-object}" + /// + /// You can patch these attributes and objects to complete these operations: + /// - `intent` — replace. + /// - `purchase_units` — replace, add. + /// - `purchase_units[].custom_id` — replace, add, remove. + /// - `purchase_units[].description` — replace, add, remove. + /// - `purchase_units[].payee.email` — replace, add. + /// - `purchase_units[].shipping` — replace, add, remove. + /// - `purchase_units[].soft_descriptor` — replace, add, remove. + /// - `purchase_units[].amount` — replace. + /// - `purchase_units[].invoice_id` — replace, add, remove. + /// - `purchase_units[].payment_instruction` — replace. + /// - `purchase_units[].payment_instruction.disbursement_mode` — replace. + /// - Note: By default, `disbursement_mode` is `INSTANT`. + /// - `purchase_units[].payment_instruction.platform_fees` — replace, add, remove. + /// + /// A successful request returns the HTTP 204 No Content status code with an empty object in the JSON response body. + /// + /// - Parameters: + /// - order: The ID of the order to update. + /// - patches: An array of JSON patch objects to apply partial updates to resources. + /// + /// - Returns: A void `EventLoopFuture` that succedes when the update completes. + public func update(order: String, with patches: [Patch]) -> EventLoopFuture { + return self.client.post(self.path + order, body: patches, as: HTTPStatus.self).transform(to: ()) + } } From f0dc09b5017aa667dbd9ef9e1c2f3fbdc6180393 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 09:08:35 -0500 Subject: [PATCH 118/160] Created Orders.get(order:) method --- Sources/V2/Controllers/Orders/Orders.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift index d87d1340..ffa42e36 100644 --- a/Sources/V2/Controllers/Orders/Orders.swift +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -76,4 +76,14 @@ public final class Orders: VersionedController { public func update(order: String, with patches: [Patch]) -> EventLoopFuture { return self.client.post(self.path + order, body: patches, as: HTTPStatus.self).transform(to: ()) } + + /// Shows details for an order, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows order details. + /// + /// - Parameter order: The ID of the order for which to show details. + /// - Returns: The order object for the given ID, wrapped in an `EventLoopFuture`. + public func get(order: String) -> EventLoopFuture { + return self.client.get(self.path + order, as: Order.self) + } } From 53386a441c43316b5b6d2e0bba55c146309df803 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 09:23:12 -0500 Subject: [PATCH 119/160] Created Order.authorize(order:payment:request:prefer:clientMetadata:authAssertion) method --- Sources/V2/Controllers/Orders/Orders.swift | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift index ffa42e36..f63faa60 100644 --- a/Sources/V2/Controllers/Orders/Orders.swift +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -86,4 +86,44 @@ public final class Orders: VersionedController { public func get(order: String) -> EventLoopFuture { return self.client.get(self.path + order, as: Order.self) } + + + /// Authorizes payment for an order. The response shows details of authorizations. + /// You can make this call only if you specified the `intent` property as `AUTHORIZE` in the create order call. + /// + /// A successful response to a non-idempotent request returns the HTTP 201 Created status code with a JSON response + /// body that shows authorized payment details. If a duplicate response is retried, returns the HTTP 200 OK status code. + /// By default, the response is minimal. If you need the complete resource representation, you must pass the + /// `.representation` value to the `prefer` parameter. + /// + /// - Parameters: + /// - order: The ID of the order for which to authorize. + /// - payment: The source of payment for the order, which can be a token or a card. Use this object only if + /// you have not redirected the user after order creation to approve the payment. In such cases, the + /// user-selected payment method in the PayPal flow is implicitly used. + /// - request: A unique user-generated ID that you can use to enforce idempotency. + /// - prefer: The preferred server response upon successful completion of the request. + /// - clientMetadata: Verifies that the payment originates from a valid, user-consented device and application. + /// - authAssertion: An API client-provided JSON Web Token (JWT) assertion that identifies the merchant. + public func authorize( + order: String, + payment: PaymentSource?, + request: String? = nil, + prefer: PreferResponse = .minimal, + clientMetadata: String? = nil, + authAssertion: String? = nil + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Content-Type": MediaType.json.serialize(), "Prefer": prefer.rawValue] + if let req = request { + headers.add(name: .paypalRequest, value: req) + } + if let metadata = clientMetadata { + headers.add(name: .paypalMetadata, value: metadata) + } + if let auth = authAssertion { + headers.add(name: .paypalAuth, value: auth) + } + + return self.client.post(self.path + order + "/authorize", headers: headers, body: payment, as: Order.self) + } } From 2eb7e9db5adacc32cb2973f5a73f7aca1daed658 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 09:26:15 -0500 Subject: [PATCH 120/160] Created Order.capture(order:payment:request:prefer:clientMetadata:authAssertion) method --- Sources/V2/Controllers/Orders/Orders.swift | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Sources/V2/Controllers/Orders/Orders.swift b/Sources/V2/Controllers/Orders/Orders.swift index f63faa60..e0b531a5 100644 --- a/Sources/V2/Controllers/Orders/Orders.swift +++ b/Sources/V2/Controllers/Orders/Orders.swift @@ -126,4 +126,40 @@ public final class Orders: VersionedController { return self.client.post(self.path + order + "/authorize", headers: headers, body: payment, as: Order.self) } + + /// Captures a payment for an order. + /// + /// A successful response to a non-idempotent request returns the HTTP 201 Created status code with a JSON response body + /// that shows captured payment details. If a duplicate response is retried, returns the HTTP 200 OK status code. + /// By default, the response is minimal. If you need the complete resource representation, pass the `.representation` + /// value to the `prefer` parameter. + /// + /// - Parameters: + /// - order: The ID of the order for which to capture a payment. + /// - payment: The payment source definition. + /// - request: A unique user-generated ID that you can use to enforce idempotency. + /// - prefer: The preferred server response upon successful completion of the request. + /// - clientMetadata: Verifies that the payment originates from a valid, user-consented device and application. + /// - authAssertion: An API client-provided JSON Web Token (JWT) assertion that identifies the merchant. + public func capture( + order: String, + payment: PaymentSource?, + request: String? = nil, + prefer: PreferResponse = .minimal, + clientMetadata: String? = nil, + authAssertion: String? = nil + ) -> EventLoopFuture { + var headers: HTTPHeaders = ["Content-Type": MediaType.json.serialize(), "Prefer": prefer.rawValue] + if let req = request { + headers.add(name: .paypalRequest, value: req) + } + if let metadata = clientMetadata { + headers.add(name: .paypalMetadata, value: metadata) + } + if let auth = authAssertion { + headers.add(name: .paypalAuth, value: auth) + } + + return self.client.post(self.path + order + "/capture", headers: headers, body: payment, as: Order.self) + } } From b9e7347154ec13cb6f890fafc8081e763ad86333 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Wed, 3 Apr 2019 10:30:41 -0500 Subject: [PATCH 121/160] Changed Order.created and .updated types from Date to ISO8601Date --- Sources/V2/Models/Order/Order.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/V2/Models/Order/Order.swift b/Sources/V2/Models/Order/Order.swift index bee878d3..e4409ecf 100644 --- a/Sources/V2/Models/Order/Order.swift +++ b/Sources/V2/Models/Order/Order.swift @@ -15,10 +15,10 @@ public struct Order: Codable { public var purchaseUnits: [PurchaseUnit]? /// The date and time when the transaction occurred. - public let created: Date? + public let created: ISO8601Date? /// The date and time when the transaction was last updated. - public let updated: Date? + public let updated: ISO8601Date? /// The ID of the order. public let id: String? From 749f9c031334be3b6fde798f91688a2af1193cae Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 10:26:46 -0500 Subject: [PATCH 122/160] Created EventType struct and .Version sub-struct and .Name sub-enum --- Sources/V1/Models/Webhook/EventType.swift | 289 ++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 Sources/V1/Models/Webhook/EventType.swift diff --git a/Sources/V1/Models/Webhook/EventType.swift b/Sources/V1/Models/Webhook/EventType.swift new file mode 100644 index 00000000..de5e5833 --- /dev/null +++ b/Sources/V1/Models/Webhook/EventType.swift @@ -0,0 +1,289 @@ +import Failable + +/// An event that will fire a registered webhook. +public struct EventType: Codable { + + /// The unique event name. + public var name: Name + + /// A human-readable description of the event. + public let description: String? + + /// The status of a webhook event. + public let status: String? + + /// The resource versions in the webhook notification. + public let versions: [Version]? + + /// Creates a new `EventType` instance. + /// + /// - Parameters: + /// - name: The unique event name. + /// - description: A human-readable description of the event. + /// - status: The status of a webhook event. + /// - versions: The resource versions in the webhook notification. + public init( + name: Name, + description: String?, + status: String?, + versions: [Version]? + ) { + self.name = name + self.description = description + self.status = status + self.versions = versions + } + + /// The validator for the `EventType.versions` property value. + public struct Version: Codable { + + /// The value which makes the major value of the version, i.e. `1.x`. + public var major: Int + + /// The value which makes the minor value of the version, i.e. `x.0`. + public var minor: Int + + /// Creates a new `EventType.Version` instance. + /// + /// - Parameters: + /// - major: The value which makes the major value of the version. + /// - minor: The value which makes the minor value of the version. + public init(major: Int, minor: Int) { + self.major = major + self.minor = minor + } + + /// Creates an `EventType` instance. + /// + /// - Parameter string: A string containing the version data, i.e. `1.0`. + public init?(_ string: String) { + + // FIXME: - We only convert to a `String` because otherwise we get a compiler crash. + // Remove that operation when the compiler gets fixed: https://bugs.swift.org/browse/SR-10305 + let components = string.split(separator: ".").map(String.init) + guard components.count == 2 else { return nil } + guard let major = components.first.flatMap(Int.init) else { return nil } + guard let minor = components.last.flatMap(Int.init) else { return nil } + + self.major = major + self.minor = minor + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder)throws { + let container = try decoder.singleValueContainer() + let version = try container.decode(String.self) + + guard let instance = Version(version) else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Cannot get version components from string \(version)" + ) + } + + self = instance + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + public func encode(to encoder: Encoder)throws { + var container = encoder.singleValueContainer() + let version = "\(self.major).\(self.minor)" + + try container.encode(version) + } + } + + /// The webhook events that are supported by PayPal. + public enum Name: String, Hashable, CaseIterable, Codable { + + /// `PAYMENT.AUTHORIZATION.CREATED` + case authorizationCreated = "PAYMENT.AUTHORIZATION.CREATED" + + /// `PAYMENT.AUTHORIZATION.VOIDED` + case authorizationVoided = "PAYMENT.AUTHORIZATION.VOIDED" + + /// `PAYMENT.CAPTURE.COMPLETED` + case captureCompleted = "PAYMENT.CAPTURE.COMPLETED" + + /// `PAYMENT.CAPTURE.DENIED` + case captureDenied = "PAYMENT.CAPTURE.DENIED" + + /// `PAYMENT.CAPTURE.PENDING` + case capturePending = "PAYMENT.CAPTURE.PENDING" + + /// `PAYMENT.CAPTURE.REFUNDED` + case captureRefunded = "PAYMENT.CAPTURE.REFUNDED" + + /// `PAYMENT.CAPTURE.REVERSED` + case captureReversed = "PAYMENT.CAPTURE.REVERSED" + + + /// `PAYMENT.PAYOUTSBATCH.DENIED` + case payoutbatchDenied = "PAYMENT.PAYOUTSBATCH.DENIED" + + /// `PAYMENT.PAYOUTSBATCH.PROCESSING` + case payoutbatchProcessing = "PAYMENT.PAYOUTSBATCH.PROCESSING" + + /// `PAYMENT.PAYOUTSBATCH.SUCCESS` + case payoutbatchSuccess = "PAYMENT.PAYOUTSBATCH.SUCCESS" + + /// `PAYMENT.PAYOUTS-ITEM.BLOCKED` + case payoutItemBlocked = "PAYMENT.PAYOUTS-ITEM.BLOCKED" + + /// `PAYMENT.PAYOUTS-ITEM.CANCELED` + case payoutItemCanceled = "PAYMENT.PAYOUTS-ITEM.CANCELED" + + /// `PAYMENT.PAYOUTS-ITEM.DENIED` + case payoutItemDenied = "PAYMENT.PAYOUTS-ITEM.DENIED" + + /// `PAYMENT.PAYOUTS-ITEM.FAILED` + case payoutItemFailed = "PAYMENT.PAYOUTS-ITEM.FAILED" + + /// `PAYMENT.PAYOUTS-ITEM.HELD` + case payoutItemHeld = "PAYMENT.PAYOUTS-ITEM.HELD" + + /// `PAYMENT.PAYOUTS-ITEM.REFUNDED` + case payoutItemRefunded = "PAYMENT.PAYOUTS-ITEM.REFUNDED" + + /// `PAYMENT.PAYOUTS-ITEM.RETURNED` + case payoutItemReturned = "PAYMENT.PAYOUTS-ITEM.RETURNED" + + /// `PAYMENT.PAYOUTS-ITEM.SUCCEEDED` + case payoutItemSucceeded = "PAYMENT.PAYOUTS-ITEM.SUCCEEDED" + + /// `PAYMENT.PAYOUTS-ITEM.UNCLAIMED` + case payoutItemUnclaimed = "PAYMENT.PAYOUTS-ITEM.UNCLAIMED" + + + /// `BILLING_AGREEMENTS.AGREEMENT.CREATED` + case agreementCreated = "BILLING_AGREEMENTS.AGREEMENT.CREATED" + + /// `BILLING_AGREEMENTS.AGREEMENT.CANCELLED` + case agreementCancelled = "BILLING_AGREEMENTS.AGREEMENT.CANCELLED" + + /// `BILLING.PLAN.CREATED` + case planCreated = "BILLING.PLAN.CREATED" + + /// `BILLING.PLAN.UPDATED` + case planeUpdated = "BILLING.PLAN.UPDATED" + + /// `BILLING.SUBSCRIPTION.CANCELLED` + case subscriptionCancelled = "BILLING.SUBSCRIPTION.CANCELLED" + + /// `BILLING.SUBSCRIPTION.CREATED` + case subscriptionCreated = "BILLING.SUBSCRIPTION.CREATED" + + /// `BILLING.SUBSCRIPTION.RE-ACTIVATED` + case subscriptionReactivated = "BILLING.SUBSCRIPTION.RE-ACTIVATED" + + /// `BILLING.SUBSCRIPTION.SUSPENDED` + case subscriptionSuspended = "BILLING.SUBSCRIPTION.SUSPENDED" + + /// `BILLING.SUBSCRIPTION.UPDATED` + case subscriptionUpdated = "BILLING.SUBSCRIPTION.UPDATED" + + + /// `IDENTITY.AUTHORIZATION-CONSENT.REVOKED` + case authorizationConsentRevoked = "IDENTITY.AUTHORIZATION-CONSENT.REVOKED" + + + /// `CUSTOMER.DISPUTE.CREATED` + case disputeCreated = "CUSTOMER.DISPUTE.CREATED" + + /// `CUSTOMER.DISPUTE.RESOLVED` + case disputeResolved = "CUSTOMER.DISPUTE.RESOLVED" + + /// `CUSTOMER.DISPUTE.UPDATED` + case disputeUpdated = "CUSTOMER.DISPUTE.UPDATED" + + /// `RISK.DISPUTE.CREATED` + case riskDisputeCreated = "RISK.DISPUTE.CREATED" + + + /// `INVOICING.INVOICE.CANCELLED` + case invoiceCancelled = "INVOICING.INVOICE.CANCELLED" + + /// `INVOICING.INVOICE.CREATED` + case invoiceCreated = "INVOICING.INVOICE.CREATED" + + /// `INVOICING.INVOICE.PAID` + case invoicePaid = "INVOICING.INVOICE.PAID" + + /// `INVOICING.INVOICE.REFUNDED` + case invoiceRefunded = "INVOICING.INVOICE.REFUNDED" + + /// `INVOICING.INVOICE.SCHEDULED` + case invoiceScheduled = "INVOICING.INVOICE.SCHEDULED" + + /// `INVOICING.INVOICE.UPDATED` + case invoiceUpdtaed = "INVOICING.INVOICE.UPDATED" + + + /// `MERCHANT.ONBOARDING.COMPLETED` + case onboardingComplete = "MERCHANT.ONBOARDING.COMPLETED" + + /// `MERCHANT.PARTNER-CONSENT.REVOKED` + case partnerConsentRevoked = "MERCHANT.PARTNER-CONSENT.REVOKED" + + + /// `CHECKOUT.ORDER.PROCESSED` + case checkoutProcessed = "CHECKOUT.ORDER.PROCESSED" + + /// `CUSTOMER.ACCOUNT-LIMITATION.ADDED` + case accountLimitationAdded = "CUSTOMER.ACCOUNT-LIMITATION.ADDED" + + /// `CUSTOMER.ACCOUNT-LIMITATION.ESCALATED` + case accountLimitationEscalated = "CUSTOMER.ACCOUNT-LIMITATION.ESCALATED" + + /// `CUSTOMER.ACCOUNT-LIMITATION.LIFTED` + case accountLimitationLifted = "CUSTOMER.ACCOUNT-LIMITATION.LIFTED" + + /// `CUSTOMER.ACCOUNT-LIMITATION.UPDATED` + case accountLimitationUpdated = "CUSTOMER.ACCOUNT-LIMITATION.UPDATED" + + + /// `PAYMENT.ORDER.CANCELLED` + case orderCancelled = "PAYMENT.ORDER.CANCELLED" + + /// `PAYMENT.ORDER.CREATED` + case orderCreated = "PAYMENT.ORDER.CREATED" + + + /// `PAYMENT.REFERENCED-PAYOUT-ITEM.COMPLETED` + case referencedItemCompleted = "PAYMENT.REFERENCED-PAYOUT-ITEM.COMPLETED" + + /// `PAYMENT.REFERENCED-PAYOUT-ITEM.FAILED` + case referencedItemFailed = "PAYMENT.REFERENCED-PAYOUT-ITEM.FAILED" + + + /// `PAYMENT.SALE.COMPLETED` + case saleCompleted = "PAYMENT.SALE.COMPLETED" + + /// `PAYMENT.SALE.DENIED` + case saleDenied = "PAYMENT.SALE.DENIED" + + /// `PAYMENT.SALE.PENDING` + case salePending = "PAYMENT.SALE.PENDING" + + /// `PAYMENT.SALE.REFUNDED` + case saleRefunded = "PAYMENT.SALE.REFUNDED" + + /// `PAYMENT.SALE.REVERSED` + case saleReversed = "PAYMENT.SALE.REVERSED" + + + /// `VAULT.CREDIT-CARD.CREATED` + case creditCardCreated = "VAULT.CREDIT-CARD.CREATED" + + /// `VAULT.CREDIT-CARD.DELETED` + case creditCardDeleted = "VAULT.CREDIT-CARD.DELETED" + + /// `VAULT.CREDIT-CARD.UPDATED` + case creditCardUpdated = "VAULT.CREDIT-CARD.UPDATED" + } + + enum CodingKeys: String, CodingKey { + case name, description, status + case versions = "resource_versions" + } +} From 1967834dd397a12a9f939761ebee5ea1bb0b217e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 10:37:11 -0500 Subject: [PATCH 123/160] Created Webhook struct --- Sources/V1/Models/Webhook/Webhook.swift | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Sources/V1/Models/Webhook/Webhook.swift diff --git a/Sources/V1/Models/Webhook/Webhook.swift b/Sources/V1/Models/Webhook/Webhook.swift new file mode 100644 index 00000000..aceab8d4 --- /dev/null +++ b/Sources/V1/Models/Webhook/Webhook.swift @@ -0,0 +1,38 @@ +import PayPal + +/// The information for a webhook that will be fired by a PayPal action. +public struct Webhook: Codable { + + /// The ID of the webhook. + public let id: String? + + /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links/). + public let links: [LinkDescription]? + + /// The URL that is configured to listen on `localhost` for incoming `POST` notification messages + /// that contain event information. + public var url: String + + /// An array of events to which to subscribe your webhook. To subscribe to all events, including events as they are added, + /// specify the asterisk wild card. To replace the `event_types` array, specify the asterisk wild card. To list + /// all supported events, [list available events](https://developer.paypal.com/docs/api/webhooks/v1/#event-type_list). + public var events: [EventType] + + /// Creates a new `Webhook` instance. + /// + /// - Parameters: + /// - url: The URL that is configured to listen on `localhost` for incoming `POST` notification messages. + /// - events: An array of events to which to subscribe your webhook. + public init(url: String, events: [EventType]) { + self.id = nil + self.links = nil + + self.url = url + self.events = events + } + + enum CodingKeys: String, CodingKey { + case id, links, url + case events = "event_types" + } +} From a95462057b9ddd35000d5bd45cb7103062ded837 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 11:45:31 -0500 Subject: [PATCH 124/160] Created Webhook.AnchorType enum --- Sources/V1/Models/Webhook/Webhook.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V1/Models/Webhook/Webhook.swift b/Sources/V1/Models/Webhook/Webhook.swift index aceab8d4..7dcd7008 100644 --- a/Sources/V1/Models/Webhook/Webhook.swift +++ b/Sources/V1/Models/Webhook/Webhook.swift @@ -31,6 +31,16 @@ public struct Webhook: Codable { self.events = events } + /// The entity types that `Webhook` objects can be filtered by when fetched from the PayPal API. + public enum AnchorType: String, Hashable, CaseIterable, Codable { + + /// (Default) `APPLICATION`. + case application = "APPLICATION" + + /// `ACCOUNT`. + case account = "ACCOUNT" + } + enum CodingKeys: String, CodingKey { case id, links, url case events = "event_types" From 1af80fcff3afe6f77dbd9b9a7ab8805d554c7e81 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 11:46:32 -0500 Subject: [PATCH 125/160] Created Wwbhooks controller type --- .../V1/Controllers/Webhooks/Webhooks.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Sources/V1/Controllers/Webhooks/Webhooks.swift diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift new file mode 100644 index 00000000..92d092de --- /dev/null +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -0,0 +1,25 @@ +import PayPal +import Vapor + +/// The PayPal REST APIs use [webhooks](https://developer.paypal.com/docs/integration/direct/webhooks) for event notification. +/// Webhooks are HTTP callbacks that receive notification messages for events. After you configure a webhook listener for your +/// app, you can [create a webhook](https://developer.paypal.com/docs/api/webhooks/v1/#webhooks_create), which subscribes +/// the webhook listener for your app to events. The `notifications` namespace contains resource collections for webhooks. +/// +/// # Webhooks +/// +/// Use the `/webhooks` resource to create, show details for, list all, update, and delete webhooks. +public final class Webhooks: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["notifications", "webhooks"] + } +} From 6ee8a9b28f39eecd70d5b0c73f6ffc609a43ffa4 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 11:46:52 -0500 Subject: [PATCH 126/160] Created Webhooks.create(webhook:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 92d092de..051426a1 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -22,4 +22,14 @@ public final class Webhooks: VersionedController { self.client = client self.resource = ["notifications", "webhooks"] } + + /// Subscribes your webhook listener to events. + /// + /// A successful request returns the HTTP 201 Created status code and a JSON response body with a + /// `Webhook` object that includes the webhook ID for later use. + /// + /// - Parameter webhook: The `Webhook` instance to create + public func create(webhook: Webhook) -> EventLoopFuture { + return self.client.post(self.path, body: webhook, as: Webhook.self) + } } From 33cb4ed992630231ad35f9e0e76c4bcc93888d7e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 11:47:37 -0500 Subject: [PATCH 127/160] Created Webhooks.get(by:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 051426a1..2a3254e3 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -32,4 +32,16 @@ public final class Webhooks: VersionedController { public func create(webhook: Webhook) -> EventLoopFuture { return self.client.post(self.path, body: webhook, as: Webhook.self) } + + /// Lists all webhooks for an app. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that lists + /// webhooks with webhook details. + /// + /// - Parameter anchor: Filters the webhooks in the response by the `anchor_id` entity type. + /// - Returns: The webhooks that match the given `anchor` value, wrapped in an `EventLoopFuture`. + public func get(by anchor: Webhook.AnchorType = .application) -> EventLoopFuture<[Webhook]> { + let parameters = QueryParamaters(custom: ["anchor_type": anchor.rawValue]) + return self.client.get(self.path, parameters: parameters, as: [Webhook].self) + } } From 030fe7ba3d1fb945cbd7bd213d9e07a1282760ca Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 11:59:17 -0500 Subject: [PATCH 128/160] Created Webhooks.delete(webhook:) methods --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 2a3254e3..2bbb5eeb 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -44,4 +44,14 @@ public final class Webhooks: VersionedController { let parameters = QueryParamaters(custom: ["anchor_type": anchor.rawValue]) return self.client.get(self.path, parameters: parameters, as: [Webhook].self) } + + /// Deletes a webhook, by ID. + /// + /// A successful request returns the HTTP 204 No Content status code with no JSON response body. + /// + /// - Parameter webhook: The ID of the webhook to delete. + /// - Returns: A void `EventLoopFuture` that succeedes when the delete completes. + public func delete(webhook: String) -> EventLoopFuture { + return self.client.delete(self.path + webhook, as: HTTPStatus.self).transform(to: ()) + } } From 9df927ae5d37404e96336a4b911092ffab46b1f7 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 12:09:16 -0500 Subject: [PATCH 129/160] Created Webhooks.update(webhook:with:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 2bbb5eeb..69f2a316 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -54,4 +54,19 @@ public final class Webhooks: VersionedController { public func delete(webhook: String) -> EventLoopFuture { return self.client.delete(self.path + webhook, as: HTTPStatus.self).transform(to: ()) } + + /// Replaces webhook fields with new values. Supports only the `replace` operation. Pass a `json_patch` object with + /// `replace` operation and `path`, which is `/url` for a URL or `/event_types` for events. The `value` is either + /// the URL or a list of events. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows webhook details. + /// + /// - Parameters: + /// - webhook: The ID of the webhook to update. + /// - patches: An array of JSON patch objects to apply partial updates to resources. + /// + /// - Returns: The updated `Webhook` object, wrapped in an `EventLoopFuture`. + public func update(webhook: String, with patches: [Patch]) -> EventLoopFuture { + return self.client.patch(self.path + webhook, body: patches, as: Webhook.self) + } } From 8c021d603f79ec36b5628897e46aca772bcbee1a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:19:05 -0500 Subject: [PATCH 130/160] Created Webhooks.get(webhook:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 69f2a316..0a02e3e3 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -9,6 +9,10 @@ import Vapor /// # Webhooks /// /// Use the `/webhooks` resource to create, show details for, list all, update, and delete webhooks. +/// +/// # Verify Webhook Signature +/// +/// Use the `/verify-webhook-signature` resource to verify a webhook signature. public final class Webhooks: VersionedController { /// See `VersionedController.client` @@ -69,4 +73,14 @@ public final class Webhooks: VersionedController { public func update(webhook: String, with patches: [Patch]) -> EventLoopFuture { return self.client.patch(self.path + webhook, body: patches, as: Webhook.self) } + + /// Shows details for a webhook, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows webhook details + /// + /// - Parameter webhook: The ID of the webhook for which to show details. + /// - Returns: The `Webhook` object for the given ID, wrapped in an `EventLoopFuture`. + public func get(webhook: String) -> EventLoopFuture { + return self.client.get(self.path + webhook, as: Webhook.self) + } } From 2b062a79a42f95a36c9425e592a0121204314067 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:20:44 -0500 Subject: [PATCH 131/160] Created Webhook.Signature struct with dependent types --- Sources/V1/Models/Webhook/Verification.swift | 166 +++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Sources/V1/Models/Webhook/Verification.swift diff --git a/Sources/V1/Models/Webhook/Verification.swift b/Sources/V1/Models/Webhook/Verification.swift new file mode 100644 index 00000000..12970110 --- /dev/null +++ b/Sources/V1/Models/Webhook/Verification.swift @@ -0,0 +1,166 @@ +import PayPal + +extension Webhook { + + /// The signature for a `Webhook` object that can be verified. + public struct Signature: Codable { + + /// The algorithm that PayPal uses to generate the signature and that you can use to verify the signature. + /// Extract this value from the PAYPAL-AUTH-ALGO response header, which is received with the webhook notification. + public var algorithm: String + + /// The X.509 public key certificate. Download the certificate from this URL and use it to verify the signature. + /// Extract this value from the PAYPAL-CERT-URL response header, which is received with the webhook notification. + public var cert: String + + /// The `transmission-x` properties for the JSON body. + public var transmission: Transmission + + /// The ID of the webhook as configured in your Developer Portal account. + public var webhook: String + + /// A webhook event notification. + public var event: VerifiedEvent + + /// Creates a new `Webhook.Verification` instance. + /// + /// - Parameters: + /// - algorithm: The algorithm that PayPal uses to generate the signature. + /// - cert: The X.509 public key certificate. + /// - webhook: The ID of the webhook as configured in your Developer Portal account. + /// - event: A webhook event notification. + public init( + algorithm: String, + cert: String, + transmission: Transmission, + webhook: String, + event: VerifiedEvent + ) { + self.algorithm = algorithm + self.cert = cert + self.transmission = transmission + self.webhook = webhook + self.event = event + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder)throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.algorithm = try container.decode(String.self, forKey: .algorithm) + self.webhook = try container.decode(String.self, forKey: .webhook) + self.event = try container.decode(VerifiedEvent.self, forKey: .event) + self.cert = try container.decode(String.self, forKey: .cert) + self.transmission = try Transmission(from: decoder) + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + public func encode(to encoder: Encoder)throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(self.algorithm, forKey: .algorithm) + try container.encode(self.webhook, forKey: .webhook) + try container.encode(self.event, forKey: .event) + try container.encode(self.cert, forKey: .cert) + try self.transmission.encode(to: encoder) + } + + /// The status options of a signature verification. + public enum Status: String, Hashable, CaseIterable, Codable { + + /// `SUCCESS`. + case success = "SUCCESS" + + /// `FAILURE`. + case failure = "FAILURE" + } + + /// The `transmission-x` properties for a `Webhok.Verification` instance. + public struct Transmission: Codable { + + /// The ID of the HTTP transmission. Contained in the `PAYPAL-TRANSMISSION-ID` header of the notification message. + public var id: String + + /// The PayPal-generated asymmetric signature. Appears in the `PAYPAL-TRANSMISSION-SIG` + /// header of the notification message. + public var signature: String + + /// The date and time of the HTTP transmission, in + /// [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + /// Appears in the `PAYPAL-TRANSMISSION-TIME` header of the notification message. + public var time: ISO8601Date + + /// Created a new `Webhook.Verification.Transmission` instance. + /// + /// - Parameters: + /// - id: The ID of the HTTP transmission. + /// - signature: The PayPal-generated asymmetric signature. + /// - time: The date and time of the HTTP transmission. + public init(id: String, signature: String, time: ISO8601Date) { + self.id = id + self.signature = signature + self.time = time + } + + enum CodingKeys: String, CodingKey { + case id = "transmission_id" + case signature = "transmission_sig" + case time = "transmission_time" + } + } + + /// The result of a `Webhooks.verify(signature:)` method call. + public struct Result: Codable { + + /// The status of a signature verification. + public var status: Status + } + + enum CodingKeys: String, CodingKey { + case algorithm = "auth_algo" + case cert = "cert_url" + case webhook = "webhook_id" + case event = "webhook_event" + } + } + + public struct VerifiedEvent: Codable { + + /// The ID of the webhook event notification. + public let id: String? + + /// The date and time when the webhook event notification was created. + public let created: ISO8601Date? + + /// The name of the resource related to the webhook notification event. + public let resourceType: String? + + /// The event version in the webhook notification. + public let version: EventType.Version? + + /// The event that triggered the webhook event notification. + public let type: EventType.Name? + + /// A summary description for the event notification. + public let summary: String? + + /// The resource version in the webhook notification. + public let resourceVersion: EventType.Version? + + /// The resource that triggered the webhook event notification. + public let resource: Resource? + + /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links). + public let links: [LinkDescription]? + } + + public struct Resource: Codable { + public let id: String? + public let created: ISO8601Date? + public let updated: ISO8601Date? + public let state: String? + public let amount: DetailedAmount? + public let parent: String? + public let validTo: ISO8601Date? + } +} From 53ca52a4fdbb7ca3841f26ec9160178dedb2ce0a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:21:10 -0500 Subject: [PATCH 132/160] Created Webhooks.verify(signature:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 0a02e3e3..a2f92130 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -83,4 +83,18 @@ public final class Webhooks: VersionedController { public func get(webhook: String) -> EventLoopFuture { return self.client.get(self.path + webhook, as: Webhook.self) } + + /// Verifies a webhook signature. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows the verification status. + /// + /// - Parameter signature: The `Webhook` object signature that will be the request's body to be verified. + /// - Returns: The verification result, wrapped in an `EventLoopFuture`. + public func verfity(signature: Webhook) -> EventLoopFuture { + return self.client.post( + self.client.environment.domain + "/v" + self.client.version.rawValue + "/notifications/verify-webhook-signature", + body: signature, + as: Webhook.Signature.Result.self + ) + } } From e7e305ee0ccaffdab2df6ec56ff35ed0e21febf2 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:32:01 -0500 Subject: [PATCH 133/160] Renamed /Webhook/Verification.swift file to /Webhook/WebhookSignature.swift --- .../Models/Webhook/{Verification.swift => WebhookSignature.swift} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Sources/V1/Models/Webhook/{Verification.swift => WebhookSignature.swift} (100%) diff --git a/Sources/V1/Models/Webhook/Verification.swift b/Sources/V1/Models/Webhook/WebhookSignature.swift similarity index 100% rename from Sources/V1/Models/Webhook/Verification.swift rename to Sources/V1/Models/Webhook/WebhookSignature.swift From c90d922886e12c2544ba5cc6af7e696132be3ac0 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:39:14 -0500 Subject: [PATCH 134/160] Moved Webhooks.verify(signature:) to Webhooks.Verification controller --- .../Controllers/Webhooks/Verification.swift | 37 +++++++++++++++++++ .../V1/Controllers/Webhooks/Webhooks.swift | 19 +++------- 2 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 Sources/V1/Controllers/Webhooks/Verification.swift diff --git a/Sources/V1/Controllers/Webhooks/Verification.swift b/Sources/V1/Controllers/Webhooks/Verification.swift new file mode 100644 index 00000000..b579c8d5 --- /dev/null +++ b/Sources/V1/Controllers/Webhooks/Verification.swift @@ -0,0 +1,37 @@ +import PayPal +import Vapor + +extension Webhooks { + + /// The controller for the `/verify-webhook-signature` resource of the Webhooks PayPal API. + public final class Verification: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["notifications", "verify-webhook-signature"] + } + + /// Verifies a webhook signature. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response + /// body that shows the verification status. + /// + /// - Parameter signature: The `Webhook` object signature that will be the request's body to be verified. + /// - Returns: The verification result, wrapped in an `EventLoopFuture`. + public func verfity(signature: Webhook) -> EventLoopFuture { + let root = self.client.environment.domain + "/v" + self.client.version.rawValue + return self.client.post( + root + "/notifications/verify-webhook-signature", + body: signature, + as: Webhook.Signature.Result.self + ) + } + } +} diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index a2f92130..8420b2c1 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -21,6 +21,11 @@ public final class Webhooks: VersionedController { /// See `VersionedController.resource`. public let resource: [String] + /// The controller for the `/notifications/verify-webhook-signature` resource. + public var verification: Verification { + return Verification(client: self.client) + } + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client @@ -83,18 +88,4 @@ public final class Webhooks: VersionedController { public func get(webhook: String) -> EventLoopFuture { return self.client.get(self.path + webhook, as: Webhook.self) } - - /// Verifies a webhook signature. - /// - /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows the verification status. - /// - /// - Parameter signature: The `Webhook` object signature that will be the request's body to be verified. - /// - Returns: The verification result, wrapped in an `EventLoopFuture`. - public func verfity(signature: Webhook) -> EventLoopFuture { - return self.client.post( - self.client.environment.domain + "/v" + self.client.version.rawValue + "/notifications/verify-webhook-signature", - body: signature, - as: Webhook.Signature.Result.self - ) - } } From 512810d04db3bb3c1ff09965adf50c45e4c4698f Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:41:33 -0500 Subject: [PATCH 135/160] Changed Webhooks.Verification.verify(signature:) 'signature' parameter type to Webhook.Signature --- Sources/V1/Controllers/Webhooks/Verification.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/V1/Controllers/Webhooks/Verification.swift b/Sources/V1/Controllers/Webhooks/Verification.swift index b579c8d5..fb4f2ac7 100644 --- a/Sources/V1/Controllers/Webhooks/Verification.swift +++ b/Sources/V1/Controllers/Webhooks/Verification.swift @@ -25,7 +25,7 @@ extension Webhooks { /// /// - Parameter signature: The `Webhook` object signature that will be the request's body to be verified. /// - Returns: The verification result, wrapped in an `EventLoopFuture`. - public func verfity(signature: Webhook) -> EventLoopFuture { + public func verify(signature: Webhook.Signature) -> EventLoopFuture { let root = self.client.environment.domain + "/v" + self.client.version.rawValue return self.client.post( root + "/notifications/verify-webhook-signature", From 0fb944efc2ebd2f11d32df91651a03b21ff87b98 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 14:44:49 -0500 Subject: [PATCH 136/160] Created Webhooks.EventTypes controller --- .../V1/Controllers/Webhooks/EventTypes.swift | 21 +++++++++++++++++++ .../V1/Controllers/Webhooks/Webhooks.swift | 10 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 Sources/V1/Controllers/Webhooks/EventTypes.swift diff --git a/Sources/V1/Controllers/Webhooks/EventTypes.swift b/Sources/V1/Controllers/Webhooks/EventTypes.swift new file mode 100644 index 00000000..cef9df01 --- /dev/null +++ b/Sources/V1/Controllers/Webhooks/EventTypes.swift @@ -0,0 +1,21 @@ +import PayPal +import Vapor + +extension Webhooks { + + /// The controller for the `/webhooks-event-types` resource of the Webhooks PayPal API. + public final class EventTypes: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["notifications", "webhooks-event-types"] + } + } +} diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index 8420b2c1..af72a745 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -13,6 +13,11 @@ import Vapor /// # Verify Webhook Signature /// /// Use the `/verify-webhook-signature` resource to verify a webhook signature. +/// +/// # Event Type +/// +/// Use the `/webhooks-event-types` resource to list events to which webhooks can subscribe and the +/// `/webhooks//event-types` resource to list event subscriptions for a webhook. public final class Webhooks: VersionedController { /// See `VersionedController.client` @@ -26,6 +31,11 @@ public final class Webhooks: VersionedController { return Verification(client: self.client) } + /// The controller for the `/notifications/webhooks-event-types` resource. + public var eventTypes: EventTypes { + return EventTypes(client: self.client) + } + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client From 9cd70cd14f7cf962ab60b722c42a7953a3e3ad0a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 15:00:23 -0500 Subject: [PATCH 137/160] Created Webhooks.EventTypes.list() method --- Sources/V1/Controllers/Webhooks/EventTypes.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/EventTypes.swift b/Sources/V1/Controllers/Webhooks/EventTypes.swift index cef9df01..8d31f566 100644 --- a/Sources/V1/Controllers/Webhooks/EventTypes.swift +++ b/Sources/V1/Controllers/Webhooks/EventTypes.swift @@ -17,5 +17,16 @@ extension Webhooks { self.client = client self.resource = ["notifications", "webhooks-event-types"] } + + /// Lists available events to which any webhook can subscribe. For a list of supported events, + /// see [Webhook event names](https://developer.paypal.com/docs/integration/direct/webhooks/event-names/). + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that + /// lists available events to which any webhook can subscribe. + /// + /// - Returns: The list of `EventType` objects, wrapped in an `EventLoopFuture`. + public func list() -> EventLoopFuture<[EventType]> { + return self.client.get("", as: [EventType].self) + } } } From 8f92c9d9dc0050c45cd7a00dcc3e215b1f8915c0 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 15:03:39 -0500 Subject: [PATCH 138/160] Created Webhook.eventTypes(for:) method --- Sources/V1/Controllers/Webhooks/Webhooks.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index af72a745..ba9f6241 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -98,4 +98,15 @@ public final class Webhooks: VersionedController { public func get(webhook: String) -> EventLoopFuture { return self.client.get(self.path + webhook, as: Webhook.self) } + + /// Lists event subscriptions for a webhook, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that lists event + /// subscriptions for a webhook. + /// + /// - Parameter webhook: The ID of the webhook for which to list subscriptions. + /// - Returns: The list of `EventType` objects for the webhook, wrapped in an `EventLoopFuture`. + public func eventTypes(for webhook: String) -> EventLoopFuture<[EventType]> { + return self.client.get(self.path + webhook + "/event-types", as: [EventType].self) + } } From a3398c495ab15568877484ac9eb9785f0f2d1199 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 15:10:42 -0500 Subject: [PATCH 139/160] Created Webhooks.Events controller --- Sources/V1/Controllers/Webhooks/Events.swift | 22 +++++++++++++++++++ .../V1/Controllers/Webhooks/Webhooks.swift | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 Sources/V1/Controllers/Webhooks/Events.swift diff --git a/Sources/V1/Controllers/Webhooks/Events.swift b/Sources/V1/Controllers/Webhooks/Events.swift new file mode 100644 index 00000000..f09672db --- /dev/null +++ b/Sources/V1/Controllers/Webhooks/Events.swift @@ -0,0 +1,22 @@ +import PayPal +import Vapor + +extension Webhooks { + + /// The controller for the `/webhooks-events` resource of the Webhooks PayPal API. + public final class Events: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["notifications", "webhooks-events"] + } + } +} + diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index ba9f6241..e18d6200 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -36,6 +36,11 @@ public final class Webhooks: VersionedController { return EventTypes(client: self.client) } + /// The controller for the `/notifications/webhooks-events` resource. + public var events: Events { + return Events(client: self.client) + } + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client From abbac32255a86dcd0a64ddfbdcae631b75c1ac9d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 16:01:32 -0500 Subject: [PATCH 140/160] Renamed Webhook.Signature.VerifiedEvent to Event --- Sources/V1/Models/Webhook/Event.swift | 58 +++++++++++++++++++ .../V1/Models/Webhook/WebhookSignature.swift | 46 +-------------- 2 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 Sources/V1/Models/Webhook/Event.swift diff --git a/Sources/V1/Models/Webhook/Event.swift b/Sources/V1/Models/Webhook/Event.swift new file mode 100644 index 00000000..1bd7021f --- /dev/null +++ b/Sources/V1/Models/Webhook/Event.swift @@ -0,0 +1,58 @@ +import PayPal + +public struct Event: Codable { + + /// The ID of the webhook event notification. + public let id: String? + + /// The date and time when the webhook event notification was created. + public let created: ISO8601Date? + + /// The name of the resource related to the webhook notification event. + public let resourceType: String? + + /// The event version in the webhook notification. + public let version: EventType.Version? + + /// The event that triggered the webhook event notification. + public let type: EventType.Name? + + /// A summary description for the event notification. + public let summary: String? + + /// The resource version in the webhook notification. + public let resourceVersion: EventType.Version? + + /// The resource that triggered the webhook event notification. + public let resource: Resource? + + /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links). + public let links: [LinkDescription]? + + enum CodingKeys: String, CodingKey { + case id, summary, resource, links + case created = "create_time" + case resourceType = "resource_type" + case version = "event_version" + case type = "event_type" + case resourceVersion = "resource_version" + } +} + +public struct Resource: Codable { + public let id: String? + public let created: ISO8601Date? + public let updated: ISO8601Date? + public let state: String? + public let amount: DetailedAmount? + public let parent: String? + public let validTo: ISO8601Date? + + enum CodingKeys: String, CodingKey { + case id, state, amount + case created = "create_time" + case updated = "update_time" + case parent = "parent_payment" + case validTo = "valid_until" + } +} diff --git a/Sources/V1/Models/Webhook/WebhookSignature.swift b/Sources/V1/Models/Webhook/WebhookSignature.swift index 12970110..8b7e041e 100644 --- a/Sources/V1/Models/Webhook/WebhookSignature.swift +++ b/Sources/V1/Models/Webhook/WebhookSignature.swift @@ -20,7 +20,7 @@ extension Webhook { public var webhook: String /// A webhook event notification. - public var event: VerifiedEvent + public var event: Event /// Creates a new `Webhook.Verification` instance. /// @@ -34,7 +34,7 @@ extension Webhook { cert: String, transmission: Transmission, webhook: String, - event: VerifiedEvent + event: Event ) { self.algorithm = algorithm self.cert = cert @@ -49,7 +49,7 @@ extension Webhook { self.algorithm = try container.decode(String.self, forKey: .algorithm) self.webhook = try container.decode(String.self, forKey: .webhook) - self.event = try container.decode(VerifiedEvent.self, forKey: .event) + self.event = try container.decode(Event.self, forKey: .event) self.cert = try container.decode(String.self, forKey: .cert) self.transmission = try Transmission(from: decoder) } @@ -123,44 +123,4 @@ extension Webhook { case event = "webhook_event" } } - - public struct VerifiedEvent: Codable { - - /// The ID of the webhook event notification. - public let id: String? - - /// The date and time when the webhook event notification was created. - public let created: ISO8601Date? - - /// The name of the resource related to the webhook notification event. - public let resourceType: String? - - /// The event version in the webhook notification. - public let version: EventType.Version? - - /// The event that triggered the webhook event notification. - public let type: EventType.Name? - - /// A summary description for the event notification. - public let summary: String? - - /// The resource version in the webhook notification. - public let resourceVersion: EventType.Version? - - /// The resource that triggered the webhook event notification. - public let resource: Resource? - - /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links). - public let links: [LinkDescription]? - } - - public struct Resource: Codable { - public let id: String? - public let created: ISO8601Date? - public let updated: ISO8601Date? - public let state: String? - public let amount: DetailedAmount? - public let parent: String? - public let validTo: ISO8601Date? - } } From c4989fb1c40f80bc5a41956d9b0ebee07dc44ec8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 16:26:32 -0500 Subject: [PATCH 141/160] Created Event.List struct --- Sources/V1/Models/Webhook/Event.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/V1/Models/Webhook/Event.swift b/Sources/V1/Models/Webhook/Event.swift index 1bd7021f..7cf4f6ef 100644 --- a/Sources/V1/Models/Webhook/Event.swift +++ b/Sources/V1/Models/Webhook/Event.swift @@ -29,6 +29,20 @@ public struct Event: Codable { /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links). public let links: [LinkDescription]? + /// The response structure for a call to `Webhooks.Events.list( + public struct List: Codable { + + /// An array of webhooks events. + public var events: [Event]? + + /// The number of items in each range of results. Note that the response might have fewer items + /// than the requested `page_size` value. + public var count: Int? + + /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/overview/#hateoas-links). + public let links: [LinkDescription]? + } + enum CodingKeys: String, CodingKey { case id, summary, resource, links case created = "create_time" From 6702d1e69bf6d5546a562c4fb7a639fbd2dd639b Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 16:27:32 -0500 Subject: [PATCH 142/160] Created Webhooks.Events.list(parameters:transaction:type:) method --- Sources/V1/Controllers/Webhooks/Events.swift | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Events.swift b/Sources/V1/Controllers/Webhooks/Events.swift index f09672db..56465a69 100644 --- a/Sources/V1/Controllers/Webhooks/Events.swift +++ b/Sources/V1/Controllers/Webhooks/Events.swift @@ -17,6 +17,33 @@ extension Webhooks { self.client = client self.resource = ["notifications", "webhooks-events"] } + + /// Lists webhook event notifications. Use query parameters to filter the response. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that + /// lists webhook event notifications. + /// + /// - Parameters: + /// - parameters: + /// - transaction: Filters the response to a single transaction, by ID. + /// - type: Filters the response to a single event. + /// + /// - Returns: The list of `Event` objects, along with count and related links. + public func list( + parameters: QueryParamaters = QueryParamaters(), + transaction: String? = nil, + type: String? = nil + ) -> EventLoopFuture { + var parameters = parameters + if let transaction = transaction { + parameters.custom?["transaction_id"] = transaction + } + if let eventType = type { + parameters.custom?["event_type"] = eventType + } + + return self.client.get(self.path, parameters: parameters, as: Event.List.self) + } } } From 8afbe1f3f16c451267b060a6c9b75bfb78b7c1d0 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 16:34:20 -0500 Subject: [PATCH 143/160] Created Webhook.Events.get(event:) method --- Sources/V1/Controllers/Webhooks/Events.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Events.swift b/Sources/V1/Controllers/Webhooks/Events.swift index 56465a69..f12c3899 100644 --- a/Sources/V1/Controllers/Webhooks/Events.swift +++ b/Sources/V1/Controllers/Webhooks/Events.swift @@ -44,6 +44,17 @@ extension Webhooks { return self.client.get(self.path, parameters: parameters, as: Event.List.self) } + + /// Shows details for a webhook event notification, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that + /// shows webhook event notification details + /// + /// - Parameter event: The ID of the webhook event notification for which to show details. + /// - Returns: The `Event` object for the given ID, wrapped in an `EventLoopFuture`. + public func get(event: String) -> EventLoopFuture { + return self.client.get(self.path + event, as: Event.self) + } } } From e2e253511ca71477945b0ed2ae92cb0b9598516a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 4 Apr 2019 16:40:36 -0500 Subject: [PATCH 144/160] Created Webhooks.Events.resend(event:ids:) method --- Sources/V1/Controllers/Webhooks/Events.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/Events.swift b/Sources/V1/Controllers/Webhooks/Events.swift index f12c3899..ed1cd024 100644 --- a/Sources/V1/Controllers/Webhooks/Events.swift +++ b/Sources/V1/Controllers/Webhooks/Events.swift @@ -55,6 +55,20 @@ extension Webhooks { public func get(event: String) -> EventLoopFuture { return self.client.get(self.path + event, as: Event.self) } + + /// Resends a webhook event notification, by ID. Any pending notifications are not resent. + /// + /// A successful request returns the HTTP 202 Accepted status code and a JSON response body + /// that shows webhook event notification details. + /// + /// - Parameters: + /// - event: The ID of the webhook event notification to resend. + /// - ids: An array of webhook account IDs. + /// + /// - Returns: The `Event` object for the event that was resent, wrapped in an `EventLoopFuture`. + public func resend(event: String, ids: [String]) -> EventLoopFuture { + return self.client.post(self.path + event, body: ["webhook_ids": ids], as: Event.self) + } } } From fba2aed06a42dca3c1dd46358da92e93799dafe2 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 06:19:07 -0500 Subject: [PATCH 145/160] Created Webhooks.SimulateEvents controller class --- .../Controllers/Webhooks/SimulateEvent.swift | 20 +++++++++++++++++++ .../V1/Controllers/Webhooks/Webhooks.swift | 13 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Sources/V1/Controllers/Webhooks/SimulateEvent.swift diff --git a/Sources/V1/Controllers/Webhooks/SimulateEvent.swift b/Sources/V1/Controllers/Webhooks/SimulateEvent.swift new file mode 100644 index 00000000..f75b7336 --- /dev/null +++ b/Sources/V1/Controllers/Webhooks/SimulateEvent.swift @@ -0,0 +1,20 @@ +import PayPal + +extension Webhooks { + + /// The controller for the `/simulate-event` resource of the Webhooks PayPal API. + public final class SimulateEvents: VersionedController { + + /// See `VersionedController.client` + public let client: PayPalClient + + /// See `VersionedController.resource`. + public let resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["notifications", "simulate-event"] + } + } +} diff --git a/Sources/V1/Controllers/Webhooks/Webhooks.swift b/Sources/V1/Controllers/Webhooks/Webhooks.swift index e18d6200..5a89d9b1 100644 --- a/Sources/V1/Controllers/Webhooks/Webhooks.swift +++ b/Sources/V1/Controllers/Webhooks/Webhooks.swift @@ -18,6 +18,14 @@ import Vapor /// /// Use the `/webhooks-event-types` resource to list events to which webhooks can subscribe and the /// `/webhooks//event-types` resource to list event subscriptions for a webhook. +/// +/// # Simulate Event +/// +/// Use the `/simulate-event` resource to use a sample payload to simulate a webhook event. The events that this call +/// generates only serve to validate the connection to the listener URL and to show how webhook events look. +/// +/// - Note: You can also use the [Webhooks simulator](https://developer.paypal.com/docs/integration/direct/webhooks/simulator/) +/// to simulate webhook events. public final class Webhooks: VersionedController { /// See `VersionedController.client` @@ -41,6 +49,11 @@ public final class Webhooks: VersionedController { return Events(client: self.client) } + /// The controller for the `/notifications/simulate-event` resource. + public var simulateEvents: SimulateEvents { + return SimulateEvents(client: self.client) + } + /// See `VersionedController.init(client:)`. public init(client: PayPalClient) { self.client = client From 998164ecb272c716b295523b8a1f284efde5d786 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 06:28:09 -0500 Subject: [PATCH 146/160] Created Event.Simulated struct --- Sources/V1/Models/Webhook/Event.swift | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Sources/V1/Models/Webhook/Event.swift b/Sources/V1/Models/Webhook/Event.swift index 7cf4f6ef..63c7c389 100644 --- a/Sources/V1/Models/Webhook/Event.swift +++ b/Sources/V1/Models/Webhook/Event.swift @@ -29,6 +29,42 @@ public struct Event: Codable { /// An array of request-related [HATEOAS links](https://developer.paypal.com/docs/api/hateoas-links). public let links: [LinkDescription]? + public struct Simulated: Codable { + + /// The ID of the webhook. If omitted, the URL is required. + public var webhook: String? + + /// The URL for the webhook endpoint. If omitted, the webhook ID is required. + public var url: String? + + /// The event name. Specify one of the subscribed events. For each request, provide only one event. + public var type: EventType.Name + + /// The identifier for event type ex: 1.0/2.0 etc. + public var version: EventType.Version? + + /// Creates a new `Event.Simulated` instance. + /// + /// - Parameters: + /// - webhook: The ID of the webhook. If omitted, the URL is required. + /// - url: The URL for the webhook endpoint. If omitted, the webhook ID is required. + /// - type: The event name. Specify one of the subscribed events. + /// - version: The identifier for event type ex: 1.0/2.0 etc. + public init(webhook: String?, url: String?, type: EventType.Name, version: EventType.Version?) { + self.webhook = webhook + self.url = url + self.type = type + self.version = version + } + + enum CodingKeys: String, CodingKey { + case webhook = "webhook_id" + case url + case type = "event_type" + case version = "resource_version" + } + } + /// The response structure for a call to `Webhooks.Events.list( public struct List: Codable { From f41babcc54457b35b86c4d384572718e9e42eb0a Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 06:31:56 -0500 Subject: [PATCH 147/160] Created Webhooks.SimulateEvents.simulate(event:) method --- Sources/V1/Controllers/Webhooks/SimulateEvent.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/V1/Controllers/Webhooks/SimulateEvent.swift b/Sources/V1/Controllers/Webhooks/SimulateEvent.swift index f75b7336..57120352 100644 --- a/Sources/V1/Controllers/Webhooks/SimulateEvent.swift +++ b/Sources/V1/Controllers/Webhooks/SimulateEvent.swift @@ -1,4 +1,5 @@ import PayPal +import Vapor extension Webhooks { @@ -16,5 +17,16 @@ extension Webhooks { self.client = client self.resource = ["notifications", "simulate-event"] } + + /// Simulates a webhook event. In the JSON request body, specify a sample payload. + /// + /// A successful request returns the HTTP 202 Accepted status code and a JSON response body that + /// shows details for the mock event. + /// + /// - Parameter event: The webhook event to simulate. This is the body of the request to PayPal. + /// - Returns: The mocked `Event` object, wrapped in an `EventLoopFuture`. + public func simulate(event: Event.Simulated) -> EventLoopFuture { + return self.client.post(self.path, body: event, as: Event.self) + } } } From 6ab293939ee481e06891b71f3cd2bc8965055b1e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 06:32:33 -0500 Subject: [PATCH 148/160] Replaced Webhooks.EventTypes.list() API endpoint with 'self.path' --- Sources/V1/Controllers/Webhooks/EventTypes.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/V1/Controllers/Webhooks/EventTypes.swift b/Sources/V1/Controllers/Webhooks/EventTypes.swift index 8d31f566..617f62b3 100644 --- a/Sources/V1/Controllers/Webhooks/EventTypes.swift +++ b/Sources/V1/Controllers/Webhooks/EventTypes.swift @@ -26,7 +26,7 @@ extension Webhooks { /// /// - Returns: The list of `EventType` objects, wrapped in an `EventLoopFuture`. public func list() -> EventLoopFuture<[EventType]> { - return self.client.get("", as: [EventType].self) + return self.client.get(self.path, as: [EventType].self) } } } From 42d84eef8f122ab75e0cff30c945f675d2a7e50e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 06:34:03 -0500 Subject: [PATCH 149/160] Changed Webhooks.Verification.verify(signature:) endpoint to 'self.path' --- Sources/V1/Controllers/Webhooks/Verification.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Sources/V1/Controllers/Webhooks/Verification.swift b/Sources/V1/Controllers/Webhooks/Verification.swift index fb4f2ac7..42193c47 100644 --- a/Sources/V1/Controllers/Webhooks/Verification.swift +++ b/Sources/V1/Controllers/Webhooks/Verification.swift @@ -26,12 +26,7 @@ extension Webhooks { /// - Parameter signature: The `Webhook` object signature that will be the request's body to be verified. /// - Returns: The verification result, wrapped in an `EventLoopFuture`. public func verify(signature: Webhook.Signature) -> EventLoopFuture { - let root = self.client.environment.domain + "/v" + self.client.version.rawValue - return self.client.post( - root + "/notifications/verify-webhook-signature", - body: signature, - as: Webhook.Signature.Result.self - ) + return self.client.post(self.path, body: signature, as: Webhook.Signature.Result.self) } } } From afe1cf8ffa3642a24045e7f355b9c4e276e55e83 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 5 Apr 2019 08:05:36 -0500 Subject: [PATCH 150/160] Created CreditCard struct and CreditCardType enum --- Sources/V1/Models/Vault/CreditCard.swift | 167 +++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 Sources/V1/Models/Vault/CreditCard.swift diff --git a/Sources/V1/Models/Vault/CreditCard.swift b/Sources/V1/Models/Vault/CreditCard.swift new file mode 100644 index 00000000..fe13cefe --- /dev/null +++ b/Sources/V1/Models/Vault/CreditCard.swift @@ -0,0 +1,167 @@ +import Foundation +import PayPal + +/// The credit card data sotred in PayPal Vault. +public struct CreditCard: Codable { + + /// The credit card number. Value is a string of numeric characters with no spaces or punctuation. + /// Must conform to modulo and the required length for the credit card type. Redacted in responses. + public var number: Failable + + /// The credit card type. + public var type: CreditCardType + + /// A date in the month and year that the card expires. + public var expiry: Date + + /// The first name of the credit card holder. + public var firstName: Failable> + + /// The last name of the credit card holder. + public var lastName: String? + + /// The billing address for this card. Supports only the `address_line_1`, `address_line_2`, `admin_area_1`, + /// `admin_area_2`, `postal_code`, and `country_code` properties. + public var billing: Address? + + /// The externally-provided ID of the customer. + public var externalCustomer: Failable> + + /// The ID of the merchant. + public var merchant: Failable> + + /// The externally-provided ID of the credit card. + public var externalCard: Failable> + + /// Creates a new `CreditCard` instance. + /// + /// - Parameters: + /// - number: The credit card number. + /// - type: The credit card type. + /// - expiry: A date in the month and year that the card expires. + /// - firstName: The first name of the credit card holder. + /// - lastName: The last name of the credit card holder. + /// - billing: The billing address for this card. + /// - externalCustomer: The externally-provided ID of the customer. + /// - merchant: The ID of the merchant. + /// - externalCard: The externally-provided ID of the credit card. + public init( + number: Failable, + type: CreditCardType, + expiry: Date, + firstName: Failable>, + lastName: String?, + billing: Address?, + externalCustomer: Failable>, + merchant: Failable>, + externalCard: Failable> + ) { + var calendar = Calendar(identifier: .iso8601) + calendar.timeZone = TimeZone(secondsFromGMT: 0) ?? calendar.timeZone + + self.number = number + self.type = type + self.expiry = calendar.date(from: calendar.dateComponents([.year, .month], from: expiry)) ?? expiry + self.firstName = firstName + self.lastName = lastName + self.billing = billing + self.externalCustomer = externalCustomer + self.merchant = merchant + self.externalCard = externalCard + } + + /// See [`Decodable.init(from:)`](https://developer.apple.com/documentation/swift/decodable/2894081-init). + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + let expireMonth = try Int(container.decode(String.self, forKey: .expiryMonth)) + let expireYear = try Int(container.decode(String.self, forKey: .expiryYear)) + guard + let expiry = Calendar(identifier: .iso8601).date(from: DateComponents( + timeZone: TimeZone(secondsFromGMT: 0), + year: expireYear, + month: expireMonth + )) + else { + throw DecodingError.dataCorrupted(DecodingError.Context( + codingPath: [CodingKeys.expiryYear, CodingKeys.expiryMonth], + debugDescription: "Cannot convert `expire_month` and `expire_year` values to a vlid date" + )) + } + + self.expiry = expiry + self.number = try container.decode(Failable.self, forKey: .number) + self.type = try container.decode(CreditCardType.self, forKey: .type) + self.firstName = try container.decode(Failable>.self, forKey: .firstName) + self.lastName = try container.decodeIfPresent(String.self, forKey: .lastName) + self.billing = try container.decodeIfPresent(Address.self, forKey: .billing) + self.externalCustomer = try container.decode(Failable>.self, forKey: .externalCustomer) + self.merchant = try container.decode(Failable>.self, forKey: .merchant) + self.externalCard = try container.decode(Failable>.self, forKey: .externalCard) + } + + /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + let calendar = Calendar(identifier: .iso8601) + let components = calendar.dateComponents([.year, .month], from: self.expiry) + try container.encodeIfPresent(components.year.map(String.init(describing:)), forKey: .expiryYear) + try container.encodeIfPresent(components.month.map(String.init(describing:)), forKey: .expiryMonth) + + try container.encode(self.number, forKey: .number) + try container.encode(self.type, forKey: .type) + try container.encode(self.firstName, forKey: .firstName) + try container.encodeIfPresent(self.lastName, forKey: .lastName) + try container.encodeIfPresent(self.billing, forKey: .billing) + try container.encode(self.externalCustomer, forKey: .externalCustomer) + try container.encode(self.merchant, forKey: .merchant) + try container.encode(self.externalCard, forKey: .externalCard) + + } + + /// The validator for the `CardCard.number` property value. + public struct Number: RegexValidation { + + /// See `RegexValidator.patter`. + public static let pattern: String = #"^\d{13,19}$"# + } + + /// The validator for the `CreditCard.firstName` property value. + public struct FirstName: StringLengthValidation { + + /// See `StringLengthValidation.maxLength`. + public static let maxLength: Int = 25 + } + + enum CodingKeys: String, CodingKey { + case number, type + case expiryMonth = "expire_month" + case expiryYear = "expire_year" + case firstName = "first_name" + case lastName = "last_name" + case billing = "billing_address" + case externalCustomer = "external_customer_id" + case merchant = "merchant_id" + case externalCard = "external_card_id" + } +} + +/// The valid card brand or network options for a `CreditCard` instance. +public enum CreditCardType: String, Hashable, CaseIterable, Codable { + + /// `visa`. + case visa + + /// `mastercard`. + case mastercard + + /// `amex`. + case amex + + /// `discover`. + case discover + + /// `maestro`. + case maestro +} From 02fbcdbe39a985180cb5896332d46a32eea5d711 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 17 May 2019 07:27:18 -0500 Subject: [PATCH 151/160] Added response proeprties to vault CreditCard type --- Sources/V1/Models/Vault/CreditCard.swift | 66 +++++++++++++++++++++--- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/Sources/V1/Models/Vault/CreditCard.swift b/Sources/V1/Models/Vault/CreditCard.swift index fe13cefe..0560d696 100644 --- a/Sources/V1/Models/Vault/CreditCard.swift +++ b/Sources/V1/Models/Vault/CreditCard.swift @@ -3,7 +3,10 @@ import PayPal /// The credit card data sotred in PayPal Vault. public struct CreditCard: Codable { - + + /// The ID of the vaulted credit card, which you can use to fund a payment. + public let id: String? + /// The credit card number. Value is a string of numeric characters with no spaces or punctuation. /// Must conform to modulo and the required length for the credit card type. Redacted in responses. public var number: Failable @@ -32,7 +35,25 @@ public struct CreditCard: Codable { /// The externally-provided ID of the credit card. public var externalCard: Failable> - + + /// The state of the credit card funding instrument. + public let state: State? + + /// The date and time when the vaulted credit card was created. + public let created: ISO8601Date? + + /// The date and time when the vaulted credit card was updated. + public let updated: ISO8601Date? + + /// The date and time when the credit card becomes unusable from the vault. The `valid_until` parameter is not the same + /// as the expiration month and year. The expiration month and year might be later than the `valid_until` date. + /// For example, the card expires in November 2019 but the `valid_until` date is October 17th, 2019. + public let valueTo: ISO8601Date? + + /// An array of request-related + /// [HATEOAS links](https://developer.paypal.com/docs/api/reference/api-responses/#hateoas-links). + public let links: [LinkDescription]? + /// Creates a new `CreditCard` instance. /// /// - Parameters: @@ -58,7 +79,14 @@ public struct CreditCard: Codable { ) { var calendar = Calendar(identifier: .iso8601) calendar.timeZone = TimeZone(secondsFromGMT: 0) ?? calendar.timeZone - + + self.id = nil + self.state = nil + self.created = nil + self.updated = nil + self.valueTo = nil + self.links = nil + self.number = number self.type = type self.expiry = calendar.date(from: calendar.dateComponents([.year, .month], from: expiry)) ?? expiry @@ -90,6 +118,7 @@ public struct CreditCard: Codable { } self.expiry = expiry + self.id = try container.decodeIfPresent(String.self, forKey: .id) self.number = try container.decode(Failable.self, forKey: .number) self.type = try container.decode(CreditCardType.self, forKey: .type) self.firstName = try container.decode(Failable>.self, forKey: .firstName) @@ -98,6 +127,11 @@ public struct CreditCard: Codable { self.externalCustomer = try container.decode(Failable>.self, forKey: .externalCustomer) self.merchant = try container.decode(Failable>.self, forKey: .merchant) self.externalCard = try container.decode(Failable>.self, forKey: .externalCard) + self.state = try container.decodeIfPresent(State.self, forKey: .state) + self.created = try container.decodeIfPresent(ISO8601Date.self, forKey: .created) + self.updated = try container.decodeIfPresent(ISO8601Date.self, forKey: .updated) + self.valueTo = try container.decodeIfPresent(ISO8601Date.self, forKey: .validTo) + self.links = try container.decodeIfPresent([LinkDescription].self, forKey: .links) } /// See [`Encodable.encode(to:)`](https://developer.apple.com/documentation/swift/encodable/2893603-encode). @@ -108,7 +142,8 @@ public struct CreditCard: Codable { let components = calendar.dateComponents([.year, .month], from: self.expiry) try container.encodeIfPresent(components.year.map(String.init(describing:)), forKey: .expiryYear) try container.encodeIfPresent(components.month.map(String.init(describing:)), forKey: .expiryMonth) - + + try container.encodeIfPresent(self.id, forKey: .id) try container.encode(self.number, forKey: .number) try container.encode(self.type, forKey: .type) try container.encode(self.firstName, forKey: .firstName) @@ -117,7 +152,11 @@ public struct CreditCard: Codable { try container.encode(self.externalCustomer, forKey: .externalCustomer) try container.encode(self.merchant, forKey: .merchant) try container.encode(self.externalCard, forKey: .externalCard) - + try container.encodeIfPresent(self.state, forKey: .state) + try container.encodeIfPresent(self.created, forKey: .created) + try container.encodeIfPresent(self.updated, forKey: .updated) + try container.encodeIfPresent(self.valueTo, forKey: .validTo) + try container.encodeIfPresent(self.links, forKey: .links) } /// The validator for the `CardCard.number` property value. @@ -133,9 +172,19 @@ public struct CreditCard: Codable { /// See `StringLengthValidation.maxLength`. public static let maxLength: Int = 25 } - + + /// The states of a credit card funding instrument. + public enum State: String, Hashable, CaseIterable, Codable { + + /// The credit card is past it's expiration date. + case expired + + /// The creadit card has not expired yet. + case ok + } + enum CodingKeys: String, CodingKey { - case number, type + case id, number, type, state, links case expiryMonth = "expire_month" case expiryYear = "expire_year" case firstName = "first_name" @@ -144,6 +193,9 @@ public struct CreditCard: Codable { case externalCustomer = "external_customer_id" case merchant = "merchant_id" case externalCard = "external_card_id" + case created = "create_time" + case updated = "update_time" + case validTo = "valid_until" } } From 78f6941d1bebec4d7e7527bf1a89bd943a000569 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Fri, 17 May 2019 07:37:06 -0500 Subject: [PATCH 152/160] Created CreditCard.List struct --- Sources/V1/Models/Vault/CreditCardList.swift | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Sources/V1/Models/Vault/CreditCardList.swift diff --git a/Sources/V1/Models/Vault/CreditCardList.swift b/Sources/V1/Models/Vault/CreditCardList.swift new file mode 100644 index 00000000..579723e6 --- /dev/null +++ b/Sources/V1/Models/Vault/CreditCardList.swift @@ -0,0 +1,40 @@ +import PayPal + +extension CreditCard { + + /// A paginated list of credit cards from a user's vault. + public struct List: Codable { + + /// An array of credit card objects. + public var cards: [CreditCard] + + /// The total number of items. + public var count: Int32 + + /// The total number of pages. + public var pages: Int32 + + /// An array of request-specific + /// [HATEOAS links](https://developer.paypal.com/docs/api/reference/api-responses/#hateoas-links). + public let links: [LinkDescription] + + /// Creates a new `CreditCard.List` struct. + /// + /// - Parameters: + /// - cards: An array of credit card objects. + /// - count: The total number of items. + /// - pages: The total number of pages. + public init(cards: [CreditCard], count: Int32, pages: Int32) { + self.cards = cards + self.count = count + self.pages = pages + } + + enum CodingKeys: String, CodingKeys { + case links + case cards = "items" + case count = "total_items" + case pages = "total_pages" + } + } +} From 6f120ed72df7f3055ca436271f2d3c4eb256c7ae Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 12:35:54 -0500 Subject: [PATCH 153/160] Created Vault controller with CreditCards sub-controller --- Sources/V1/Controllers/Vault/Vault.swift | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Sources/V1/Controllers/Vault/Vault.swift diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift new file mode 100644 index 00000000..a2e9c264 --- /dev/null +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -0,0 +1,56 @@ +import PayPal +import Vapor + +/// As a merchant, you can use the Vault API to securely store customer credit cards in the PayPal vault rather +/// than on your server. When you use the API to store a customer credit card, the API returns the ID of the vaulted card. +/// To make a payment with the vaulted card, you specify this ID instead of credit card details. +/// For information, see the [Vault Integration Guide](https://developer.paypal.com/docs/integration/direct/vault/). +/// +/// - Note: PayPal does not validate credit card information that you store in the vault. +/// +/// - Warning: The use of the PayPal REST /vault APIs to accept credit card payments is restricted because the +/// merchant must enable but can no longer get approved for the REST direct credit cards (DCC) feature. Instead, +/// you can accept credit card payments with [Braintree Direct](https://www.braintreepayments.com/products/braintree-direct). +/// +/// # Credit Cards +/// +/// Use the `/credit-cards` resource to store a credit card in the vault, delete, show details for, list, +/// and update vaulted cards. +public final class Valut: VersionedController { + + /// See `VersionedController.client`. + public var client: PayPalClient + + /// See `VersionedController.resource` + public var resource: [String] + + /// The controller for the `/vault/credit-cards` resource. + public var creditCards: CreditCards { + return CreditCards(client: self.client) + } + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["vault"] + } +} + +extension Valut { + + /// The controller for the `/credit-cards` resource of the Vault API. + public final class CreditCards: VersionedController { + + /// See `VersionedController.client`. + public var client: PayPalClient + + /// See `VersionedController.resource` + public var resource: [String] + + /// See `VersionedController.init(client:)`. + public init(client: PayPalClient) { + self.client = client + self.resource = ["vault", "credit-cards"] + } + } +} From efacd9fc96cf4dcd487f969a70f26066c694ed96 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 12:36:15 -0500 Subject: [PATCH 154/160] Created Vault.CreditCards.store(_:) method --- Sources/V1/Controllers/Vault/Vault.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index a2e9c264..1e66b60d 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -52,5 +52,21 @@ extension Valut { self.client = client self.resource = ["vault", "credit-cards"] } + + /// Stores credit card details in the PayPal vault. To use the vaulted card to make a payment, specify this ID as the + /// `credit_card_id` in a + /// [`credit_card_token`](https://developer.paypal.com/docs/api/payments/#definition-credit_card_token) object. + /// If you include a payer_id when you store the credit card, you must also include that ID as the + /// `external_customer_id` in the `credit_card_token` object. To show details for, update, or delete the vaulted card, + /// use the ID of the vaulted credit card. + /// + /// A successful request returns the HTTP 201 Created status code and a JSON response body that shows credit card + /// details, including the ID of the vaulted card. + /// + /// - Parameter card: The credit card information to store in the customer's vault. + /// - Returns: The stored credit cardm wrapped in an `EventLoopFuture`. + public func store(_ card: CreditCard) -> EventLoopFuture { + return self.client.post(self.path, body: card, as: CreditCard.self) + } } } From 926f201f20d3e133c6cbb056a02fb623b2cb07e9 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 12:42:44 -0500 Subject: [PATCH 155/160] Created Vault.CreditCards.list(parameters:) method --- Sources/V1/Controllers/Vault/Vault.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index 1e66b60d..9a4b8276 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -68,5 +68,28 @@ extension Valut { public func store(_ card: CreditCard) -> EventLoopFuture { return self.client.post(self.path, body: card, as: CreditCard.self) } + + /// Lists vaulted credit cards. To filter the cards in the response, specify one or more optional query parameters. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that includes an array of + /// vaulted cards. Each item in the array shows card details. + /// + /// - Parameter parameters: The query parameters that will be sent with the request to the PayPal API. + /// The supported query keys are: + /// - `page_size` + /// - `page` + /// - `start_time` + /// - `end_time` + /// - `sort_order` + /// - `sort_by` + /// - `merchant_id` + /// - `external_card_id` + /// - `external_customer_id` + /// - `total_required` + /// + /// - Returns: A paginated list of the credit cards in the customer's vault. + public func list(parameters: QueryParamaters = QueryParamaters()) -> EventLoopFuture { + return self.client.get(self.path, parameters: parameters, as: CreditCard.List.self) + } } } From 3284f3e6e62d791c7dba42f98207f57cb3ea990e Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 13:42:57 -0500 Subject: [PATCH 156/160] Created Vault.CreditCards.update(card:with:) method --- Sources/V1/Controllers/Vault/Vault.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index 9a4b8276..08eba3d5 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -91,5 +91,18 @@ extension Valut { public func list(parameters: QueryParamaters = QueryParamaters()) -> EventLoopFuture { return self.client.get(self.path, parameters: parameters, as: CreditCard.List.self) } + + /// Updates information for a vaulted credit card, by ID. In the JSON request body, specify the values to update. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body that shows card details. + /// + /// - Parameters: + /// - id: The ID of the vaulted credit card to update. + /// - patches: An array of JSON patch objects to apply partial updates to resources. + /// + /// - Returns: The updated credit card information, wrapped in an `EventLoopFuture`. + public func update(card id: String, with patches: [Patch]) -> EventLoopFuture { + return self.client.patch(self.path + id, body: patches, as: CreditCard.self) + } } } From 5cd91e1b8aef4dae9e7096444c99e38be68bd482 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 13:45:38 -0500 Subject: [PATCH 157/160] Created Vault.CreditCards.delete(card:) method --- Sources/V1/Controllers/Vault/Vault.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index 08eba3d5..4dbee699 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -104,5 +104,15 @@ extension Valut { public func update(card id: String, with patches: [Patch]) -> EventLoopFuture { return self.client.patch(self.path + id, body: patches, as: CreditCard.self) } + + /// Deletes a vaulted credit card, by ID. + /// + /// A successful request returns the HTTP 204 No Content status code with no JSON response body. + /// + /// - Parameter id: The ID of the vaulted credit card to delete. + /// - Returns: The HTTP status code of the response, wrapped in an `EventLoopFuture`. + public func delete(card id: String) -> EventLoopFuture { + return self.client.delete(self.path + id) + } } } From 560c53b037bfed5624ae79b0e1f0c84eaadc135c Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 13:49:44 -0500 Subject: [PATCH 158/160] Changed Vault.CreditCards.delete(card:) return type to EventLoopFuture --- Sources/V1/Controllers/Vault/Vault.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index 4dbee699..e41d0dc8 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -110,9 +110,9 @@ extension Valut { /// A successful request returns the HTTP 204 No Content status code with no JSON response body. /// /// - Parameter id: The ID of the vaulted credit card to delete. - /// - Returns: The HTTP status code of the response, wrapped in an `EventLoopFuture`. - public func delete(card id: String) -> EventLoopFuture { - return self.client.delete(self.path + id) + /// - Returns: An empty `EventLoopFuture` that succeeds when the deletion completes. + public func delete(card id: String) -> EventLoopFuture { + return self.client.delete(self.path + id, as: HTTPStatus.self).transform(to: ()) } } } From 41c00bfacb73d2252b4b787902ef1661b07aa4da Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 13:59:56 -0500 Subject: [PATCH 159/160] Created Vault.CreditCards.get(card:) method --- Sources/V1/Controllers/Vault/Vault.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/V1/Controllers/Vault/Vault.swift b/Sources/V1/Controllers/Vault/Vault.swift index e41d0dc8..b212d326 100644 --- a/Sources/V1/Controllers/Vault/Vault.swift +++ b/Sources/V1/Controllers/Vault/Vault.swift @@ -114,5 +114,17 @@ extension Valut { public func delete(card id: String) -> EventLoopFuture { return self.client.delete(self.path + id, as: HTTPStatus.self).transform(to: ()) } + + /// Shows details for a vaulted credit card, by ID. + /// + /// A successful request returns the HTTP 200 OK status code and a JSON response body with card details. + /// + /// - Parameter id: The ID of the vaulted credit card for which to show details. + /// This ID is returned when you store the credit card in the PayPal vault. + /// + /// - Returns: The credit card information for the ID passed in, wrapped in an `EventLoopFuture`. + public func get(card id: String) -> EventLoopFuture { + return self.client.get(self.path + id, as: CreditCard.self) + } } } From 78542449ba8ccf004c9446a190b15d4ed55edfa8 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Mon, 20 May 2019 14:01:37 -0500 Subject: [PATCH 160/160] Fixed CrediCard.List type --- Sources/V1/Models/Vault/CreditCardList.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/V1/Models/Vault/CreditCardList.swift b/Sources/V1/Models/Vault/CreditCardList.swift index 579723e6..12494723 100644 --- a/Sources/V1/Models/Vault/CreditCardList.swift +++ b/Sources/V1/Models/Vault/CreditCardList.swift @@ -6,17 +6,17 @@ extension CreditCard { public struct List: Codable { /// An array of credit card objects. - public var cards: [CreditCard] + public var cards: [CreditCard]? /// The total number of items. - public var count: Int32 + public var count: Int32? /// The total number of pages. - public var pages: Int32 + public var pages: Int32? /// An array of request-specific /// [HATEOAS links](https://developer.paypal.com/docs/api/reference/api-responses/#hateoas-links). - public let links: [LinkDescription] + public let links: [LinkDescription]? /// Creates a new `CreditCard.List` struct. /// @@ -24,13 +24,14 @@ extension CreditCard { /// - cards: An array of credit card objects. /// - count: The total number of items. /// - pages: The total number of pages. - public init(cards: [CreditCard], count: Int32, pages: Int32) { + public init(cards: [CreditCard]?, count: Int32?, pages: Int32?) { self.cards = cards self.count = count self.pages = pages + self.links = nil } - enum CodingKeys: String, CodingKeys { + enum CodingKeys: String, CodingKey { case links case cards = "items" case count = "total_items"