Skip to content

Commit

Permalink
Merge remote-tracking branch 'main' into PM-133-fix-ipad-window-size
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-gini committed Feb 5, 2025
2 parents 7c16f7b + 755767f commit f7c1b98
Show file tree
Hide file tree
Showing 33 changed files with 118 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
jira_ticket=$(echo "$commit_message" | awk 'NR > 1 && $0 != "" { print $0; exit }')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
prepare-frameworks:
name: Create Release
runs-on: macos-14
runs-on: macos-15
steps:
- uses: maxim-lobanov/[email protected]
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
jira_ticket=$(echo "$commit_message" | awk 'NR > 1 && $0 != "" { print $0; exit }')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
jira_ticket=$(echo "$commit_message" | awk 'NR > 1 && $0 != "" { print $0; exit }')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protocol EditLineItemViewModelDelegate: AnyObject {
final class EditLineItemViewModel {
weak var delegate: EditLineItemViewModelDelegate?
private var lineItem: DigitalInvoice.LineItem
private (set) var itemsChanged: [GiniLineItemAnalytics] = []
private(set) var itemsChanged: [GiniLineItemAnalytics] = []

var name: String? {
return lineItem.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class SkontoDocumentPagesViewModel: DocumentPagesViewModelProtocol {
private var expiryDate: Date

// Information to be displayed in the screen after highlighting Skonto details
private (set) var processedImages = [UIImage]()
private(set) var processedImages = [UIImage]()
static var screenTitle = NSLocalizedStringPreferredGiniBankFormat("ginibank.skonto.document.pages.screen.title",
comment: "Skonto discount details")
var bottomInfoItems: [String] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ class SkontoViewModel {
var proceedAction: (() -> Void)?

private let skontoDiscounts: SkontoDiscounts
private (set) var isWithDiscountSwitchAvailable: Bool
private(set) var isWithDiscountSwitchAvailable: Bool
private var skontoPercentage: Double

private (set) var isSkontoApplied: Bool = true
private (set) var amountToPay: Price
private (set) var skontoAmountToPay: Price
private(set) var isSkontoApplied: Bool = true
private(set) var amountToPay: Price
private(set) var skontoAmountToPay: Price

private (set) var dueDate: Date
private (set) var amountDiscounted: Price
private (set) var currencyCode: String
private (set) var remainingDays: Int
private (set) var paymentMethod: SkontoDiscountDetails.PaymentMethod
private (set) var edgeCase: SkontoEdgeCase?
private(set) var dueDate: Date
private(set) var amountDiscounted: Price
private(set) var currencyCode: String
private(set) var remainingDays: Int
private(set) var paymentMethod: SkontoDiscountDetails.PaymentMethod
private(set) var edgeCase: SkontoEdgeCase?

private (set) var documentPagesViewModel: SkontoDocumentPagesViewModel?
private(set) var documentPagesViewModel: SkontoDocumentPagesViewModel?

private var maximumAmountToPayValue: Decimal = 99999.99

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TransactionDocsItemView: UIView {

private let configuration = GiniBankConfiguration.shared

private (set) var transactionDocsItem: TransactionDoc?
private(set) var transactionDocsItem: TransactionDoc?

var optionsAction: (() -> Void)?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class HelpFormatsViewController: UIViewController, HelpBottomBarEnabledVie
tableView.translatesAutoresizingMaskIntoConstraints = false
return tableView
}()
private (set) var dataSource: HelpFormatsDataSource
private(set) var dataSource: HelpFormatsDataSource
private var giniConfiguration: GiniConfiguration
private let tableRowHeight: CGFloat = 44
private let sectionHeight: CGFloat = 70
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protocol HelpMenuViewControllerDelegate: AnyObject {
final class HelpMenuViewController: UIViewController, HelpBottomBarEnabledViewController {

weak var delegate: HelpMenuViewControllerDelegate?
private (set) var dataSource: HelpMenuDataSource
private(set) var dataSource: HelpMenuDataSource
private let giniConfiguration: GiniConfiguration
private let tableRowHeight: CGFloat = 44
var navigationBarBottomAdapter: HelpBottomNavigationBarAdapter?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class HelpTipsViewController: UIViewController, HelpBottomBarEnabledViewCo
tableView.translatesAutoresizingMaskIntoConstraints = false
return tableView
}()
private (set) var dataSource: HelpTipsDataSource
private(set) var dataSource: HelpTipsDataSource
private var giniConfiguration: GiniConfiguration
private let tableRowHeight: CGFloat = 76

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class BottomButtonsViewModel {

init(retakeBlock: (() -> Void)? = nil,
manuallyPressed: (() -> Void)? = nil,
cancelPressed: @escaping(() -> Void)) {
cancelPressed: @escaping (() -> Void)) {
self.retakePressed = retakeBlock
self.enterManuallyPressed = manuallyPressed
self.cancelPressed = cancelPressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class NoResultScreenViewController: UIViewController {
}
fatalError("No result header not found")
}()
private (set) var dataSource: HelpDataSource
private(set) var dataSource: HelpDataSource
private var giniConfiguration: GiniConfiguration
private let type: NoResultType
private let viewModel: BottomButtonsViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class OnboardingDataSource: NSObject, BaseCollectionViewDataSource {

weak var delegate: OnboardingScreen?
var isProgrammaticScroll = false

private let giniConfiguration: GiniConfiguration
private (set) var currentPageIndex = 0
private(set) var currentPageIndex = 0
private var isInitialScroll = true

lazy var pageModels: [OnboardingPageModel] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class OnboardingViewController: UIViewController {
@IBOutlet weak var pagesCollection: UICollectionView!
@IBOutlet weak var pageControl: UIPageControl!
@IBOutlet weak var nextButton: MultilineTitleButton!
private (set) var dataSource: OnboardingDataSource
private(set) var dataSource: OnboardingDataSource
private let configuration = GiniConfiguration.shared
private var navigationBarBottomAdapter: OnboardingNavigationBarBottomAdapter?
private var bottomNavigationBar: UIView?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "GiniHealthAPILibrary", url: "https://github.com/gini/health-api-library-ios.git", .exact("5.0.0")),
.package(name: "GiniUtilites", url: "https://github.com/gini/utilites-ios.git", .exact("2.0.0")),
.package(name: "GiniUtilites", url: "https://github.com/gini/utilites-ios.git", .exact("2.0.1")),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
//


public let GiniInternalPaymentSDKVersion = "1.1.0"
public let GiniInternalPaymentSDKVersion = "2.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ protocol PaymentReviewViewModelDelegate: AnyObject {
func presentInstallAppBottomSheet(bottomSheet: BottomSheetViewController)
func presentBankSelectionBottomSheet(bottomSheet: BottomSheetViewController)
func createPaymentRequestAndOpenBankApp()
func obtainPDFFromPaymentRequest()
func obtainPDFFromPaymentRequest(paymentRequestId: String)
}

/// BottomSheetsProviderProtocol defines methods for providing custom bottom sheets.
public protocol BottomSheetsProviderProtocol: AnyObject {
func installAppBottomSheet() -> BottomSheetViewController
func shareInvoiceBottomSheet(qrCodeData: Data) -> BottomSheetViewController
func shareInvoiceBottomSheet(qrCodeData: Data, paymentRequestId: String) -> BottomSheetViewController
func bankSelectionBottomSheet() -> UIViewController
}

Expand All @@ -30,11 +30,10 @@ public typealias PaymentReviewProtocol = PaymentReviewAPIProtocol & PaymentRevie
public protocol PaymentReviewAPIProtocol: AnyObject {
func createPaymentRequest(paymentInfo: PaymentInfo, completion: @escaping (Result<String, GiniError>) -> Void)
func shouldHandleErrorInternally(error: GiniError) -> Bool
func didCreatePaymentRequest(paymentRequestId: String)
func openPaymentProviderApp(requestId: String, universalLink: String)
func submitFeedback(for document: Document, updatedExtractions: [Extraction], completion: ((Result<Void, GiniHealthAPILibrary.GiniError>) -> Void)?)
func preview(for documentId: String, pageNumber: Int, completion: @escaping (Result<Data, GiniHealthAPILibrary.GiniError>) -> Void)
func obtainPDFURLFromPaymentRequest(paymentInfo: PaymentInfo, viewController: UIViewController)
func obtainPDFURLFromPaymentRequest(viewController: UIViewController, paymentRequestId: String)
}

/// PaymentReviewTrackingProtocol defines methods for tracking user interactions during the payment review process.
Expand Down Expand Up @@ -194,7 +193,6 @@ public class PaymentReviewModel: NSObject {
self?.isLoading = false
switch result {
case let .success(requestId):
self?.delegate?.didCreatePaymentRequest(paymentRequestId: requestId)
completion?(requestId)
case let .failure(error):
if self?.delegate?.shouldHandleErrorInternally(error: error) == true {
Expand Down Expand Up @@ -295,8 +293,8 @@ extension PaymentReviewModel: InstallAppBottomViewProtocol {
}

extension PaymentReviewModel: ShareInvoiceBottomViewProtocol {
public func didTapOnContinueToShareInvoice() {
viewModelDelegate?.obtainPDFFromPaymentRequest()
public func didTapOnContinueToShareInvoice(paymentRequestId: String) {
viewModelDelegate?.obtainPDFFromPaymentRequest(paymentRequestId: paymentRequestId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ extension PaymentReviewViewController: PaymentReviewViewModelDelegate {
presentBottomSheet(viewController: bottomSheet)
}

func obtainPDFFromPaymentRequest() {
model.delegate?.obtainPDFURLFromPaymentRequest(paymentInfo: paymentInfoContainerView.obtainPaymentInfo(), viewController: self)
func obtainPDFFromPaymentRequest(paymentRequestId: String) {
model.delegate?.obtainPDFURLFromPaymentRequest(viewController: self,
paymentRequestId: paymentRequestId)
}

func presentBankSelectionBottomSheet(bottomSheet: BottomSheetViewController) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import GiniHealthAPILibrary

/// A protocol for handling actions from the Onboarding Share Invoice bottom view
public protocol ShareInvoiceBottomViewProtocol: AnyObject {
func didTapOnContinueToShareInvoice()
func didTapOnContinueToShareInvoice(paymentRequestId: String)
}

struct SingleApp {
Expand Down Expand Up @@ -39,6 +39,8 @@ public final class ShareInvoiceBottomViewModel {
let bankImageIcon: Data
let qrCodeData: Data
let continueButtonText: String

let paymentRequestId: String

/// An optional identifier for the document ID being shared in order to pass it back to the delegates
public var documentId: String?
Expand All @@ -64,7 +66,8 @@ public final class ShareInvoiceBottomViewModel {
poweredByGiniConfiguration: PoweredByGiniConfiguration,
poweredByGiniStrings: PoweredByGiniStrings,
qrCodeData: Data,
paymentInfo: PaymentInfo?) {
paymentInfo: PaymentInfo?,
paymentRequestId: String) {
self.selectedPaymentProvider = selectedPaymentProvider
self.bankImageIcon = selectedPaymentProvider?.iconData ?? Data()
self.paymentProviderColors = selectedPaymentProvider?.colors
Expand All @@ -74,13 +77,14 @@ public final class ShareInvoiceBottomViewModel {
self.poweredByGiniViewModel = PoweredByGiniViewModel(configuration: poweredByGiniConfiguration, strings: poweredByGiniStrings)
self.qrCodeData = qrCodeData
self.paymentInfo = paymentInfo
self.paymentRequestId = paymentRequestId

titleText = strings.titleTextPattern.replacingOccurrences(of: bankToReplaceString, with: selectedPaymentProvider?.name ?? "")
descriptionLabelText = strings.descriptionTextPattern.replacingOccurrences(of: bankToReplaceString, with: selectedPaymentProvider?.name ?? "")
continueButtonText = strings.continueLabelText.replacingOccurrences(of: bankToReplaceString, with: selectedPaymentProvider?.name ?? "")
}

func didTapOnContinue() {
viewDelegate?.didTapOnContinueToShareInvoice()
viewDelegate?.didTapOnContinueToShareInvoice(paymentRequestId: paymentRequestId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
// Copyright © 2024 Gini GmbH. All rights reserved.
//

public let GiniUtilitesVersion = "2.0.0"
public let GiniUtilitesVersion = "2.0.1"
11 changes: 10 additions & 1 deletion GiniComponents/GiniUtilites/Sources/GiniUtilites/Price.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ import Foundation

public struct Price {
// Decimal value
public var value: Decimal
public var value: Decimal {
didSet {
if value > Price.maxValue {
value = Price.maxValue
}
}
}
// Currency code
let currencyCode: String

// Maximum allowed value
private static let maxValue: Decimal = 99999.99

/**
Returns a price structure with decimal value and currency code from extraction string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Once you have your Swift package set up, adding `GiniHealthSDK` as a dependency

```swift
dependencies: [
.package(url: "https://github.com/gini/health-sdk-ios.git", .exact("5.0.2"))
.package(url: "https://github.com/gini/health-sdk-ios.git", .exact("5.1.0"))
]
```
13 changes: 13 additions & 0 deletions HealthSDK/GiniHealthSDK/Documentation/source/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ dispatchGroup.notify(queue: .main) {
}
```

## Check if the document contains multiple invoices

GiniHealth provides a method to check whether a document contains multiple invoices:

```swift
healthSDK.checkIfDocumentContainsMultipleInvoices(docId: String, completion: @escaping (Result<Bool, GiniHealthError>) -> Void)
```

The method returns `true` in the success case if the `contains_multiple_docs` field was extracted and its value is `true`.

> - Recommendation: Use this check in a specific order. First, call the `checkIfDocumentIsPayable` method, and then call `checkIfDocumentContainsMultipleInvoices` method.

## Integrate the Payment flow

We provide a custom payment flow for the users to pay the invoice/document/digital payment .
Expand Down
4 changes: 2 additions & 2 deletions HealthSDK/GiniHealthSDK/Package-release.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "GiniHealthAPILibrary", url: "https://github.com/gini/health-api-library-ios.git", .exact("5.0.0")),
.package(name: "GiniInternalPaymentSDK", url: "https://github.com/gini/internal-payment-sdk-ios", .exact("1.1.0")),
.package(name: "GiniUtilites", url: "https://github.com/gini/utilites-ios.git", .exact("2.0.0")),
.package(name: "GiniInternalPaymentSDK", url: "https://github.com/gini/internal-payment-sdk-ios", .exact("2.0.0")),
.package(name: "GiniUtilites", url: "https://github.com/gini/utilites-ios.git", .exact("2.0.1")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
Loading

0 comments on commit f7c1b98

Please sign in to comment.