Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions src/acpJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class AcpJob {
}

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -171,9 +172,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.TRANSACTION,
type,
expiredAt,
Expand Down Expand Up @@ -241,11 +240,13 @@ class AcpJob {
)
);

const x402PaymentDetails =
await this.acpContractClient.getX402PaymentDetails(this.id);
if (this.price > 0) {
const x402PaymentDetails =
await this.acpContractClient.getX402PaymentDetails(this.id);

if (x402PaymentDetails.isX402) {
await this.performX402Payment(this.price);
if (x402PaymentDetails.isX402) {
await this.performX402Payment(this.price);
}
}

return await this.acpContractClient.handleOperation(operations);
Expand Down Expand Up @@ -371,7 +372,8 @@ class AcpJob {
);

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE && !skipFee;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE && !skipFee;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -382,9 +384,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.COMPLETED,
MemoType.PAYABLE_TRANSFER,
expiredAt,
Expand Down Expand Up @@ -437,7 +437,8 @@ class AcpJob {
);

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE && !skipFee;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE && !skipFee;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -448,9 +449,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.COMPLETED,
MemoType.PAYABLE_NOTIFICATION,
expiredAt,
Expand Down