11package ca .bc .gov .open .bambora .payment .starter .managment ;
22
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-
103import java .net .MalformedURLException ;
4+ import java .net .URI ;
5+ import java .net .URISyntaxException ;
116import java .text .MessageFormat ;
127import java .text .SimpleDateFormat ;
138import java .util .Calendar ;
149import java .util .Date ;
1510
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+
1618public class BamboraCardServiceImpl implements BamboraCardService {
1719
1820 private final BamboraProperties bamboraProperties ;
@@ -22,16 +24,18 @@ public BamboraCardServiceImpl(BamboraProperties bamboraProperties) {
2224 }
2325
2426 @ Override
25- public Uri setupRecurringPayment (RecurringPaymentDetails recurringPaymentDetails ) {
27+ public URI setupRecurringPayment (RecurringPaymentDetails recurringPaymentDetails ) {
2628 try {
2729 return buildRecurringPaymentUrl (recurringPaymentDetails );
2830 } catch (MalformedURLException e ) {
2931 throw new BamboraException ("Url construction failed" , e .getCause ());
30- }
32+ } catch (URISyntaxException e ) {
33+ throw new BamboraException ("Url construction failed" , e .getCause ());
34+ }
3135 }
3236
3337
34- private Uri buildRecurringPaymentUrl (RecurringPaymentDetails recurringPaymentDetails ) throws MalformedURLException {
38+ private URI buildRecurringPaymentUrl (RecurringPaymentDetails recurringPaymentDetails ) throws MalformedURLException , URISyntaxException {
3539
3640 String operationType = (recurringPaymentDetails .getEndUserId () != null ? BamboraConstants .OperationTypes .M .toString () : BamboraConstants .OperationTypes .N .toString ());
3741
@@ -56,7 +60,7 @@ private Uri buildRecurringPaymentUrl(RecurringPaymentDetails recurringPaymentDet
5660
5761 paramString .append (MessageFormat .format ("&{0}={1}&{2}={3}" , BamboraConstants .PARAM_TRANS_HASH_VALUE , getHash (paramString .toString ()), BamboraConstants .PARAM_TRANS_HASH_EXPIRY , getExpiry ()));
5862
59- return new Uri (MessageFormat .format ("{0}?{1}" , bamboraProperties .getHostedProfileUrl (), paramString .toString ()));
63+ return new URI (MessageFormat .format ("{0}?{1}" , bamboraProperties .getHostedProfileUrl (), paramString .toString ()));
6064
6165 }
6266
0 commit comments