com.checkout.StaticKeysSdkCredentials Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checkout-sdk-java Show documentation
Show all versions of checkout-sdk-java Show documentation
Checkout SDK for Java https://checkout.com
package com.checkout;
public final class StaticKeysSdkCredentials extends AbstractStaticKeysSdkCredentials {
private static final String SECRET_KEY_PATTERN = "^sk_(sbox_)?[a-z2-7]{26}[a-z2-7*#$=]$";
private static final String PUBLIC_KEY_PATTEN = "^pk_(sbox_)?[a-z2-7]{26}[a-z2-7*#$=]$";
StaticKeysSdkCredentials(final String secretKey, final String publicKey) {
super(PlatformType.DEFAULT, SECRET_KEY_PATTERN, PUBLIC_KEY_PATTEN, secretKey, publicKey);
}
@Override
public SdkAuthorization getAuthorization(final SdkAuthorizationType authorizationType) {
switch (authorizationType) {
case SECRET_KEY:
case SECRET_KEY_OR_OAUTH:
return new SdkAuthorization(platformType, secretKey);
case PUBLIC_KEY:
case PUBLIC_KEY_OR_OAUTH:
return new SdkAuthorization(platformType, publicKey);
default:
throw CheckoutAuthorizationException.invalidAuthorization(authorizationType);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy