Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobile committed May 29, 2018
1 parent f258c42 commit 7ce4828
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 87 deletions.
61 changes: 18 additions & 43 deletions README.md
Expand Up @@ -45,12 +45,6 @@ Add the following to `AndroidManifest.xml` file:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
```

In case the SMS code paste function is used, add also:

```xml
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
```

Next, in `application` section, add `TransferActivity`:

```xml
Expand All @@ -59,14 +53,6 @@ Next, in `application` section, add `TransferActivity`:
android:theme="@style/Theme.AppCompat.Light.DarkActionBar”/>
```

and `PaymentSettingsActivity`:

```xml
<activity android:name="pl.przelewy24.p24lib.settings.PaymentSettingsActivity"
android:configChanges="orientation|keyboard|keyboardHidden"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
```

__All Activities in the library draw on the AppCompatActivity, which is why „Theme.AppCompat.*” group styles as well as derivative styles should be used__

In the case of default Activity settings, the WebView will get reloaded during the rotation of the library display screen, which may cause a return from the bank’s website to the list of payment forms and render further transaction processing impossible. In order to prevent the reloading of the library window, the following parameter must be set:
Expand All @@ -88,9 +74,6 @@ Below is an example of an `AndroidManifext.xml` file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!--optional-->
<uses-permission android:name="android.permission.RECEIVE_SMS"/>

<application >

<!--other activities-->
Expand All @@ -99,18 +82,27 @@ Below is an example of an `AndroidManifext.xml` file:
android:configChanges="keyboardHidden|orientation|keyboard|screenSize"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>

<activity android:name="pl.przelewy24.p24lib.settings.PaymentSettingsActivity"
android:configChanges="keyboardHidden|orientation|keyboard|screenSize"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>

</application>

</manifest>


```

## 2. trnDirect transaction call
## 2. SSL Pinning

The library has a Pinning SSL mechanism that can be activated globally for webview calls.
If you want use this feature, please make sure configuration is setup before any library methods calls. Example:

```java
SdkConfig.setCertificatePinningEnabled(true);
```

**UWAGA!!**

> When activating SSL Pinning, keep in mind that the certificates embedded in the library have their validity time. Before time of their expiry, Przelewy24 will be sending out appropriate information and updating.
## 3. trnDirect transaction call

In order to call the transaction, the following parameters must be set using the builder class and providing the Merchant ID and the CRC key:

Expand Down Expand Up @@ -155,22 +147,6 @@ Optionally, the transaction call may be set at the Sandbox server:
params.setSandbox(true);
```

Yet another option is to add library settings for bank websites (mobile styles at the banks’ websites – turned on by default, should the library remember logins and passwords, should the library automatically paste sms passwords to the transaction confirmation form at the bank page):

```java
SettingsParams settingsParams = new SettingsParams();
settingsParams.setEnableBanksRwd(true);
settingsParams.setSaveBankCredentials(true);
settingsParams.setReadSmsPasswords(true);
params.setSettingsParams(settingsParams);
```

In case `setReadSmsPasswords` is set as `true`, the following should be added to the manifest:

```xml
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
```

With the configurational objects complete, one may proceed to call Activity for a transaction. The initiation looks as follows:

```java
Expand Down Expand Up @@ -203,7 +179,7 @@ protected void onActivityResult(int reqCode, int resCode, Intent data) {
`TransferActivity` returns only information regarding the completion of the transaction. It need not mean that the transaction has been verified by the partner’s server. That is why, each time the `isSuccess()` status is obtained, the application should call its own backend to check the transaction status.


## 3. trnRequest transaction call
## 4. trnRequest transaction call

During the registration with the "trnRegister" method, additional parameters should be provided:
- `p24_mobile_lib=1`
Expand All @@ -223,8 +199,7 @@ The transaction parameters must be set using the token of a transaction register
```java
TrnRequestParams params = TrnRequestParams
.create("XXXXXXXXXX-XXXXXX-XXXXXX-XXXXXXXXXX")
.setSandbox(true)
.setSettingsParams(settingsParams);
.setSandbox(true);
```

Next, create `Intent` to call transaction `Activity` and run it:
Expand All @@ -236,7 +211,7 @@ activity.startActivityForResult(intent, TRANSACTION_REQUEST_CODE);

The transaction result should be served in the same way as in the case of "trnDirect".

## 4. Express transaction call
## 5. Express transaction call

The transaction parameters must be set using the url obtained during the registration of the transaction with Express. The transaction must be registered as mobile.

Expand All @@ -253,7 +228,7 @@ activity.startActivityForResult(intent, TRANSACTION_REQUEST_CODE);

The transaction result should be served in the same way as in the case of "trnDirect".

## 5. Passage 2.0 transaction call
## 6. Passage 2.0 transaction call

The transaction parameters must be set in the same way as for "trnDirect". A properly prepared cart object should be added:

Expand Down
62 changes: 18 additions & 44 deletions README_pl.md
Expand Up @@ -45,12 +45,6 @@ Do pliku `AndroidManifest.xml`, w węźle `manifest` dodać:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
```

W sytuacji kiedy wykorzystujemy funkcję wklejania kodu SMS należy również dodać:

```xml
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
```

Następnie w węźle `application` dodać aktywność `TransferActivity`:

```xml
Expand All @@ -59,14 +53,6 @@ Następnie w węźle `application` dodać aktywność `TransferActivity`:
android:theme="@style/Theme.AppCompat.Light.DarkActionBar”/>
```

Oraz aktywność `PaymentSettingsActivity`:

```xml
<activity android:name="pl.przelewy24.p24lib.settings.PaymentSettingsActivity"
android:configChanges="orientation|keyboard|keyboardHidden"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
```

__Wszystkie Activity w bibliotece dziedziczą po AppCompatActivity, dlatego należy do nich stosować style z grupy „Theme.AppCompat.*” i pochodne__

Przy domyślnych ustawieniach Activity podczas obrotu ekranu biblioteki nastąpi przeładowanie WebView, co może powodować powrót ze strony banku do listy form płatności i uniemożliwić sfinalizowanie transakcji. Aby okno biblioteki nie przeładowywało się konieczne jest ustawienie parametru:
Expand All @@ -88,9 +74,6 @@ Przykładowo plik `AndroidManifext.xml` powinien wyglądać tak:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!--optional-->
<uses-permission android:name="android.permission.RECEIVE_SMS"/>

<application >

<!--other activities-->
Expand All @@ -99,18 +82,26 @@ Przykładowo plik `AndroidManifext.xml` powinien wyglądać tak:
android:configChanges="keyboardHidden|orientation|keyboard|screenSize"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>

<activity android:name="pl.przelewy24.p24lib.settings.PaymentSettingsActivity"
android:configChanges="keyboardHidden|orientation|keyboard|screenSize"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>

</application>

</manifest>

```

## 2. SSL Pinning

Biblioteka posiada mechanizm SSL Pinningu, który można aktywować globalnie dla wywołań webview.
Aby funkcja działała należy upewnić się, że przed wywołaniem jakiejkolwiek metody biblioteki jest ona odpowiedno zkonfigurowana. Przykład:

```java
SdkConfig.setCertificatePinningEnabled(true);
```

## 2. Wywołanie transakcji trnDirect
**UWAGA!!**

> Aktywując SSL Pinning należy mieć na uwadze, że zaszyte w bibliotece certyfikaty mają swój czas ważności. Gdy będzie się zbliżał czas ich wygaśnięcia, Przelewy24 poinformują o tym oraz udostępnią odpowiednią aktualizację.
## 3. Wywołanie transakcji trnDirect

W tym celu należy ustawić parametry transakcji korzystając z klasy buildera, podając Merchant Id i klucz do CRC:

Expand Down Expand Up @@ -155,22 +146,6 @@ Opcjonalne można ustawić wywołanie transakcji na serwer Sandbox:
params.setSandbox(true);
```

Również opcjonalne można dodać ustawienia zachowania biblioteki dla stron banków (style mobile na stronach banków – domyślnie włączone, czy biblioteka ma zapamiętywać logi i hasło do banków, czy biblioteka ma automatycznie przeklejać hasła sms do formularza potwierdzenia transakcji w banku):

```java
SettingsParams settingsParams = new SettingsParams();
settingsParams.setEnableBanksRwd(true);
settingsParams.setSaveBankCredentials(true);
settingsParams.setReadSmsPasswords(true);
params.setSettingsParams(settingsParams);
```

W przypadku ustawienia `setReadSmsPasswords` na `true` należy również dodać do manifestu:

```xml
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
```

Mając gotowe obiekty konfiguracyjne możemy przystąpić do wywołania `Activity` dla transakcji. Uruchomienie wygląda następująco:

```java
Expand Down Expand Up @@ -202,7 +177,7 @@ protected void onActivityResult(int reqCode, int resCode, Intent data) {
```
`TransferActivity` zwraca tylko informację o tym, że transakcja się zakończyła. Nie zawsze oznacza to czy transakcja jest zweryfikowana przez serwer partnera, dlatego za każdym razem po uzyskaniu statusu `isSuccess()` aplikacja powinna odpytać własny backend o status transakcji.

## 3. Wywołanie transakcji trnRequest
## 4. Wywołanie transakcji trnRequest

Podczas rejestracji transakcji metodą "trnRegister" należy podać dodatkowe parametry:
- `p24_mobile_lib=1`
Expand All @@ -222,13 +197,12 @@ bibliotece przy wejściu bezpośrednio z parametrami)
dana metoda płatności, należy ustawić ją w tym parametrze przy rejestracji
- `p24_url_status` - adres, który zostanie wykorzystany do weryfikacji transakcji przez serwer partnera po zakończeniu procesu płatności w bibliotece mobilnej

Należy ustawić parametry transakcji podając token zarejestrowanej wcześniej transakcji, opcjonalnie można ustawić serwer sandbox oraz konfigurację banków:
Należy ustawić parametry transakcji podając token zarejestrowanej wcześniej transakcji, opcjonalnie można ustawić serwer sandbox:

```java
TrnRequestParams params = TrnRequestParams
.create("XXXXXXXXXX-XXXXXX-XXXXXX-XXXXXXXXXX")
.setSandbox(true)
.setSettingsParams(settingsParams);
.setSandbox(true);
```

Następnie należy stworzyć `Intent` do wywołania `Activity` transakcji i uruchomić go:
Expand All @@ -240,7 +214,7 @@ activity.startActivityForResult(intent, TRANSACTION_REQUEST_CODE);

Rezultat transakcji należy obsłużyć identycznie jak dla wywołania "trnDirect".

## 4. Wywołanie transakcji Ekspres
## 5. Wywołanie transakcji Ekspres

Należy ustawić parametry transakcji podając url uzyskany podczas rejestracji transakcji w systemie Ekspres. Transakcja musi być zarejestrowana jako mobilna.

Expand All @@ -257,7 +231,7 @@ activity.startActivityForResult(intent, TRANSACTION_REQUEST_CODE);

Rezultat transakcji należy obsłużyć identycznie jak dla wywołania "trnDirect".

## 5. Wywołanie transakcji z Pasażem 2.0
## 6. Wywołanie transakcji z Pasażem 2.0

Należy ustawić parametry transakcji identycznie jak dla wywołania "trnDirect", dodając odpowiednio przygotowany obiekt koszyka:

Expand Down

0 comments on commit 7ce4828

Please sign in to comment.