-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Important] Adding imageUrl, upcType, upcCode to PayPalLineItem (#1165)
* Added the ability for merchants to pass imageURL, upcCode, upcType in PayPalLineItem Co-authored-by: Jax DesMarais-Leder <jdesmarais@paypal.com>
- Loading branch information
1 parent
a16d4b5
commit 307cbdf
Showing
5 changed files
with
142 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
UnitTests/BraintreePayPalTests/BTPayPalLineItem_Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Foundation | ||
import XCTest | ||
@testable import BraintreePayPal | ||
|
||
class BTPayPalLineItem_Tests: XCTestCase { | ||
|
||
func testUPCTypeStringReturnsCorrectValue() { | ||
let lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "10", name: "item-name", kind: .debit) | ||
|
||
lineItem.upcType = .UPC_A | ||
let requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-A"); | ||
|
||
lineItem.upcType = .UPC_B | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-B"); | ||
|
||
lineItem.upcType = .UPC_C | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-C"); | ||
|
||
lineItem.upcType = .UPC_D | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-D"); | ||
|
||
lineItem.upcType = .UPC_E | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-E"); | ||
|
||
lineItem.upcType = .UPC_1 | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-1"); | ||
|
||
lineItem.upcType = .UPC_2 | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["upc_type"] as! String, "UPC-2"); | ||
} | ||
|
||
func testKindStringReturnsCorrectValue() { | ||
let lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "10", name: "item-name", kind: .debit) | ||
let requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["kind"] as! String, "debit"); | ||
|
||
lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "10", name: "item-name", kind: .credit) | ||
requestParams = lineItem.requestParameters(); | ||
XCTAssertEqual(requestParams["kind"] as! String, "credit"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters