@@ -11,15 +11,8 @@ The Client comes in 3 flavors:
11113 . Reactive - Responses in Mono and Flux
1212
1313## Setup
14- 1 . Add the dependency to your project
15- ``` xml
16- <dependency >
17- <groupId >com.chrisworks.paystackclient</groupId >
18- <artifactId >paystack-clients</artifactId >
19- <version >${VERSION}</version >
20- </dependency >
21- ```
22- 2 . Add GitHub Maven Package Repository to your POM
14+
15+ 1 . Add GitHub Maven Package Repository to your POM
2316``` xml
2417<repositories >
2518 <repository >
@@ -29,8 +22,66 @@ The Client comes in 3 flavors:
2922</repositories >
3023```
3124
32- ## usage
25+ ### 1. When Using SpringBoot
26+ - Add the dependency to your spring boot project:
27+ ``` xml
28+ <dependency >
29+ <groupId >com.chrisworks.paystackclient</groupId >
30+ <artifactId >paystack-clients-spring-boot-starter</artifactId >
31+ <version >${VERSION}</version >
32+ </dependency >
33+ ```
34+
35+ - Add the following property to you ` applications.properties ` file
36+ ``` properties
37+ paystack-client.secret-key =INPUT_YOUR_PAYSTACK_SECRET_KEY_HERE
38+ paystack-client.definition-type =(REACTIVE|NON_REACTIVE) # This property is optional, it defaults to 'NON_REACTIVE' if not specified
39+ ```
40+
41+ - Usage
42+ ``` java
43+ // Imports here
44+
45+ import com.chrisworks.paystackclient.definitions.simple.PlanClient ; // When using the non-reactive type
46+ import com.chrisworks.paystackclient.definitions.reactive.PlanClient ; // When using the reactive type
47+
48+ @Service
49+ class Example {
50+
51+ private final PlanClient planClient;
52+
53+ public Example (PlanClient planClient ) {
54+ this . planClient = planClient;
55+ }
56+
57+ public void yourMethodThatDoesAndReturnsSomething () {
58+
59+ // A.
60+ PlanResponse . Single nonReactiveRes = planClient
61+ .createPlan(new CreatePlanRequest (" Sample Plan 9" , Interval . DAILY ,
62+ Amount . actualValue(BigDecimal . valueOf(10_000 )). ofCurrency(Currency . NGN )));
63+
64+ // Or B.
65+ Mono<PlanResponse . Single > reactiveRes = planClient
66+ .createPlan(new CreatePlanRequest (" Sample Plan 9" , Interval . DAILY ,
67+ Amount . actualValue(BigDecimal . valueOf(10_000 )). ofCurrency(Currency . NGN )));
68+ }
69+ }
70+ ```
71+ NB: During injection of the client, you can only inject either the REACTIVE type or the NON_REACTIVE type and never both.
72+ The implementation here is powered by the popular Spring WebClient which is part of the Spring Framework Project Reactor.
73+
74+ ### 2. Java/Maven Project without SpringBoot
75+ - Add the dependency to your project
76+ ``` xml
77+ <dependency >
78+ <groupId >com.chrisworks.paystackclient</groupId >
79+ <artifactId >paystack-clients</artifactId >
80+ <version >${VERSION}</version >
81+ </dependency >
82+ ```
3383
84+ - usage
3485``` java
3586// Imports here
3687
@@ -82,4 +133,5 @@ class Example {
82133 .executeAsync();
83134 }
84135}
85- ```
136+ ```
137+ NB: The implementation here is powered by the popular OkHttp library.
0 commit comments