Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
31 changes: 24 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// swift-tools-version: 5.10
import PackageDescription

let releaseVersion = "1.10.0"
let releaseVersion = "2.0.0"
let githubRepo = "checkout/checkout-ios-components"

let sdkChecksum = "d9b4f08daa7f1d75032675a6e21b1c899d72f5e0bcc1fa2a25ec2f609039cbf7"
let sdkChecksum = "4a5f41fa4f516e58fd25b67488a576d2e4544fea68f8eb0b228e6dac3386ed8a"
let paymentMethodsChecksum = "9edfb84e39cb35f80c5e81ce6030cc4dce62ca0f3c36a970b89ce52a2b33035d"

let sdkURL = "https://github.com/\(githubRepo)/releases/download/\(releaseVersion)/CheckoutComponentsSDK.xcframework.zip"
let paymentMethodsURL = "https://github.com/\(githubRepo)/releases/download/\(releaseVersion)/CheckoutPaymentMethods.xcframework.zip"

let package = Package(
name: "CheckoutComponents",
Expand All @@ -17,9 +19,11 @@ let package = Package(
products: [
.library(
name: "CheckoutComponents",
targets: [
"CheckoutComponentsPackage"
]
targets: ["CheckoutComponentsPackage"]
),
.library(
name: "CheckoutPaymentMethods",
targets: ["CheckoutPaymentMethodsPackage"]
),
],
dependencies: [
Expand All @@ -41,6 +45,19 @@ let package = Package(
name: "CheckoutComponentsSDK",
url: sdkURL,
checksum: sdkChecksum
)
),
.target(
name: "CheckoutPaymentMethodsPackage",
dependencies: [
.target(name: "CheckoutPaymentMethods"),
.target(name: "CheckoutComponentsPackage"),
],
path: "CheckoutPaymentMethodsPackage"
),
.binaryTarget(
name: "CheckoutPaymentMethods",
url: paymentMethodsURL,
checksum: paymentMethodsChecksum
),
]
)
)
42 changes: 23 additions & 19 deletions SampleApplication/SampleApplication.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 56;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -29,11 +29,12 @@
A246560F2F44CE66001AE99A /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = A246560E2F44CE66001AE99A /* CheckoutComponents */; };
A26B7BEB2E27CD1200B1E840 /* SubmitPaymentSessionRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A26B7BEA2E27CD1200B1E840 /* SubmitPaymentSessionRequest.swift */; };
A27312D42F475793006F7FDE /* Risk in Frameworks */ = {isa = PBXBuildFile; productRef = 16A5BCA82D835918007B79C0 /* Risk */; };
A2D1C7832FBCD82C0085BAA0 /* MainViewModel+CountryCurrencyOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2D1C7822FBCD82C0085BAA0 /* MainViewModel+CountryCurrencyOption.swift */; };
A2EF10AD2F22771700CDC478 /* MainViewModel+LocaleOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2EF10AC2F22771700CDC478 /* MainViewModel+LocaleOption.swift */; };
FFE7091D2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 1695611B2D440E3E00030923 /* CheckoutComponents */; };
FFE7091E2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 951AE3372D5243E800519900 /* CheckoutComponents */; };
FFE7091F2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 951AE33A2D527A7400519900 /* CheckoutComponents */; };
FFE709202FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 16A28E2B2E71769F003668B9 /* CheckoutComponents */; };
FF2F6B0F2FC44C3C0089E837 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 1695611B2D440E3E00030923 /* CheckoutComponents */; };
FF2F6B102FC44C3C0089E837 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 951AE3372D5243E800519900 /* CheckoutComponents */; };
FF2F6B112FC44C3C0089E837 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 951AE33A2D527A7400519900 /* CheckoutComponents */; };
FF2F6B122FC44C3C0089E837 /* CheckoutComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 16A28E2B2E71769F003668B9 /* CheckoutComponents */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -60,6 +61,7 @@
A21EBD672DFAD9ED00F9BC14 /* MainView+SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MainView+SettingsView.swift"; sourceTree = "<group>"; };
A21EBD692E005C2D00F9BC14 /* AddressComponentConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressComponentConfiguration.swift; sourceTree = "<group>"; };
A26B7BEA2E27CD1200B1E840 /* SubmitPaymentSessionRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubmitPaymentSessionRequest.swift; sourceTree = "<group>"; };
A2D1C7822FBCD82C0085BAA0 /* MainViewModel+CountryCurrencyOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MainViewModel+CountryCurrencyOption.swift"; sourceTree = "<group>"; };
A2EF10AC2F22771700CDC478 /* MainViewModel+LocaleOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MainViewModel+LocaleOption.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -68,10 +70,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FFE709202FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */,
FFE7091F2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */,
FFE7091E2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */,
FFE7091D2FA89D2E0029DBD6 /* CheckoutComponents in Frameworks */,
FF2F6B122FC44C3C0089E837 /* CheckoutComponents in Frameworks */,
FF2F6B112FC44C3C0089E837 /* CheckoutComponents in Frameworks */,
FF2F6B102FC44C3C0089E837 /* CheckoutComponents in Frameworks */,
FF2F6B0F2FC44C3C0089E837 /* CheckoutComponents in Frameworks */,
A27312D42F475793006F7FDE /* Risk in Frameworks */,
A246560F2F44CE66001AE99A /* CheckoutComponents in Frameworks */,
);
Expand Down Expand Up @@ -113,6 +115,7 @@
isa = PBXGroup;
children = (
16FC05412C40170E00D75022 /* SampleApplication */,
FF7FD2452FD1CD3600926AD1 /* Frameworks */,
16FC05402C40170E00D75022 /* Products */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -182,6 +185,7 @@
959FEF5C2C805CE1001D7C20 /* ViewModel */ = {
isa = PBXGroup;
children = (
A2D1C7822FBCD82C0085BAA0 /* MainViewModel+CountryCurrencyOption.swift */,
95EC13972CB446A200812B24 /* MainViewModel+CallbacksProvider.swift */,
16EFA2382C650D3A00157450 /* MainViewModel.swift */,
A2EF10AC2F22771700CDC478 /* MainViewModel+LocaleOption.swift */,
Expand All @@ -198,6 +202,13 @@
path = Helpers;
sourceTree = "<group>";
};
FF7FD2452FD1CD3600926AD1 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -252,7 +263,6 @@
);
mainGroup = 16FC05362C40170E00D75022;
packageReferences = (
A246560D2F44CE66001AE99A /* XCLocalSwiftPackageReference "../../checkout-ios-components" */,
);
productRefGroup = 16FC05402C40170E00D75022 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -287,6 +297,7 @@
A21EBD682DFAD9ED00F9BC14 /* MainView+SettingsView.swift in Sources */,
95EC13982CB446A200812B24 /* MainViewModel+CallbacksProvider.swift in Sources */,
1699DC712C74F5500069008D /* SampleApplication.swift in Sources */,
A2D1C7832FBCD82C0085BAA0 /* MainViewModel+CountryCurrencyOption.swift in Sources */,
9513C3242C47FC0C0018BB7E /* MainView.swift in Sources */,
A21EBD622DF8007900F9BC14 /* AccessibilityIdentifiers.swift in Sources */,
16C44C732C57B95500CE0CCE /* EnvironmentVars.generated.swift in Sources */,
Expand Down Expand Up @@ -476,8 +487,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SampleApplication/SampleApplication.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "Apple Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = "\"SampleApplication/Preview Content\"";
DEVELOPMENT_TEAM = E32XBQK4Q5;
Expand Down Expand Up @@ -533,13 +544,6 @@
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
A246560D2F44CE66001AE99A /* XCLocalSwiftPackageReference "../../checkout-ios-components" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = "../../checkout-ios-components";
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
1695611B2D440E3E00030923 /* CheckoutComponents */ = {
isa = XCSwiftPackageProductDependency;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//swiftlint:disable all
struct EnvironmentVars {
/// Generated using 'EnvironmentVars.stencil' template
static let sandboxPublicKey = "{{ argument.COMPONENTS_SANDBOX_PUBLIC_KEY }}"
static let sandboxSecretKey = "{{ argument.COMPONENTS_SANDBOX_SECRET_KEY }}"
static let sandboxProcessingChannelID = "{{ argument.COMPONENTS_SANDBOX_PROCESSING_CHANNEL_ID }}"

static let productionPublicKey = "{{ argument.COMPONENTS_PRODUCTION_PUBLIC_KEY }}"
static let productionSecretKey = "{{ argument.COMPONENTS_PRODUCTION_SECRET_KEY }}"
static let sandboxPublicKey = "${COMPONENTS_SANDBOX_PUBLIC_KEY}"
static let sandboxSecretKey = "${COMPONENTS_SANDBOX_SECRET_KEY}"
static let sandboxProcessingChannelID = "${COMPONENTS_SANDBOX_PROCESSING_CHANNEL_ID}"
static let productionPublicKey = "${COMPONENTS_PRODUCTION_PUBLIC_KEY}"
static let productionSecretKey = "${COMPONENTS_PRODUCTION_SECRET_KEY}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ enum AccessibilityIdentifier {
case productionEnvironmentOption = "production_environment_option"
case localePicker = "locale_picker"
case paymentSessionLocalePicker = "payment_session_locale_picker"
case countryPicker = "country_picker"
case currencyPicker = "currency_picker"
case customLocale = "custom_locale_option"
case addressPicker = "address_picker"
case applePayTypePicker = "applepay_type_picker"
Expand All @@ -25,6 +27,8 @@ enum AccessibilityIdentifier {
case paymentMethodPicker = "payment_method_picker"
case cardPaymentMethodOption = "card_payment_method_option"
case applePayPaymentMethodOption = "google_apple_pay_payment_method_option"
case tabbyPaymentMethodOption = "tabby_payment_method_option"
case tamaraPaymentMethodOption = "tamara_payment_method_option"
case payButtonPicker = "pay_button_picker"
case payment = "payment"
case tokenize = "tokenize"
Expand All @@ -35,28 +39,35 @@ enum AccessibilityIdentifier {
case acceptedCardTypesPicker = "accepted_card_types_picker"
case advancedFeaturesExpandable = "advanced_features"
case cardholderNameMaxLengthInput = "cardholder_name_max_length_input"


// Payment Session
case paymentSessionConfigurationsExpandable = "ps_configurations_button"
case paymentSessionUsernameTextField = "ps_username_textfield"
case paymentSessionUserEmailTextField = "ps_user_email_textfield"
case paymentSessionUserCountryCodeTextField = "ps_user_country_code_textfield"
case paymentSessionUserPhoneNumberTextField = "ps_user_phone_number_textfield"

// RemeberMe
case rememberMeConfigurationsExpandable = "remember_me_configurations"
case showRememberMeToggle = "show_remember_me_toggle"
case showRememberMePayButtonToggle = "show_remember_me_pay_button_toggle"
case ignoreRememberMeEmailFeatureFlagToggle = "ignore_remember_me_email_feature_flag_toggle"

// SDK RememberMe config
case rememberMeSDKSetupExpandable = "remember_me_sdk_setup"
case userEmailTextField = "user_email_text_field"
case userCountryCodeTextField = "user_country_code_text_field"
case userPhoneNumberTextField = "user_phone_number_text_field"

// RememberMe Payment Session / Customer config
case rememberMePaymentSessionSetupExpandable = "remember_me_payment_session_setup"
case customerEmailInput = "customer_email_input"
case customerPhoneCountryCodePicker = "customer_phone_country_code_picker"
case customerPhoneNumberInput = "customer_phone_number_input"

}

enum PaymentResultView: String {
case closeButton = "payment_result_close_button"
case paymentIDLabel = "payment_id_label"
case generatedTokenLabel = "generated_token_label"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ enum CheckoutComponent: String, CaseIterable {
case flow = "Flow"
case card = "Card"
case applePay = "Apple Pay"
case tabby = "Tabby"
case tamara = "Tamara"

var accessibilityIdentifier: String {
switch self {
Expand All @@ -21,6 +23,10 @@ enum CheckoutComponent: String, CaseIterable {
return "card"
case .applePay:
return "google_apple_pay"
case .tabby:
return "tabby"
case .tamara:
return "tamara"
}
}
}
Expand All @@ -39,8 +45,11 @@ extension MainView {
appearanceView
localeView
paymentSessionLocaleView
countryView
currencyView

advancedFeaturesView
paymentSessionConfigurationView
rememberMeConfigurationsView
}
.padding(.horizontal)
Expand All @@ -67,6 +76,10 @@ extension MainView {
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.cardPaymentMethodOption.rawValue)
Toggle("Apple Pay", isOn: $viewModel.isApplePaySelected)
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.applePayPaymentMethodOption.rawValue)
Toggle("Tabby", isOn: $viewModel.isTabbySelected)
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.tabbyPaymentMethodOption.rawValue)
Toggle("Tamara", isOn: $viewModel.isTamaraSelected)
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.tamaraPaymentMethodOption.rawValue)
}.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.paymentMethodPicker.rawValue)
}
}
Expand Down Expand Up @@ -147,6 +160,36 @@ extension MainView {
}
}

var countryView: some View {
HStack {
Text("Country:")

Picker("Country", selection: $viewModel.selectedCountry) {
ForEach(CountryOption.allCases, id: \.self) { option in
Text(option.displayName)
.tag(option)
.accessibilityIdentifier(option.accessibilityIdentifier)
}
}
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.countryPicker.rawValue)
}
}

var currencyView: some View {
HStack {
Text("Currency:")

Picker("Currency", selection: $viewModel.selectedCurrency) {
ForEach(CurrencyOption.allCases, id: \.self) { option in
Text(option.displayName)
.tag(option)
.accessibilityIdentifier(option.accessibilityIdentifier)
}
}
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.currencyPicker.rawValue)
}
}

var environmentView: some View {
HStack {
Text("Environment:")
Expand Down Expand Up @@ -216,6 +259,19 @@ extension MainView {
}
}

var paymentSessionConfigurationView: some View {
expandableSection(title: "Payment session Configurations",
isExpanded: $viewModel.isPaymentSessionConfigurationExpanded,
accessibilityIdentifier: AccessibilityIdentifier.SettingsView.paymentSessionConfigurationsExpandable.rawValue) {
VStack(alignment: .leading, spacing: 12) {
paymentSessionUsername
paymentSessionUserEmail
}
.padding(.leading, 16)
.transition(.opacity.combined(with: .slide))
}
}

var rememberMeConfigurationsView: some View {
expandableSection(title: "RememberMe Configurations",
isExpanded: $viewModel.isRememberMeExpanded,
Expand Down Expand Up @@ -246,6 +302,24 @@ extension MainView {
}
}

var paymentSessionUsername: some View {
HStack {
Text("Customer name: ")
TextField("Customer name", text: $viewModel.paymentSessionUsername)
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.paymentSessionUsernameTextField.rawValue)
.keyboardType(.namePhonePad)
}
}

var paymentSessionUserEmail: some View {
HStack {
Text("Customer email: ")
TextField("Customer email", text: $viewModel.paymentSessionUserEmail)
.accessibilityIdentifier(AccessibilityIdentifier.SettingsView.paymentSessionUserEmailTextField.rawValue)
.keyboardType(.emailAddress)
}
}

var customButtonOperationView: some View {
HStack {
Text("Custom button type:")
Expand Down
Loading
Loading