public void setFeeObject(ApplicationFee c) { this.fee = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setApplicationFeeObject(ApplicationFee c) { this.applicationFee = new ExpandableField<>(c.getId(), c); } // </editor-fold>
/** * Returns the {@code refunds} list. * * @return the {@code refunds} list */ public FeeRefundCollection getRefunds() { // API versions 2014-07-26 and earlier render charge refunds as an array // instead of an object, meaning there is no sublist URL. if (refunds.getUrl() == null) { refunds.setUrl(String.format("/v1/application_fees/%s/refunds", getId())); } return refunds; }
@Test public void testCreate() throws StripeException { final ApplicationFee fee = getFeeFixture(); final Map<String, Object> params = new HashMap<>(); params.put("amount", 100); final FeeRefund refund = fee.getRefunds().create(params); assertNotNull(refund); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/application_fees/%s/refunds", fee.getId()), params ); }
@Test public void testList() throws StripeException { final ApplicationFee fee = getFeeFixture(); final Map<String, Object> params = new HashMap<>(); params.put("limit", 1); final FeeRefundCollection refunds = fee.getRefunds().list(params); assertNotNull(refunds); verifyRequest( ApiResource.RequestMethod.GET, String.format("/v1/application_fees/%s/refunds", fee.getId()), params ); } }
@Test public void testUpdate() throws StripeException { final ApplicationFee fee = getFeeFixture(); final FeeRefund refund = getRefundFixture(fee); Map<String, Object> metadata = new HashMap<>(); metadata.put("key", "value"); Map<String, Object> params = new HashMap<>(); params.put("metadata", metadata); final FeeRefund updatedRefund = refund.update(params); assertNotNull(updatedRefund); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/application_fees/%s/refunds/%s", fee.getId(), refund.getId()), params ); }
@Test public void testRetrieve() throws StripeException { final ApplicationFee fee = getFeeFixture(); final FeeRefund refund = fee.getRefunds().retrieve(REFUND_ID); assertNotNull(refund); verifyRequest( ApiResource.RequestMethod.GET, String.format("/v1/application_fees/%s/refunds/%s", fee.getId(), REFUND_ID) ); }
@Test public void testDeserializeWithExpansions() throws Exception { final String[] expansions = { "balance_transaction", "fee", }; final String data = getFixture("/v1/application_fees/fee_123/refunds/fr_123", expansions); final FeeRefund refund = ApiResource.GSON.fromJson(data, FeeRefund.class); assertNotNull(refund); final BalanceTransaction balanceTransaction = refund.getBalanceTransactionObject(); assertNotNull(balanceTransaction); assertNotNull(balanceTransaction.getId()); assertEquals(refund.getBalanceTransaction(), balanceTransaction.getId()); final ApplicationFee fee = refund.getFeeObject(); assertNotNull(fee); assertNotNull(fee.getId()); assertEquals(refund.getFee(), fee.getId()); } }
@Test public void testDeserialize() throws Exception { final String data = getFixture("/v1/application_fees/fee_123"); final ApplicationFee fee = ApiResource.GSON.fromJson(data, ApplicationFee.class); assertNotNull(fee); assertNotNull(fee.getId()); assertEquals("application_fee", fee.getObject()); assertNull(fee.getAccountObject()); assertNull(fee.getApplicationObject()); assertNull(fee.getBalanceTransactionObject()); assertNull(fee.getChargeObject()); assertNull(fee.getOriginatingTransactionObject()); }
final ApplicationFee applicationFee = charge.getApplicationFeeObject(); assertNotNull(applicationFee); assertNotNull(applicationFee.getId()); assertEquals(charge.getApplicationFee(), applicationFee.getId()); final BalanceTransaction balanceTransaction = charge.getBalanceTransactionObject(); assertNotNull(balanceTransaction);