-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from Mangopay/feature/deposits-endpoints
Feature/deposits endpoints
- Loading branch information
Showing
18 changed files
with
970 additions
and
47 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.mangopay.core.APIs; | ||
|
||
import com.mangopay.entities.Deposit; | ||
import com.mangopay.entities.subentities.CreateDeposit; | ||
|
||
public interface DepositApi { | ||
Deposit create(CreateDeposit deposit, String idempotencyKey) throws Exception; | ||
|
||
Deposit get(String depositId) throws Exception; | ||
|
||
Deposit cancel(String depositId) throws Exception; | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/mangopay/core/APIs/implementation/DepositApiImpl.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,33 @@ | ||
package com.mangopay.core.APIs.implementation; | ||
|
||
import com.mangopay.MangoPayApi; | ||
import com.mangopay.core.APIs.ApiBase; | ||
import com.mangopay.core.APIs.DepositApi; | ||
import com.mangopay.core.enumerations.PaymentStatus; | ||
import com.mangopay.entities.Deposit; | ||
import com.mangopay.entities.subentities.CancelDeposit; | ||
import com.mangopay.entities.subentities.CreateDeposit; | ||
|
||
public class DepositApiImpl extends ApiBase implements DepositApi { | ||
public DepositApiImpl(MangoPayApi root) { | ||
super(root); | ||
} | ||
|
||
@Override | ||
public Deposit create(CreateDeposit deposit, String idempotencyKey) throws Exception { | ||
return this.createObject(Deposit.class, idempotencyKey, "deposits_create", deposit); | ||
} | ||
|
||
@Override | ||
public Deposit get(String depositId) throws Exception { | ||
return this.getObject(Deposit.class, "deposits_get", depositId); | ||
} | ||
|
||
@Override | ||
public Deposit cancel(String depositId) throws Exception { | ||
CancelDeposit dto = new CancelDeposit(); | ||
dto.setPaymentStatus(PaymentStatus.CANCELED); | ||
|
||
return this.updateObject(Deposit.class, "deposits_cancel", dto, depositId); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/mangopay/core/enumerations/DepositStatus.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,12 @@ | ||
package com.mangopay.core.enumerations; | ||
|
||
/** | ||
* Business type enumeration | ||
*/ | ||
public enum DepositStatus { | ||
CREATED, | ||
|
||
SUCCEEDED, | ||
|
||
FAILED | ||
} |
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
176 changes: 176 additions & 0 deletions
176
src/main/java/com/mangopay/entities/CardPreAuthorizedDepositPayIn.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,176 @@ | ||
package com.mangopay.entities; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.mangopay.core.EntityBase; | ||
import com.mangopay.core.Money; | ||
import com.mangopay.core.enumerations.*; | ||
|
||
public class CardPreAuthorizedDepositPayIn extends EntityBase { | ||
@SerializedName("AuthorId") | ||
private String authorId; | ||
|
||
@SerializedName("CreditedUserId") | ||
private String creditedUserId; | ||
|
||
@SerializedName("DepositId") | ||
private String depositId; | ||
|
||
@SerializedName("ResultCode") | ||
private String resultCode; | ||
|
||
@SerializedName("ResultMessage") | ||
private String resultMessage; | ||
|
||
@SerializedName("Status") | ||
private TransactionStatus status; | ||
|
||
@SerializedName("ExecutionDate") | ||
private Long executionDate; | ||
|
||
@SerializedName("Type") | ||
private TransactionType type; | ||
|
||
@SerializedName("Nature") | ||
private TransactionNature nature; | ||
|
||
@SerializedName("PaymentType") | ||
private PayInPaymentType paymentType; | ||
|
||
@SerializedName("ExecutionType") | ||
private PayInExecutionType executionType; | ||
|
||
@SerializedName("DebitedFunds") | ||
private Money debitedFunds; | ||
|
||
@SerializedName("CreditedFunds") | ||
private Money creditedFunds; | ||
|
||
@SerializedName("Fees") | ||
private Money fees; | ||
|
||
public String getAuthorId() { | ||
return authorId; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setAuthorId(String authorId) { | ||
this.authorId = authorId; | ||
return this; | ||
} | ||
|
||
public String getCreditedUserId() { | ||
return creditedUserId; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setCreditedUserId(String creditedUserId) { | ||
this.creditedUserId = creditedUserId; | ||
return this; | ||
} | ||
|
||
public String getDepositId() { | ||
return depositId; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setDepositId(String depositId) { | ||
this.depositId = depositId; | ||
return this; | ||
} | ||
|
||
public String getResultCode() { | ||
return resultCode; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setResultCode(String resultCode) { | ||
this.resultCode = resultCode; | ||
return this; | ||
} | ||
|
||
public String getResultMessage() { | ||
return resultMessage; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setResultMessage(String resultMessage) { | ||
this.resultMessage = resultMessage; | ||
return this; | ||
} | ||
|
||
public TransactionStatus getStatus() { | ||
return status; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setStatus(TransactionStatus status) { | ||
this.status = status; | ||
return this; | ||
} | ||
|
||
public Long getExecutionDate() { | ||
return executionDate; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setExecutionDate(Long executionDate) { | ||
this.executionDate = executionDate; | ||
return this; | ||
} | ||
|
||
public TransactionType getType() { | ||
return type; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setType(TransactionType type) { | ||
this.type = type; | ||
return this; | ||
} | ||
|
||
public TransactionNature getNature() { | ||
return nature; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setNature(TransactionNature nature) { | ||
this.nature = nature; | ||
return this; | ||
} | ||
|
||
public PayInPaymentType getPaymentType() { | ||
return paymentType; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setPaymentType(PayInPaymentType paymentType) { | ||
this.paymentType = paymentType; | ||
return this; | ||
} | ||
|
||
public PayInExecutionType getExecutionType() { | ||
return executionType; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setExecutionType(PayInExecutionType executionType) { | ||
this.executionType = executionType; | ||
return this; | ||
} | ||
|
||
public Money getDebitedFunds() { | ||
return debitedFunds; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setDebitedFunds(Money debitedFunds) { | ||
this.debitedFunds = debitedFunds; | ||
return this; | ||
} | ||
|
||
public Money getCreditedFunds() { | ||
return creditedFunds; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setCreditedFunds(Money creditedFunds) { | ||
this.creditedFunds = creditedFunds; | ||
return this; | ||
} | ||
|
||
public Money getFees() { | ||
return fees; | ||
} | ||
|
||
public CardPreAuthorizedDepositPayIn setFees(Money fees) { | ||
this.fees = fees; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.