Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BTPayPalEditRequest and Tokenize for Edit FI #1358

Merged
merged 9 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions Braintree.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
3B57E9EA29ECC1AF00245174 /* BTLocalPaymentAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B57E9E929ECC1AF00245174 /* BTLocalPaymentAnalytics.swift */; };
3B5A41E92BA2375600921922 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3B5A41E82BA2375600921922 /* PrivacyInfo.xcprivacy */; };
3B5CD9B02C3C3FCC002EE8F7 /* BTPayPalEditRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD9AF2C3C3FCC002EE8F7 /* BTPayPalEditRequest.swift */; };
3B610FD32C3DEE220098EFBB /* BTPayPalEditRequest_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B610FD12C3DEE1C0098EFBB /* BTPayPalEditRequest_Tests.swift */; };
3B7A261129C0CAA40087059D /* BTPayPalAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B7A261029C0CAA40087059D /* BTPayPalAnalytics.swift */; };
3B7A261429C35BD00087059D /* BTPayPalAnalytics_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B7A261229C35B670087059D /* BTPayPalAnalytics_Tests.swift */; };
3BC0E09229E4673C009217D6 /* BTSEPADirectAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC0E09129E4673C009217D6 /* BTSEPADirectAnalytics.swift */; };
Expand Down Expand Up @@ -732,6 +733,7 @@
3B57E9E929ECC1AF00245174 /* BTLocalPaymentAnalytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTLocalPaymentAnalytics.swift; sourceTree = "<group>"; };
3B5A41E82BA2375600921922 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B5CD9AF2C3C3FCC002EE8F7 /* BTPayPalEditRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalEditRequest.swift; sourceTree = "<group>"; };
3B610FD12C3DEE1C0098EFBB /* BTPayPalEditRequest_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalEditRequest_Tests.swift; sourceTree = "<group>"; };
3B668B7D2BFD12BE0024FB29 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B7A261029C0CAA40087059D /* BTPayPalAnalytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalAnalytics.swift; sourceTree = "<group>"; };
3B7A261229C35B670087059D /* BTPayPalAnalytics_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalAnalytics_Tests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1952,6 +1954,7 @@
BEBA590E2BB1B5B9005FA8A2 /* BTPayPalReturnURL_Tests.swift */,
427F328F25D1A7B900435294 /* BTPayPalVaultRequest_Tests.swift */,
A9E5C1E424FD665D00EE691F /* Info.plist */,
3B610FD12C3DEE1C0098EFBB /* BTPayPalEditRequest_Tests.swift */,
);
path = BraintreePayPalTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -3554,6 +3557,7 @@
42FC218B25CDE0290047C49A /* BTPayPalRequest_Tests.swift in Sources */,
42FC237125CE0E110047C49A /* BTPayPalCheckoutRequest_Tests.swift in Sources */,
BEDEAF112AC1D049004EA970 /* BTPayPalAccountNonce_Tests.swift in Sources */,
3B610FD32C3DEE220098EFBB /* BTPayPalEditRequest_Tests.swift in Sources */,
427F329025D1A7B900435294 /* BTPayPalVaultRequest_Tests.swift in Sources */,
BECB10C62B5999EE008D398E /* BTPayPalLineItem_Tests.swift in Sources */,
3B7A261429C35BD00087059D /* BTPayPalAnalytics_Tests.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraintreePayPal/BTPayPalEditRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import BraintreeCore
/// Options for the PayPal Edit FI flow
/// - Warning: This feature is currently in beta and may change or be removed in future releases.
public class BTPayPalEditRequest {
private let token: String
let token: String
KunJeongPark marked this conversation as resolved.
Show resolved Hide resolved

/// Initializes a PayPal Edit Request for the Edit FI flow
/// - Parameters:
Expand Down
19 changes: 19 additions & 0 deletions UnitTests/BraintreePayPalTests/BTPayPalClient_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ class BTPayPalClient_Tests: XCTestCase {
self.waitForExpectations(timeout: 1)
}

func testTokenizePayPalEditRequest_whenResponseIsSuccessful_returnsPayPalAccountNonce() {
KunJeongPark marked this conversation as resolved.
Show resolved Hide resolved

let editRequest = BTPayPalEditRequest(token: "test-token")

// TODO: implement test to return PayPalAccountNonce
}

func testTokenizePayPalEditRequest_whenResposneIsErorr_returnsError() {
let editRequest = BTPayPalEditRequest(token: "test-token")

// TODO: implement test to return Error
}

func testTokenizePayPalEditRequest_whenUserCancels_returnsError() {
let editRequest = BTPayPalEditRequest(token: "test-token")

// TODO: implement test to return Error
}

// MARK: - PayPal approval URL to present in browser

func testTokenizePayPalAccount_checkout_whenUserActionIsNotSet_approvalUrlIsNotModified() {
Expand Down
16 changes: 16 additions & 0 deletions UnitTests/BraintreePayPalTests/BTPayPalEditRequest_Tests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import XCTest
@testable import BraintreeCore
@testable import BraintreePayPal

class BTPayPalEditRequest_Tests: XCTestCase {

override func setUp() {
super.setUp()
}

func testBTPayPalEditRequestInitializer() {
KunJeongPark marked this conversation as resolved.
Show resolved Hide resolved
let expectedToken = "test-token"
let editRequest = BTPayPalEditRequest(token: expectedToken)
XCTAssertEqual(editRequest.token, expectedToken)
}
}
Loading