-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Authorize/Capture for PayPalWebPayments in Demo App (#216)
* add authorize/capture for PayPalWebPayments * add missing pbxproj changes, remove name header * spacing PayPalTransactionButtonView * display sandbox email in demo app * Revert project.pbxproj to match main * Change view names for consistency between PayPalWeb and Card * Jax PR feedback * Update Demo/Demo/ViewModels/PayPalWebViewModel.swift --------- Co-authored-by: Jax DesMarais-Leder <[email protected]>
- Loading branch information
1 parent
7c561bf
commit dbc73a7
Showing
13 changed files
with
248 additions
and
23 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
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
2 changes: 1 addition & 1 deletion
2
...ws/OrderCreateCardPaymentResultView.swift → ...mentViews/OrderCreateCardResultView.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
39 changes: 39 additions & 0 deletions
39
Demo/Demo/SwiftUIComponents/PayPalWebViews/PayPalOrderActionButton.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,39 @@ | ||
import SwiftUI | ||
|
||
struct PayPalOrderActionButton: View { | ||
|
||
let intent: Intent | ||
let orderID: String | ||
let selectedMerchantIntegration: MerchantIntegration | ||
|
||
@ObservedObject var paypalWebViewModel: PayPalWebViewModel | ||
|
||
var body: some View { | ||
ZStack { | ||
Button("\(intent.rawValue)") { | ||
completeOrder() | ||
} | ||
.buttonStyle(RoundedBlueButtonStyle()) | ||
.padding() | ||
|
||
if .loading == paypalWebViewModel.state.authorizedOrderResponse || | ||
.loading == paypalWebViewModel.state.capturedOrderResponse { | ||
CircularProgressView() | ||
} | ||
} | ||
} | ||
|
||
private func completeOrder() { | ||
Task { | ||
do { | ||
try await paypalWebViewModel.completeOrder( | ||
with: intent, | ||
orderID: orderID, | ||
selectedMerchantIntegration: selectedMerchantIntegration | ||
) | ||
} catch { | ||
print("Error capturing order: \(error.localizedDescription)") | ||
} | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...ayPalWebViews/PayPalWebApprovalView.swift → ...ebViews/PayPalWebApprovalResultView.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
Oops, something went wrong.