-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
352 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
api-schema/src/main/java/org/stellar/anchor/api/callback/SendEventRequestPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.stellar.anchor.api.callback; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.stellar.anchor.api.event.AnchorEvent; | ||
import org.stellar.anchor.api.platform.GetQuoteResponse; | ||
import org.stellar.anchor.api.platform.GetTransactionResponse; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SendEventRequestPayload { | ||
GetTransactionResponse transaction; | ||
GetQuoteResponse quote; | ||
|
||
/** | ||
* Creates a SendEventRequestPayload from an AnchorEvent. | ||
* | ||
* @param event | ||
* @return a SendEventRequestPayload | ||
*/ | ||
public static SendEventRequestPayload from(AnchorEvent event) { | ||
SendEventRequestPayload payload = new SendEventRequestPayload(); | ||
switch (event.getType()) { | ||
case QUOTE_CREATED: | ||
payload.setQuote(event.getQuote()); | ||
case TRANSACTION_CREATED: | ||
payload.setTransaction(event.getTransaction()); | ||
case TRANSACTION_ERROR: | ||
payload.setTransaction(event.getTransaction()); | ||
case TRANSACTION_STATUS_CHANGED: | ||
payload.setTransaction(event.getTransaction()); | ||
} | ||
return payload; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.