public void setFeeObject(ApplicationFee c) { this.fee = new ExpandableField<>(c.getId(), c); } // </editor-fold>
/** * List all application fees. */ public static ApplicationFeeCollection list(Map<String, Object> params) throws StripeException { return list(params, null); }
/** * Retrieve an application fee. */ public static ApplicationFee retrieve(String id) throws StripeException { return retrieve(id, (RequestOptions) null); }
/** * List all application fees. */ public static ApplicationFeeCollection list(Map<String, Object> params, RequestOptions options) throws StripeException { return requestCollection(classUrl(ApplicationFee.class), params, ApplicationFeeCollection.class, options); } // </editor-fold>
final ApplicationFee fee = ApiResource.GSON.fromJson(data, ApplicationFee.class); assertNotNull(fee); final Account account = fee.getAccountObject(); assertNotNull(account); assertNotNull(account.getId()); assertEquals(fee.getAccount(), account.getId()); final Application application = fee.getApplicationObject(); assertNotNull(application); assertNotNull(application.getId()); assertEquals(fee.getApplication(), application.getId()); final BalanceTransaction balanceTransaction = fee.getBalanceTransactionObject(); assertNotNull(balanceTransaction); assertNotNull(balanceTransaction.getId()); assertEquals(fee.getBalanceTransaction(), balanceTransaction.getId()); final Charge charge = fee.getChargeObject(); assertNotNull(charge); assertNotNull(charge.getId()); assertEquals(fee.getCharge(), charge.getId()); final Charge originatingTransaction = fee.getOriginatingTransactionObject(); assertNotNull(originatingTransaction); assertNotNull(originatingTransaction.getId()); assertEquals(fee.getOriginatingTransaction(), originatingTransaction.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()); }
@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 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) ); }
public void setApplicationFeeObject(ApplicationFee c) { this.applicationFee = new ExpandableField<>(c.getId(), c); } // </editor-fold>
/** * Retrieve an application fee. */ public static ApplicationFee retrieve(String id, RequestOptions options) throws StripeException { return retrieve(id, null, options); }
@Test public void testList() throws StripeException { final Map<String, Object> params = new HashMap<>(); params.put("limit", 1); final ApplicationFeeCollection fees = ApplicationFee.list(params); assertNotNull(fees); verifyRequest( ApiResource.RequestMethod.GET, String.format("/v1/application_fees"), params ); } }
/** * 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; }
private ApplicationFee getFeeFixture() throws StripeException { final ApplicationFee fee = ApplicationFee.retrieve(FEE_ID); resetNetworkSpy(); return fee; }
@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 = ApplicationFee.retrieve(FEE_ID); assertNotNull(fee); verifyRequest( ApiResource.RequestMethod.GET, String.format("/v1/application_fees/%s", FEE_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()); } }
final ApplicationFee applicationFee = charge.getApplicationFeeObject(); assertNotNull(applicationFee); assertNotNull(applicationFee.getId()); assertEquals(charge.getApplicationFee(), applicationFee.getId()); final BalanceTransaction balanceTransaction = charge.getBalanceTransactionObject(); assertNotNull(balanceTransaction);