Skip to content

Commit

Permalink
chore: rename components into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
descorp committed Dec 8, 2023
1 parent b5cf8b2 commit c7bcf13
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PassKit
import React

@objc(AdyenApplePay)
internal final class ApplePayComponent: BaseModule {
internal final class ApplePayModule: BaseModule {

override func supportedEvents() -> [String]! { [ Events.didSubmit.rawValue, Events.didFail.rawValue ] }

Expand All @@ -37,7 +37,9 @@ internal final class ApplePayComponent: BaseModule {
}

guard let apiContext = try? APIContext(environment: parser.environment, clientKey: clientKey) else { return }
let context = AdyenContext(apiContext: apiContext, payment: payment, analyticsConfiguration: AnalyticsConfiguration())

// TODO: add analyticsConfiguration: AnalyticsConfiguration()
let context = AdyenContext(apiContext: apiContext, payment: payment)
let applePayComponent: Adyen.ApplePayComponent
do {
applePayComponent = try Adyen.ApplePayComponent(paymentMethod: paymentMethod,
Expand All @@ -52,7 +54,7 @@ internal final class ApplePayComponent: BaseModule {

}

extension ApplePayComponent: PaymentComponentDelegate {
extension ApplePayModule: PaymentComponentDelegate {

internal func didSubmit(_ data: PaymentComponentData, from component: PaymentComponent) {
let applePayDetails = data.paymentMethod as? ApplePayDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PassKit
import React

@objc(AdyenDropIn)
internal final class AdyenDropIn: BaseModule {
internal final class DropInModule: BaseModule {

override public func supportedEvents() -> [String]! { Events.allCases.map(\.rawValue) }

Expand All @@ -35,6 +35,8 @@ internal final class AdyenDropIn: BaseModule {
return sendEvent(error: error)
}

AdyenLogging.isEnabled = true

guard let apiContext = try? APIContext(environment: parser.environment, clientKey: clientKey) else { return }
let config = DropInConfigurationParser(configuration: configuration).configuration
config.card = CardConfigurationParser(configuration: configuration).dropinConfiguration
Expand All @@ -45,7 +47,9 @@ internal final class AdyenDropIn: BaseModule {
(try? ApplepayConfigurationParser(configuration: configuration).buildConfiguration(payment: payment)).map {
config.applePay = $0
}
context = AdyenContext(apiContext: apiContext, payment: payment, analyticsConfiguration: AnalyticsConfiguration())

// TODO: add analyticsConfiguration: AnalyticsConfiguration()
context = AdyenContext(apiContext: apiContext, payment: payment)
} else {
context = AdyenContext(apiContext: apiContext, payment: nil, analyticsConfiguration: AnalyticsConfiguration())
}
Expand Down Expand Up @@ -75,7 +79,7 @@ internal final class AdyenDropIn: BaseModule {

}

extension AdyenDropIn: DropInComponentDelegate {
extension DropInModule: DropInComponentDelegate {
func didSubmit(_ data: Adyen.PaymentComponentData, from component: Adyen.PaymentComponent, in dropInComponent: Adyen.AnyDropInComponent) {
let response: SubmitData
if let appleData = data.paymentMethod as? ApplePayDetails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React
import UIKit

@objc(AdyenGooglePay)
internal class AdyenGooglePayMock: BaseModule {
internal class GooglePayModuleMock: BaseModule {

override func supportedEvents() -> [String]! { [Events.didFail.rawValue] }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PassKit
import React

@objc(AdyenInstant)
internal final class InstantComponent: BaseModule {
internal final class InstantModule: BaseModule {

override public func supportedEvents() -> [String]! { Events.allCases.map(\.rawValue) }

Expand All @@ -32,7 +32,9 @@ internal final class InstantComponent: BaseModule {
}

guard let apiContext = try? APIContext(environment: parser.environment, clientKey: clientKey) else { return }
let context = AdyenContext(apiContext: apiContext, payment: nil, analyticsConfiguration: AnalyticsConfiguration())

// TODO: add analyticsConfiguration: AnalyticsConfiguration()
let context = AdyenContext(apiContext: apiContext, payment: nil)

let style = AdyenAppearanceLoader.findStyle()?.actionComponent ?? .init()
actionHandler = AdyenActionComponent(context: context, configuration: .init(style: style))
Expand Down Expand Up @@ -64,7 +66,7 @@ internal final class InstantComponent: BaseModule {

}

extension InstantComponent: PaymentComponentDelegate {
extension InstantModule: PaymentComponentDelegate {

internal func didSubmit(_ data: PaymentComponentData, from component: PaymentComponent) {
let response = SubmitData(paymentData: data.jsonObject, extra: nil)
Expand All @@ -77,7 +79,7 @@ extension InstantComponent: PaymentComponentDelegate {

}

extension InstantComponent: ActionComponentDelegate {
extension InstantModule: ActionComponentDelegate {

internal func didFail(with error: Error, from component: ActionComponent) {
sendEvent(error: error)
Expand Down

0 comments on commit c7bcf13

Please sign in to comment.