9
9
import org .junit .jupiter .api .Test ;
10
10
11
11
import java .math .BigDecimal ;
12
+ import java .util .Date ;
12
13
import java .util .Optional ;
13
14
14
15
import static com .flutterwave .bean .AuthorizationModes .PIN ;
@@ -25,22 +26,24 @@ void setUp() {
25
26
Environment .setPublicKey (getProperty ("PUB_KEY" ));
26
27
Environment .setEncryptionKey (getProperty ("ENCR_KEY" ));
27
28
28
- cardRequest = new CardRequest ("5438898014560229 " ,
29
- "564 " ,
30
- "09 " ,
31
- "32 " ,
32
- "NGN " ,
33
- new BigDecimal ("100.88 " ),
34
- "Yolande Aglaé Colbert " ,
35
- "tafchaty @gmail.com " ,
36
- "javasdk-test" ,
29
+ cardRequest = new CardRequest ("4187427415564246 " ,
30
+ "NG " ,
31
+ "812 " ,
32
+ "10 " ,
33
+ "33 " ,
34
+ "NGN" , new BigDecimal ("10000 " ),
35
+ "Tafa Chati " ,
36
+ "test @gmail.io " ,
37
+ "javasdk-test-" + new Date () ,
37
38
"https://www,flutterwave.ng" ,
38
39
null );
39
40
}
40
41
41
42
@ Test
42
43
void runTransaction () {
43
44
Assertions .assertEquals ("success" , new CardCharge ().runTransaction (cardRequest ).getStatus ());
45
+ //System.out.println(new CardCharge().runTransaction(cardRequest).getData().getId());
46
+ //verifyTransaction(new CardCharge().runTransaction(cardRequest).getData().getId());
44
47
}
45
48
46
49
@ Test
@@ -57,6 +60,8 @@ void authorizeTransactionPin() {
57
60
case REDIRECT -> {
58
61
//redirect user
59
62
}
63
+ case OTP -> cardRequest .setAuthorization (new Authorization ().pinAuthorization ("3310" ));
64
+ default -> throw new IllegalArgumentException ("Unexpected value: " + response .getMeta ().getAuthorization ().getMode ());
60
65
}
61
66
Response authorizeResponse = new CardCharge ().runTransaction (cardRequest );
62
67
System .out .println ("authorizeResponse response ==>" + authorizeResponse );
0 commit comments