Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
000D59C19A60AB637CE65EE9 /* StripePaymentsUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89E47F13DA6D394178F06849 /* StripePaymentsUI.framework */; };
09FA1391DCA2717DBC962562 /* StripePayments.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1E565B552830E657F863C4F8 /* StripePayments.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1094816DB7E9DFAF01815365 /* StripeApplePay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63237DF22FD4600B9D2E8071 /* StripeApplePay.framework */; };
11DDC6610B393BFF4C6DF02C /* StripeCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FD1F5193E4A361EA9E8FED3 /* StripeCore.framework */; };
185A611D085DC24198C3D2D1 /* StripeUICore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9F9C96D25ED549D6255FC274 /* StripeUICore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
37CDE2E21F00571F147FCFF7 /* StripePaymentsUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 89E47F13DA6D394178F06849 /* StripePaymentsUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
424BBBEBF25E5F020FF40F36 /* Stripe3DS2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C2655A8B1DF0649CD996E045 /* Stripe3DS2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
551DB033DB4C8257ABAADA8F /* StripePaymentSheet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 240DDF52B887E788853A838B /* StripePaymentSheet.framework */; };
65D034E37B345C1B64785451 /* StripeCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1FD1F5193E4A361EA9E8FED3 /* StripeCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand Down Expand Up @@ -69,7 +67,6 @@
FBA21DE7C9261D3BFD53A6CB /* StripeFinancialConnections.framework in Embed Frameworks */,
75D1997DA514F6DB82FF1CFC /* StripePaymentSheet.framework in Embed Frameworks */,
09FA1391DCA2717DBC962562 /* StripePayments.framework in Embed Frameworks */,
37CDE2E21F00571F147FCFF7 /* StripePaymentsUI.framework in Embed Frameworks */,
185A611D085DC24198C3D2D1 /* StripeUICore.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
Expand Down Expand Up @@ -166,7 +163,6 @@
9F126696AD86BF2E861B5CC5 /* StripeFinancialConnections.framework in Frameworks */,
551DB033DB4C8257ABAADA8F /* StripePaymentSheet.framework in Frameworks */,
D89C23032CFB732A0CFCD565 /* StripePayments.framework in Frameworks */,
000D59C19A60AB637CE65EE9 /* StripePaymentsUI.framework in Frameworks */,
FA36E30724AAC6E3EF717A6A /* StripeUICore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ let package = Package(
),
.target(
name: "StripePaymentSheet",
dependencies: ["StripePaymentsUI", "StripeApplePay", "StripePayments", "StripeCore", "StripeUICore"],
dependencies: ["StripeApplePay", "StripePayments", "StripeCore", "StripeUICore"],
path: "StripePaymentSheet/StripePaymentSheet",
exclude: ["Info.plist"],
resources: [
Expand Down
125 changes: 0 additions & 125 deletions Stripe/StripeiOSTests/STPStringUtilsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,123 +8,9 @@
import Foundation

@testable@_spi(STP) import StripeCore
@testable@_spi(STP) import StripePaymentSheet
@testable@_spi(STP) import StripePaymentsUI

class STPStringUtilsTest: XCTestCase {
func testParseRangeSingleTagSuccess1() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRange(
from: "Test <b>string</b>",
withTag: "b"
) { string, range in
XCTAssertTrue(NSEqualRanges(range, NSRange(location: 5, length: 6)))
XCTAssertEqual(string, "Test string")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}

func testParseRangeSingleTagSuccess2() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRange(
from: "<a>Test <b>str</a>ing</b>",
withTag: "b"
) { string, range in
XCTAssertTrue(NSEqualRanges(range, NSRange(location: 8, length: 10)))
XCTAssertEqual(string, "<a>Test str</a>ing")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}

func testParseRangeSingleTagFailure1() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRange(
from: "Test <b>string</b>",
withTag: "a"
) { string, range in
XCTAssertEqual(range.location, NSNotFound)
XCTAssertEqual(string, "Test <b>string</b>")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}

func testParseRangeSingleTagFailure2() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRange(
from: "Test <b>string",
withTag: "b"
) { string, range in
XCTAssertEqual(range.location, NSNotFound)
XCTAssertEqual(string, "Test <b>string")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}

func testParseRangeMultiTag1() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRanges(
from: "<a>Test</a> <b>string</b>",
withTags: Set(["a", "b", "c"])
) { string, tagMap in
XCTAssertTrue(NSEqualRanges(tagMap["a"]!.rangeValue, NSRange(location: 0, length: 4)))
XCTAssertTrue(NSEqualRanges(tagMap["b"]!.rangeValue, NSRange(location: 5, length: 6)))
XCTAssertEqual(tagMap["c"]!.rangeValue.location, NSNotFound)
XCTAssertEqual(string, "Test string")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}

func testParseRangeMultiTag2() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRanges(from: "Test string", withTags: Set(["a", "b", "c"])) {
string,
tagMap in
XCTAssertEqual(tagMap["a"]!.rangeValue.location, NSNotFound)
XCTAssertEqual(tagMap["b"]!.rangeValue.location, NSNotFound)
XCTAssertEqual(tagMap["c"]!.rangeValue.location, NSNotFound)
XCTAssertEqual(string, "Test string")
exp.fulfill()
}
waitForExpectations(timeout: 1)
}
func testParseRangeWithOverlappingRanges() {
let exp = self.expectation(description: "Parsed")
STPStringUtils.parseRanges(
from: "<a>Test <b>string</b></a>",
withTags: Set(["a", "b"])
) { string, tagMap in
XCTAssertEqual(string, "Test string")
XCTAssertTrue(tagMap.isEmpty)
exp.fulfill()
}
waitForExpectations(timeout: 1)
}
func testHasOverlappingRanges_singleItem() {
let ranges: [NSValue: String] = [
NSValue(range: NSRange(location: 0, length: 2)): "a",
]
XCTAssertFalse(STPStringUtils.hasOverlappingRanges(ranges: ranges))
}
func testHasOverlappingRanges_nonOverlapping() {
let ranges: [NSValue: String] = [
NSValue(range: NSRange(location: 0, length: 2)): "a",
NSValue(range: NSRange(location: 2, length: 1)): "b",
]
XCTAssertFalse(STPStringUtils.hasOverlappingRanges(ranges: ranges))
}
func testHasOverlappingRanges_overlapping() {
let ranges: [NSValue: String] = [
NSValue(range: NSRange(location: 0, length: 2)): "a",
NSValue(range: NSRange(location: 1, length: 1)): "b",
]
XCTAssert(STPStringUtils.hasOverlappingRanges(ranges: ranges))
}

func testExpirationDateStrings() {
XCTAssertEqual(STPStringUtils.expirationDateString(from: "12/1995"), "12/95")
XCTAssertEqual(STPStringUtils.expirationDateString(from: "12 / 1995"), "12 / 95")
Expand All @@ -139,15 +25,4 @@ class STPStringUtilsTest: XCTestCase {
XCTAssertEqual(STPStringUtils.expirationDateString(from: " "), " ")
XCTAssertEqual(STPStringUtils.expirationDateString(from: "12/"), "12/")
}

func testSanitizedExpirationDateFromOCRString() {
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("12/1995"), "1295")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("12/95"), "1295")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("Security Code 123 Valid Thru 01/35"), "0135")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("BankCo Logo Is Copyright 1995 BankCo Call us at 888-555-5555 Expiration date 01/35 Security Code 123"), "0135")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("Made with 10% recycled plastic, 45% organic matter. Expiration date 01/35"), "0135")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("Expiration date 01/35, card produced 01/23"), "0135")
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("Expiration date 01 35"), nil)
XCTAssertEqual(STPStringUtils.sanitizedExpirationDateFromOCRString("AA/BB"), nil)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
395CFB782E1F93789A260434 /* StripePaymentSheet.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2E42F31D392C0AED757D6239 /* StripePaymentSheet.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3D4497A6A1CB151C4B75A68F /* StripeCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41AA4E90E5BB28D588FDE51 /* StripeCore.framework */; };
48DA2EFE0944E737B0F197B0 /* OHHTTPStubs in Frameworks */ = {isa = PBXBuildFile; productRef = B2AFFAD776D5F21DF837F1BD /* OHHTTPStubs */; };
4A8C7B2AFB290567C961DAB0 /* StripePaymentsUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F22354BD25171B8DC2B922D2 /* StripePaymentsUI.framework */; };
5AD73D80CB804EC3E20AE464 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11E117C348836EF631BD2DB8 /* ViewController.swift */; };
5C047CFEA91C1A04EAEC0CFF /* StripeUICore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 35BFC60D1945087E74B6BD89 /* StripeUICore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
61C0D3B8C63EB4558AB74A7E /* StripePayments.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A1C7CFA5C9C1A8A73CFA1C0 /* StripePayments.framework */; };
Expand Down Expand Up @@ -175,7 +174,6 @@
999D46841AFC73E411A91037 /* StripeApplePay.framework in Frameworks */,
3D4497A6A1CB151C4B75A68F /* StripeCore.framework in Frameworks */,
61C0D3B8C63EB4558AB74A7E /* StripePayments.framework in Frameworks */,
4A8C7B2AFB290567C961DAB0 /* StripePaymentsUI.framework in Frameworks */,
96B1DCBDA1923BF5E7F990B8 /* StripeUICore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icon-card-amex.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icon-card-cartebancaire.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "cvcLight.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "cvcDark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading