@@ -79,13 +79,11 @@ final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingU
7979 /// If both plugins are active, don't bother initializing the backend nor fetching
8080 /// accounts. Fall through to updateState so the end user can fix the problem.
8181 guard !bothPluginsInstalledAndActive( wcPay: wcPayPlugin, stripe: stripePlugin) else {
82- print ( " ==== in updateAccounts - both WCPay and Stripe are active - bailing " )
8382 self . updateState ( )
8483 return
8584 }
8685
8786 if wcPayPlugin? . active ?? false {
88- print ( " ==== in updateAccounts - WCPay is active on store - informing CPPS " )
8987 let useWCPayAction = CardPresentPaymentAction . useWCPay // TODO asynchronicity / ordering of actions?
9088 stores. dispatch ( useWCPayAction)
9189 } else {
@@ -97,12 +95,10 @@ final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingU
9795 }
9896
9997 if stripePlugin? . active ?? false {
100- print ( " ==== in updateAccounts - Stripe is active on store - informing CPPS " )
10198 let useStripeAction = CardPresentPaymentAction . useStripe // TODO asynchronicity / ordering of actions?
10299 stores. dispatch ( useStripeAction)
103100 }
104101
105- print ( " ==== in updateAccounts - asking CPPS to load account " )
106102 let paymentGatewayAccountsAction = CardPresentPaymentAction . loadAccounts ( siteID: siteID) { [ weak self] result in
107103 self ? . updateState ( )
108104 }
@@ -176,107 +172,82 @@ private extension CardPresentPaymentsOnboardingUseCase {
176172 DDLogError ( " [CardPresentPaymentsOnboarding] Couldn't determine country for store " )
177173 return . genericError
178174 }
179- print ( " ==== was able to obtain country code " )
180175
181176 guard isCountrySupported ( countryCode: countryCode) else {
182177 return . countryNotSupported( countryCode: countryCode)
183178 }
184- print ( " ==== country code is supported " )
185179
186180 let wcPay = getWCPayPlugin ( )
187181 guard stripeGatewayIPPEnabled == true else {
188- print ( " ==== Stripe IPP experiment is NOT enabled - only considering WCPay " )
189182 return wcPayOnlyOnboardingState ( plugin: wcPay)
190183 }
191184
192- print ( " ==== Stripe IPP experiment IS enabled " )
193185 let stripe = getStripePlugin ( )
194186
195187 // If both the Stripe plugin and WCPay are installed and activated, the user needs
196188 // to deactivate one: pdfdoF-fW-p2#comment-683
197189 if bothPluginsInstalledAndActive ( wcPay: wcPay, stripe: stripe) {
198- print ( " ==== Both plugins are active - bailing " )
199190 return . selectPlugin
200191 }
201192
202193 // If only the Stripe extension is active, skip to checking plugin version
203194 if let stripe = stripe,
204195 onlyStripeIsActive ( wcPay: wcPay, stripe: stripe) {
205- print ( " ==== Only Stripe is active " )
206196 return stripeGatewayOnlyOnboardingState ( plugin: stripe)
207197 } else {
208- print ( " ==== Only WCPay is active " )
209198 return wcPayOnlyOnboardingState ( plugin: wcPay)
210199 }
211200 }
212201
213202 func wcPayOnlyOnboardingState( plugin: SystemPlugin ? ) -> CardPresentPaymentOnboardingState {
214- print ( " ==== Checking WCPay plugin version " )
215203 // Plugin checks
216204 guard let plugin = plugin else {
217- print ( " ==== Checking WCPay plugin installation - plugin is NOT installed! " )
218205 return . pluginNotInstalled
219206 }
220207 guard isWCPayVersionSupported ( plugin: plugin) else {
221- print ( " ==== Checking WCPay plugin version - plugin version is unsupported " )
222208 return . pluginUnsupportedVersion
223209 }
224210 guard plugin. active else {
225- print ( " ==== Checking WCPay plugin activation - plugin is NOT active! " )
226211 return . pluginNotActivated
227212 }
228213
229214 // Account checks
230- print ( " ==== Checking Stripe plugin version - plugin version is good - proceeding to account check " )
231215 return accountChecks ( )
232216 }
233217
234218 func stripeGatewayOnlyOnboardingState( plugin: SystemPlugin ) -> CardPresentPaymentOnboardingState {
235- print ( " ==== Checking Stripe plugin version " )
236219 guard isStripeVersionSupported ( plugin: plugin) else {
237- print ( " ==== Checking Stripe plugin version - plugin version is unsupported " )
238220 return . pluginUnsupportedVersion
239221 }
240- print ( " ==== Checking Stripe plugin version - plugin version is good - proceeding to account check " )
241222 return accountChecks ( )
242223 }
243224
244225 func accountChecks( ) -> CardPresentPaymentOnboardingState {
245- print ( " ==== In accountChecks " )
246226 guard let account = getPaymentGatewayAccount ( ) else {
247- print ( " ==== accountChecks genericError " )
248227 return . genericError
249228 }
250229 guard isPaymentGatewaySetupCompleted ( account: account) else {
251- print ( " ==== accountChecks pluginSetupNotCompleted " )
252230 return . pluginSetupNotCompleted
253231 }
254232 guard !isPluginInTestModeWithLiveStripeAccount( account: account) else {
255- print ( " ==== accountChecks pluginInTestModeWithLiveStripeAccount " )
256233 return . pluginInTestModeWithLiveStripeAccount
257234 }
258235 guard !isStripeAccountUnderReview( account: account) else {
259- print ( " ==== accountChecks stripeAccountUnderReview " )
260236 return . stripeAccountUnderReview
261237 }
262238 guard !isStripeAccountOverdueRequirements( account: account) else {
263- print ( " ==== accountChecks stripeAccountOverdueRequirement " )
264239 return . stripeAccountOverdueRequirement
265240 }
266241 guard !isStripeAccountPendingRequirements( account: account) else {
267- print ( " ==== accountChecks stripeAccountPendingRequirement " )
268242 return . stripeAccountPendingRequirement( deadline: account. currentDeadline)
269243 }
270244 guard !isStripeAccountRejected( account: account) else {
271- print ( " ==== accountChecks stripeAccountRejected " )
272245 return . stripeAccountRejected
273246 }
274247 guard !isInUndefinedState( account: account) else {
275- print ( " ==== accountChecks genericError 2 " )
276248 return . genericError
277249 }
278250
279- print ( " ==== accountChecks completed " )
280251 return . completed
281252 }
282253}
0 commit comments