Skip to content

Commit

Permalink
Merge branch 'master' into bn/cvv-recapture-drop-in
Browse files Browse the repository at this point in the history
# Conflicts:
#	Debug App/.swiftlint.yml
#	Debug App/Sources/Model/CreateClientToken.swift
#	Debug App/Sources/View Controllers/Merchant Helpers/MerchantHelpers.swift
#	Debug App/Sources/View Controllers/MerchantSessionAndSettingsViewController.swift
#	Debug App/Tests/Unit Tests/Mocks.swift
#	Debug App/Tests/Unit Tests/Mocks/MockPaymentMethodTokenizationViewModel.swift
#	Debug App/Tests/Unit Tests/Primer/Ideal/BankComponentTests.swift
#	Sources/PrimerSDK/Classes/Core/3DS/3DSService.swift
#	Sources/PrimerSDK/Classes/Core/BIN Data/CardValidationService.swift
#	Sources/PrimerSDK/Classes/Core/PrimerHeadlessUniversalCheckout/Managers/Payment Method Managers/CardComponentsManager.swift
#	Sources/PrimerSDK/Classes/Core/PrimerHeadlessUniversalCheckout/PrimerHeadlessUniversalCheckout.swift
#	Sources/PrimerSDK/Classes/Data Models/CardButtonViewModel.swift
#	Sources/PrimerSDK/Classes/Data Models/ClientSession.swift
#	Sources/PrimerSDK/Classes/Error Handler/PrimerError.swift
#	Sources/PrimerSDK/Classes/Error Handler/PrimerValidationError.swift
#	Sources/PrimerSDK/Classes/Extensions & Utilities/AnyDecodable.swift
#	Sources/PrimerSDK/Classes/PCI/Checkout Components/PrimerRawCardDataRedirectTokenizationBuilder.swift
#	Sources/PrimerSDK/Classes/User Interface/Root/PrimerRootViewController.swift
#	Sources/PrimerSDK/Classes/User Interface/Root/PrimerUniversalCheckoutViewController.swift
  • Loading branch information
BorisNikolic committed Mar 25, 2024
2 parents b62bf05 + 27f784a commit 5cb11cf
Show file tree
Hide file tree
Showing 54 changed files with 475 additions and 754 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_test_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
unit-test:
needs: danger
runs-on: macos-13
runs-on: macos-13-large
timeout-minutes: 30
name: "Unit Tests"
steps:
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: '15.1'
xcode-version: '15.2'
- name: Install SSH key
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 #v2.7.0
with:
Expand Down
25 changes: 8 additions & 17 deletions Debug App/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
#line_length:
# warning: 150
# ignores_function_declarations: true
# ignores_comments: true
# ignores_interpolated_strings: true
# ignores_urls: true
#
#included:
# - ../Sources
#
#excluded:
# - ../Sources/PrimerSDK/Classes/Third Party/PromiseKit
disabled_rules:
- line_length
- type_body_length
- function_body_length
- file_length
# - cyclomatic_complexity
- superfluous_disable_command

line_length:
warning: 150
ignores_function_declarations: true
ignores_comments: true
ignores_interpolated_strings: true
ignores_urls: true

included:
- ../Sources

Expand Down
12 changes: 6 additions & 6 deletions Debug App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ project 'Primer.io Debug App.xcodeproj'
target 'Debug App' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for Debug App
pod 'PrimerSDK', :path => '../'
pod 'Primer3DS', "2.2.0"
pod 'Primer3DS'
pod 'PrimerKlarnaSDK'
pod 'PrimerIPay88MYSDK'
pod 'PrimerNolPaySDK'
pod 'IQKeyboardManagerSwift'

target 'Debug App Tests' do
inherit! :search_paths
# Pods for testing
end

post_install do |installer|
fix_code_signing(installer)
fix_linking(installer)
Expand All @@ -27,7 +27,7 @@ end


def fix_code_signing(installer)

installer.generated_projects.each do |project|
project.targets.each do |target|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
Expand All @@ -42,7 +42,7 @@ end


def fix_linking(installer)

installer.generated_projects.each do |project|
primer_target_names = project.targets.filter { |target|
!target.name.start_with?("PrimerSDK") && target.name.start_with?("Primer")
Expand Down
8 changes: 4 additions & 4 deletions Debug App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- IQKeyboardManagerSwift (7.0.1)
- Primer3DS (2.2.0)
- Primer3DS (2.3.0)
- PrimerIPay88MYSDK (0.1.7)
- PrimerKlarnaSDK (1.1.0)
- PrimerNolPaySDK (1.0.1)
Expand All @@ -10,7 +10,7 @@ PODS:

DEPENDENCIES:
- IQKeyboardManagerSwift
- Primer3DS (= 2.2.0)
- Primer3DS
- PrimerIPay88MYSDK
- PrimerKlarnaSDK
- PrimerNolPaySDK
Expand All @@ -30,12 +30,12 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
IQKeyboardManagerSwift: 7f6b1b1d1497855d2beea7f2f10ffcc6978525b1
Primer3DS: affa70b17e4b7f8f3bd6110fa88dce24cb5ac4c0
Primer3DS: c70e939120c0e37aa968f89ecb59d5add5497720
PrimerIPay88MYSDK: 436ee0be7e2c97e4e81456ccddee20175e9e3c4d
PrimerKlarnaSDK: 83e9a1357a7247bf8fa2836fc945cf97644d601d
PrimerNolPaySDK: 08b140ed39b378a0b33b4f8746544a402175c0cc
PrimerSDK: af09c3d815cda8b5dc815cb91b2a693e55c52677

PODFILE CHECKSUM: 0338ba968079466f92e90a37e90d263807adbb7f
PODFILE CHECKSUM: 4070d0f559c86f4414e465a26e3de7b095420546

COCOAPODS: 1.15.2
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/primer-io/primer-sdk-3ds-ios",
"state": {
"branch": null,
"revision": "cf576e98418c5e7ba6b556a14c5253cd9de5692b",
"version": "2.2.0"
"revision": "e1ec345543e1d7583dd574cecfb488b47b681936",
"version": "2.3.0"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Debug App/Sources/Model/CheckoutTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct CheckoutTheme {
themeData.buttons.main.defaultColor = .systemBlue
themeData.buttons.main.disabledColor = .systemGray4
themeData.buttons.paymentMethod.border.width = 1.0

if UITraitCollection.current.userInterfaceStyle == .dark {
themeData.view.backgroundColor = .systemGray6
themeData.text.title = PrimerThemeData.Text(defaultColor: .systemGray)
Expand All @@ -69,7 +69,7 @@ struct CheckoutTheme {
themeData.input.border = PrimerThemeData.Border(defaultColor: .systemGray, selectedColor: .systemBlue)
themeData.input.text = PrimerThemeData.Text(defaultColor: .systemGray)
themeData.input.backgroundColor = .systemGray3

} else {
themeData.view.backgroundColor = .white
themeData.text.title = PrimerThemeData.Text(defaultColor: .black)
Expand All @@ -84,7 +84,7 @@ struct CheckoutTheme {
themeData.input.text = PrimerThemeData.Text(defaultColor: .black)
themeData.input.backgroundColor = .systemGray5
}

return PrimerTheme.init(with: themeData)
}
}
42 changes: 21 additions & 21 deletions Debug App/Sources/Model/CreateClientToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ struct ClientSessionRequestBody {
var discountAmount: Int?
var taxAmount: Int?
var productType: String?

var dictionaryValue: [String: Any]? {
var dic: [String: Any] = [:]

Expand All @@ -308,16 +308,16 @@ struct ClientSessionRequestBody {
if let discountAmount = discountAmount {
dic["discountAmount"] = discountAmount
}

if let productType = productType {
dic["productType"] = productType
}

return dic.keys.count == 0 ? nil : dic
}
}
}

struct PaymentMethod: Codable {
let vaultOnSuccess: Bool?
var options: PaymentMethodOptionGroup?
Expand All @@ -334,7 +334,7 @@ struct ClientSessionRequestBody {
if let options = options {
dic["options"] = options.dictionaryValue
}

if let descriptor = descriptor {
dic["descriptor"] = descriptor
}
Expand All @@ -345,14 +345,14 @@ struct ClientSessionRequestBody {

return dic.keys.count == 0 ? nil : dic
}

struct PaymentMethodOptionGroup: Codable {
var KLARNA: PaymentMethodOption?
var PAYMENT_CARD: PaymentMethodOption?

var dictionaryValue: [String: Any]? {
var dic: [String: Any] = [:]

if let KLARNA = KLARNA {
dic["KLARNA"] = KLARNA.dictionaryValue
}
Expand All @@ -364,7 +364,7 @@ struct ClientSessionRequestBody {
return dic.keys.count == 0 ? nil : dic
}
}

struct PaymentMethodOption: Codable {
var surcharge: SurchargeOption?
var instalmentDuration: String?
Expand All @@ -387,27 +387,27 @@ struct ClientSessionRequestBody {

func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)

if let surcharge = surcharge {
try container.encode(surcharge, forKey: .surcharge)
}

if let instalmentDuration = instalmentDuration {
try container.encode(instalmentDuration, forKey: .instalmentDuration)
}

if let extraMerchantData = extraMerchantData {
let jsonData = try JSONSerialization.data(withJSONObject: extraMerchantData, options: [])
let jsonString = String(data: jsonData, encoding: .utf8)
try container.encode(jsonString, forKey: .extraMerchantData)
}
}

init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
surcharge = try container.decodeIfPresent(SurchargeOption.self, forKey: .surcharge)
instalmentDuration = try container.decodeIfPresent(String.self, forKey: .instalmentDuration)

let jsonString = try container.decodeIfPresent(String.self, forKey: .extraMerchantData)
if let jsonData = jsonString?.data(using: .utf8) {
extraMerchantData = try JSONSerialization.jsonObject(with: jsonData) as? [String: Any]
Expand All @@ -417,18 +417,18 @@ struct ClientSessionRequestBody {

captureVaultedCardCvv = try container.decodeIfPresent(Bool.self, forKey: .captureVaultedCardCvv) ?? false
}

var dictionaryValue: [String: Any]? {
var dic: [String: Any] = [:]

if let surcharge = surcharge {
dic["surcharge"] = surcharge.dictionaryValue
}

if let instalmentDuration = instalmentDuration {
dic["instalmentDuration"] = instalmentDuration
}

if let extraMerchantData = extraMerchantData {
dic["extraMerchantData"] = extraMerchantData
}
Expand All @@ -440,17 +440,17 @@ struct ClientSessionRequestBody {
return dic.keys.count == 0 ? nil : dic
}
}

struct SurchargeOption: Codable {
var amount: Int?

var dictionaryValue: [String: Any]? {
var dic: [String: Any] = [:]

if let amount = amount {
dic["amount"] = amount
}

return dic.keys.count == 0 ? nil : dic
}
}
Expand Down
3 changes: 1 addition & 2 deletions Debug App/Sources/Utilities/MetadataParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation


struct MetadataParser {

func parse(_ metadata: String?) -> [String: Any] {
Expand Down Expand Up @@ -39,7 +38,7 @@ struct MetadataParser {

if let int = Int(value) { return int }
if let number = Double(value) { return number }

// String
if value.hasPrefix("\"") && value.hasSuffix("\"") {
return String(value.dropFirst().dropLast())
Expand Down
10 changes: 5 additions & 5 deletions Debug App/Sources/Utilities/TapGestureRecognizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import UIKit

@objc
class TapGestureRecognizer: UITapGestureRecognizer {

@objc
class Container: NSObject {
let callback: () -> Void

init(_ callback: @escaping () -> Void) {
self.callback = callback
}

@objc func didTap(_ sender: UIView?) {
callback()
}
}

private let container: Container

required init(_ callback: @escaping () -> Void) {
self.container = Container(callback)
super.init(target: container, action: #selector(Container.didTap(_:)))
Expand Down
Loading

0 comments on commit 5cb11cf

Please sign in to comment.