mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 01:40:13 +01:00
Support for advertising payment addresses on profile
This commit is contained in:
@@ -55,6 +55,7 @@ import org.whispersystems.textsecuregcm.storage.Account;
|
||||
import org.whispersystems.textsecuregcm.storage.AccountsManager;
|
||||
import org.whispersystems.textsecuregcm.storage.Device;
|
||||
import org.whispersystems.textsecuregcm.storage.MessagesManager;
|
||||
import org.whispersystems.textsecuregcm.storage.PaymentAddressList;
|
||||
import org.whispersystems.textsecuregcm.storage.PendingAccountsManager;
|
||||
import org.whispersystems.textsecuregcm.storage.UsernamesManager;
|
||||
import org.whispersystems.textsecuregcm.util.Constants;
|
||||
@@ -514,6 +515,16 @@ public class AccountController {
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@PUT
|
||||
@Path("/payments")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public void setPayments(@Auth Account account, @Valid PaymentAddressList payments) {
|
||||
account.setPayments(payments.getPayments());
|
||||
accounts.update(account);
|
||||
}
|
||||
|
||||
private CaptchaRequirement requiresCaptcha(String number, String transport, String forwardedFor,
|
||||
String requester,
|
||||
Optional<String> captchaToken,
|
||||
@@ -608,6 +619,7 @@ public class AccountController {
|
||||
setAccountRegistrationLockFromAttributes(account, accountAttributes);
|
||||
account.setUnidentifiedAccessKey(accountAttributes.getUnidentifiedAccessKey());
|
||||
account.setUnrestrictedUnidentifiedAccess(accountAttributes.isUnrestrictedUnidentifiedAccess());
|
||||
account.setPayments(accountAttributes.getPayments());
|
||||
|
||||
if (accounts.create(account)) {
|
||||
newUserMeter.mark();
|
||||
|
||||
@@ -200,7 +200,9 @@ public class ProfileController {
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
new UserCapabilities(accountProfile.get().isUuidAddressingSupported(), accountProfile.get().isGroupsV2Supported()),
|
||||
username.orElse(null),
|
||||
null, credential.orElse(null)));
|
||||
null,
|
||||
credential.orElse(null),
|
||||
accountProfile.get().getPayments()));
|
||||
} catch (InvalidInputException e) {
|
||||
logger.info("Bad profile request", e);
|
||||
throw new WebApplicationException(Response.Status.BAD_REQUEST);
|
||||
@@ -236,7 +238,9 @@ public class ProfileController {
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
new UserCapabilities(accountProfile.get().isUuidAddressingSupported(), accountProfile.get().isGroupsV2Supported()),
|
||||
username,
|
||||
accountProfile.get().getUuid(), null);
|
||||
accountProfile.get().getUuid(),
|
||||
null,
|
||||
accountProfile.get().getPayments());
|
||||
}
|
||||
|
||||
private Optional<ProfileKeyCredentialResponse> getProfileCredential(Optional<String> encodedProfileCredentialRequest,
|
||||
@@ -307,7 +311,9 @@ public class ProfileController {
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
new UserCapabilities(accountProfile.get().isUuidAddressingSupported(), accountProfile.get().isGroupsV2Supported()),
|
||||
username.orElse(null),
|
||||
null, null);
|
||||
null,
|
||||
null,
|
||||
accountProfile.get().getPayments());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user