Skip to content

Commit

Permalink
Merge pull request #7 from tutipay/master
Browse files Browse the repository at this point in the history
Small changes and fixes for the api
  • Loading branch information
adonese authored Nov 20, 2023
2 parents c786c4a + 73bbab5 commit 3c84c47
Show file tree
Hide file tree
Showing 23 changed files with 1,264 additions and 598 deletions.
Binary file added .DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ jobs:
with:
arguments: build -x test

- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "::set-output name=short_sha::$calculatedSha"
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publish
arguments: publish -P version=${{ steps.vars.outputs.short_sha }}
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

### Add it in your root build.gradle

```sh
```sh
repositories {
...
maven { url 'https://jitpack.io' }
}
```
```
### Add the dependency
```sh
```sh
dependencies {
implementation 'com.github.tutipay:java-sdk:-SNAPSHOT' # add this stage always use the bleeding edge version
}
```
```
## How does the api work
Expand Down Expand Up @@ -110,6 +110,7 @@ repositories {
}
}
```
- That is it actually!
### how to use noebs published Github Package
Expand All @@ -125,4 +126,4 @@ repositories {
}
}
```
- add to your app's gradle file the implementation, which is `implementation 'noebs:lib:22.10.27'`
- add to your app's gradle file the implementation, which is `implementation 'noebs:lib:-latest-version'`
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=22.11.23
version=23.10.32
63 changes: 38 additions & 25 deletions lib/src/main/java/com/tuti/Library.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,52 @@
package com.tuti

import com.tuti.api.TutiApiClient
import com.tuti.api.authentication.SignInRequest
import com.tuti.api.authentication.SignInResponse
import com.tuti.api.data.Card
import com.tuti.api.data.TutiResponse
import com.tuti.api.ebs.EBSRequest
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import com.tuti.api.data.PaymentRequest
import com.tuti.api.data.UserProfile

object Library {
var jwt: String? = null

@JvmStatic
fun main(args: Array<String>) {
addBeneficiary()
testFirebase()
}
}
val client = TutiApiClient()
val tuti_username = System.getenv("tuti_username")
val tuti_password = System.getenv("tuti_password")
val tuti_card_pan = System.getenv("tuti_card_pan")
val tuti_card_exp_date = System.getenv("tuti_card_exp_date")
val tuti_card_ipin = System.getenv("tuti_card_ipin")

val card = Card(
PAN = tuti_card_pan,
expiryDate = tuti_card_exp_date
)

client.SignIn(SignInRequest(
mobile = tuti_username,
password = tuti_password
),
onResponse = { signInResponse: SignInResponse ->

private fun addBeneficiary() {
val tutiApiClient = TutiApiClient()
tutiApiClient.authToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2JpbGUiOiIwMTExNDkzODg1IiwiZXhwIjoxNjY3NDk4MDc1LCJpc3MiOiJub2VicyJ9.2YveVIAuCg6O4-PsxZJ4pclQJGNapdNlIUC0XaBmFrY"


val token = signInResponse.authorizationJWT
client.authToken = token

client.sendPaymentRequest(
paymentRequest = PaymentRequest(
mobile = tuti_username,
toCard = tuti_card_pan,
amount = 1L
),
onResponse = {tutiResponse -> println(tutiResponse.uuid) },
onError = {tutiResponse, exception -> }
)

},
onError = { tutiResponse, exception -> })
}
}

private fun testFirebase() {
val tutiApiClient = TutiApiClient()
tutiApiClient.authToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2JpbGUiOiIwMTExNDkzODg1IiwiZXhwIjoxNjY4MTQ0OTIxLCJpc3MiOiJub2VicyJ9.bgvBds5TL24YsVAWT6aGS6BCmm1BMRQyaEzRXJbU2TQ"

tutiApiClient.UpsertFirebase("this is my firebase token", { signInResponse: TutiResponse? ->
run { println(signInResponse) }
}, { objectReceived: TutiResponse?, exception: Exception? ->
run {
println(objectReceived.toString())
}
})
}
Loading

0 comments on commit 3c84c47

Please sign in to comment.