-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NT-354] Remove deprecated CreateApplePayBacking mutation #916
Conversation
Library/SharedFunctions.swift
Outdated
shippingAmountDecimal = Decimal(shippingRule.cost) | ||
shippingLocationId = String(shippingRule.location.id) | ||
} | ||
|
||
let pledgeTotal = NSDecimalNumber(decimal: pledgeAmountDecimal + shippingAmountDecimal) | ||
let formattedPledgeTotal = Format.decimalCurrency(for: pledgeTotal.doubleValue) | ||
|
||
let rewardId = reward == Reward.noReward ? nil : reward.graphID | ||
let rewardId = reward.graphID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to make Reward non-optional for this input so this kind've repeats the change in #915 🤷♂
.switchMap { input in | ||
AppEnvironment.current.apiService.createBacking(input: input) | ||
.ksr_delay(AppEnvironment.current.apiDelayInterval, on: AppEnvironment.current.scheduler) | ||
.map { $0 as StripeSCARequiring } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this type mapping higher up means we don't have to do so many signal merges further down.
.materialize() | ||
} | ||
|
||
let createOrUpdateEvent = Signal.merge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All values and errors are just merged here now.
@@ -999,8 +999,16 @@ final class PledgeViewModelTests: TestCase { | |||
) | |||
} | |||
|
|||
func testGoToThanks() { | |||
withEnvironment(apiService: MockService()) { | |||
func testApplePay_GoToThanks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to kind've prove that there were no regressions I left these tests largely as-is. But we can chat about potentially adding more? I just didn't want this PR to be 1000+ lines from the start 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great!
Tested:
✅creating a backing with a stored card
✅creating a backing with Apple Pay
✅updating an Apple Pay backing to a stored card
✅updating a credit card backing to an Apple Pay backing
Just had a couple small comments and questions.
- parameter applePay: The optional ApplePayParams. | ||
- parameter locationId: The optional ID of the ShippingRule's Location. | ||
- parameter paymentSourceId: The optional ID of the PaymentSource. | ||
- parameter projectId: The ID of the Project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we differentiate in this documentation for future folks the difference between graphId
and ID
? projectId
and rewardId
both need to be graphID
s (or relayId
, whatever terminology we want) whereas locationId
is the regular id
from the location.
"amount": amount, | ||
"paymentSourceId": paymentSourceId, | ||
// swiftlint:disable:next line_length | ||
"paymentType": PaymentType.creditCard.rawValue, // this is temporary and will be removed once the mutation has been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed since we made this object Encodable
we removed this parameter. I believe it's still required 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per Slack convo - it's no longer required.
@@ -27,21 +60,26 @@ final class CreateBackingInputTests: XCTestCase { | |||
func testCreateBackingInputDictionary_TestNilLocationAndReward() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update the name of this test to reflect the fact that we now always send rewardId
even if it's Reward.noReward
? Maybe testCreateBackingInputDictionary_Location_IsNil()
?
XCTAssertEqual(input.amount, "10.00") | ||
XCTAssertNil(input.applePay) | ||
XCTAssertNil(input.locationId) | ||
XCTAssertEqual(input.projectId, project.graphID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also update this assertion to show the exact string that's expected, similar to rewardId
below on line 35?
# Conflicts: # Library/CreateApplePayBackingInputConstructorTests.swift # Library/CreateBackingConstructorTests.swift
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
G2G!
📲 What
Removes the deprecated
CreateApplePayBacking
mutation, updates our existingCreateBacking
mutation to support Apple Pay.🤔 Why
Changes on our back-end allowed for us to merge these together. This also helps us to keep this code DRYer.
🛠 How
CreateApplePayBacking
mutation.CreateBacking
,CreateBackingInput
,CreateBackingInput+Constructor
, etc.✅ Acceptance criteria