File tree Expand file tree Collapse file tree
main/java/pl/smsapi/api/action/hlr
test/java/pl/smsapi/api/action/hlr Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1111- ` date_sent ` to SMS/MMS send action responses
1212- ` time_restriction ` parameter for SMS send action
1313- HLR action factory, ` HlrFactory `
14+ - HLR with IDX support
1415
1516### Changed
1617- ` pl.smsapi.api.UserFactory.actionAdd ` marked as deprecated, use ` pl.smsapi.api.action.subusers.SubusersFactory.actionAdd ` instead
Original file line number Diff line number Diff line change @@ -28,6 +28,14 @@ public HLRCheckNumber setNumber(String number) {
2828 return this ;
2929 }
3030
31+ /**
32+ * Set optional custom value sent with HLR and sent back in CALLBACK.
33+ */
34+ public HLRCheckNumber setIDx (String idx ) {
35+ params .put ("idx" , idx );
36+ return this ;
37+ }
38+
3139 protected CheckNumberResponse createResponse (String data ) {
3240 JSONObject jsonObject = new JSONObject (data );
3341 return new CheckNumberResponse (jsonObject .getInt ("count" ), jsonObject .getJSONArray ("list" ));
Original file line number Diff line number Diff line change @@ -28,4 +28,23 @@ public void executeCheckNumberRequest() throws SmsapiException {
2828 expectedRequestPayload .put ("format" , "json" );
2929 assertEquals (expectedRequestPayload , requestStub .requestPayload );
3030 }
31+
32+ @ Test
33+ public void executeCheckNumberWithOptionalFieldsRequest () throws SmsapiException {
34+ ProxyRequestSpy requestStub = new ProxyRequestSpy (StatusJsonMother .create ());
35+ HLRCheckNumber action = new HLRCheckNumber ("500600700" );
36+ action .client (new ClientStub ());
37+ action .proxy (requestStub );
38+ action .setIDx ("example-user-provided-id-123" );
39+
40+ action .execute ();
41+
42+ assertEquals ("POST" , requestStub .requestMethod );
43+ assertEquals ("hlrsync.do" , requestStub .requestEndpoint );
44+ HashMap <String , String > expectedRequestPayload = new HashMap <>();
45+ expectedRequestPayload .put ("number" , "500600700" );
46+ expectedRequestPayload .put ("format" , "json" );
47+ expectedRequestPayload .put ("idx" , "example-user-provided-id-123" );
48+ assertEquals (expectedRequestPayload , requestStub .requestPayload );
49+ }
3150}
Original file line number Diff line number Diff line change @@ -22,8 +22,9 @@ public void setUp() {
2222
2323 @ Test
2424 public void checkNumberTest () throws SmsapiException {
25-
26- HLRCheckNumber actionCheckNumber = apiFactory .actionCheckNumber ("500600700" );
25+ HLRCheckNumber actionCheckNumber = apiFactory
26+ .actionCheckNumber ("500600700" )
27+ .setIDx ("example-user-provided-id-123" );
2728
2829 CheckNumberResponse responseCheckNumber = actionCheckNumber .execute ();
2930
You can’t perform that action at this time.
0 commit comments