mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
Move BIP71 MIME types to PaymentProtocol class.
This commit is contained in:
parent
40d60306fa
commit
81f62db0e9
@ -51,6 +51,11 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
||||
|
||||
public class PaymentProtocol {
|
||||
|
||||
// MIME types as defined in BIP71.
|
||||
public static final String MIMETYPE_PAYMENTREQUEST = "application/bitcoin-paymentrequest";
|
||||
public static final String MIMETYPE_PAYMENT = "application/bitcoin-payment";
|
||||
public static final String MIMETYPE_PAYMENTACK = "application/bitcoin-paymentack";
|
||||
|
||||
/**
|
||||
* Sign the provided payment request.
|
||||
*
|
||||
|
@ -176,7 +176,7 @@ public class PaymentSession {
|
||||
@Override
|
||||
public PaymentSession call() throws Exception {
|
||||
HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection();
|
||||
connection.setRequestProperty("Accept", "application/bitcoin-paymentrequest");
|
||||
connection.setRequestProperty("Accept", PaymentProtocol.MIMETYPE_PAYMENTREQUEST);
|
||||
connection.setUseCaches(false);
|
||||
Protos.PaymentRequest paymentRequest = Protos.PaymentRequest.parseFrom(connection.getInputStream());
|
||||
return new PaymentSession(paymentRequest, verifyPki, trustStoreLoader);
|
||||
@ -359,8 +359,8 @@ public class PaymentSession {
|
||||
public Ack call() throws Exception {
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/bitcoin-payment");
|
||||
connection.setRequestProperty("Accept", "application/bitcoin-paymentack");
|
||||
connection.setRequestProperty("Content-Type", PaymentProtocol.MIMETYPE_PAYMENT);
|
||||
connection.setRequestProperty("Accept", PaymentProtocol.MIMETYPE_PAYMENTACK);
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(payment.getSerializedSize()));
|
||||
connection.setUseCaches(false);
|
||||
connection.setDoInput(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user