-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
892 additions
and
983 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 SimPay.pl | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
group 'pl.simpay' | ||
version '1.0' | ||
sourceCompatibility = '17' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.22' | ||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' | ||
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.32' | ||
implementation group: 'com.google.guava', name: 'guava', version: '31.0.1-jre' | ||
implementation group: 'com.squareup.moshi', name: 'moshi', version: '1.12.0' | ||
implementation group: 'dev.zacsweers.moshix', name: 'moshi-records-reflect', version: '0.14.1' | ||
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3' | ||
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.2' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.2' | ||
annotationProcessor group: 'org.projectlombok', name: 'org.projectlombok', version: '1.18.22' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,140 +1,5 @@ | ||
# SimPay-API-java | ||
Oficjalny klient do wszystkich API SimPay | ||
|
||
## SMS | ||
### Weryfikacja kodu | ||
```java | ||
Sms sms = new Sms(); | ||
Sms sms = new Sms("key","secret"); | ||
|
||
CodeVerifyRequest request = new CodeVerifyRequest(); | ||
request.setCode("code"); | ||
request.setKey("key"); // can be omitted by passing value in constructor | ||
request.setSecret("secret"); // can be omitted by passing value in constructor | ||
request.setNumber("number"); | ||
request.setService_id("service_id"); | ||
|
||
APIResponse<CodeVerifyResponse> response = sms.verifyCode(request); | ||
List<String> error = response.getError(); // List of errors, if request was successful list will be empty | ||
CodeVerifyResponse codeVerifyResponse = response.getRespond(); | ||
int from = codeVerifyResponse.getFrom(); // Sender number | ||
int number = codeVerifyResponse.getNumber(); // Number where sms were sent | ||
String status = codeVerifyResponse.getStatus(); // Status received from api | ||
int test = codeVerifyResponse.getTest(); // 1 if sms was test else 0 | ||
double value = codeVerifyResponse.getValue(); // Code Value | ||
``` | ||
|
||
### Pobieranie listy usług | ||
```java | ||
Sms sms = new Sms(); | ||
Sms sms = new Sms("key","secret"); | ||
|
||
|
||
ServiceListRequest request = new ServiceListRequest(); | ||
request.setKey("key"); | ||
request.setSecret("secret"); | ||
APIResponse<ServicesResponse> response = sms.getServiceList(request); | ||
List<String> error = response.getError(); // List of errors, if request was successful list will be empty | ||
ServicesResponse serviceList = response.getRespond(); | ||
String status = serviceList.getStatus(); // Status received from api | ||
List<Service> services = serviceList.getServices(); // List of services | ||
``` | ||
|
||
## SMS XML | ||
```java | ||
SmsXml smsXml = new SmsXml("apikey"); | ||
String code = smsXml.generateCode(); // Generate code | ||
double number = smsXml.getSmsValue("number"); // retrieve information's about sms | ||
String sms = smsXml.generateXml("sms"); // Generate xml from sms message | ||
boolean ip = smsXml.getServersIp("ip"); // Check if passed ip is valid ip of simpay servers | ||
``` | ||
|
||
## Direct Billing | ||
### Generowanie transakcji | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
DirectBilling directBilling = new DirectBilling("apiKey", "secret", false, 1); | ||
|
||
DbGenerateRequest request = new DbGenerateRequest(); | ||
request.setAmount("amount"); | ||
request.setAmount_gross("amount_gross"); | ||
request.setAmount_required("amount_required"); | ||
request.setComplete("complete"); | ||
request.setFailure("failure"); | ||
request.setProvider(Operator.ORANGE); // orange, play, t-mobile, plus-gsm | ||
request.setControl("control"); | ||
request.setServiceId(1); | ||
|
||
DbGenerateResponse dbGenerateResponse = directBilling.generateTransaction(request); | ||
dbGenerateResponse.getLink(); // Link | ||
dbGenerateResponse.getName(); // Transaction Name | ||
dbGenerateResponse.getStatus(); // Status received from api | ||
``` | ||
|
||
### Pobieranie danych o transakcji | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
DirectBilling directBilling = new DirectBilling("apiKey", "secret", false, 1); | ||
|
||
DbTransactionRequest request = new DbTransactionRequest(); | ||
request.setId(1); | ||
request.setKey("key"); // can be omitted by passing value in constructor | ||
request.setSecret("secret"); // can be omitted by passing value in constructor | ||
|
||
APIResponse<DbTransaction> response = directBilling.getTransaction(request); | ||
List<String> error = response.getError(); // List of errors, if request was successful list will be empty | ||
DbTransaction respond = response.getRespond(); | ||
``` | ||
|
||
### Pobieranie listy usług DCB | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
DirectBilling directBilling = new DirectBilling("apiKey", "secret", false, 1); | ||
|
||
DbServicesListRequest request = new DbServicesListRequest(); | ||
request.setApi("key"); // can be omitted by passing value in constructor | ||
request.setSecret("secret"); // can be omitted by passing value in constructor | ||
|
||
APIResponse<DbServicesListResponse> response = directBilling.getServices(request); | ||
List<String> error = response.getError(); // List of errors, if request was successful list will be empty | ||
DbTransaction respond = response.getRespond(); | ||
``` | ||
|
||
### Pobieranie maksymalnych kwot transakcji | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
DirectBilling directBilling = new DirectBilling("apiKey", "secret", false, 1); | ||
|
||
DbTransactionLimitsRequest request = new DbTransactionLimitsRequest(); | ||
request.setService_id(1); | ||
request.setApi("key"); // can be omitted by passing value in constructor | ||
request.setSecret("secret"); // can be omitted by passing value in constructor | ||
|
||
APIResponse<List<DbTransactionLimit>> response = directBilling.getTransactionLimits(request); | ||
``` | ||
|
||
### Pobieranie prowizji dla usługi | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
DirectBilling directBilling = new DirectBilling("apiKey", "secret", false, 1); | ||
|
||
DbServiceCommissionRequest request = new DbServiceCommissionRequest(); | ||
request.setService_id(1); | ||
request.setApi("key"); // can be omitted by passing value in constructor | ||
request.setSecret("secret"); // can be omitted by passing value in constructor | ||
|
||
List<DbCommission> response = directBilling.getServiceCommission(request); | ||
``` | ||
|
||
### Pobieranie adresów IP serwerów SimPay | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
|
||
List<String> response = directBilling.getServersIp(); | ||
``` | ||
|
||
### Obliczanie podpisu sign | ||
```java | ||
DirectBilling directBilling = new DirectBilling(); | ||
|
||
String sign = directBilling.sign(int id, String status, String valuenet, String valuepartner, String control); | ||
``` | ||
# Dokumentacja | ||
[Kliknij tutaj](hhttps://docs.simpay.pl/java/?java#wstep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'simpay-java-api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package pl.simpay.api.adapter; | ||
|
||
public interface Adapter<T> { | ||
|
||
T fromJson(String json); | ||
|
||
String toJson(T type); | ||
} |
Oops, something went wrong.