Skip to content

Commit

Permalink
move MerchantIntegration enum to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
KunJeongPark committed Jul 10, 2023
1 parent 733e127 commit 234a4a6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
4 changes: 4 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
3B80D50E2A291C0800D2EAC4 /* ClientIDRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B80D50D2A291C0800D2EAC4 /* ClientIDRequest.swift */; };
3B80D5102A291CB100D2EAC4 /* ClientIDResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B80D50F2A291CB100D2EAC4 /* ClientIDResponse.swift */; };
3BB7A9772A5CA6FD00C05140 /* MerchantIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB7A9762A5CA6FD00C05140 /* MerchantIntegration.swift */; };
5301468C28918B4D00184F22 /* ApprovalResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5301468B28918B4D00184F22 /* ApprovalResult.swift */; };
536A5CA82898AA2A005C053D /* SwiftUINativeCheckoutDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 536A5CA72898AA2A005C053D /* SwiftUINativeCheckoutDemo.swift */; };
53B9E8EA28C93B4400719239 /* OrderRequestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B9E8E928C93B4400719239 /* OrderRequestHelpers.swift */; };
Expand Down Expand Up @@ -98,6 +99,7 @@
/* Begin PBXFileReference section */
3B80D50D2A291C0800D2EAC4 /* ClientIDRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientIDRequest.swift; sourceTree = "<group>"; };
3B80D50F2A291CB100D2EAC4 /* ClientIDResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientIDResponse.swift; sourceTree = "<group>"; };
3BB7A9762A5CA6FD00C05140 /* MerchantIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MerchantIntegration.swift; sourceTree = "<group>"; };
5301468B28918B4D00184F22 /* ApprovalResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApprovalResult.swift; sourceTree = "<group>"; };
536A5CA22898A48C005C053D /* PayPalNativeCheckout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PayPalNativeCheckout.framework; sourceTree = BUILT_PRODUCTS_DIR; };
536A5CA72898AA2A005C053D /* SwiftUINativeCheckoutDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUINativeCheckoutDemo.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -297,6 +299,7 @@
children = (
80F33CE726F8DE29006811B1 /* DemoMerchantAPI.swift */,
BE1766B226F911A2007EF438 /* URLResponseError.swift */,
3BB7A9762A5CA6FD00C05140 /* MerchantIntegration.swift */,
);
path = Networking;
sourceTree = "<group>";
Expand Down Expand Up @@ -493,6 +496,7 @@
80F33CEF26F8E7CC006811B1 /* CreateOrderParams.swift in Sources */,
BECD84A227036DDB007CCAE4 /* Intent.swift in Sources */,
BED041AF270CA0FB00C80954 /* CustomButton.swift in Sources */,
3BB7A9772A5CA6FD00C05140 /* MerchantIntegration.swift in Sources */,
BE1766B326F911A2007EF438 /* URLResponseError.swift in Sources */,
CBC16DD929ED90B600307117 /* UpdateOrderParams.swift in Sources */,
BE9F36D82745490400AFC7DA /* FloatingLabelTextField.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions Demo/Demo/Networking/MerchantIntegration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation

enum MerchantIntegration {
case direct
case connectedPath
case managedPath
case unspecified

var path: String {
switch self {
case .direct:
return "/direct"
case .connectedPath:
return "/connected_path"
case .managedPath:
return "/managed_path"
default:
return ""
}
}
}
23 changes: 1 addition & 22 deletions Demo/Demo/ViewModels/BaseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,6 @@ import PayPalCheckout

/// This class is used to share the orderID across shared views, update the text of `bottomStatusLabel` in our `FeatureBaseViewController`
/// as well as share the logic of `processOrder` across our duplicate (SwiftUI and UIKit) card views.
///
/// // temp place instead of new file
enum MerchantIntegration {
case direct
case connectedPath
case managedPath
case unspecified

var path: String {
switch self {
case .direct:
return "/direct"
case .connectedPath:
return "/connected_path"
case .managedPath:
return "/managed_path"
default:
return ""
}
}
}

class BaseViewModel: ObservableObject, PayPalWebCheckoutDelegate, CardDelegate {

Expand All @@ -38,7 +17,7 @@ class BaseViewModel: ObservableObject, PayPalWebCheckoutDelegate, CardDelegate {

/// order ID shared across views
@Published var orderID: String?
@Published var selectedMerchantIntegration: MerchantIntegration = .connectedPath
@Published var selectedMerchantIntegration: MerchantIntegration = .unspecified

// MARK: - Init

Expand Down

0 comments on commit 234a4a6

Please sign in to comment.