Skip to content

Commit

Permalink
add ScrollView to PayPalWebTransactionView
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxdesmarais committed Dec 1, 2023
1 parent 5f95aa4 commit ee4f5da
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,35 @@ struct PayPalWebTransactionView: View {
@ObservedObject var payPalWebViewModel: PayPalWebViewModel

var body: some View {
VStack {
PayPalWebStatusView(status: .approved, payPalViewModel: payPalWebViewModel)
ZStack {
Button("\(payPalWebViewModel.intent.rawValue.capitalized) Order") {
Task {
do {
try await payPalWebViewModel.completeTransaction()
} catch {
print("Error capturing order: \(error.localizedDescription)")
ScrollView {
VStack {
PayPalWebStatusView(status: .approved, payPalViewModel: payPalWebViewModel)
ZStack {
Button("\(payPalWebViewModel.intent.rawValue.capitalized) Order") {
Task {
do {
try await payPalWebViewModel.completeTransaction()
} catch {
print("Error capturing order: \(error.localizedDescription)")
}
}
}
.buttonStyle(RoundedBlueButtonStyle())
.padding()

if payPalWebViewModel.state == .loading {
CircularProgressView()
}
}
.buttonStyle(RoundedBlueButtonStyle())
.padding()

if payPalWebViewModel.state == .loading {
CircularProgressView()

if payPalWebViewModel.state == .success {
PayPalWebResultView(payPalWebViewModel: payPalWebViewModel, status: .completed)
}
}

if payPalWebViewModel.state == .success {
PayPalWebResultView(payPalWebViewModel: payPalWebViewModel, status: .completed)
.onAppear {
payPalWebViewModel.resetState()
}
Spacer()
}
.onAppear {
payPalWebViewModel.resetState()
}
Spacer()
}
}

0 comments on commit ee4f5da

Please sign in to comment.