Skip to content

Commit

Permalink
Update example and readme (#6)
Browse files Browse the repository at this point in the history
* Update example

* Update build.gradle

* Remove unused dependency
  • Loading branch information
nqnhat1988 authored Apr 17, 2019
1 parent 2c05fc6 commit a5d4b4b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 31 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ allprojects {



Then, add the SDK library as a dependency (`implementation com.github.alaxio:alax-pay-sdk:0.3.0`) and ensure that the following dependencies, required by ALAX Pay SDK are added to the build.gradle file of the application you are working on.
Then, add the SDK library as a dependency (`implementation com.github.alaxio:alax-pay-sdk:0.3.4`) and ensure that the following dependencies, required by ALAX Pay SDK are added to the build.gradle file of the application you are working on.

```
dependencies {
// ...
implementation 'com.github.alaxio:alax-pay-sdk:0.3.3'
implementation 'com.github.alaxio:alax-pay-sdk:0.3.4'
// ...
}
```
Expand Down Expand Up @@ -172,22 +172,27 @@ See `fun onActivityResult` in the provided example application for context.
The `TransferInput` object carries information on the recipient of the transfer, the amount of the transfer.

```
data class TransferInput (val receiver: String,
val amount: BigDecimal,
val asset: Asset = Asset.ALXT)
data class TransferInput (
val receiver: String,
val amount: BigDecimal,
val asset: Asset = Asset.AIA,
val xApiKey : String?
)
```

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
receiver | String | Account name of the intended recipient of the transfer. |
receiver | String | Publisher name alias of the intended recipient of the transfer. |
amount | BigDecimal | The amount to be transferred, formatted as a Decimal value. |
asset | Asset | Asset to be used in transfer. |
xApiKey | String |API Key which is generated in our ALAX Publisher Website. |

For example:
`TransferInput(“alx-customer-6bf38de3-01af-449b-9fef-2eab82c5ca5c”, “27.50”.toBigDecimal())`
`TransferInput(“Game publisher name”, “27.50”.toBigDecimal(), Asset.AIA, "xAPIKEY")`

Represents a transfer of `27.5 ALXT` (the default asset type) to the user `alx-customer-6bf38de3-01af-449b-9fef-2eab82c5ca5c`.
Represents a transfer of `27.5 AIA` to the user with alias name "Game publisher name".

The `TransactionConfirmation` object carries information about processed transaction after it’s carried out and serves for purposes of verifying that the transfer is indeed registered on the blockchain.

Expand Down
38 changes: 17 additions & 21 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="io.alax.sdk.pay.app"
>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="io.alax.sdk.pay.app">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity android:name=".PayActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".PayActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
7 changes: 6 additions & 1 deletion example/src/main/java/io/alax/sdk/pay/app/PayActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ class PayActivity : AppCompatActivity() {

if (inputReceiver.text.isNotEmpty() && inputAmount.text.isNotEmpty()) {
try {
AlaxPay.Ui.requestTransferActivity(TransferInput(inputReceiver.text.toString(), inputAmount.text.toString().toBigDecimal(), Asset.ALX), this)
AlaxPay.Ui.requestTransferActivity(
TransferInput(
receiver = "Game publisher name",
amount = inputAmount.text.toString().toBigDecimal(),
xApiKey = inputReceiver.text.toString()
), this)
} catch (e: Exception) {
Toast.makeText(this@PayActivity, e.message, Toast.LENGTH_SHORT).show()
}
Expand Down
2 changes: 1 addition & 1 deletion example/src/main/res/layout/activity_pay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:id="@+id/inputReceiver"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Receiver Address"
android:hint="Publisher API Key"
android:inputType="text"
/>

Expand Down

0 comments on commit a5d4b4b

Please sign in to comment.