Skip to content

Commit

Permalink
Get payment by GUID
Browse files Browse the repository at this point in the history
  • Loading branch information
sda authored and DaniilSolovyov committed Jul 4, 2024
1 parent a6fbb4f commit c553405
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,39 @@
import com.untill.driver.IDriverContext;
import com.untill.driver.untillapi.IUntillApi;

import java.util.Optional;

/**
* UntillAPI for working with payments
*
* @see IUntillApi
* @see IDriverContext
*/
public interface IUntillPaymentsApi extends IUntillApi {

/**
* @param guid Payment GUID
* @return Returns ID of payment or null when payment not found by GUID
*/
Long getPaymentIdByGuid(String guid);

/**
* Retrieves a <tt>payment</tt> based on the provided unique identifier (GUID).
*
* @param guid the unique identifier for the <tt>payment</tt> to be retrieved.
* @return an optional containing the <tt>payment</tt> if found, or an empty optional if not found.
*
* <p>Example usage:</p>
* <pre>
* {@code
* Optional<Payment> optional = paymentService.getPaymentByGuid("some-guid");
* if (optional.isPresent()) {
* Payment payment = optional.get();
* // Process payment
* } else {
* // Handle case where payment is not found
* }
* }
* </pre>
*/
Optional<Payment> getPaymentByGuid(String guid);
}
40 changes: 40 additions & 0 deletions src/main/java/com/untill/driver/untillapi/payments/Payment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.untill.driver.untillapi.payments;

public class Payment {
private long id;
private String name;
private int kind;
private String guid;

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getName() {
return name;
}

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

public int getKind() {
return kind;
}

public void setKind(int kind) {
this.kind = kind;
}

public String getGuid() {
return guid;
}

public void setGuid(String guid) {
this.guid = guid;
}
}

0 comments on commit c553405

Please sign in to comment.