Пример #1
0
 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());
 }
Пример #2
0
 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());
 }
Пример #3
0
 public Bill refundBill(String billId) {
   return fromJson(
       httpClient.post(format(ApiPath.BILL_REFUND, billId), headers(), null), Bill.class);
 }
Пример #4
0
 public Bill cancelBill(String billId) {
   return fromJson(
       httpClient.put(format(ApiPath.BILL_CANCEL, billId), headers(), null), Bill.class);
 }
Пример #5
0
 public Bill getBill(String billId) {
   return fromJson(httpClient.get(format("%s/%s", ApiPath.BILL, billId), headers()), Bill.class);
 }
Пример #6
0
 public List<User> getMerchantUsers(String merchantId) {
   return fromJson(
       httpClient.get(format(ApiPath.MERCHANT_USERS, merchantId), headers()),
       new TypeToken<ArrayList<User>>() {}.getType());
 }
Пример #7
0
 public Merchant getMerchant(String merchantId) {
   return fromJson(
       httpClient.get(format("%s/%s", ApiPath.MERCHANT, merchantId), headers()), Merchant.class);
 }
Пример #8
0
 public Payout getPayout(String payoutId) {
   return fromJson(
       httpClient.get(format("%s/%s", ApiPath.PAYOUT, payoutId), headers()), Payout.class);
 }
Пример #9
0
 public List<Payout> getMerchantPayouts(String merchantId) {
   return fromJson(
       httpClient.get(format(ApiPath.MERCHANT_PAYOUTS, merchantId), headers()),
       new TypeToken<ArrayList<Payout>>() {}.getType());
 }
Пример #10
0
 public Bill postPreAuthorizedBill(PreAuthorizedBill preAuthorizedBill) {
   return fromJson(
       httpClient.post(ApiPath.BILL, headers(), toJson(preAuthorizedBill, "bill")), Bill.class);
 }
Пример #11
0
 public PreAuthorization cancelPreAuthorization(String preAuthorizationId) {
   return fromJson(
       httpClient.put(
           format(ApiPath.PRE_AUTHORIZATION_CANCEL, preAuthorizationId), headers(), null),
       PreAuthorization.class);
 }
Пример #12
0
 public PreAuthorization getPreAuthorization(String preAuthorizationId) {
   return fromJson(
       httpClient.get(format("%s/%s", ApiPath.PRE_AUTHORIZATION, preAuthorizationId), headers()),
       PreAuthorization.class);
 }
Пример #13
0
 public Subscription cancelSubscription(String subscriptionId) {
   return fromJson(
       httpClient.put(format(ApiPath.SUBSCRIPTION_CANCEL, subscriptionId), headers(), null),
       Subscription.class);
 }
Пример #14
0
 public Subscription getSubscription(String subscriptionId) {
   return fromJson(
       httpClient.get(format("%s/%s", ApiPath.SUBSCRIPTION, subscriptionId), headers()),
       Subscription.class);
 }