transaction.getTransactionDetails().put("TRANSACTIONID", token); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
transaction.getTransactionDetails().put("TRANSACTIONID", token); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
transaction.getTransactionDetails().put("TRANSACTIONID", capturableTransaction.getTransactionDetails().get("TRANSACTIONID")); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
public void setDestinationPaymentObject(Charge destinationPayment) { this.destinationPayment = new ExpandableField<>(destinationPayment.getId(), destinationPayment); } // </editor-fold>
public void setSourceTransactionObject(Charge sourceTransaction) { this.sourceTransaction = new ExpandableField<>(sourceTransaction.getId(), sourceTransaction); } // </editor-fold>
public void setChargeObject(Charge charge) { this.charge = new ExpandableField<>(charge.getId(), charge); } // </editor-fold>
public void setChargeObject(Charge c) { this.charge = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setChargeObject(Charge charge) { this.charge = new ExpandableField<>(charge.getId(), charge); } // </editor-fold>
public void setChargeObject(Charge charge) { this.charge = new ExpandableField<>(charge.getId(), charge); } // </editor-fold>
public void setChargeObject(Charge c) { this.charge = new ExpandableField<Charge>(c.getId(), c); } // </editor-fold>
public void setChargeObject(Charge c) { this.charge = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setOriginatingTransactionObject(Charge c) { this.originatingTransaction = new ExpandableField<Charge>(c.getId(), c); } // </editor-fold>
public void setChargeObject(Charge charge) { this.charge = new ExpandableField<>(charge.getId(), charge); } // </editor-fold>
/** * Refund the charge. * * @deprecated Prefer using the {@link Refund#create(Map, RequestOptions)} method instead. */ @Deprecated public Charge refund(Map<String, Object> params, RequestOptions options) throws StripeException { return request(RequestMethod.POST, String.format("%s/refund", instanceUrl(Charge.class, this.getId())), params, Charge.class, options); } // </editor-fold>
/** * Capture a charge. */ public Charge capture(Map<String, Object> params, RequestOptions options) throws StripeException { return request(RequestMethod.POST, String.format("%s/capture", instanceUrl(Charge.class, this.getId())), params, Charge.class, options); } // </editor-fold>
/** * Returns the {@code refunds} list. * * @return the {@code refunds} list */ public ChargeRefundCollection getRefunds() { // API versions 2014-05-19 and earlier render charge refunds as an array // instead of an object, meaning there is no sublist URL. if (refunds != null && refunds.getUrl() == null) { refunds.setUrl(String.format("/v1/charges/%s/refunds", getId())); } return refunds; }
@Test public void testMarkFaudulent() throws StripeException { final Charge charge = getChargeFixture(); final Charge fraudulentCharge = charge.markFraudulent(null); assertNotNull(fraudulentCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), ImmutableMap.of("fraud_details", (Object)ImmutableMap.of("user_report", (Object)"fraudulent")) ); }
@Test public void testMarkSafe() throws StripeException { final Charge charge = getChargeFixture(); final Charge safeCharge = charge.markSafe(null); assertNotNull(safeCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), ImmutableMap.of("fraud_details", (Object)ImmutableMap.of("user_report", (Object)"safe")) ); } }
@Test public void testDeserializeWithExpansions() throws Exception { final String[] expansions = { "charge", }; final String data = getFixture("/v1/issuer_fraud_records/issfr_123", expansions); final IssuerFraudRecord record = ApiResource.GSON.fromJson(data, IssuerFraudRecord.class); assertNotNull(record); assertNotNull(record.getId()); final Charge charge = record.getChargeObject(); assertNotNull(charge); assertNotNull(charge.getId()); assertEquals(record.getCharge(), charge.getId()); } }
@Test public void testDeserializeExpanded() throws Exception { final String[] expansions = { "charge", }; final String data = getFixture("/v1/invoices/in_123", expansions); final Invoice invoice = ApiResource.GSON.fromJson(data, Invoice.class); assertNotNull(invoice); assertNotNull(invoice.getId()); final Charge charge = invoice.getChargeObject(); assertNotNull(charge); assertNotNull(charge.getId()); assertEquals(invoice.getCharge(), charge.getId()); } }