1+ package com .flutterwave .services ;
2+
3+ import com .flutterwave .bean .*;
4+ import com .flutterwave .bean .MobileMoneyRequest ;
5+ import com .flutterwave .utility .Environment ;
6+ import org .junit .jupiter .api .Assertions ;
7+ import org .junit .jupiter .api .BeforeEach ;
8+ import org .junit .jupiter .api .Test ;
9+
10+ import java .math .BigDecimal ;
11+ import java .util .Optional ;
12+
13+ /**
14+ * @author Cleopatra Douglas
15+ */
16+ class MobileMoneyRequestTest {
17+ MpesaRequest mpesaRequest ;
18+ GhanaMobileMoneyRequestRequest ghanaMobileMoneyRequest ;
19+ UgandaMobileMoneyRequestRequest ugandaMobileMoneyRequest ;
20+ FrancophoneMobileMoneyRequestRequest francophoneMobileMoneyRequest ;
21+ RwandaMobileMoneyRequestRequest rwandaMobileMoneyRequest ;
22+ ZambiaMobileMoneyRequestRequest zambiaMobileMoneyRequest ;
23+
24+ @ BeforeEach
25+ void setUp () {
26+
27+
28+ mpesaRequest = new MpesaRequest ("MC-15852113s09v5050e8" ,
29+ new BigDecimal ("10" ),
30+ "KES" ,
31+ "stefan.wexler@hotmail.eu" ,
32+ "25454709929220" ,
33+ "Yolande Aglaé Colbert" );
34+
35+ ghanaMobileMoneyRequest = new GhanaMobileMoneyRequestRequest ("MC-158523s09v5050e8" ,
36+ new BigDecimal ("150" ),
37+ "GHS" ,
38+ "143256743" ,
39+ "MTN" ,
40+ "stefan.wexler@hotmail.eu" ,
41+ "054709929220" ,
42+ "Yolande Aglaé Colbert" ,
43+ "154.123.220.1" ,
44+ "62wd23423rq324323qew1" ,
45+ Optional .empty ());
46+
47+ ugandaMobileMoneyRequest = new UgandaMobileMoneyRequestRequest ("MC-158523s09v5050e8" ,
48+ new BigDecimal ("150" ),
49+ "UGX" ,
50+ "143256743" ,
51+ "MTN" ,
52+ "stefan.wexler@hotmail.eu" ,
53+ "054709929220" ,
54+ "Yolande Aglaé Colbert" ,
55+ "154.123.220.1" ,
56+ "62wd23423rq324323qew1" ,
57+ Optional .empty ());
58+
59+ francophoneMobileMoneyRequest = new FrancophoneMobileMoneyRequestRequest ("MC-15852113s09v5050e8" ,
60+ new BigDecimal ("10" ),
61+ "CM" ,
62+ "XAF" ,
63+ "stefan.wexler@hotmail.eu" ,
64+ "25454709929220" ,
65+ "Yolande Aglaé Colbert" );
66+
67+ rwandaMobileMoneyRequest = new RwandaMobileMoneyRequestRequest ("MC-15852113s09v5050e8" ,
68+ new BigDecimal ("10" ),
69+ "KES" ,
70+ "stefan.wexler@hotmail.eu" ,
71+ "25454709929220" ,
72+ "Yolande Aglaé Colbert" );
73+
74+ zambiaMobileMoneyRequest = new ZambiaMobileMoneyRequestRequest ("MC-158523s09v5050e8" ,
75+ new BigDecimal ("150" ),
76+ "UGX" ,
77+ "143256743" ,
78+ "MTN" ,
79+ "stefan.wexler@hotmail.eu" ,
80+ "054709929220" ,
81+ "Yolande Aglaé Colbert" ,
82+ "154.123.220.1" ,
83+ "62wd23423rq324323qew1" ,
84+ Optional .empty ());
85+
86+
87+ }
88+
89+ @ Test
90+ void runMpesaTransaction () {
91+ Assertions .assertEquals ("success" , new MobileMoney ().runMpesaTransaction (mpesaRequest ).getStatus ());
92+ }
93+
94+ @ Test
95+ void runGhanaMobileMoneyTransaction () {
96+ Assertions .assertEquals ("success" , new MobileMoney ().runGhanaMobileMoneyTransaction (ghanaMobileMoneyRequest ).getStatus ());
97+ }
98+
99+ @ Test
100+ void runUgandaMobileMoneyTransaction () {
101+ Assertions .assertEquals ("success" , new MobileMoney ().runUgandaMobileMoneyTransaction (ugandaMobileMoneyRequest ).getStatus ());
102+ }
103+
104+ @ Test
105+ void runFrancophoneMobileMoneyTransaction () {
106+ Assertions .assertEquals ("success" , new MobileMoney ().runFrancophoneMobileMoneyTransaction (francophoneMobileMoneyRequest ).getStatus ());
107+ }
108+
109+ @ Test
110+ void runRwandaMobileMoneyTransaction () {
111+ Assertions .assertEquals ("success" , new MobileMoney ().runRwandaMobileMoneyTransaction (rwandaMobileMoneyRequest ).getStatus ());
112+ }
113+
114+ @ Test
115+ void runZambiaMobileMoneyTransaction () {
116+ Assertions .assertEquals ("success" , new MobileMoney ().runZambiaMobileMoneyTransaction (zambiaMobileMoneyRequest ).getStatus ());
117+ }
118+ }
0 commit comments