public List<Subscription> getMerchantSubscriptions( String merchantId, String userId, Date before, Date after) { Map<String, String> params = new HashMap<String, String>(); if (userId != null) params.put("user_id", userId); if (before != null) params.put("before", formatUTC(before)); if (after != null) params.put("after", formatUTC(after)); return fromJson( httpClient.get(url(format(ApiPath.MERCHANT_SUBSCRIPTIONS, merchantId), params), headers()), new TypeToken<ArrayList<Subscription>>() {}.getType()); }
public List<Bill> getMerchantBills( String merchantId, String sourceId, String subscriptionId, String preAuthorizationId, String userId, Date before, Date after, Boolean paid) { Map<String, String> params = new HashMap<String, String>(); if (sourceId != null) params.put("source_id", sourceId); if (subscriptionId != null) params.put("subscription_id", subscriptionId); if (preAuthorizationId != null) params.put("pre_authorization_id", preAuthorizationId); if (userId != null) params.put("user_id", userId); if (before != null) params.put("before", formatUTC(before)); if (after != null) params.put("after", formatUTC(after)); if (paid != null) params.put("paid", paid.toString()); return fromJson( httpClient.get(url(format(ApiPath.MERCHANT_BILLS, merchantId), params), headers()), new TypeToken<ArrayList<Bill>>() {}.getType()); }
public Bill refundBill(String billId) { return fromJson( httpClient.post(format(ApiPath.BILL_REFUND, billId), headers(), null), Bill.class); }
public Bill cancelBill(String billId) { return fromJson( httpClient.put(format(ApiPath.BILL_CANCEL, billId), headers(), null), Bill.class); }
public Bill getBill(String billId) { return fromJson(httpClient.get(format("%s/%s", ApiPath.BILL, billId), headers()), Bill.class); }
public List<User> getMerchantUsers(String merchantId) { return fromJson( httpClient.get(format(ApiPath.MERCHANT_USERS, merchantId), headers()), new TypeToken<ArrayList<User>>() {}.getType()); }
public Merchant getMerchant(String merchantId) { return fromJson( httpClient.get(format("%s/%s", ApiPath.MERCHANT, merchantId), headers()), Merchant.class); }
public Payout getPayout(String payoutId) { return fromJson( httpClient.get(format("%s/%s", ApiPath.PAYOUT, payoutId), headers()), Payout.class); }
public List<Payout> getMerchantPayouts(String merchantId) { return fromJson( httpClient.get(format(ApiPath.MERCHANT_PAYOUTS, merchantId), headers()), new TypeToken<ArrayList<Payout>>() {}.getType()); }
public Bill postPreAuthorizedBill(PreAuthorizedBill preAuthorizedBill) { return fromJson( httpClient.post(ApiPath.BILL, headers(), toJson(preAuthorizedBill, "bill")), Bill.class); }
public PreAuthorization cancelPreAuthorization(String preAuthorizationId) { return fromJson( httpClient.put( format(ApiPath.PRE_AUTHORIZATION_CANCEL, preAuthorizationId), headers(), null), PreAuthorization.class); }
public PreAuthorization getPreAuthorization(String preAuthorizationId) { return fromJson( httpClient.get(format("%s/%s", ApiPath.PRE_AUTHORIZATION, preAuthorizationId), headers()), PreAuthorization.class); }
public Subscription cancelSubscription(String subscriptionId) { return fromJson( httpClient.put(format(ApiPath.SUBSCRIPTION_CANCEL, subscriptionId), headers(), null), Subscription.class); }
public Subscription getSubscription(String subscriptionId) { return fromJson( httpClient.get(format("%s/%s", ApiPath.SUBSCRIPTION, subscriptionId), headers()), Subscription.class); }