Skip to content

Commit

Permalink
Merge branch 'brand-ingredient-configuration' into comunication-tone-…
Browse files Browse the repository at this point in the history
…configuration
  • Loading branch information
razvancapra committed Jan 30, 2025
2 parents ebc3f4a + dcf6d7c commit 08be042
Show file tree
Hide file tree
Showing 31 changed files with 232 additions and 110 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/health-sdk.build.xcframeworks.xcode16.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build HealthSDK XCFrameworks XCode 16
on:
push:
tags:
- 'GiniHealthSDK;[0-9]+.[0-9]+.[0-9]+;xcframeworks**'
- 'GiniHealthSDK;[0-9]+.[0-9]+.[0-9]+-beta[0-9][0-9]+;xcframeworks**'
workflow_dispatch:
workflow_call:
secrets:
BUILD_CERTIFICATE_BASE64:
required: true
P12_PASSWORD:
required: true
BUILD_PROVISION_PROFILE_BASE64:
required: true
KEYCHAIN_PASSWORD:
required: true
jobs:
prepare-frameworks:
name: Create Release
runs-on: macos-15
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: '16.2'

- name: Checkout repository
uses: actions/checkout@v4

- name: Archiving project and creating XCFrameworks
run: |
./build-healthsdk.sh
- name: Sign the XCFrameworks
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_ADHOC_DISTRIBUTION_PROVISION_PROFILE }}
KEYCHAIN_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }}
run: |
# Setup distribution certificate
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH1=$RUNNER_TEMP/build_pp1.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH1
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH1 ~/Library/MobileDevice/Provisioning\ Profiles
# sign xcframeworks
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthAPILibrary.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthSDK.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniInternalPaymentSDK.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniUtilites.xcframework
- name: archive frameworks GiniHealthAPILibrary
uses: actions/upload-artifact@v4
with:
name: GiniHealthSDKFramework
path: |
GiniHealthAPILibrary.xcframework
GiniHealthSDK.xcframework
GiniInternalPaymentSDK.xcframework
GiniUtilites.xcframework
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 @@ -198,19 +198,26 @@ public final class DocumentPickerCoordinator: NSObject {
/// A UIDocumentPickerViewController that sets navigation bar buttons' tint color to a correct one, instead of using the accent color specified by app
private class GiniDocumentPickerViewController: UIDocumentPickerViewController {
var initialTintColor: UIColor? = navBarInstance.tintColor
var initialButtonTintColor: UIColor? = barButtonInstance.tintColor

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
Self.navBarInstance.tintColor = .GiniCapture.accent1
Self.barButtonInstance.tintColor = .GiniCapture.accent1
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// make sure to revert the tint color, otherwise it will affect document pickers/browsers from the host app
Self.navBarInstance.tintColor = initialTintColor
Self.navBarInstance.tintColor = initialTintColor ?? UINavigationBar.appearance().tintColor
Self.barButtonInstance.tintColor = initialButtonTintColor ?? UIBarButtonItem.appearance().tintColor
}
static var navBarInstance: UINavigationBar {
UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self])
}

static var barButtonInstance: UIBarButtonItem {
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self])
}
}

fileprivate extension DocumentPickerCoordinator {
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 @@ -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 @@ -33,7 +33,7 @@ public protocol PaymentReviewAPIProtocol: AnyObject {
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 @@ -298,8 +298,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 @@ -42,7 +42,7 @@ public final class PaymentReviewContainerView: UIView {

private lazy var recipientTextFieldView = buildTextFieldWithLabelView(tag: TextFieldType.recipientFieldTag.rawValue, isEditable: !viewModel.configuration.lockedFields)
private lazy var ibanTextFieldView = buildTextFieldWithLabelView(tag: TextFieldType.ibanFieldTag.rawValue, isEditable: !viewModel.configuration.lockedFields)
private lazy var amountTextFieldView = buildTextFieldWithLabelView(tag: TextFieldType.amountFieldTag.rawValue, isEditable: true)
private lazy var amountTextFieldView = buildTextFieldWithLabelView(tag: TextFieldType.amountFieldTag.rawValue, isEditable: true, keyboardType: .numberPad)
private lazy var usageTextFieldView = buildTextFieldWithLabelView(tag: TextFieldType.usageFieldTag.rawValue, isEditable: !viewModel.configuration.lockedFields)

private let buttonsView = EmptyView()
Expand Down Expand Up @@ -557,10 +557,11 @@ public final class PaymentReviewContainerView: UIView {
return label
}

private func buildTextFieldWithLabelView(tag: Int, isEditable: Bool) -> TextFieldWithLabelView {
private func buildTextFieldWithLabelView(tag: Int, isEditable: Bool, keyboardType: UIKeyboardType = .default) -> TextFieldWithLabelView {
let textFieldView = TextFieldWithLabelView()
textFieldView.tag = tag
textFieldView.isUserInteractionEnabled = isEditable
textFieldView.setKeyboardType(keyboardType: keyboardType)
return textFieldView
}
}
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 @@ -77,6 +77,10 @@ public final class TextFieldWithLabelView: UIView {
textField.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -Constants.topBottomPadding)
])
}

func setKeyboardType(keyboardType: UIKeyboardType) {
textField.keyboardType = keyboardType
}
}

public extension TextFieldWithLabelView {
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ extension GiniHealth: PaymentComponentsConfigurationProvider {
}

public var showPaymentReviewCloseButton: Bool {
false
GiniHealthConfiguration.shared.showPaymentReviewCloseButton
}


public var paymentComponentButtonsHeight: CGFloat {
GiniHealthConfiguration.shared.paymentComponentButtonsHeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public struct DataForReview {
self.clientConfigurationService = giniApiLib.clientConfigurationService()
super.init()
self.paymentComponentsController = PaymentComponentsController(giniHealth: self)
self.paymentComponentsController.delegate = self
}

/**
Expand Down
Loading

0 comments on commit 08be042

Please sign in to comment.