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

[MBL-1958] Use New PLOT Disclaimer Copy On Project Fragment #2237

Merged
merged 11 commits into from
Jan 13, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ final class PledgePaymentPlansViewController: UIViewController {
type: .pledgeInFull,
selectedType: data.selectedPlan,
paymentIncrements: data.paymentIncrements,
project: data.project,
thresholdAmount: data.thresholdAmount
project: data.project
))
self.pledgeOverTimeOption.configureWith(value: PledgePaymentPlanOptionData(
ineligible: data.ineligible,
type: .pledgeOverTime,
selectedType: data.selectedPlan,
paymentIncrements: data.paymentIncrements,
project: data.project,
thresholdAmount: data.thresholdAmount
project: data.project
))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import SnapshotTesting
import UIKit

final class PledgePaymentPlansViewControllerTest: TestCase {
private let thresholdAmount = 125.0
override func setUp() {
super.setUp()
AppEnvironment.pushEnvironment(mainBundle: Bundle.framework)
Expand Down Expand Up @@ -46,8 +45,7 @@ final class PledgePaymentPlansViewControllerTest: TestCase {

let data = PledgePaymentPlansAndSelectionData(
selectedPlan: .pledgeInFull,
project: project,
thresholdAmount: thresholdAmount
project: project
)
controller.configure(with: data)

Expand All @@ -73,8 +71,7 @@ final class PledgePaymentPlansViewControllerTest: TestCase {
selectedPlan: .pledgeOverTime,
increments: testIncrements,
ineligible: false,
project: project,
thresholdAmount: thresholdAmount
project: project
)
controller.configure(with: data)

Expand Down Expand Up @@ -103,8 +100,7 @@ final class PledgePaymentPlansViewControllerTest: TestCase {
selectedPlan: .pledgeInFull,
increments: testPledgePaymentIncrement(),
ineligible: true,
project: Project.template,
thresholdAmount: self.thresholdAmount
project: Project.template
)

controller.configure(with: data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ final class PledgeRewardsSummaryTotalViewControllerTests: TestCase {
selectedPlan: .pledgeInFull,
increments: paymentIncrements,
ineligible: false,
project: project,
thresholdAmount: 125.0
project: project
)

controller.configureWith(pledgeOverTimeData: plotData)
Expand Down Expand Up @@ -161,8 +160,7 @@ final class PledgeRewardsSummaryTotalViewControllerTests: TestCase {
selectedPlan: .pledgeOverTime,
increments: paymentIncrements,
ineligible: false,
project: project,
thresholdAmount: 125.0
project: project
)

controller.configureWith(pledgeOverTimeData: plotData)
Expand Down
16 changes: 14 additions & 2 deletions KsApi/GraphAPI.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions KsApi/fragments/ProjectFragment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fragment ProjectFragment on Project {
minPledge
name
pid
pledgeOverTimeMinimumExplanation
pledged {
...MoneyFragment
}
Expand Down
34 changes: 31 additions & 3 deletions KsApi/graphql-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5032,16 +5032,32 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "amountCollectedForPledgeManagerAddons",
"description": "The total amount collected for add-ons in the pledge manager",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "amountCollectedForShipping",
"description": "The total amount collected for shipping during pledge redemption",
"description": "The total amount collected for shipping in the pledge manager",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"name": "String",
"ofType": null
}
},
Expand Down Expand Up @@ -5234,7 +5250,7 @@
},
{
"name": "backersRemainingForPledgeRedemption",
"description": "The number of backers who have yet to go through pledge redemption",
"description": "The number of backers who have yet to go through the pledge manager",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -6758,6 +6774,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pledgeOverTimeMinimumExplanation",
"description": "The minimum pledge amount to be eligible for PLOT, localized to the project currency and backer language",
"args": [],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pledged",
"description": "How much money is pledged to the project.",
Expand Down
6 changes: 6 additions & 0 deletions KsApi/models/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct Project {
public var id: Int
public var location: Location
public var name: String
public var pledgeOverTimeMinimumExplanation: String
public var personalization: Personalization
public var photo: Photo
public var isInPostCampaignPledgingPhase: Bool
Expand Down Expand Up @@ -281,6 +282,7 @@ extension Project: Decodable {
case location
case name
case photo
case pledgeOverTimeMinimumExplanation = "pledge_over_time_minimum_explanation"
case isInPostCampaignPledgingPhase = "is_in_post_campaign_pledging_phase"
case postCampaignPledgingEnabled = "post_campaign_pledging_enabled"
case prelaunchActivated = "prelaunch_activated"
Expand Down Expand Up @@ -313,6 +315,10 @@ extension Project: Decodable {
self.photo = try values.decode(Photo.self, forKey: .photo)
self.isInPostCampaignPledgingPhase =
try values.decodeIfPresent(Bool.self, forKey: .isInPostCampaignPledgingPhase) ?? false
self.pledgeOverTimeMinimumExplanation = try values.decodeIfPresent(
String.self,
forKey: .pledgeOverTimeMinimumExplanation
) ?? ""
self.postCampaignPledgingEnabled =
try values.decodeIfPresent(Bool.self, forKey: .postCampaignPledgingEnabled) ?? false
self.prelaunchActivated = try values.decodeIfPresent(Bool.self, forKey: .prelaunchActivated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ private func backingDictionary() -> [String: Any] {
"MASTERCARD",
"AMEX"
],
"pledgeOverTimeMinimumExplanation": "Available for pledges over $125",
"backersCount": 135,
"backing": {
"__typename": "Backing",
Expand Down Expand Up @@ -1006,6 +1007,7 @@ private func backingDictionary() -> [String: Any] {
"__typename": "ProjectBackerFriendsConnection",
"nodes": []
},
"pledgeOverTimeMinimumExplanation": "Available for pledges over $125",
"isWatched": false
},
"remainingQuantity": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ extension Project {
id: projectFragment.pid,
location: location,
name: projectFragment.name,
pledgeOverTimeMinimumExplanation: "Available for pledges over $125",
personalization: projectPersonalization(
isStarred: projectFragment.isWatched,
backing: backing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ final class Project_ProjectFragmentTests: XCTestCase {
XCTAssertNil(project.rewardData.addOns)
XCTAssertEqual(project.sendMetaCapiEvents, false)
XCTAssertEqual(project.watchesCount, 18)
XCTAssertEqual(project.pledgeOverTimeMinimumExplanation, "Available for pledges over $125")
XCTAssertFalse(project.isPledgeOverTimeAllowed!)

guard let extendedProjectProperties = project.extendedProjectProperties,
Expand Down Expand Up @@ -400,6 +401,7 @@ final class Project_ProjectFragmentTests: XCTestCase {
"minPledge": 23,
"name":"FINAL GAMBLE Issue #1",
"pid":1841936784,
"pledgeOverTimeMinimumExplanation": "Available for pledges over $125",
"pledged":{
"__typename":"Money",
"amount":"3567.0",
Expand Down
Loading