Skip to content

Commit

Permalink
Renamed invalidateSession to clearSession (#281)
Browse files Browse the repository at this point in the history
* Renamed invalidateSession to clearSession

* Renamed method in test class
  • Loading branch information
Robert-SD authored Oct 3, 2024
1 parent ae130d4 commit 893fbe4
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CheckoutPlatformApi(
}
}

override fun invalidateSession() {
override fun clearSession() {
sessionHolder.reset()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ private object CheckoutPlatformInterfaceCodec : StandardMessageCodec() {
interface CheckoutPlatformInterface {
fun getReturnUrl(callback: (Result<String>) -> Unit)
fun createSession(sessionId: String, sessionData: String, configuration: Any?, callback: (Result<SessionDTO>) -> Unit)
fun invalidateSession()
fun clearSession()
fun encryptCard(unencryptedCardDTO: UnencryptedCardDTO, publicKey: String, callback: (Result<EncryptedCardDTO>) -> Unit)
fun encryptBin(bin: String, publicKey: String, callback: (Result<String>) -> Unit)
fun enableConsoleLogging(loggingEnabled: Boolean)
Expand Down Expand Up @@ -1498,12 +1498,12 @@ interface CheckoutPlatformInterface {
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.invalidateSession", codec)
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
var wrapped: List<Any?>
try {
api.invalidateSession()
api.clearSession()
wrapped = listOf<Any?>(null)
} catch (exception: Throwable) {
wrapped = wrapError(exception)
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/CheckoutPlatformApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CheckoutPlatformApi: CheckoutPlatformInterface {
}
}

func invalidateSession() {
func clearSession() {
sessionHolder.reset()
}

Expand Down
10 changes: 5 additions & 5 deletions ios/Classes/PlatformApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ class CheckoutPlatformInterfaceCodec: FlutterStandardMessageCodec {
protocol CheckoutPlatformInterface {
func getReturnUrl(completion: @escaping (Result<String, Error>) -> Void)
func createSession(sessionId: String, sessionData: String, configuration: Any?, completion: @escaping (Result<SessionDTO, Error>) -> Void)
func invalidateSession() throws
func clearSession() throws
func encryptCard(unencryptedCardDTO: UnencryptedCardDTO, publicKey: String, completion: @escaping (Result<EncryptedCardDTO, Error>) -> Void)
func encryptBin(bin: String, publicKey: String, completion: @escaping (Result<String, Error>) -> Void)
func enableConsoleLogging(loggingEnabled: Bool) throws
Expand Down Expand Up @@ -1452,18 +1452,18 @@ class CheckoutPlatformInterfaceSetup {
} else {
createSessionChannel.setMessageHandler(nil)
}
let invalidateSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.invalidateSession", binaryMessenger: binaryMessenger, codec: codec)
let clearSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", binaryMessenger: binaryMessenger, codec: codec)
if let api {
invalidateSessionChannel.setMessageHandler { _, reply in
clearSessionChannel.setMessageHandler { _, reply in
do {
try api.invalidateSession()
try api.clearSession()
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
invalidateSessionChannel.setMessageHandler(nil)
clearSessionChannel.setMessageHandler(nil)
}
let encryptCardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard", binaryMessenger: binaryMessenger, codec: codec)
if let api {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/adyen_checkout_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AdyenCheckoutApi implements CheckoutPlatformInterface {
);

@override
Future<void> invalidateSession() => checkoutApi.invalidateSession();
Future<void> clearSession() => checkoutApi.clearSession();

@override
Future<void> enableConsoleLogging(bool loggingEnabled) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/adyen_checkout_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AdyenCheckoutSession {
);
}

Future<void> invalidate() async => await adyenCheckoutApi.invalidateSession();
Future<void> clear() async => await adyenCheckoutApi.clearSession();

dynamic _mapConfiguration(
BaseConfiguration configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ class ApplePaySessionComponent extends BaseApplePayComponent {
));
}

void _resetSession() => AdyenCheckout.session.invalidate();
void _resetSession() => AdyenCheckout.session.clear();
}
2 changes: 1 addition & 1 deletion lib/src/components/card/card_session_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ class CardSessionComponent extends BaseCardComponent {
));
}

void _resetSession() => AdyenCheckout.session.invalidate();
void _resetSession() => AdyenCheckout.session.clear();
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ class GooglePaySessionComponent extends BaseGooglePayComponent {
));
}

void _resetSession() => AdyenCheckout.session.invalidate();
void _resetSession() => AdyenCheckout.session.clear();
}
2 changes: 1 addition & 1 deletion lib/src/components/instant/instant_session_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ class InstantSessionComponent extends BaseInstantComponent {
));
}

void _resetSession() => AdyenCheckout.session.invalidate();
void _resetSession() => AdyenCheckout.session.clear();
}
4 changes: 2 additions & 2 deletions lib/src/generated/platform_api.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1605,9 +1605,9 @@ class CheckoutPlatformInterface {
}
}

Future<void> invalidateSession() async {
Future<void> clearSession() async {
const String __pigeon_channelName =
'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.invalidateSession';
'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession';
final BasicMessageChannel<Object?> __pigeon_channel =
BasicMessageChannel<Object?>(
__pigeon_channelName,
Expand Down
2 changes: 1 addition & 1 deletion pigeons/platform_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ abstract class CheckoutPlatformInterface {
Object? configuration,
);

void invalidateSession();
void clearSession();

@async
EncryptedCardDTO encryptCard(
Expand Down
2 changes: 1 addition & 1 deletion test/adyen_checkout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MockAdyenCheckoutPlatform implements CheckoutPlatformInterface {
}

@override
Future<void> invalidateSession() async {
Future<void> clearSession() async {
return;
}
}
Expand Down

0 comments on commit 893fbe4

Please sign in to comment.