Пример #1
0
  /**
   * Send a member installment to member when a member installment is created
   *
   * @param memberInstallment Member installment with information for mail content
   */
  private void sendMemberInstallmentNotice(MemberInstallment memberInstallment) {
    Config conf = ConfigFactory.load();
    String sendFromEmail = conf.getString("play.mailer.user");
    String sendFromName = Messages.get("app.global.title");
    String subject = sendFromName + ": " + Messages.get("adminUser.mail.subject.newAccount");

    Email email = new Email();
    email.setSubject(subject);
    email.setFrom(sendFromName + "<" + sendFromEmail + ">");
    email.addTo(
        memberInstallment.getMember().toString()
            + "<"
            + memberInstallment.getMember().getEmail()
            + ">");
    String body =
        views
            .html
            .subscription
            .memberInstallment
            .memberInstallmentNotice
            .render(subject, memberInstallment)
            .body();
    email.setBodyHtml(body);

    mailer.send(email);
  }
Пример #2
0
 /** {@inheritDoc} */
 public void createMemberInstallment(Member member, Installment installment) {
   MemberInstallment memberInstallment = getModel();
   memberInstallment.setMember(member);
   memberInstallment.setInstallment(installment);
   memberInstallment.save();
   sendMemberInstallmentNotice(memberInstallment);
 }
Пример #3
0
 /** {@inheritDoc} */
 public Double getAmountDue(String token) {
   if (token != null) {
     MemberInstallment memberInstallment = getModel().get("token", token);
     if (memberInstallment != null) {
       return memberInstallment.getAmountDue();
     }
   }
   return 0.0;
 }
Пример #4
0
 /** {@inheritDoc} */
 public void setMemberInstallments(Member member) {
   InstallmentService installmentService = new InstallmentService();
   for (Subscription subscription : member.getSubscriptions()) {
     if (subscription != null) {
       boolean isMemberInstallmentSet = false;
       Installment lastInstallment =
           installmentService.getSubscriptionLastInstallment(subscription);
       for (MemberInstallment memberInstallment : member.getMemberInstallments()) {
         isMemberInstallmentSet =
             (memberInstallment.getInstallment().equals(lastInstallment))
                 || isMemberInstallmentSet;
       }
       if (!isMemberInstallmentSet) createMemberInstallment(member, lastInstallment);
     }
   }
 }
Пример #5
0
 /** {@inheritDoc} */
 public void setPaid(MemberInstallment memberInstallment) {
   memberInstallment.setAsPaid();
 }