Permalink
Browse files

Add Fee object, feeDetails to Charge object.

  • Loading branch information...
1 parent a128a88 commit 7342805dfd1f50787bfd313ef131d03ee72f5665 @amber-stripe amber-stripe committed Oct 15, 2012
@@ -1,6 +1,7 @@
package com.stripe.model;
import java.util.Map;
+import java.util.List;
import com.stripe.exception.StripeException;
import com.stripe.net.APIResource;
@@ -20,6 +21,7 @@
Integer amountRefunded;
String customer;
String invoice;
+ List<Fee> feeDetails;
Card card;
public String getId() {
@@ -133,6 +135,14 @@ public String getInvoice() {
public void setInvoice(String invoice) {
this.invoice = invoice;
}
+
+ public List<Fee> getFeeDetails() {
+ return feeDetails;
+ }
+
+ public void setFeeDetails(List<Fee> feeDetails) {
+ this.feeDetails = feeDetails;
+ }
public Card getCard() {
return card;
@@ -0,0 +1,51 @@
+package com.stripe.model;
+
+import com.stripe.net.APIResource;
+
+public class Fee extends APIResource {
+ String type;
+ String application;
+ Integer amount;
+ String description;
+ String currency;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getApplication() {
+ return application;
+ }
+
+ public void setApplication(String application) {
+ this.application = application;
+ }
+
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+}
@@ -27,6 +27,7 @@
import com.stripe.model.Invoice;
import com.stripe.model.InvoiceItem;
import com.stripe.model.Event;
+import com.stripe.model.Fee;
import com.stripe.model.Plan;
import com.stripe.model.Subscription;
import com.stripe.model.Token;
@@ -120,6 +121,14 @@ static Customer createDefaultCustomerWithPlan(Plan plan) throws StripeException
@Test public void testChargeCreate() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams);
assertFalse(createdCharge.getRefunded());
+
+ assertEquals(1, createdCharge.getFeeDetails().size());
+
+ Fee fee = createdCharge.getFeeDetails().get(0);
+ assertEquals("stripe_fee", fee.getType());
+ assertEquals(createdCharge.getFee(), fee.getAmount());
+ assertEquals(createdCharge.getCurrency(), fee.getCurrency());
+ assertEquals(null, fee.getApplication());
}
@Test public void testChargeRetrieve() throws StripeException {

0 comments on commit 7342805

Please sign in to comment.