コード例 #1
0
ファイル: PaymentService.java プロジェクト: bagnos/othala
  @Override
  public RefundTransactionDTO requestRefund(
      RefoundFullDTO ref, ProfilePayPalDTO profile, MailPropertiesDTO mail)
      throws PayPalException, PayPalFailureException, PayPalPostRefundPaymentException {
    // TODO Auto-generated method stub
    List<String> articles = new ArrayList<>();
    String art = null;
    for (ArticleRefounded artRef : ref.getCart()) {
      art =
          String.format(
              "%d %s %s %s",
              artRef.getPrdFullDTO().getIdProduct(),
              artRef.getPrdFullDTO().getDescription(),
              artRef.getTxSize(),
              artRef.getTxColor());
      articles.add(art);
    }
    RefundTransactionDTO refTrans =
        getWrapper(profile)
            .refundTransaction(
                ref.getIdTransaction(),
                ref.getImRefound(),
                true,
                articles,
                ref.getIdRefound().toString());

    try {
      updateStateRefund(
          refTrans.getREFUNDSTATUS(), refTrans.getPENDINGREASON(), null, ref, refTrans, mail);
    } catch (MailNotSendException e) {
      // TODO Auto-generated catch block
      log.error("Errore nell'invio della mail per la conferma del rimborso", e);
    } catch (PayPalException e) {
      throw new PayPalPostRefundPaymentException(
          e,
          ref.getIdRefound() != null ? ref.getIdRefound().toString() : "",
          "errore nella'aggiornamento dello stato dopo il rimborso");
    }

    return refTrans;
  }