Skip to content

Commit 68f9719

Browse files
committed
add doc comments
1 parent c9b1c83 commit 68f9719

34 files changed

+641
-19
lines changed

documentation/.DS_Store

6 KB
Binary file not shown.

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,6 @@
114114
<maven.compiler.target>19</maven.compiler.target>
115115
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
116116
</properties>
117+
117118

118119
</project>

src/main/java/com/flutterwave/client/Utility.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import static com.flutterwave.bean.Verb.*;
1010

1111
public class Utility {
12-
1312
public static String post(String url, String request, ChargeTypes chargeType, List<NameValuePair> nameValuePairs){
1413
return Optional.ofNullable(Client.runTransaction(
1514
url,

src/main/java/com/flutterwave/metric/Metric.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@
77
import static com.flutterwave.bean.ChargeTypes.DEFAULT;
88
import static com.flutterwave.bean.Verb.POST;
99

10+
/**
11+
* Handles sending metric data to assist F4B make the sdk and API better where needed.
12+
* @author cleopatradouglas
13+
*/
1014
public class Metric {
1115

16+
/**
17+
* sends the metric data needed
18+
* @param type of charge
19+
*/
1220
public static void send(ChargeTypes type) {
1321
//validate public key is set in environment
1422
if (System.getProperty("publicKey") == null) {

src/main/java/com/flutterwave/services/ACH.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88
import static com.flutterwave.bean.ChargeTypes.ACH_PAYMENT;
99

1010
/**
11-
* Handles ACH charge payments
11+
* @author Cleopatra Douglas
12+
* This payment method allows you to collect USD and ZAR payments via ACH
1213
*/
1314
public class ACH extends Charge{
15+
16+
/**
17+
* Handles ACH requests
18+
* @param achRequest bean
19+
* @return Response
20+
*/
1421
public Response runTransaction(ACHRequest achRequest){
1522
return runTransaction(achRequest.toString(), ACH_PAYMENT, false, Optional.empty());
1623
}

src/main/java/com/flutterwave/services/ApplePay.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77

88
import static com.flutterwave.bean.ChargeTypes.APPLEPAY;
99

10+
/**
11+
* @author Cleopatra Douglas
12+
* This payment method allows you to accept payments from your customers via Apple Pay.
13+
*/
1014
public class ApplePay extends Charge{
1115

16+
/**
17+
* Handles ApplePay requests
18+
* @param applePayRequest bean
19+
* @return Response
20+
*/
1221
public Response runTransaction(ApplePayRequest applePayRequest){
1322
return runTransaction(applePayRequest.toString(), APPLEPAY, false, Optional.empty());
1423
}

src/main/java/com/flutterwave/services/BanKTransfer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77

88
import static com.flutterwave.bean.ChargeTypes.BANK_TRANSFER;
99

10+
/**
11+
* @author cleopatradouglas
12+
*/
1013
public class BanKTransfer extends Charge{
14+
/**
15+
* Handles bank transfer requests
16+
* @param banKTransferRequest bean
17+
* @return Response
18+
*/
1119
public Response runTransaction(BanKTransferRequest banKTransferRequest){
1220
return runTransaction(banKTransferRequest.toString(), BANK_TRANSFER, false, Optional.empty());
1321
}

src/main/java/com/flutterwave/services/BankAccount.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@
88
import static com.flutterwave.bean.ChargeTypes.DEBIT_NG_ACCOUNT;
99
import static com.flutterwave.bean.ChargeTypes.DEBIT_UK_ACCOUNT;
1010

11+
/**
12+
* This payment method helps you charge Nigerian and UK bank accounts using Flutterwave.
13+
* @author Cleopatra Douglas
14+
*/
1115
public class BankAccount extends Charge{
1216

17+
/**
18+
* Handles bank account requests
19+
* @param bankAccountRequest bean
20+
* @return Response
21+
*/
1322
public Response runTransaction(BankAccountRequest bankAccountRequest){
1423
return runTransaction(bankAccountRequest.toString(),
1524
bankAccountRequest.getCurrency().equals("NGN")? DEBIT_NG_ACCOUNT: DEBIT_UK_ACCOUNT,

src/main/java/com/flutterwave/services/Banks.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@
1212
* @author Cleopatra Douglas
1313
*/
1414
public class Banks {
15+
/**
16+
* Retrieves bank list
17+
* @param country to retrieve
18+
* @return ListResponse
19+
*/
1520
public ListResponse getBanks(String country){
1621
return Optional.of(get(getProperty("BANKS_BASE")+country, GET_BANKS, null))
1722
.map(ListResponse::toListResponse).orElseThrow();
1823
}
1924

25+
/**
26+
* Retrieves bank branches
27+
* @param id for bank
28+
* @return ListResponse
29+
*/
2030
public ListResponse getBankBranches(int id){
2131
return Optional.of(get(getProperty("BANKS_BASE")+id+"/branches", GET_BANKS, null))
2232
.map(ListResponse::toListResponse).orElseThrow();

src/main/java/com/flutterwave/services/Beneficiaries.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,65 @@
33
import com.flutterwave.bean.BeneficiaryRequest;
44
import com.flutterwave.bean.ListResponse;
55
import com.flutterwave.bean.Response;
6+
import org.apache.http.NameValuePair;
7+
import org.apache.http.message.BasicNameValuePair;
68

9+
import java.util.ArrayList;
10+
import java.util.List;
711
import java.util.Optional;
812

913
import static com.flutterwave.bean.ChargeTypes.BENEFICIARY;
1014
import static com.flutterwave.client.Utility.*;
1115
import static com.flutterwave.utility.Properties.getProperty;
1216

1317
/**
18+
* Manage Transfer Beneficiaries.
1419
* @author Cleopatra Douglas
1520
*/
1621
public class Beneficiaries {
1722

1823
private String ERROR = "Error processing request, please check logs";
1924

25+
/**
26+
* Create beneficiaries for Transfers.
27+
* @param beneficiaryRequest bean
28+
* @return Response
29+
*/
2030
public Response runCreateBeneficiary(BeneficiaryRequest beneficiaryRequest){
2131
return Optional.of(post(getProperty("BENEFICIARY_BASE"), beneficiaryRequest.toString(),
2232
BENEFICIARY, null))
2333
.map(Response::toResponse).orElseThrow(() -> new RuntimeException(ERROR));
2434
}
2535

26-
public ListResponse runGetAllBeneficiaries(Optional<Integer> id){
27-
return Optional.of(get(getProperty("BENEFICIARY_BASE"), BENEFICIARY, null))
36+
/**
37+
* Get all beneficiaries saves for Transfers.
38+
* @param page This is the page number to retrieve e.g. setting 1 retrieves the first page
39+
* @return ListResponse
40+
*/
41+
public ListResponse runGetAllBeneficiaries(Optional<Integer> page){
42+
List<NameValuePair> nameValuePairs = new ArrayList<>();
43+
page.ifPresent(s -> nameValuePairs.add(new BasicNameValuePair("page", s.toString())));
44+
return Optional.of(get(getProperty("BENEFICIARY_BASE"), BENEFICIARY, nameValuePairs))
2845
.map(ListResponse::toListResponse).orElseThrow(() -> new RuntimeException(ERROR));
2946
}
3047

48+
/**
49+
* Get all details for a particular beneficiary.
50+
* @param id int This is the unique identifier for the beneficiary you intend to fetch.
51+
* It is returned in the call to create a beneficiary as data.id
52+
* @return Response
53+
*/
3154
public Response runGetBeneficiary(int id){
3255
return Optional.of(get(getProperty("BENEFICIARY_BASE") +"/" + id, BENEFICIARY, null))
3356
.map(Response::toResponse).orElseThrow(() -> new RuntimeException(ERROR));
3457
}
3558

59+
/**
60+
* Remove a beneficiary from your beneficiary list.
61+
* @param id int This is the unique identifier for the beneficiary you intend to fetch.
62+
* It is returned in the call to create a beneficiary as data.id
63+
* @return Response
64+
*/
3665
public Response runDeleteBeneficiary(int id){
3766
return Optional.of(delete(getProperty("BENEFICIARY_BASE") +"/" + id, BENEFICIARY, null))
3867
.map(Response::toResponse).orElseThrow(() -> new RuntimeException(ERROR));

0 commit comments

Comments
 (0)