1
1
package ca .bc .gov .open .bambora .payment .starter .managment ;
2
2
3
- import ca .bc .gov .open .bambora .payment .starter .BamboraConstants ;
4
- import ca .bc .gov .open .bambora .payment .starter .BamboraException ;
5
- import ca .bc .gov .open .bambora .payment .starter .BamboraProperties ;
6
- import ca .bc .gov .open .bambora .payment .starter .managment .models .RecurringPaymentDetails ;
7
- import com .sun .jndi .toolkit .url .Uri ;
8
- import org .apache .commons .codec .digest .DigestUtils ;
9
-
10
3
import java .net .MalformedURLException ;
4
+ import java .net .URI ;
5
+ import java .net .URISyntaxException ;
11
6
import java .text .MessageFormat ;
12
7
import java .text .SimpleDateFormat ;
13
8
import java .util .Calendar ;
14
9
import java .util .Date ;
15
10
11
+ import org .apache .commons .codec .digest .DigestUtils ;
12
+
13
+ import ca .bc .gov .open .bambora .payment .starter .BamboraConstants ;
14
+ import ca .bc .gov .open .bambora .payment .starter .BamboraException ;
15
+ import ca .bc .gov .open .bambora .payment .starter .BamboraProperties ;
16
+ import ca .bc .gov .open .bambora .payment .starter .managment .models .RecurringPaymentDetails ;
17
+
16
18
public class BamboraCardServiceImpl implements BamboraCardService {
17
19
18
20
private final BamboraProperties bamboraProperties ;
@@ -22,16 +24,18 @@ public BamboraCardServiceImpl(BamboraProperties bamboraProperties) {
22
24
}
23
25
24
26
@ Override
25
- public Uri setupRecurringPayment (RecurringPaymentDetails recurringPaymentDetails ) {
27
+ public URI setupRecurringPayment (RecurringPaymentDetails recurringPaymentDetails ) {
26
28
try {
27
29
return buildRecurringPaymentUrl (recurringPaymentDetails );
28
30
} catch (MalformedURLException e ) {
29
31
throw new BamboraException ("Url construction failed" , e .getCause ());
30
- }
32
+ } catch (URISyntaxException e ) {
33
+ throw new BamboraException ("Url construction failed" , e .getCause ());
34
+ }
31
35
}
32
36
33
37
34
- private Uri buildRecurringPaymentUrl (RecurringPaymentDetails recurringPaymentDetails ) throws MalformedURLException {
38
+ private URI buildRecurringPaymentUrl (RecurringPaymentDetails recurringPaymentDetails ) throws MalformedURLException , URISyntaxException {
35
39
36
40
String operationType = (recurringPaymentDetails .getEndUserId () != null ? BamboraConstants .OperationTypes .M .toString () : BamboraConstants .OperationTypes .N .toString ());
37
41
@@ -56,7 +60,7 @@ private Uri buildRecurringPaymentUrl(RecurringPaymentDetails recurringPaymentDet
56
60
57
61
paramString .append (MessageFormat .format ("&{0}={1}&{2}={3}" , BamboraConstants .PARAM_TRANS_HASH_VALUE , getHash (paramString .toString ()), BamboraConstants .PARAM_TRANS_HASH_EXPIRY , getExpiry ()));
58
62
59
- return new Uri (MessageFormat .format ("{0}?{1}" , bamboraProperties .getHostedProfileUrl (), paramString .toString ()));
63
+ return new URI (MessageFormat .format ("{0}?{1}" , bamboraProperties .getHostedProfileUrl (), paramString .toString ()));
60
64
61
65
}
62
66
0 commit comments