Skip to content

Commit

Permalink
Merge branch 'next-major-version' of https://github.com/paypal/paypal…
Browse files Browse the repository at this point in the history
…-ios into fix/button-size

# Conflicts:
#	Demo/Demo/SwiftUIComponents/PayPalWebPayments/PayPalWebButtonsView.swift
  • Loading branch information
stechiu committed Feb 14, 2024
2 parents 233eb34 + 51c43d0 commit e47e030
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 52 deletions.
23 changes: 6 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# PayPal iOS SDK Release Notes

## unreleased
* PaymentButtons
* Add `custom` case for `PaymentButtonEdges`
* Support VoiceOver by adding button accessibility labels
* Add `custom` case for `PaymentButtonEdges`
* Support VoiceOver by adding button accessibility labels
* Font typeface changed to "PayPalOpen" to meet brand guidelines
* CardPayments
* Add `liabilityShift` property to `CardResult`
* Add `CardClientError.threeDSVerificationError` for invalid verification
Expand All @@ -12,23 +18,6 @@
* Add `PayPalVaultResult` type to return vault result
* Add `PayPalVaultDelegate` to handle results from vault flow
* Add `PayPalWebCheckoutClientError.paypalVaultResponseError` for missing or invalid response from vaulting
* PaymentButtons
* Add new `PaymentButtonSize` case `.standard`
* Add `custom` case for `PaymentButtonEdges`
* Support VoiceOver by adding button accessibility labels
* Add new `PaymentButtonSize` case `.miniWithWordmark`
* Add new `PayPalButton.Labels` cases: `.addMoneyWith`, `.bookWith`, `.buyWith`, `.buyNowWith`,
`.checkoutWith`, `.continueWith`, `.contributeWith`, `.orderWith`, `.payLaterWith`, `.payWith`,
`.reloadWith`, `.rentWith`, `.reserveWith`, `.subscribeWith`, `.supportWith`, `.tipWith`,
`.topUpWith`
* `PayPalButtonSize` `.mini` changed to rectangular button to meet brand guidelines
* Font typeface changed to "PayPalOpen" to meet brand guidelines
* Breaking Changes
* PaymentButtons
* Remove `PayPalButton.Labels` cases: `.checkout`, `.buyNow`, `.payLater`
* Remove `PaymentButtonColor` `.black`, `.silver`, `.blue`, and `.darkBlue`
* Add `PaymentButtonColor.gold` for `PayPalCreditButton`
* Remove `PaymentButtonSize` cases: `.miniWithWordmark`, `.collapsed`, `.expanded`, `.full`

## 1.1.0 (2023-11-16)
* PayPalNativePayments
Expand Down
30 changes: 5 additions & 25 deletions Demo/Demo/Extensions/PaymentButtonEnums+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PaymentButtons
extension PayPalPayLaterButton.Color {

public static var allCases: [PayPalPayLaterButton.Color] {
[.gold, .white]
[.gold, .white, .black, .silver, .blue]
}

static func allCasesAsString() -> [String] {
Expand All @@ -14,7 +14,7 @@ extension PayPalPayLaterButton.Color {
extension PayPalButton.Color: CaseIterable {

public static var allCases: [PayPalButton.Color] {
[.gold, .white]
[.gold, .white, .black, .silver, .blue]
}

static func allCasesAsString() -> [String] {
Expand All @@ -25,7 +25,7 @@ extension PayPalButton.Color: CaseIterable {
extension PayPalCreditButton.Color: CaseIterable {

public static var allCases: [PayPalCreditButton.Color] {
[.gold, .white]
[.white, .black, .darkBlue]
}

static func allCasesAsString() -> [String] {
Expand All @@ -47,7 +47,7 @@ extension PaymentButtonEdges: CaseIterable {
extension PaymentButtonSize: CaseIterable {

public static var allCases: [PaymentButtonSize] {
[.mini, .standard]
[.mini, .collapsed, .expanded, .full]
}

static func allCasesAsString() -> [String] {
Expand All @@ -69,27 +69,7 @@ extension PaymentButtonFundingSource: CaseIterable {
extension PayPalButton.Label: CaseIterable {

public static var allCases: [PayPalButton.Label] {
[
.none,
.addMoneyWith,
.bookWith,
.buyNowWith,
.buyWith,
.checkoutWith,
.continueWith,
.contributeWith,
.orderWith,
.payWith,
.payLater,
.payLaterWith,
.reloadWith,
.rentWith,
.reserveWith,
.subscribeWith,
.supportWith,
.tipWith,
.topUpWith
]
[.none, .checkout, .buyNow, .payWith]
}

static func allCasesAsString() -> [String] {
Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo/Models/Order.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ struct Order: Codable, Equatable {

struct Vault: Codable, Equatable {

let id: String
let id: String?
let status: String
let customer: Customer
let customer: Customer?
}

struct Customer: Codable, Equatable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ struct CardOrderCompletionResultView: View {
LeadingText("Brand", weight: .bold)
LeadingText("\(brand)")
}
if let vaultStatus = orderResponse.paymentSource?.card?.attributes?.vault.status {
LeadingText("Vault Status", weight: .bold)
LeadingText("\(vaultStatus)")
}
if let vaultID = orderResponse.paymentSource?.card?.attributes?.vault.id {
LeadingText("Vault ID / Payment Token", weight: .bold)
LeadingText("\(vaultID)")
}
if let customerID = orderResponse.paymentSource?.card?.attributes?.vault.customer.id {
if let customerID = orderResponse.paymentSource?.card?.attributes?.vault.customer?.id {
LeadingText("Customer ID", weight: .bold)
LeadingText("\(customerID)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct PayPalWebButtonsView: View {

switch selectedFundingSource {
case .paypalCredit:
PayPalCreditButton.Representable(color: .gold, edges: .rounded, size: .standard) {
PayPalCreditButton.Representable(color: .white, edges: .rounded, size: .standard) {
payPalWebViewModel.paymentButtonTapped(funding: .paypalCredit)
}
case .paylater:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct PayPalWebResultView: View {
LabelViewText("Payment Token:", bodyText: vaultID)
}

if let customerID = payPalWebViewModel.order?.paymentSource?.paypal?.attributes?.vault.customer.id {
if let customerID = payPalWebViewModel.order?.paymentSource?.paypal?.attributes?.vault.customer?.id {
LabelViewText("Customer ID:", bodyText: customerID)
}
}
Expand Down
3 changes: 1 addition & 2 deletions Sources/PaymentButtons/PayPalCreditButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ public final class PayPalCreditButton: PaymentButton {
Available colors for PayPalCreditButton.
*/
public enum Color: String {
case gold
case white

var color: PaymentButtonColor {
PaymentButtonColor(rawValue: rawValue) ?? .white
PaymentButtonColor(rawValue: rawValue) ?? .darkBlue
}
}

Expand Down
48 changes: 45 additions & 3 deletions Sources/PaymentButtons/PaymentButtonColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,51 @@ public enum PaymentButtonColor: String {
/// The gold background and blue wordmark, monogram, and black text.
case gold

/// The white background and blue wordmark, blue border, monogram, and black text.
/// The white background and blue wordmark, monogram, and black text.
case white

/// The black background and monochrome wordmark, monogram, and white text.
case black

/// The silver background and blue wordmark, monogram, and black text.
case silver

/// The blue background and white wordmark, blue monogram, and white text.
case blue

/// The dark blue background with PayPal Credit wordmark and monogram.
case darkBlue

var color: UIColor {
switch self {
case .gold:
return UIColor(hexString: "#FFD140")
return UIColor(hexString: "#FFC439")

case .white:
return UIColor(hexString: "#FFFFFF")

case .black:
return UIColor(hexString: "#000000")

case .silver:
return UIColor(hexString: "#EEEEEE")

case .blue:
return UIColor(hexString: "#0070BA")

case .darkBlue:
return UIColor(hexString: "#073990")
}
}

var fontColor: UIColor {
.black
switch self {
case .gold, .white, .silver:
return .black

case .blue, .black, .darkBlue:
return .white
}
}

public var description: String {
Expand All @@ -29,6 +59,18 @@ public enum PaymentButtonColor: String {

case .white:
return "White"

case .black:
return "Black"

case .silver:
return "Silver"

case .blue:
return "Blue"

case .darkBlue:
return "Dark blue"
}
}
}
Expand Down

0 comments on commit e47e030

Please sign in to comment.