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

COIOS-774: Pay by Bank - Confirmation Sheet #1876

Merged

Conversation

goergisn
Copy link
Contributor

Summary

  • Adds a confirmation sheet in front of SFSafariViewController and triggers the instant payment method only after triggering the submit button

Demo

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-10-23.at.11.57.04.mp4

Ticket

COIOS-774

@goergisn goergisn added the chore a pull request that has chore changes that shouldn't be in the release notes label Oct 23, 2024
@goergisn goergisn changed the title COIOS-774 - Pay by Bank - Confirmation Sheet COIOS-774: Pay by Bank - Confirmation Sheet Oct 23, 2024
Base automatically changed from better-stored-paybybank-plaid-support to COIOS-774_pay-by-bank-improvements October 24, 2024 08:49
@goergisn goergisn requested review from nauaros and atmamont October 24, 2024 11:18
contentButtonStack.alignment = .fill

view.addSubview(contentButtonStack)
contentButtonStack.adyen.anchor(inside: view.layoutMarginsGuide, with: .init(top: 16, left: 0, bottom: 8, right: 0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should go to some style constants in the future to avoid these magic numbers and make style changes easier.

model.continueHandler()
}

override public var preferredContentSize: CGSize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we don't provide this manually?

Copy link
Contributor Author

@goergisn goergisn Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will not get the height it needs

style: PayByBankUSComponent.Style,
continueHandler: @escaping () -> Void
) {
let message: [String] = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be localized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 😬

]

self.headerImageUrl = headerImageUrl
self.title = "Pay by Bank"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and further down

@@ -419,7 +433,7 @@ extension ComponentManager: PaymentComponentBuilder {
)
}

private func createBoletoComponent(_ paymentMethod: BoletoPaymentMethod) -> BoletoComponent {
func createBoletoComponent(_ paymentMethod: BoletoPaymentMethod) -> BoletoComponent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a linter rule to prevent us from NOT having a scope defined, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not catch here for some reason - it's in a private extension

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can turn swiftlint warnings into errors so every time one doesn't need to even focus on this during code review.

Copy link
Contributor

@atmamont atmamont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy to read and review, thanks 👍

/// Stored PayByBank payment.
public struct StoredPayByBankPlaidPaymentMethod: StoredPaymentMethod {
/// Stored PayByBank US payment.
public struct StoredPayByBankUSPaymentMethod: StoredPaymentMethod {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This is a fully breaking change, can we keep struct and maybe create a typealias?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found StoredPayByBankPlaidPaymentMethod was added in the base branch. Let's rethink which branch to target when we run api diff? Options:

  • develop (then we might have all long-living branch changes)
  • latest release tag (then every time we have all development changes combined)

Or we can switch off api diff for all PRs not targeting develop and deal with all changes when we merge long-living branch into develop. The only concern I have is that usually it's a common sentiment to merge as fast as possible because "everything was reviewed", everyone has seen the code multiple times and naturally you just want to merge it asap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a tricky one - also thought about it.
I want to see the changes to the target branch but also agree that it would be nice to see the full change set to develop/release.
We could run it twice if the target branch is not develop and we're not in a release branch - so it creates 2 comments (one to the target branch and one to develop) - 🤔

Copy link
Contributor

👀 6 public changes detected

Comparing https://github.com/Adyen/adyen-ios.git @ COIOS-774_pay-by-bank-ui-update to https://github.com/Adyen/adyen-ios.git @ COIOS-774_pay-by-bank-improvements


Adyen

❇️ Added

public struct PayByBankUSPaymentMethod: Adyen.PaymentMethod
{
  public let type: Adyen.PaymentMethodType { get }
  public var name: Swift.String
  public var merchantProvidedDisplayInformation: Adyen.MerchantCustomDisplayInformation?
  public func encode(to encoder: any Swift.Encoder) throws -> Swift.Void
  public init(from decoder: any Swift.Decoder) throws
}
public struct StoredPayByBankUSPaymentMethod: Adyen.StoredPaymentMethod
{
  public let type: Adyen.PaymentMethodType { get }
  public let name: Swift.String { get }
  public let label: Swift.String? { get }
  public var merchantProvidedDisplayInformation: Adyen.MerchantCustomDisplayInformation?
  public let identifier: Swift.String { get }
  public let supportedShopperInteractions: [Adyen.ShopperInteraction] { get }
  public func encode(to encoder: any Swift.Encoder) throws -> Swift.Void
  public init(from decoder: any Swift.Decoder) throws
}

😶‍🌫️ Removed

public struct StoredPayByBankPlaidPaymentMethod: Adyen.StoredPaymentMethod

PaymentMethodType

❇️ Added

case payByBankAISDD

😶‍🌫️ Removed

case payByBankPlaid

AdyenComponents

❇️ Added

final public class PayByBankUSComponent: Adyen.PaymentComponent, Adyen.PresentableComponent, Adyen.LoadingComponent
{
  final public let paymentMethod: any Adyen.PaymentMethod { get }
  final public var paymentData: Adyen.PaymentComponentData { get }
  final public var configuration: AdyenComponents.PayByBankUSComponent.Configuration
  weak final public var delegate: (any Adyen.PaymentComponentDelegate)?
  final public var requiresModalPresentation: Swift.Bool
  final public var viewController: UIKit.UIViewController { get }
  public init(paymentMethod: Adyen.PayByBankUSPaymentMethod, context: Adyen.AdyenContext, configuration: AdyenComponents.PayByBankUSComponent.Configuration = .init())
  final public func initiatePayment() -> Swift.Void
  public struct Configuration: Adyen.AnyBasicComponentConfiguration
  {
      public var style: AdyenComponents.PayByBankUSComponent.Style
      public var localizationParameters: Adyen.LocalizationParameters?
      public init(style: AdyenComponents.PayByBankUSComponent.Style = .init(), localizationParameters: Adyen.LocalizationParameters? = nil)
  }
  public struct Style
  {
      public var title: Adyen.TextStyle
      public var subtitle: Adyen.TextStyle
      public var message: Adyen.TextStyle
      public var headerImage: Adyen.ImageStyle
      public init()
  }
  final public func stopLoading() -> Swift.Void
}

Analyzed targets: Adyen, AdyenActions, AdyenCard, AdyenCashAppPay, AdyenComponents, AdyenDelegatedAuthentication, AdyenDropIn, AdyenEncryption, AdyenSession, AdyenSwiftUI, AdyenTwint, AdyenWeChatPay

Copy link

sonarcloud bot commented Oct 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
7.5% Coverage on New Code (required ≥ 70%)

See analysis details on SonarCloud

@goergisn goergisn merged commit dc5436c into COIOS-774_pay-by-bank-improvements Oct 28, 2024
10 of 11 checks passed
@goergisn goergisn deleted the COIOS-774_pay-by-bank-ui-update branch October 28, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore a pull request that has chore changes that shouldn't be in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants