Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GiniHealthSDK): Payment providers added to payment component IPC-97 #451

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4564032
feat(GiniHealthSDK): Payment component linked with payment providers …
razvancapra Feb 1, 2024
16877f4
Merge branch 'payment-component-pay-invoice-button' into IPC-110_paym…
razvancapra Feb 2, 2024
e38b216
fix(GiniHealthSDK): Fix small issues, prepare for review and clean co…
razvancapra Feb 2, 2024
0052d7b
fix(GiniHealthSDK): protocol structure included for end client IPC-97
razvancapra Feb 5, 2024
49a70e1
fix(GiniHealthSDK): Fix more information button tap + passing actions…
razvancapra Feb 5, 2024
1989589
fix(GiniHealthSDK): Clean payment view constraints + Adding constants…
razvancapra Feb 5, 2024
455c4a7
fix(GiniHealthSDK): Fix suggestions from review + fetch payment provi…
razvancapra Feb 7, 2024
1718dee
fix(GiniHealthSDK): Fix wrong replacement IPC-97
razvancapra Feb 7, 2024
6b218f9
Merge branch 'payment-component-pay-invoice-button' into IPC-110_paym…
razvancapra Feb 8, 2024
73eb1dc
Merge branch 'payment-component-pay-invoice-button' into IPC-110_paym…
razvancapra Feb 9, 2024
e8ea055
fix(GiniHealthSDK): Fix isPayable protocol after merge
razvancapra Feb 9, 2024
b56d254
fix(GiniHealthSDK): Fix payment provider label name width
razvancapra Feb 9, 2024
edde48c
fix(GiniHealthSDK): Fix chevron icon color on dark mode
razvancapra Feb 9, 2024
155d5b2
Merge branch 'main' into IPC-110_payment-component-bank-available
razvancapra Feb 13, 2024
51ea7be
Merge branch 'payment-component-pay-invoice-button' into IPC-110_paym…
razvancapra Feb 19, 2024
f822c59
fix(GiniHealthSDK): Fix merge changes
razvancapra Feb 19, 2024
a89cbad
fix(GiniHealthSDK): Fix obtain payment providers on a different function
razvancapra Feb 19, 2024
0f148ee
fix(GiniHealthSDK): Fix sending the installed payment providers
razvancapra Feb 20, 2024
2dba0ef
fix(GiniHealthSDK): Fix indenation
razvancapra Feb 20, 2024
3c4be24
fix(GiniHealthSDK): Use button configurations for primary + secondary…
razvancapra Feb 22, 2024
ea9c732
Merge branch 'ipc-health-sdk-update' into IPC-110_payment-component-b…
razvancapra Feb 22, 2024
54a4f63
fix(GiniHealthSDK): Fixes info icon colour and more info label text c…
zladzeyka Feb 22, 2024
6589893
fix(GiniHealthSDK): Fix renaming, cleaning unused variables
razvancapra Feb 23, 2024
c2b9d45
fix(GiniHealthSDK): Fix layout issue to bank icon when payment provid…
razvancapra Feb 23, 2024
9aca000
fix(GiniHealthSDK): Fix colors on not installed payment provider
razvancapra Feb 23, 2024
5d6addb
fix(GiniHealthSDKexmaple): Adds Queried URL Schemes
zladzeyka Feb 23, 2024
5cadf2d
fix(GiniHealthSDK): Remove stored paymentProvider in invoice object
razvancapra Feb 26, 2024
4eea771
fix(GiniHealthSDK): Store selected payment provider in payment contro…
razvancapra Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// ButtonConfiguration.swift
//
// Copyright © 2024 Gini GmbH. All rights reserved.
//


import UIKit

public struct ButtonConfiguration {
let backgroundColor: UIColor
let borderColor: UIColor
let titleColor: UIColor
let shadowColor: UIColor
let cornerRadius: CGFloat
let borderWidth: CGFloat
let shadowRadius: CGFloat

let withBlurEffect: Bool

/// Button configuration initalizer
/// - Parameters:
/// - backgroundColor: the button's background color
/// - borderColor: the button's border color
/// - titleColor: the button's title color
/// - shadowColor: the button's color of the shadow
/// - cornerRadius: the button's corner radius
/// - borderWidth: the button's border width
/// - shadowRadius: the button's shadow radius
/// - withBlurEffect: adds a blur effect on the button ignoring the background color and making it translucent
public init(backgroundColor: UIColor,
borderColor: UIColor,
titleColor: UIColor,
shadowColor: UIColor,
cornerRadius: CGFloat,
borderWidth: CGFloat,
shadowRadius: CGFloat,
withBlurEffect: Bool) {
self.backgroundColor = backgroundColor
self.borderColor = borderColor
self.titleColor = titleColor
self.shadowColor = shadowColor
self.cornerRadius = cornerRadius
self.borderWidth = borderWidth
self.shadowRadius = shadowRadius
self.withBlurEffect = withBlurEffect
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// String.swift
//
// Copyright © 2024 Gini GmbH. All rights reserved.
//


import UIKit

extension String {
func toColor() -> UIColor? {
return UIColor(hex: String.rgbaHexFrom(rgbHex: self))
}
}
45 changes: 8 additions & 37 deletions HealthSDK/GiniHealthSDK/Sources/GiniHealthSDK/Core/GiniColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,14 @@
//

import UIKit
/**
The `Color` class allows us decode and encode the color
*/

public struct CodableColor: Codable {
private var red: CGFloat = 0.0
private var green: CGFloat = 0.0
private var blue: CGFloat = 0.0
private var alpha: CGFloat = 0.0

public var uiColor: UIColor {
UIColor(red: red,
green: green,
blue: blue,
alpha: alpha)
}

public var giniColor: GiniColor {
GiniColor(lightModeColor: uiColor,
darkModeColor: uiColor)
}

public init(uiColor: UIColor) {
uiColor.getRed(&red,
green: &green,
blue: &blue,
alpha: &alpha)
}
}

/**
The `GiniColor` class allows to customize color for the light and the dark modes.
*/

@objc public class GiniColor : NSObject, Codable {
var lightModeColor: CodableColor
var darkModeColor: CodableColor
@objc public class GiniColor : NSObject {
var lightModeColor: UIColor
var darkModeColor: UIColor

/**
Creates a GiniColor with the colors for the light and dark modes
Expand All @@ -51,24 +22,24 @@ public struct CodableColor: Codable {
- parameter darkModeColor: color for the dark mode
*/
public init(lightModeColor: UIColor, darkModeColor: UIColor) {
self.lightModeColor = CodableColor(uiColor: lightModeColor)
self.darkModeColor = CodableColor(uiColor: darkModeColor)
self.lightModeColor = lightModeColor
self.darkModeColor = darkModeColor
}

func uiColor() -> UIColor {
if #available(iOS 13, *) {
return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
/// Return the color for Dark Mode
return self.darkModeColor.uiColor
return self.darkModeColor
} else {
/// Return the color for Light Mode
return self.lightModeColor.uiColor
return self.lightModeColor
}
}
} else {
/// Return a fallback color for iOS 12 and lower.
return self.lightModeColor.uiColor
return self.lightModeColor
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ public struct DataForReview {
In case of failure error that there are no supported banking apps installed.

*/
private func getInstalledBankingApps(completion: @escaping (Result<PaymentProviders, GiniHealthError>) -> Void){
paymentService.paymentProviders { result in
private func getInstalledBankingApps(completion: @escaping (Result<PaymentProviders, GiniHealthError>) -> Void) {
razvancapra marked this conversation as resolved.
Show resolved Hide resolved
getBankingApps { result in
switch result {
case let .success(providers):
self.bankProviders = []
case .success(let providers):
for provider in providers {
DispatchQueue.main.async {
if let url = URL(string:provider.appSchemeIOS) {
Expand All @@ -110,12 +109,33 @@ public struct DataForReview {
}
case let .failure(error):
DispatchQueue.main.async {
completion(.failure(.apiError(error)))

completion(.failure(error))
}
}
}
}

/**
Getting a list of the banking apps supported by SDK

- Parameters:
- completion: An action for processing asynchronous data received from the service with Result type as a paramater.
Result is a value that represents either a success or a failure, including an associated value in each case.
In success case it includes array of payment providers supported by SDK.
In case of failure error provided by API.
*/

public func getBankingApps(completion: @escaping (Result<PaymentProviders, GiniHealthError>) -> Void) {
razvancapra marked this conversation as resolved.
Show resolved Hide resolved
paymentService.paymentProviders { result in
switch result {
case let .success(providers):
self.bankProviders = providers
completion(.success(self.bankProviders))
case let .failure(error):
completion(.failure(.apiError(error)))
}
}
}

/**
Checks if there are any banking app which support Gini Pay Connect functionality installed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,50 @@ public final class GiniHealthConfiguration: NSObject {
*/
@objc public var infoBarCornerRadius: CGFloat = 12.0

// MARK: - Button configuration options
/**
A configuration that defines the appearance of the primary button, including its background color, border color, title color, shadow color, corner radius, border width, shadow radius, and whether to apply a blur effect. It is used for buttons on different screens: `PaymentComponentView`
razvancapra marked this conversation as resolved.
Show resolved Hide resolved
*/
public lazy var primaryButtonConfiguration = ButtonConfiguration(backgroundColor: .GiniColors.accent1,
borderColor: .clear,
titleColor: .white,
shadowColor: .clear,
cornerRadius: 12,
borderWidth: 0,
shadowRadius: 0,
withBlurEffect: false)
/**
A configuration that defines the appearance of the secondary button, including its background color, border color, title color, shadow color, corner radius, border width, shadow radius, and whether to apply a blur effect. It is used for buttons on different screens: `PaymentComponentView`
razvancapra marked this conversation as resolved.
Show resolved Hide resolved
*/
public lazy var secondaryButtonConfiguration = ButtonConfiguration(backgroundColor: GiniColor(lightModeColor: UIColor.GiniColors.dark6,
darkModeColor: UIColor.GiniColors.light6).uiColor(),
borderColor: GiniColor(lightModeColor: UIColor.GiniColors.dark5,
darkModeColor: UIColor.GiniColors.light5).uiColor(),
titleColor: GiniColor(lightModeColor: UIColor.GiniColors.dark1,
darkModeColor: UIColor.GiniColors.light1).uiColor(),
shadowColor: .clear,
cornerRadius: 12,
borderWidth: 1,
shadowRadius: 0,
withBlurEffect: true)

// MARK: - Shared properties

/**
Sets the font used in the screens by default.
*/

@objc public lazy var customFont = GiniFont(regular: UIFont.systemFont(ofSize: 14,
weight: .regular),
bold: UIFont.systemFont(ofSize: 14,
weight: .bold),
light: UIFont.systemFont(ofSize: 14,
weight: .light),
thin: UIFont.systemFont(ofSize: 14,
weight: .thin),
medium: UIFont.systemFont(ofSize: 14,
weight: .medium),
isEnabled: false)
weight: .regular),
bold: UIFont.systemFont(ofSize: 14,
weight: .bold),
light: UIFont.systemFont(ofSize: 14,
weight: .light),
thin: UIFont.systemFont(ofSize: 14,
weight: .thin),
medium: UIFont.systemFont(ofSize: 14,
weight: .medium),
isEnabled: false)
/**
Sets the color of the loading indicator to the specified color.
*/
Expand All @@ -254,13 +281,13 @@ public final class GiniHealthConfiguration: NSObject {
*/
@objc public var loadingIndicatorScale: CGFloat = 1.0

private var textStyleFonts: [UIFont.TextStyle: UIFont] = [
.caption1: UIFontMetrics(forTextStyle: .caption1).scaledFont(for: UIFont.systemFont(ofSize: 12)),
.caption2: UIFontMetrics(forTextStyle: .caption2).scaledFont(for: UIFont.systemFont(ofSize: 11)),
.linkBold: UIFontMetrics(forTextStyle: .linkBold).scaledFont(for: UIFont.systemFont(ofSize: 14)),
.subtitle2: UIFontMetrics(forTextStyle: .subtitle2).scaledFont(for: UIFont.systemFont(ofSize: 14)),
.input: UIFontMetrics(forTextStyle: .input).scaledFont(for: UIFont.systemFont(ofSize: 16)),
.button: UIFontMetrics(forTextStyle: .button).scaledFont(for: UIFont.systemFont(ofSize: 16))
var textStyleFonts: [UIFont.TextStyle: UIFont] = [
.caption1: UIFontMetrics(forTextStyle: .caption1).scaledFont(for: UIFont.systemFont(ofSize: 13, weight: .regular)),
.caption2: UIFontMetrics(forTextStyle: .caption2).scaledFont(for: UIFont.systemFont(ofSize: 12, weight: .regular)),
.linkBold: UIFontMetrics(forTextStyle: .linkBold).scaledFont(for: UIFont.systemFont(ofSize: 14, weight: .bold)),
.subtitle2: UIFontMetrics(forTextStyle: .subtitle2).scaledFont(for: UIFont.systemFont(ofSize: 14, weight: .medium)),
.input: UIFontMetrics(forTextStyle: .input).scaledFont(for: UIFont.systemFont(ofSize: 16, weight: .medium)),
.button: UIFontMetrics(forTextStyle: .button).scaledFont(for: UIFont.systemFont(ofSize: 16, weight: .bold))
]

}
Loading
Loading