-
Notifications
You must be signed in to change notification settings - Fork 14
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 #116 from gocardless/template-changes
[MENG-527] Template changes
- Loading branch information
Showing
6 changed files
with
157 additions
and
5 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
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
67 changes: 67 additions & 0 deletions
67
src/main/java/com/gocardless/resources/TransferredMandate.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,67 @@ | ||
package com.gocardless.resources; | ||
|
||
/** | ||
* Represents a transferred mandate resource returned from the API. | ||
* | ||
* Mandates that have been transferred using Current Account Switch Service | ||
*/ | ||
public class TransferredMandate { | ||
private TransferredMandate() { | ||
// blank to prevent instantiation | ||
} | ||
|
||
private String encryptedCustomerBankDetails; | ||
private String encryptedDecryptionKey; | ||
private Links links; | ||
private String publicKeyId; | ||
|
||
/** | ||
* Encrypted customer bank account details, containing: `iban`, `account_holder_name`, | ||
* `swift_bank_code`, `swift_branch_code`, `swift_account_number` | ||
*/ | ||
public String getEncryptedCustomerBankDetails() { | ||
return encryptedCustomerBankDetails; | ||
} | ||
|
||
/** | ||
* Random AES-256 key used to encrypt bank account details, itself encrypted with your public | ||
* key. | ||
*/ | ||
public String getEncryptedDecryptionKey() { | ||
return encryptedDecryptionKey; | ||
} | ||
|
||
public Links getLinks() { | ||
return links; | ||
} | ||
|
||
/** | ||
* The ID of an RSA-2048 public key, from your JWKS, used to encrypt the AES key. | ||
*/ | ||
public String getPublicKeyId() { | ||
return publicKeyId; | ||
} | ||
|
||
public static class Links { | ||
private Links() { | ||
// blank to prevent instantiation | ||
} | ||
|
||
private String customerBankAccount; | ||
private String mandate; | ||
|
||
/** | ||
* The ID of the updated [customer_bank_account](#core-endpoints-customer-bank-accounts) | ||
*/ | ||
public String getCustomerBankAccount() { | ||
return customerBankAccount; | ||
} | ||
|
||
/** | ||
* The ID of the transferred mandate | ||
*/ | ||
public String getMandate() { | ||
return mandate; | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/com/gocardless/services/TransferredMandateService.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,76 @@ | ||
package com.gocardless.services; | ||
|
||
import com.gocardless.http.*; | ||
import com.gocardless.resources.TransferredMandate; | ||
import com.google.common.collect.ImmutableMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Service class for working with transferred mandate resources. | ||
* | ||
* Mandates that have been transferred using Current Account Switch Service | ||
*/ | ||
public class TransferredMandateService { | ||
private final HttpClient httpClient; | ||
|
||
/** | ||
* Constructor. Users of this library should have no need to call this - an instance of this | ||
* class can be obtained by calling | ||
* {@link com.gocardless.GoCardlessClient#transferredMandates() }. | ||
*/ | ||
public TransferredMandateService(HttpClient httpClient) { | ||
this.httpClient = httpClient; | ||
} | ||
|
||
/** | ||
* Returns new customer bank details for a mandate that's been recently transferred | ||
*/ | ||
public TransferredMandateTransferredMandatesRequest transferredMandates(String identity) { | ||
return new TransferredMandateTransferredMandatesRequest(httpClient, identity); | ||
} | ||
|
||
/** | ||
* Request class for {@link TransferredMandateService#transferredMandates }. | ||
* | ||
* Returns new customer bank details for a mandate that's been recently transferred | ||
*/ | ||
public static final class TransferredMandateTransferredMandatesRequest | ||
extends GetRequest<TransferredMandate> { | ||
@PathParam | ||
private final String identity; | ||
|
||
private TransferredMandateTransferredMandatesRequest(HttpClient httpClient, | ||
String identity) { | ||
super(httpClient); | ||
this.identity = identity; | ||
} | ||
|
||
public TransferredMandateTransferredMandatesRequest withHeader(String headerName, | ||
String headerValue) { | ||
this.addHeader(headerName, headerValue); | ||
return this; | ||
} | ||
|
||
@Override | ||
protected Map<String, String> getPathParams() { | ||
ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); | ||
params.put("identity", identity); | ||
return params.build(); | ||
} | ||
|
||
@Override | ||
protected String getPathTemplate() { | ||
return "transferred_mandates/:identity"; | ||
} | ||
|
||
@Override | ||
protected String getEnvelope() { | ||
return "transferred_mandates"; | ||
} | ||
|
||
@Override | ||
protected Class<TransferredMandate> getResponseClass() { | ||
return TransferredMandate.class; | ||
} | ||
} | ||
} |