Skip to content

Commit

Permalink
MOB-934 Update Read Me and CodeOwners (#113)
Browse files Browse the repository at this point in the history
- Updated Readme with sample of Result Transaction
	- Adding Code Owner file
	- Updated the Example application for Result Tranaction
  • Loading branch information
Peter-John-paystack authored May 22, 2024
1 parent a00d463 commit d75f205
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These owners will be the default owners for everything in the repo.
# For more info, see: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @Peter-John-paystack @michael-paystack @PaystackHQ/mobile @dami-paystack
11 changes: 10 additions & 1 deletion Example/paystack-sdk-ios/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ struct ContentView: View {
.padding()
}

func paymentDone(_ result: TransactionResult) {}
func paymentDone(_ result: TransactionResult) {
switch result {
case .completed(let details):
print("Transaction completed with reference: \(details.reference)")
case .cancelled:
print("Transaction was cancelled")
case .error(error: let error, reference: let reference):
print("An error occured: \(error.message) with reference: \(String(describing: reference))")
}
}
}

struct ContentView_Previews: PreviewProvider {
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ We currently have two variations of Example apps.

To get started with either of these:
- Open the associated project file.
- Add the Pusher public key to the `secrets.plist` file located in `/Sources/PaystackSDK/Core/Service/Subscription`
- Inside `ContentView.swift` (SwiftUI Example App) or `ViewController.swift` (UIKit Example app), modify the Paystack object that is being built to include the public key of the integration being used.

```swift
Expand All @@ -32,18 +31,7 @@ To install the SDK using [Swift Package Manager](https://github.com/apple/swift-
1. In Xcode, select “File” → “Add Packages...”
2. Enter https://github.com/PaystackHQ/paystack-sdk-ios.git

### CocoaPods
Add the pods to your Podfile as required:
```ruby
pod 'PaystackCore'
pod `PaystackUI`
```

And then run:
```ruby
pod install
```
After installing the Cocoapod into your project import it using
After installing with Swift package Manager into your project import it using
```swift
import PaystackCore
import PaystackUI
Expand All @@ -63,7 +51,14 @@ paystackObject?.chargeUIButton(accessCode: "transaction access code",
}

func paymentDone(_ result: TransactionResult) {
// Handle transaction result
switch (result){
case .completed(let details):
print("Transaction completed with reference: \(details.reference)")
case .cancelled:
print("Transaction was cancelled")
case .error(error: let error, reference: let reference):
print("An error occured: \(error.message) with reference: \(String(describing: reference))")
}
}
```

Expand All @@ -78,7 +73,14 @@ For UIKit, you would create your own button to trigger the flow and provide a re
}

func paymentDone(_ result: TransactionResult) {
// Handle transaction result
switch (result){
case .completed(let details):
print("Transaction completed with reference: \(details.reference)")
case .cancelled:
print("Transaction was cancelled")
case .error(error: let error, reference: let reference):
print("An error occured: \(error.message) with reference: \(String(describing: reference))")
}
}
```

Expand Down

0 comments on commit d75f205

Please sign in to comment.