Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sources/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<parent>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.parent</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
</parent>
<artifactId>tools.dynamia.modules.saas.api</artifactId>

<name>DynamiaModules - SaaS API</name>
<url>https://www.dynamia.tools/modules/saas</url>
<version>3.4.0</version>
<version>3.4.1</version>

<build>
<plugins>
Expand Down
8 changes: 4 additions & 4 deletions sources/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<parent>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.parent</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
</parent>
<artifactId>tools.dynamia.modules.saas</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<name>DynamiaModules - SaaS Core</name>
<url>https://www.dynamia.tools/modules/saas</url>

Expand All @@ -49,12 +49,12 @@
<dependency>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.api</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.jpa</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class Account extends SimpleEntity implements Transferable<AccountDTO> {
@Email(message = "ingreso direccion de correo valida ")
@NotEmpty(message = "ingrese direccion de correo electronico")
private String email;
@OneToOne
@ManyToOne
@NotNull
private AccountType type;
@Temporal(jakarta.persistence.TemporalType.DATE)
Expand Down Expand Up @@ -167,6 +167,18 @@ public class Account extends SimpleEntity implements Transferable<AccountDTO> {
@ManyToOne
private AccountReseller reseller;

@ManyToOne
private AccountResellerAgent resellerAgent;

@Lob
private String resellerComments;

@Column(length = 50)
private String resellerInvoice;

@Temporal(TemporalType.DATE)
private Date resellerInvoiceDate;

@ManyToOne
private AccountRegion accountRegion;
private boolean templateAccount;
Expand All @@ -186,7 +198,7 @@ public class Account extends SimpleEntity implements Transferable<AccountDTO> {

private String activationCoupon;
private String redirect;
@OneToOne
@ManyToOne
private AccountChannelSale channel;

public Account() {
Expand Down Expand Up @@ -910,4 +922,36 @@ public boolean isTemplateAccount() {
public void setTemplateAccount(boolean templateAccount) {
this.templateAccount = templateAccount;
}

public AccountResellerAgent getResellerAgent() {
return resellerAgent;
}

public void setResellerAgent(AccountResellerAgent resellerAgent) {
this.resellerAgent = resellerAgent;
}

public String getResellerComments() {
return resellerComments;
}

public void setResellerComments(String resellerComments) {
this.resellerComments = resellerComments;
}

public String getResellerInvoice() {
return resellerInvoice;
}

public void setResellerInvoice(String resellerInvoice) {
this.resellerInvoice = resellerInvoice;
}

public Date getResellerInvoiceDate() {
return resellerInvoiceDate;
}

public void setResellerInvoiceDate(Date resellerInvoiceDate) {
this.resellerInvoiceDate = resellerInvoiceDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package tools.dynamia.modules.saas.domain;

import jakarta.persistence.ManyToOne;
import tools.dynamia.domain.jpa.BaseEntity;

import jakarta.persistence.Entity;
Expand All @@ -29,7 +30,7 @@
@Table(name = "saas_charges")
public class AccountCharge extends BaseEntity {

@OneToOne
@ManyToOne
@NotNull
private Account account;
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AccountLog extends BaseEntity implements Transferable<AccountLogDTO
@Column(name = "logDate")
private Date date = new Date();

@OneToOne
@ManyToOne
@NotNull
private Account account;
private String ip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
@OrderBy("creationDate")
public class AccountPayment extends BaseEntity implements Transferable<AccountPaymentDTO> {

@OneToOne
@ManyToOne
@NotNull(message = "Select account")
private Account account;
@OneToOne
@ManyToOne
private AccountType type;
@NotEmpty(message = "Entrer payment reference")
private String reference;
Expand All @@ -60,7 +60,7 @@ public class AccountPayment extends BaseEntity implements Transferable<AccountPa
@Column(length = 2000)
private String paymentMethodDescription;
private boolean finished = true;
@OneToOne
@ManyToOne
@NotNull
private AccountPaymentMethod paymentMethod;
private BigDecimal resellerComission;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,41 @@

package tools.dynamia.modules.saas.domain;

import jakarta.persistence.*;
import org.hibernate.annotations.BatchSize;
import tools.dynamia.domain.contraints.NotEmpty;
import tools.dynamia.domain.jpa.BaseEntity;
import tools.dynamia.domain.jpa.ContactInfo;
import tools.dynamia.domain.util.DomainUtils;

import jakarta.persistence.Entity;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "saas_resellers")
@BatchSize(size = 20)
public class AccountReseller extends BaseEntity {


public static AccountReseller findByMainAccount(Long accountId){
return DomainUtils.lookupCrudService().findSingle(AccountReseller.class,"mainAccount.id",accountId);
}

@NotEmpty
private String name;
private String identification;
private String idType;
private ContactInfo contactInfo = new ContactInfo();
private boolean enabled;
private Long externalId;
@OneToOne
@ManyToOne
private Account mainAccount;
private double comissionRate;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true, mappedBy = "reseller")
private List<AccountResellerAgent> agents = new ArrayList<>();
@Temporal(TemporalType.DATE)
private Date startDate = new Date();
@Temporal(TemporalType.DATE)
private Date endDate = null;
@Column(length = 1000)
private String comments;


public String getName() {
Expand Down Expand Up @@ -74,7 +79,7 @@ public void setIdType(String idType) {
}

public ContactInfo getContactInfo() {
if(contactInfo==null){
if (contactInfo == null) {
contactInfo = new ContactInfo();
}
return contactInfo;
Expand Down Expand Up @@ -116,6 +121,38 @@ public void setComissionRate(double comissionRate) {
this.comissionRate = comissionRate;
}

public List<AccountResellerAgent> getAgents() {
return agents;
}

public void setAgents(List<AccountResellerAgent> agents) {
this.agents = agents;
}

public Date getStartDate() {
return startDate;
}

public void setStartDate(Date startDate) {
this.startDate = startDate;
}

public Date getEndDate() {
return endDate;
}

public void setEndDate(Date endDate) {
this.endDate = endDate;
}

public String getComments() {
return comments;
}

public void setComments(String comments) {
this.comments = comments;
}

@Override
public String toString() {
return name;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package tools.dynamia.modules.saas.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;
import tools.dynamia.domain.contraints.Email;
import tools.dynamia.domain.contraints.NotEmpty;
import tools.dynamia.domain.jpa.SimpleEntity;

import java.io.Serializable;

/**
* Entity representing an agent or seller for a reseller (AccountReseller).
* Contains basic contact information and a many-to-one relationship with AccountReseller.
* <p>
* Fields:
* <ul>
* <li>name: Agent's full name (required)</li>
* <li>email: Contact email</li>
* <li>phone: Contact phone number</li>
* <li>address: Contact address</li>
* <li>identification: Identification number or code</li>
* <li>reseller: Associated AccountReseller</li>
* </ul>
*/
@Entity
public class AccountResellerAgent extends SimpleEntity implements Serializable {


@NotEmpty(message = "Agent name is required")
private String name;

@Email
private String email;

@Column(length = 20)
private String phone;

@Column(length = 200)
private String address;

@Column(length = 50)
private String identification;

@ManyToOne(optional = false)
private AccountReseller reseller;


// Getters y setters

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public String getIdentification() {
return identification;
}

public void setIdentification(String identification) {
this.identification = identification;
}

public AccountReseller getReseller() {
return reseller;
}

public void setReseller(AccountReseller reseller) {
this.reseller = reseller;
}

@Override
public String toString() {
return name;
}
}
Loading