Skip to content

Commit

Permalink
removed tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
TpayDev committed Mar 21, 2024
1 parent 2cbdb97 commit 6b08513
Show file tree
Hide file tree
Showing 284 changed files with 1,975 additions and 113,834 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,19 @@ jobs:
- name: Publish to Maven Central
run: ./gradlew sdk:publishReleasePublicationToMavenCentralRepository

- name: Publish to local maven
run: ./gradlew sdk:publishReleasePublicationToLocalRepository

- name: Zip local maven
run: |
zip -qq -r tpayMaven.zip tpayMaven
cd ../..
mv ./sdk/build/tpayMaven.zip .
working-directory: ./sdk/build

- name: Create Github release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_VERSION }}
body: "Release is available on Maven Central repository. Add > implementation \"com.tpay:sdk:${{ env.RELEASE_VERSION }}\" < to your app level build.gradle file."
artifacts: "tpayMaven.zip"
7 changes: 5 additions & 2 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ jobs:
uses: gradle/gradle-build-action@v2.9.0

- name: Gradle generate documentation
run: ./gradlew sdk:generateDocumentation
run: ./gradlew sdk:dokkaHtml

- name: Remove previous documentation
run: rm -rf docs

- name: Copy generated documentation
run: cp -r ./sdk/build/dokka/javadoc/ ./docs
run: cp -r ./sdk/build/dokka/html/ ./docs

- name: Configure Git
run: |
Expand Down
125 changes: 95 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## About
This SDK allows your app to make payments with Tpay.
Documentation is available [here](https://tpay-com.github.io/tpay-android/).

## Install
Tpay SDK is available on Maven Central.
Expand All @@ -17,6 +18,22 @@ dependencies {
implementation "com.tpay:sdk:<version>"
}
```
Tpay SDK is also available as a local maven repository, downloadable from Github releases.
```groovy
// Unzip the downloaded file and then
// Add local maven repository to root level build.gradle or settings.gradle file
repositories {
maven {
url "/path/to/tpayMaven"
}
}
// Add Tpay SDK dependency to app level build.gradle
// Local repository contains only one SDK version
dependencies {
implementation "com.tpay:sdk:<downloaded_version>"
}
```

# Usage
Tpay SDK contains UI module that users can interact with and exposes a possibility to make screenless payments.
Expand All @@ -29,7 +46,6 @@ Configure information about merchant.
```kotlin
TpayModule.configure(
Merchant(
merchantId = "YOUR_MERCHANT_ID",
authorization = Merchant.Authorization(
clientId = "YOUR_CLIENT_ID",
clientSecret = "YOUR_CLIENT_SECRET"
Expand All @@ -56,15 +72,18 @@ TpayModule.configure(
### Payment methods
Configure payment methods that customer will be able to use.
```kotlin
TpayModule.configure(
paymentMethods = listOf(
PaymentMethod.Card,
PaymentMethod.Blik,
PaymentMethod.Pbl,
PaymentMethod.DigitalWallets(
wallets = listOf(DigitalWallet.GOOGLE_PAY)
)
)
TpayModule.configure(
paymentMethods = listOf(
PaymentMethod.Card,
PaymentMethod.Blik,
PaymentMethod.Pbl,
PaymentMethod.DigitalWallets(
wallets = listOf(DigitalWallet.GOOGLE_PAY)
),
PaymentMethod.InstallmentPayments(
methods = listOf(InstallmentPayment.RATY_PEKAO)
)
)
)
```

Expand Down Expand Up @@ -104,6 +123,25 @@ TpayModule.configure(object : SSLCertificatesProvider {
})
```

### Google Pay configuration
Configure Google Pay by providing your merchant id.
```kotlin
TpayModule.configure(GooglePayConfiguration(merchantId = "YOUR_MERCHANT_ID"))
```

### Compatibility
Configure the compatibility mode for SDK.
Currently available modes are Native and Flutter. Native is set by default.
Tpay has a official Flutter plugin, check this [repository](https://github.com/tpay-com/tpay-flutter) for more details.
Want to create your own plugin? Use Compatibility.Flutter when configuring.
```kotlin
// For native development
TpayModule.configure(Compatibility.Native)

// For Flutter plugin
TpayModule.configure(Compatibility.Flutter)
```

## Back press handling
Tpay UI sheets need to handle system back press events.
```kotlin
Expand Down Expand Up @@ -233,26 +271,39 @@ if (result is SheetOpenResult.Success) {
}
```
# Screenless payments
## Get payment methods
GetPaymentMethods class allows you to get payment methods that you can use within your app. It takes a common part of payment methods available on Tpay backend and payment methods that you configured using TpayModule.

## Get payment channels
GetPaymentChannels class allows you to get payment channels available on your merchant account.
You can also use GroupedPaymentChannels class to group channels received from GetPaymentChannels.
There is also a AvailablePaymentMethods class, you can get available payment methods that satisfy payment constraints from it.
```kotlin
GetPaymentMethods().execute { result ->
if (result is GetPaymentMethodsResult.Success) {
if (result.isCreditCardPaymentAvailable) {
// show credit card
}
if (result.isBLIKPaymentAvailable) {
// show BLIK
}
if (result.availableTransferMethods.isNotEmpty()) {
// show transfers
// each transfer object contains
// groupId, name and image url
GetPaymentChannels().execute { result ->
when (result) {
is GetPaymentChannelsResult.Success -> {
// read channels via result.channels

// Group payment channels by type
val grouped = GroupedPaymentChannels.from(result.channels)

// Get only available methods that satisfy payment constraints.
// It returns a common part of "grouped" and provided "methods".
// Amount needs to be a final price that will be used while creating transaction.
val availableMethods = AvailablePaymentMethods.from(
grouped = grouped,
methods = listOf(
PaymentMethod.Blik,
PaymentMethod.Pbl,
PaymentMethod.DigitalWallets(listOf(DigitalWallet.GOOGLE_PAY))
),
amount = 39.99
)

// display availableMethods in your UI
}
if (result.availableDigitalWallets.isNotEmpty()) {
// show digital wallets
}
}
is GetPaymentChannelsResult.Error -> {
// read error via result.devErrorMessage
}
}
}
```
## Parameters
Expand Down Expand Up @@ -345,10 +396,10 @@ if (result is CreateBLIKTransactionResult.AmbiguousBlikAlias) {
}
```
## Screenless transfer payment
TransferPayment allows you to create payment with bank selected by user identified by groupId.
TransferPayment allows you to create payment with bank selected by user identified by channelId.
```kotlin
TransferPayment.Builder()
.setGroupId(102)
.setChannelId(102)
.setPayer(payer)
.setPaymentDetails(paymentDetails)
.setCallbacks(redirects, notifications)
Expand All @@ -357,6 +408,20 @@ TransferPayment.Builder()
// handle payment create result
}
```

## Screenless Raty Pekao payment
PekaoInstallmentPayment allows you to create installment payment with Pekao.
```kotlin
PekaoInstallmentPayment.Builder()
.setChannelId(81)
.setPayer(payer)
.setPaymentDetails(paymentDetails)
.setCallbacks(redirects, notifications)
.build()
.execute { result ->
// handle payment create result
}
```
## Screenless Google Pay payment
GooglePayPayment allows you to create payments with credit card data provided by Google Pay.
```kotlin
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tpay/sdk/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MainActivity : AppCompatActivity() {
.configure(Environment.SANDBOX)
.configure(PaymentMethod.allMethods)
.configure(Language.PL)
.configure(GooglePayConfiguration("<merchant id>"))
.configure(object : MerchantDetailsProvider {
override fun merchantDisplayName(language: Language): String {
return when(language){
Expand All @@ -81,7 +82,6 @@ class MainActivity : AppCompatActivity() {
})
.configure(
Merchant(
merchantId = "<merchant id>",
authorization = Merchant.Authorization(
clientId = "<client id>",
clientSecret = "<client secret>"
Expand Down
160 changes: 0 additions & 160 deletions docs/allclasses.html

This file was deleted.

Loading

0 comments on commit 6b08513

Please sign in to comment.