They have an Android lib, maybe you can use it as a normal Java lib too:
https://developers.simplepay.ng/plugins/#android_repository_-_jcenter_and_mavencentral
Otherwise you would have to parse the json response all by yourself:
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
JsonObject postJson = buildJson(chargeDTO);
Entity payload = Entity.json(postJson.toString());
Client client = ClientBuilder.newClient();
Response response = client.target("https://checkout.simplepay.ng/")
.path("v2/payments/card/charge/")
.queryParam("someparam", "somevalue")
.request(MediaType.APPLICATION_JSON_TYPE)
.header("Content-Type", "application/json")
.header("Authorization", getAuthorizationTokenHeader())
.post(payload);
if (response.getStatus() != 200) {
//error
}
else{
String jsonResponse = response.readEntity(String.class);
//parse the json
}
On Sat, Jul 15, 2017 at 7:52 AM, Martin Grigorov <[email protected]>
wrote:
> Hi,
>
> Wicket is not a swiss army knife.
> There are other libraries for making HTTP calls - HttpUrlConnection, Apache
> HttpComponents, OkHttp, ...
> Any of them can easily make POST calls.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Sat, Jul 15, 2017 at 11:04 AM, gasper <[email protected]> wrote:
>
> > Hello Wicketers,
> >
> > how can i make this work and get the response using Apache Wicket 6.x
> > It has been storming my head for days ....
> > A working code sample will help a lot...
> >
> > Thanks
> >
> > POST https://checkout.simplepay.ng/v2/payments/card/charge/
> >
> > curl "https://checkout.simplepay.ng/v2/payments/card/charge/" \
> > -d token= 'tk_iKdhkLxPZEaGoNodfWoEFW' \
> > -d amount= '110000' \
> > -d amount_currency= 'NGN' \
> > -u test_pr_demo: ‘test_pr_demo’'
> >
> > RESPONSE FORMAT
> >
> > {
> > u'customer':
> > {
> > u'address_city': u'',
> > u'address_postal': u'110001',
> > u'address': u'17 Da Silva St, Lekki, Lagos, Nigeria',
> > u'email': u'[email protected]',
> > u'phone': u'+2347035706380',
> > u'address_state': None,
> > u'address_country': u'NG',
> > u'id': u'cus_CKX7mSkCFgkyiz4oHDY2mW'
> > },
> > u'created': 1494677790,
> > u'response_code': 20000,
> > u'livemode': False,
> > u'currency': u'NGN',
> > u'source':
> > {
> > u'exp_month': 12,
> > u'funding': u'credit',
> > u'brand': u'VISA',
> > u'object': u'card',
> > u'last4': u'1111',
> > u'exp_year': 2018,
> > u'id': u'card_2aP8nZNtHDp9dkNPrbKsYc',
> > u'is_recurrent': False
> > },
> > u'amount': 6000000, (amount in cents)
> > u'payment_reference': u'1850877790146606',
> > u'id': u'trans_67UQe4iSZQr6NdXjgBT57R',
> > u'captured': True
> > }
> >
> > 'response_code': 20000, Signifies a verified payment
> >
> >
> > --
> > View this message in context: http://apache-wicket.1842946.
> > n4.nabble.com/How-to-use-Apache-Wicket-to-send-a-post-
> > request-via-Curl-tp4678242.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
--
Marcel Barbosa Pinto
55 11 98255 8288