Skip to content

Commit

Permalink
feat: qr code paying
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdev01 committed Apr 7, 2024
1 parent e048edd commit 2f11be4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/pix_transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ Transfer transfer = Transfer.pixManualCreator()
.create();
```

## Pagar um QR Code Pix
```java
final String examplePayload = "00020101021226730014br.gov.bcb.pix2551pix-h.asaas.com/pixqrcode/cobv/pay_76575613967995145204000053039865802BR5905ASAAS6009Joinville61088922827162070503***63045E7A";
PixTransaction pixTransactionQrCodeCreator = PixTransaction
.qrCodeCreator()
.setPayload(examplePayload)
.setValue(Money.create(new BigDecimal(10.0)))
.create();
```

## Listar transações Pix
```java
ResourceSet<PixTransaction> pixTransactionResourceSet = PixTransaction.reader().read();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/github/jpdev/asaassdk/http/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum Domain {
REFUND_PAYMENT("payments/$id/refund"),
PIX_TRANSACTION("pix/transactions"),
PIX_TRANSACTION_CANCELLATION("pix/transactions/$id/cancel"),
PIX_TRANSACTION_QR_CODE("pix/qrCodes/pay"),
PIX_ADDRESS_KEY("pix/addressKeys"),
STATIC_PIX_QR_CODE("pix/qrCodes/static"),
DECODE_PIX_QR_CODE("pix/qrCodes/decode"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ public static PixTransactionCanceller canceller(String id) {
public static PixTransactionFetcher fetcher(Object id) {
return new PixTransactionFetcher(id);
}

public static PixTransactionQrCodeCreator qrCodeCreator() {
return new PixTransactionQrCodeCreator();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.github.jpdev.asaassdk.rest.pix.transaction;

import io.github.jpdev.asaassdk.http.Domain;
import io.github.jpdev.asaassdk.rest.action.Creator;
import io.github.jpdev.asaassdk.rest.pix.transaction.children.QrCode;

import java.math.BigDecimal;

public class PixTransactionQrCodeCreator extends Creator<PixTransaction> {

private QrCode qrCode;
private BigDecimal value;

public BigDecimal getValue() {
return value;
}

public PixTransactionQrCodeCreator setValue(BigDecimal value) {
this.value = value;
return this;
}

public PixTransactionQrCodeCreator setPayload(String payload) {
this.qrCode = new QrCode().setPayload(payload);
return this;
}

public QrCode getQrCode() {
return qrCode;
}

public String getResourceUrl() {
return Domain.PIX_TRANSACTION_QR_CODE.toString();
}

public Class<PixTransaction> getResourceClass() {
return PixTransaction.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.jpdev.asaassdk.rest.pix.transaction.children;

public class QrCode {

public String payload;

public String getPayload() {
return payload;
}

public QrCode setPayload(String payload) {
this.payload = payload;
return this;
}
}

0 comments on commit 2f11be4

Please sign in to comment.