3
0
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:
Andreas Schildbach 2014-04-13 15:16:05 +02:00 committed by Mike Hearn
parent 40d60306fa
commit 81f62db0e9
2 changed files with 8 additions and 3 deletions

View File

@ -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.
*

View File

@ -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);