-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wilson Lin
committed
Oct 24, 2023
1 parent
290ad7b
commit e069a52
Showing
3 changed files
with
133 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
package com.dnsimple.data; | ||
|
||
import com.dnsimple.data.*; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class Charge { | ||
private final String invoicedAt; | ||
private final String totalAmount; | ||
private final String balanceAmount; | ||
private final String reference; | ||
private final String state; | ||
private final List<ChargeItem> items; | ||
|
||
public Charge(String invoicedAt, String totalAmount, String balanceAmount, String reference, String state, List<ChargeItem> items) { | ||
this.invoicedAt = invoicedAt; | ||
this.totalAmount = totalAmount; | ||
this.balanceAmount = balanceAmount; | ||
this.reference = reference; | ||
this.state = state; | ||
this.items = items; | ||
} | ||
|
||
public String getInvoicedAt() { | ||
return this.invoicedAt; | ||
} | ||
|
||
public String getTotalAmount() { | ||
return this.totalAmount; | ||
} | ||
|
||
public String getBalanceAmount() { | ||
return this.balanceAmount; | ||
} | ||
|
||
public String getReference() { | ||
return this.reference; | ||
} | ||
|
||
public String getState() { | ||
return this.state; | ||
} | ||
|
||
public List<ChargeItem> getItems() { | ||
return this.items; | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
package com.dnsimple.data; | ||
|
||
import com.dnsimple.data.*; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class ChargeItem { | ||
private final String description; | ||
private final String amount; | ||
private final Number productId; | ||
private final String productType; | ||
private final String productReference; | ||
|
||
public ChargeItem(String description, String amount, Number productId, String productType, String productReference) { | ||
this.description = description; | ||
this.amount = amount; | ||
this.productId = productId; | ||
this.productType = productType; | ||
this.productReference = productReference; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public String getAmount() { | ||
return this.amount; | ||
} | ||
|
||
public Number getProductId() { | ||
return this.productId; | ||
} | ||
|
||
public String getProductType() { | ||
return this.productType; | ||
} | ||
|
||
public String getProductReference() { | ||
return this.productReference; | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
package com.dnsimple.endpoints; | ||
|
||
import com.dnsimple.data.*; | ||
import com.dnsimple.http.HttpEndpointClient; | ||
import com.dnsimple.request.*; | ||
import com.dnsimple.response.EmptyResponse; | ||
import com.dnsimple.response.ListResponse; | ||
import com.dnsimple.response.SimpleResponse; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static com.dnsimple.http.HttpMethod.*; | ||
|
||
public class Billing { | ||
private final HttpEndpointClient client; | ||
|
||
public Billing(HttpEndpointClient client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* Lists the billing charges for the account. | ||
* | ||
* @see <a href="https://developer.dnsimple.com/v2/billing/#listCharges">https://developer.dnsimple.com/v2/billing/#listCharges</a> | ||
*/ | ||
public ListResponse<Charge> listCharges(Number account, ListOptions options) { | ||
return client.list( | ||
GET, | ||
String.format("/%s/billing/charges", account), | ||
options, | ||
null, Charge.class | ||
); | ||
} | ||
} |