Charge ch = Charge.retrieve(trnID); Refund re = ch.getRefunds().create(params); transaction.setPaymentType(PaymentType.CREDITCARD); transaction.getTransactionDetails().put("TRANSACTIONID", transaction.getTransactionDetails().get("TRANSACTIONID")); transaction.getTransactionDetails().put("TRNAPPROVED", re.getReason()); transaction.getTransactionDetails().put("TRNORDERNUMBER", re.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
Charge ch = Charge.retrieve(chargeId); ch.capture(); transaction.setPaymentType(PaymentType.CREDITCARD); 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);
Charge ch = Charge.create(chargeParams); transaction.setPaymentType(PaymentType.CREDITCARD); transaction.getTransactionDetails().put("TRANSACTIONID", token); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
customer = Customer.retrieve(userStripeId, requestOptions); if (customer.getDeleted() == Boolean.TRUE) { customer = Customer.create(customerParams, requestOptions); userStripeId = customer.getId(); service.setStripeId(webUser.get().id, userStripeId); } else { customer.update(customerParams, requestOptions); customer = Customer.create(customerParams, requestOptions); userStripeId = customer.getId(); service.setStripeId(webUser.get().id, userStripeId); subsParams.put("coupon", coupon); customer.createSubscription(subsParams, requestOptions); return Customer.retrieve(userStripeId, requestOptions).getSubscriptions().getData().stream().map(subs -> new UserSubscription( subs.getPlan().getId(), subs.getPlan().getAmount(), Instant.ofEpochMilli(subs.getCurrentPeriodStart()), Instant.ofEpochMilli(subs.getCurrentPeriodEnd()), Optional.ofNullable(subs.getDiscount()) .map(e -> e.getCoupon()) .map(e -> new RakamCoupon(e.getPercentOff(), e.getAmountOff())).orElse(null))) .collect(Collectors.toList());
Customer customer = Customer.retrieve(userStripeId, requestOptions); if (customer.getSubscriptions() == null) { return ImmutableList.of(); return customer.getSubscriptions().getData().stream().map(subs -> new UserSubscription( subs.getPlan().getId(), subs.getPlan().getAmount(), Instant.ofEpochSecond(subs.getCurrentPeriodStart()), Instant.ofEpochSecond(subs.getCurrentPeriodEnd()), Optional.ofNullable(subs.getDiscount()) .map(e -> e.getCoupon()) .map(e -> new RakamCoupon(e.getPercentOff(), e.getAmountOff())).orElse(null))) .collect(Collectors.toList());
public void setSourceTransactionObject(Charge sourceTransaction) { this.sourceTransaction = new ExpandableField<>(sourceTransaction.getId(), sourceTransaction); } // </editor-fold>
@JsonRequest @ProtectEndpoint(writeOperation = true, requiresProject = false) @Path("/plans") public List<RakamPlan> listPlans(@javax.inject.Named("user_id") UIPermissionParameterProvider.Project project) { Optional<WebUser> webUser = service.getUser(project.userId); if (!webUser.isPresent()) { throw new RakamException(FORBIDDEN); } try { return Plan.list(ImmutableMap.of("limit", 50), requestOptions).getData().stream() .map(e -> new RakamPlan(e.getId(), e.getName(), e.getAmount(), e.getStatementDescriptor())) .collect(Collectors.toList()); } catch (Exception e) { throw Throwables.propagate(e); } }
public void setCustomerObject(Customer c) { this.customer = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setFailureBalanceTransactionObject(BalanceTransaction c) { this.failureBalanceTransaction = new ExpandableField<>(c.getId(), c); } // </editor-fold>
@JsonRequest @ProtectEndpoint(writeOperation = true, requiresProject = false) @Path("/coupon") public RakamCoupon checkCoupon( @ApiParam("coupon") String coupon, @HeaderParam("X-Requested-With") String csrfHeader, @javax.inject.Named("user_id") UIPermissionParameterProvider.Project project) { if (!"XMLHttpRequest".equals(csrfHeader)) { throw new RakamException(FORBIDDEN); } Optional<WebUser> webUser = service.getUser(project.userId); if (!webUser.isPresent() || webUser.get().readOnly) { throw new RakamException("User is not allowed to perform this operation", UNAUTHORIZED); } try { Coupon retrieve = Coupon.retrieve(coupon, requestOptions); return new RakamCoupon(retrieve.getPercentOff(), retrieve.getAmountOff()); } catch (InvalidRequestException e) { if (e.getStatusCode() == 404) { throw new RakamException(NOT_FOUND); } throw Throwables.propagate(e); } catch (StripeException e) { throw Throwables.propagate(e); } }
public void setDefaultCardObject(Card c) { this.defaultCard = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setSourceTransferReversalObject(Reversal c) { this.sourceTransferReversal = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setInvoiceObject(Invoice invoice) { this.invoice = new ExpandableField<Invoice>(invoice.getId(), invoice); } // </editor-fold>
public void setDefaultSourceObject(ExternalAccount c) { this.defaultSource = new ExpandableField<>(c.getId(), c); } // </editor-fold>
public void setDestinationPaymentObject(Charge destinationPayment) { this.destinationPayment = new ExpandableField<>(destinationPayment.getId(), destinationPayment); } // </editor-fold>
Charge ch = Charge.create(chargeParams); transaction.setPaymentType(PaymentType.CREDITCARD); transaction.getTransactionDetails().put("TRANSACTIONID", token); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
public void setBalanceTransactionObject(BalanceTransaction c) { this.balanceTransaction = new ExpandableField<BalanceTransaction>(c.getId(), c); } // </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>