Fix sendCoins. Tested and works in the ATM.
This commit is contained in:
parent
076071376b
commit
fc80a51176
|
@ -39,6 +39,7 @@ public class Potwallet implements IWallet {
|
||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
this.privateKey = privateKey;
|
this.privateKey = privateKey;
|
||||||
this.walletId = walletId;
|
this.walletId = walletId;
|
||||||
|
|
||||||
api = RestProxyFactory.createProxy(PotwalletAPI.class, "https://api.potwallet.com");
|
api = RestProxyFactory.createProxy(PotwalletAPI.class, "https://api.potwallet.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ public class Potwallet implements IWallet {
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
accessHash = generateHash(privateKey, "https://api.potwallet.com/v1/send", nonce);
|
accessHash = generateHash(privateKey, "https://api.potwallet.com/v1/send", nonce);
|
||||||
PotwalletResponse response = api.sendPots(publicKey, accessHash, nonce, destinationAddress, amount.stripTrailingZeros());
|
PotwalletResponse response = api.sendPots(publicKey, accessHash, nonce, new PotwalletSendRequest(destinationAddress, amount.stripTrailingZeros()));
|
||||||
if (response != null && response.getMessage() != null && response.getSuccess()) {
|
if (response != null && response.getMessage() != null && response.getSuccess()) {
|
||||||
return new String(response.getMessage());
|
return new String(response.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,5 @@ public interface PotwalletAPI {
|
||||||
@POST
|
@POST
|
||||||
@Path("/send")
|
@Path("/send")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
PotwalletResponse sendPots(@HeaderParam("Access-Public") String publicKey, @HeaderParam("Access-Hash") String accessHash, @HeaderParam("Access-Nonce") String nonce, @PathParam("address") String address, @PathParam("amount") BigDecimal amount) throws IOException;
|
PotwalletResponse sendPots(@HeaderParam("Access-Public") String publicKey, @HeaderParam("Access-Hash") String accessHash, @HeaderParam("Access-Nonce") String nonce, PotwalletSendRequest request) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.generalbytes.batm.server.extensions.extra.potcoin.wallets.potwallet;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class PotwalletSendRequest {
|
||||||
|
@JsonProperty("address")
|
||||||
|
String address;
|
||||||
|
|
||||||
|
@JsonProperty("amount")
|
||||||
|
BigDecimal amount;
|
||||||
|
|
||||||
|
public PotwalletSendRequest(String address, BigDecimal amount) {
|
||||||
|
this.address = address;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue