Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription entity nmock #239

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions src/main/java/com/razorpay/SubscriptionClient.java
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);
}
}
Loading