0% found this document useful (0 votes)
14 views

LetterOfCredit

Uploaded by

Dineshkumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

LetterOfCredit

Uploaded by

Dineshkumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

package LCfinance;

import com.owlike.genson.annotation.JsonProperty;
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

import java.util.Objects;

@DataType()
public final class LetterOfCredit {

@Property()
private final String id;

@Property()
private final String expiryDate;

@Property()
private final String buyer;

@Property()
private final String bank;

@Property()
private final String seller;

@Property()
private final double amount;

@Property()
private String status;

public String getId() {


return id;
}

public String getExpiryDate() {


return expiryDate;
}

public String getBuyer() {


return buyer;
}

public String getBank() {


return bank;
}
public String getSeller() {
return seller;
}

public double getAmount() {


return amount;
}

public String getStatus() {


return status;
}

// Setter method for updating the status


public void setStatus(String status) {
this.status = status;
}

public LetterOfCredit(@JsonProperty("id") final String id,


@JsonProperty("expiryDate") final String expiryDate,
@JsonProperty("buyer") final String buyer,
@JsonProperty("bank") final String bank,
@JsonProperty("seller") final String seller,
@JsonProperty("amount") final double amount,
@JsonProperty("status") final String status
){
this.id = id;
this.expiryDate = expiryDate;
this.buyer = buyer;
this.bank = bank;
this.seller = seller;
this.amount = amount;
this.status = status;
}

@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}

if ((obj == null) || (getClass() != obj.getClass())) {


return false;
}

LetterOfCredit other = (LetterOfCredit) obj;


return Objects.deepEquals(new String[]{getId(), getExpiryDate(), getBuyer(),
getBank(), getSeller()},
new String[]{other.getId(), other.getExpiryDate(), other.getBuyer(),
other.getBank(), other.getSeller()});
}

@Override
public int hashCode() {
return Objects.hash(getId(), getExpiryDate(), getBuyer(), getBank(), getSeller());
}

@Override
public String toString() {
return this.getClass().getSimpleName() + "@" + Integer.toHexString(hashCode())
+ " [id=" + id + ", expiryDate=" + expiryDate + ", buyer=" + buyer + ", bank=" +
bank + ", seller=" + seller
+ ", amount=" + amount + ", status=" + status + "]";
}
}

You might also like