-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from razorpay/subscription_entity_nmock
Subscription entity nmock
- Loading branch information
Showing
2 changed files
with
178 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,67 @@ | ||
package com.razorpay; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.util.List; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public class SubscriptionClient extends ApiClient { | ||
|
||
SubscriptionClient(String auth) { | ||
super(auth); | ||
SubscriptionClient(String auth, ApiUtils apiUtils) { | ||
super(auth,apiUtils); | ||
} | ||
|
||
public Subscription create(JSONObject request) throws RazorpayException { | ||
public Subscription create(JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(Constants.SUBSCRIPTION_CREATE, request); | ||
} | ||
|
||
public Subscription fetch(String id) throws RazorpayException { | ||
public Subscription fetch(String id) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return get(String.format(Constants.SUBSCRIPTION, id), null); | ||
} | ||
|
||
public List<Subscription> fetchAll() throws RazorpayException { | ||
public List<Subscription> fetchAll() throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return fetchAll(null); | ||
} | ||
|
||
public List<Subscription> fetchAll(JSONObject request) throws RazorpayException { | ||
public List<Subscription> fetchAll(JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return getCollection(Constants.SUBSCRIPTION_LIST, request); | ||
} | ||
|
||
public Subscription cancel(String id) throws RazorpayException { | ||
public Subscription cancel(String id) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return cancel(id, null); | ||
} | ||
|
||
public Subscription cancel(String id, JSONObject request) throws RazorpayException { | ||
public Subscription cancel(String id, JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(String.format(Constants.SUBSCRIPTION_CANCEL, id), request); | ||
} | ||
|
||
public Addon createAddon(String id, JSONObject request) throws RazorpayException { | ||
public Addon createAddon(String id, JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(String.format(Constants.SUBSCRIPTION_ADDON_CREATE, id), request); | ||
} | ||
|
||
public Subscription update(String id, JSONObject request) throws RazorpayException { | ||
public Subscription update(String id, JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return patch(String.format(Constants.SUBSCRIPTION, id), request); | ||
} | ||
|
||
public Subscription fetchPendingUpdate(String id) throws RazorpayException { | ||
public Subscription fetchPendingUpdate(String id) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return get(String.format(Constants.SUBSCRIPTION_PENDING_UPDATE, id), null); | ||
} | ||
|
||
public Subscription cancelPendingUpdate(String id) throws RazorpayException { | ||
public Subscription cancelPendingUpdate(String id) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(String.format(Constants.SUBSCRIPTION_CANCEL_SCHEDULED_UPDATE, id), null); | ||
} | ||
|
||
public Subscription pause(String id, JSONObject request) throws RazorpayException { | ||
public Subscription pause(String id, JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(String.format(Constants.PAUSE_SUBSCRIPTION, id), request); | ||
} | ||
|
||
public Subscription resume(String id, JSONObject request) throws RazorpayException { | ||
public Subscription resume(String id, JSONObject request) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return post(String.format(Constants.RESUME_SUBSCRIPTION, id), request); | ||
} | ||
|
||
public Subscription deleteSubscriptionOffer(String subId, String offerId) throws RazorpayException { | ||
public Subscription deleteSubscriptionOffer(String subId, String offerId) throws RazorpayException, JSONException, IOException, URISyntaxException { | ||
return delete(String.format(Constants.SUBSCRIPTION_OFFER, subId, offerId), null); | ||
} | ||
} |
Oops, something went wrong.