Skip to content

Commit

Permalink
Prepare main for Release 1.2.0 (#21)
Browse files Browse the repository at this point in the history
* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.

* feat: Add Stripe as First Payment Gateway (#11)

Add all necessary logic and changes to make payment processing using Stripe including Protocols, Factories and Models to deal with the StripePayments pod. Unit tests are included.

* Feat: Add Gateway property to OSPMTDetailsModel (#12)

Add `gateway` property to `OSPMTDetailsModel` struct. When authorising payment, confirm that this property corresponds to a configured gateway (on plist).

* feat: Add AccessToken to Full Payment Process (#13)

Add the optional parameter `accessToken` to the `OSPMTActionDelegate`'s `set` method and the `OSPMTStripeWrapper`'s `processPaymentWithDetails` method. Apply consequent changes to it.
In case of a full payment is triggered but no access token is passed, a `tokenIssue` is returned.

* chore: Set Release Tag

Set release tag on the repo's CHANGELOG file.

* Merge Development Into Main (#10)

* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.

* feat: Make library available as xcframework (#15)

Add the necessary script (script.sh) to make the library available as a xcframework.
Remove podspec file as the CocoaPods approach was discarded.
Exchange Stripe pod for a Swift Package Manager.

* chore: Set Release Tag

* Prepare Release 1.1.0 (#14)

* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.

* feat: Add Stripe as First Payment Gateway (#11)

Add all necessary logic and changes to make payment processing using Stripe including Protocols, Factories and Models to deal with the StripePayments pod. Unit tests are included.

* Feat: Add Gateway property to OSPMTDetailsModel (#12)

Add `gateway` property to `OSPMTDetailsModel` struct. When authorising payment, confirm that this property corresponds to a configured gateway (on plist).

* feat: Add AccessToken to Full Payment Process (#13)

Add the optional parameter `accessToken` to the `OSPMTActionDelegate`'s `set` method and the `OSPMTStripeWrapper`'s `processPaymentWithDetails` method. Apply consequent changes to it.
In case of a full payment is triggered but no access token is passed, a `tokenIssue` is returned.

* chore: Set Release Tag

Set release tag on the repo's CHANGELOG file.

* Prepare Release 1.1.1 (#16)

* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.

* feat: Add Stripe as First Payment Gateway (#11)

Add all necessary logic and changes to make payment processing using Stripe including Protocols, Factories and Models to deal with the StripePayments pod. Unit tests are included.

* Feat: Add Gateway property to OSPMTDetailsModel (#12)

Add `gateway` property to `OSPMTDetailsModel` struct. When authorising payment, confirm that this property corresponds to a configured gateway (on plist).

* feat: Add AccessToken to Full Payment Process (#13)

Add the optional parameter `accessToken` to the `OSPMTActionDelegate`'s `set` method and the `OSPMTStripeWrapper`'s `processPaymentWithDetails` method. Apply consequent changes to it.
In case of a full payment is triggered but no access token is passed, a `tokenIssue` is returned.

* chore: Set Release Tag

Set release tag on the repo's CHANGELOG file.

* feat: Make library available as xcframework (#15)

Add the necessary script (script.sh) to make the library available as a xcframework.
Remove podspec file as the CocoaPods approach was discarded.
Exchange Stripe pod for a Swift Package Manager.

* chore: Set Release Tag

* fix: Update GitHub Actions (#17)

Update `github_actions.yml` file steps versions.

References: https://outsystemsrd.atlassian.net/browse/RMET-2568

* RMET-3283 ::: Add Privacy Manifest (#19)

* chore: add CODEOWNERS (#18)

Signed-off-by: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com>

* chore: Update Stripe to `23.26.0`

Considering that this new version doesn't work with Xcode 14, we update the minimum versions to:
- xCode 15;
- iOS 14.
These updates require updating `Quick` and `Nimble` to the latest versions: `7.5.0` and `13.2.1` respectively. This requires updating the test cases, to make them pass successfully.
The update to iOS 14 also requires the insertion of the `presentationWindow(for:)` method for `OSPMTApplePayRequestBehaviour`.
Add `Podfile.lock` to the `gitignore` file.

References: https://outsystemsrd.atlassian.net/browse/RMET-3283

* chore: Update scripts

Update `github_actions.yml` file to allow the correct execution of the unit tests.
Update the `build.sh` script by including:
- the Xcode version to run;
- the `sdk`s to run;
- code signing.

* feat: Add Privacy Manifest

References: https://outsystemsrd.atlassian.net/browse/RMET-3283

* chore: Use `macos-14` for GitHub Actions

Replace `macos-latest` with `macos-14`. This is required as we aim to use Xcode 15 to run the unit tests.
Add `Gemfile.lock` file to `gitignore`.

References: https://outsystemsrd.atlassian.net/browse/RMET-3283

* chore: Add CHANGELOG entry

References: https://outsystemsrd.atlassian.net/browse/RMET-3283

---------

Signed-off-by: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com>
Co-authored-by: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com>

* RMET-3340 ::: Prepare Release `1.2.0` (#20)

* chore: Set Release Version

Raise version to `1.2.0`.

References: https://outsystemsrd.atlassian.net/browse/RMET-3340

* fix: Typo

References: https://outsystemsrd.atlassian.net/browse/RMET-3340

* chore: Add missing configurations

---------

Signed-off-by: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com>
Co-authored-by: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com>
  • Loading branch information
OS-ricardomoreirasilva and IT-MikeS committed Apr 11, 2024
1 parent ee57cd8 commit cca6379
Show file tree
Hide file tree
Showing 208 changed files with 12,445 additions and 3,234 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,45 @@ on:
jobs:
test:
name: Unit-Tests
runs-on: macos-latest

runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Set up XCode
run: sudo xcode-select --switch /Applications/Xcode_15.1.app

- name: Bundle Install
run: bundle install

- name: Install Cocoapods
run: bundle exec pod install

- name: Link SwiftLint or install it
run: brew link --overwrite swiftlint || brew install swiftlint || brew link --overwrite swiftlint

- name: Unit tests
run: bundle exec fastlane unit_tests
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

- name: Code Coverage
run: bundle exec fastlane coverage

- name: Lint
run: bundle exec fastlane lint

- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v3
uses: warchant/setup-sonar-scanner@v8

- name: Send to Sonarcloud
run: bundle exec fastlane sonarqube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_KEY }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
Podfile.lock
Gemfile.lock
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source "https://rubygems.org"

gem "fastlane"
gem "slather"
gem 'cocoapods', '1.14.3'
gem 'fastlane'
gem 'slather'
119 changes: 74 additions & 45 deletions OSPaymentsLib.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -45,7 +45,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
launchStyle = "1"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/stripe/stripe-ios-spm",
"state" : {
"revision" : "87e3ebe7539e4408430606a5f1fbc9b88e67ae84",
"version" : "23.2.0"
"revision" : "3631ddcfa4c5dcccc4609b1682bbdec3d586bba8",
"version" : "23.26.0"
}
}
],
Expand Down
97 changes: 97 additions & 0 deletions OSPaymentsLib/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>

<key>NSPrivacyTrackingDomains</key>
<array/>

<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeName</string>

<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>

<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>

<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>

<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeEmailAddress</string>

<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>

<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>

<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>

<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePhoneNumber</string>

<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>

<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>

<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>

<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePhysicalAddress</string>

<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>

<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>

<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>

<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePaymentInfo</string>

<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>

<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>

<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>

<key>NSPrivacyAccessedAPITypes</key>
<array/>
</dict>
</plist>
13 changes: 6 additions & 7 deletions OSPaymentsLib/Protocols/OSPMTRequestDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ extension OSPMTApplePayRequestBehaviour {

// MARK: - Set up PKPaymentAuthorizationControllerDelegate conformance
extension OSPMTApplePayRequestBehaviour: PKPaymentAuthorizationControllerDelegate {
/// Tells the delegate that payment authorization finished.
/// - Parameter controller: The payment authorization view controller.
func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) {
controller.dismiss()
// The payment sheet doesn't automatically dismiss once it has finished. Dismiss the payment sheet.
Expand All @@ -124,11 +122,6 @@ extension OSPMTApplePayRequestBehaviour: PKPaymentAuthorizationControllerDelegat
}
}

/// Tells the delegate that the user authorized the payment request, and asks for a result.
/// - Parameters:
/// - controller: The payment authorization view controller.
/// - payment: The authorized payment. This object contains the payment token you need to submit to your payment processor, as well as the billing and shipping information required by the payment request.
/// - completion: The completion handler to call with the result of authorizing the payment.
func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) {
func setPaymentResults(with errorArray: [OSPMTError], and scopeModel: OSPMTScopeModel?, _ completion: @escaping (PKPaymentAuthorizationResult) -> Void) {
if errorArray.isEmpty, let scopeModel = scopeModel {
Expand Down Expand Up @@ -172,4 +165,10 @@ extension OSPMTApplePayRequestBehaviour: PKPaymentAuthorizationControllerDelegat
setPaymentResults(with: [], and: payment.createScopeModel(), completion)
}
}

/**
Despite the need to implement the method, this is not required by app's functionality.
For that reason, we're returning `nil` as the presentation window.
*/
func presentationWindow(for controller: PKPaymentAuthorizationController) -> UIWindow? { nil }
}
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/ModelSpecs/OSPMTAddressModelSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class OSPMTAddressModelSpec: QuickSpec {
)
}

override func spec() {
override class func spec() {
describe("Given a full configuration") {
context("When decoding the Address Model") {
it("Should return a filled object") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OSPMTContactInfoModelSpec: QuickSpec {
)
}

override func spec() {
override class func spec() {
describe("Given a full configuration") {
context("When decoding the Contact Info Model") {
it("Should return a filled object") {
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/ModelSpecs/OSPMTDataModelSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OSPMTDataModelSpec: QuickSpec {
)
}

override func spec() {
override class func spec() {
describe("Given a full configuration") {
context("When decoding the Data Model") {
it("Should return a filled object") {
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/ModelSpecs/OSPMTScopeModelSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OSPMTScopeModelSpec: QuickSpec {
static let paymentRequest = PKPaymentRequest()
}

override func spec() {
override class func spec() {
describe("Given a full configuration") {
context("When decoding the Data Model") {
it("Should return a filled object") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class OSPMTTokenInfoModelSpec: QuickSpec {
static let fullModel = OSPMTTokenInfoModel(token: OSPMTTestConfigurations.dummyString, type: OSPMTTestConfigurations.dummyString)
}

override func spec() {
override class func spec() {
describe("Given a full configuration") {
context("When decoding the Token Info Model") {
it("Should return a filled object") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MockSetupAvailableBehaviour: OSPMTApplePaySetupAvailabilityDelegate {
}

class OSPMTApplePayAvailabilityBehaviourSpec: QuickSpec {
override func spec() {
override class func spec() {
var applePayAvailabilityBehaviour: OSPMTApplePayAvailabilityBehaviour!

let mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig)
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/OSPMTApplePayConfigurationSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Quick
@testable import OSPaymentsLib

class OSPMTApplePayConfigurationSpec: QuickSpec {
override func spec() {
override class func spec() {
var applePayConfiguration: OSPMTApplePayConfiguration!

describe("Given a correct configuration") {
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/OSPMTApplePayHandlerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class OSPMTMockRequestBehaviour: OSPMTRequestDelegate {
}

class OSPMTApplePayHandlerSpec: QuickSpec {
override func spec() {
override class func spec() {
var applePayHandler: OSPMTApplePayHandler!
var mockAvailabilityBehaviour: OSPMTMockAvailabilityBehaviour!
var mockRequestBehaviour: OSPMTMockRequestBehaviour!
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/OSPMTApplePayRequestBehaviourSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MockRequestTriggerBehaviour: OSPMTApplePayRequestTriggerDelegate {
}

class OSPMTApplePayRequestBehaviourSpec: QuickSpec {
override func spec() {
override class func spec() {
var applePayRequestBehaviour: OSPMTApplePayRequestBehaviour!

var mockConfiguration: OSPMTApplePayConfiguration!
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/OSPMTGatewayFactorySpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Quick
@testable import OSPaymentsLib

class OSPMTGatewayFactorySpec: QuickSpec {
override func spec() {
override class func spec() {
var model: OSPMTGatewayModel!
var wrapper: OSPMTGatewayDelegate!

Expand Down
19 changes: 14 additions & 5 deletions OSPaymentsLibTests/OSPMTPaymentsSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OSPMTMockHandler: OSPMTHandlerDelegate {
}

class OSPMTPaymentsSpec: QuickSpec {
override func spec() {
override class func spec() {
var mockDelegate: OSPMTMockCallback!
var mockHandler: OSPMTMockHandler!
var payments: OSPMTPayments!
Expand Down Expand Up @@ -86,8 +86,12 @@ class OSPMTPaymentsSpec: QuickSpec {
expect(mockDelegate.error).to(beNil())

let result = payments.encode(OSPMTTestConfigurations.dummyScopeModel)
if case let .success(scopeText) = result {
expect(mockDelegate.successText).to(equal(scopeText))
if case let .success(scopeText) = result,
let scopeTextData = scopeText.data(using: .utf8),
let successTextData = mockDelegate.successText?.data(using: .utf8),
let scopeObject = try? JSONSerialization.jsonObject(with: scopeTextData) as? [String: Any],
let successTextObject = try? JSONSerialization.jsonObject(with: successTextData) as? [String: Any] {
expect(NSDictionary(dictionary: scopeObject)).to(equal(NSDictionary(dictionary: successTextObject)))
} else {
fail()
}
Expand Down Expand Up @@ -118,9 +122,14 @@ class OSPMTPaymentsSpec: QuickSpec {
payments.set(detailsString)

expect(mockDelegate.error).to(beNil())

let result = payments.encode(OSPMTTestConfigurations.useConfigurationBillingScopeModel)
if case let .success(scopeText) = result {
expect(mockDelegate.successText).to(equal(scopeText))
if case let .success(scopeText) = result,
let scopeTextData = scopeText.data(using: .utf8),
let successTextData = mockDelegate.successText?.data(using: .utf8),
let scopeObject = try? JSONSerialization.jsonObject(with: scopeTextData) as? [String: Any],
let successTextObject = try? JSONSerialization.jsonObject(with: successTextData) as? [String: Any] {
expect(NSDictionary(dictionary: scopeObject)).to(equal(NSDictionary(dictionary: successTextObject)))
} else {
fail()
}
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLibTests/OSPMTStripeWrapperSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MockURLProtocol: URLProtocol {
}

class OSPMTStripeWrapperSpec: QuickSpec {
override func spec() {
override class func spec() {
var mockAPIDelegate: MockStripeAPIDelegate!
var mockPayment: PKPayment!
var mockDetailsModel: OSPMTDetailsModel!
Expand Down
6 changes: 3 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
platform :ios, '13.0'
platform :ios, '14.0'

target 'OSPaymentsLib' do
use_frameworks!

# Pods for OSPaymentsLib

target 'OSPaymentsLibTests' do
pod 'Quick', '5.0.1'
pod 'Nimble', '10.0.0'
pod 'Quick', '7.5.0'
pod 'Nimble', '13.2.1'
end

end
Loading

0 comments on commit cca6379

Please sign in to comment.