From 8fca2354e49f739863b72a88ccaef5587a647f40 Mon Sep 17 00:00:00 2001 From: gabrielstoica Date: Fri, 15 Nov 2024 16:13:17 +0200 Subject: [PATCH] chore: rename left 'Invoice*' docs/methods to 'Payment*' --- src/modules/payment-module/PaymentModule.sol | 2 +- .../payment-module/libraries/Errors.sol | 2 +- .../payment-module/libraries/Helpers.sol | 2 +- .../transfer-from/transferFrom.t.sol | 4 +-- .../cancel-request/cancelRequest.t.sol | 30 +++++++++---------- .../create-request/createRequest.t.sol | 4 +-- .../pay-request/payRequest.t.sol | 28 ++++++++--------- .../pay-request/payRequest.tree | 2 +- .../withdrawRequestStream.t.sol} | 6 ++-- .../withdrawRequestStream.tree} | 2 +- test/integration/fuzz/payRequest.t.sol | 6 ++-- test/integration/shared/cancelRequest.t.sol | 14 +-------- test/integration/shared/createRequest.t.sol | 4 +-- test/integration/shared/payRequest.t.sol | 2 +- test/utils/Errors.sol | 2 +- test/utils/Helpers.sol | 6 ++-- 16 files changed, 52 insertions(+), 64 deletions(-) rename test/integration/concrete/payment-module/{withdraw-invoice-stream/withdrawStream.t.sol => withdraw-request-stream/withdrawRequestStream.t.sol} (94%) rename test/integration/concrete/payment-module/{withdraw-invoice-stream/withdrawStream.tree => withdraw-request-stream/withdrawRequestStream.tree} (93%) diff --git a/src/modules/payment-module/PaymentModule.sol b/src/modules/payment-module/PaymentModule.sol index c3b74faa..2670b55f 100644 --- a/src/modules/payment-module/PaymentModule.sol +++ b/src/modules/payment-module/PaymentModule.sol @@ -301,7 +301,7 @@ contract PaymentModule is IPaymentModule, StreamManager { if (request.config.asset == address(0)) { // Checks: the payment amount matches the request value if (msg.value < request.config.amount) { - revert Errors.PaymentAmountLessThanInvoiceValue({ amount: request.config.amount }); + revert Errors.PaymentAmountLessThanRequestedAmount({ amount: request.config.amount }); } // Interactions: pay the recipient with native token (ETH) diff --git a/src/modules/payment-module/libraries/Errors.sol b/src/modules/payment-module/libraries/Errors.sol index 63aa0887..e4cefdf3 100644 --- a/src/modules/payment-module/libraries/Errors.sol +++ b/src/modules/payment-module/libraries/Errors.sol @@ -24,7 +24,7 @@ library Errors { error ZeroPaymentAmount(); /// @notice Thrown when the payment amount is less than the payment request value - error PaymentAmountLessThanInvoiceValue(uint256 amount); + error PaymentAmountLessThanRequestedAmount(uint256 amount); /// @notice Thrown when a payment in the native token (ETH) fails error NativeTokenPaymentFailed(); diff --git a/src/modules/payment-module/libraries/Helpers.sol b/src/modules/payment-module/libraries/Helpers.sol index d32d36bd..56d430fb 100644 --- a/src/modules/payment-module/libraries/Helpers.sol +++ b/src/modules/payment-module/libraries/Helpers.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.26; import { Types } from "./Types.sol"; /// @title Helpers -/// @notice Library with helpers used across the {InvoiceModule} contract +/// @notice Library with helpers used across the {PaymentModule} contract library Helpers { /// @dev Calculates the number of payments that must be done for a recurring transfer or tranched stream paymentRequest /// Notes: diff --git a/test/integration/concrete/invoice-module/transfer-from/transferFrom.t.sol b/test/integration/concrete/invoice-module/transfer-from/transferFrom.t.sol index 798a126c..c055d311 100644 --- a/test/integration/concrete/invoice-module/transfer-from/transferFrom.t.sol +++ b/test/integration/concrete/invoice-module/transfer-from/transferFrom.t.sol @@ -28,7 +28,7 @@ contract TransferFrom_Integration_Concret_Test is TransferFrom_Integration_Share // Make Bob the payer for the payment request vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].payment.amount }); // Pay the payment request @@ -47,7 +47,7 @@ contract TransferFrom_Integration_Concret_Test is TransferFrom_Integration_Share // Make Eve's space the caller which is the recipient of the payment request vm.startPrank({ msgSender: address(space) }); - // Approve the {InvoiceModule} to transfer the `streamId` stream on behalf of the Eve's space + // Approve the {PaymentModule} to transfer the `streamId` stream on behalf of the Eve's space sablierV2LockupLinear.approve({ to: address(paymentModule), tokenId: streamId }); // Run the test diff --git a/test/integration/concrete/payment-module/cancel-request/cancelRequest.t.sol b/test/integration/concrete/payment-module/cancel-request/cancelRequest.t.sol index 626f8304..986bc67c 100644 --- a/test/integration/concrete/payment-module/cancel-request/cancelRequest.t.sol +++ b/test/integration/concrete/payment-module/cancel-request/cancelRequest.t.sol @@ -11,7 +11,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha CancelRequest_Integration_Shared_Test.setUp(); } - function test_RevertWhen_InvoiceIsPaid() external { + function test_RevertWhen_PaymentIsPaid() external { // Set the one-off ETH transfer payment request as current one uint256 paymentRequestId = 2; @@ -50,7 +50,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha paymentModule.cancelRequest({ requestId: paymentRequestId }); } - function test_RevertWhen_PaymentMethodTransfer_SenderNotInvoiceRecipient() + function test_RevertWhen_PaymentMethodTransfer_SenderNotPaymentRecipient() external whenRequestNotAlreadyPaid whenRequestNotCanceled @@ -74,7 +74,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha whenRequestNotAlreadyPaid whenRequestNotCanceled givenPaymentMethodTransfer - whenSenderInvoiceRecipient + whenRequestSenderRecipient { // Set the one-off ETH transfer payment request as current one uint256 paymentRequestId = 2; @@ -94,12 +94,12 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha assertEq(uint8(paymentRequestStatus), uint8(Types.Status.Canceled)); } - function test_RevertWhen_PaymentMethodLinearStream_StatusPending_SenderNotInvoiceRecipient() + function test_RevertWhen_PaymentMethodLinearStream_StatusPending_SenderNotPaymentRecipient() external whenRequestNotAlreadyPaid whenRequestNotCanceled givenPaymentMethodLinearStream - givenInvoiceStatusPending + givenRequestStatusPending { // Set current paymentRequest as a linear stream-based one uint256 paymentRequestId = 5; @@ -119,8 +119,8 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha whenRequestNotAlreadyPaid whenRequestNotCanceled givenPaymentMethodLinearStream - givenInvoiceStatusPending - whenSenderInvoiceRecipient + givenRequestStatusPending + whenRequestSenderRecipient { // Set current paymentRequest as a linear stream-based one uint256 paymentRequestId = 5; @@ -154,7 +154,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha // Make Bob the payer of the payment request (also Bob will be the stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) @@ -187,7 +187,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha // Make Bob the payer of the payment request (also Bob will be the initial stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) @@ -210,12 +210,12 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha assertEq(uint8(paymentRequestStatus), uint8(Types.Status.Canceled)); } - function test_RevertWhen_PaymentMethodTranchedStream_StatusPending_SenderNotInvoiceRecipient() + function test_RevertWhen_PaymentMethodTranchedStream_StatusPending_SenderNotPaymentRecipient() external whenRequestNotAlreadyPaid whenRequestNotCanceled givenPaymentMethodTranchedStream - givenInvoiceStatusPending + givenRequestStatusPending { // Set current paymentRequest as a tranched stream-based one uint256 paymentRequestId = 5; @@ -235,8 +235,8 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha whenRequestNotAlreadyPaid whenRequestNotCanceled givenPaymentMethodTranchedStream - givenInvoiceStatusPending - whenSenderInvoiceRecipient + givenRequestStatusPending + whenRequestSenderRecipient { // Set current paymentRequest as a tranched stream-based one uint256 paymentRequestId = 5; @@ -270,7 +270,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha // Make Bob the payer of the payment request (also Bob will be the stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) @@ -303,7 +303,7 @@ contract CancelRequest_Integration_Concret_Test is CancelRequest_Integration_Sha // Make Bob the payer of the payment request (also Bob will be the initial stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) diff --git a/test/integration/concrete/payment-module/create-request/createRequest.t.sol b/test/integration/concrete/payment-module/create-request/createRequest.t.sol index dacd5923..83a8bbd2 100644 --- a/test/integration/concrete/payment-module/create-request/createRequest.t.sol +++ b/test/integration/concrete/payment-module/create-request/createRequest.t.sol @@ -203,7 +203,7 @@ contract CreateRequest_Integration_Concret_Test is CreateRequest_Integration_Sha // Create a recurring transfer payment request that must be paid on a monthly basis // Hence, the interval between the start and end time must be at least 1 month paymentRequest = - createInvoiceWithRecurringTransfer({ recurrence: Types.Recurrence.Monthly, recipient: address(space) }); + createPaymentWithRecurringTransfer({ recurrence: Types.Recurrence.Monthly, recipient: address(space) }); // Alter the end time to be 3 weeks from now paymentRequest.endTime = uint40(block.timestamp) + 3 weeks; @@ -236,7 +236,7 @@ contract CreateRequest_Integration_Concret_Test is CreateRequest_Integration_Sha // Create a recurring transfer payment request that must be paid on weekly basis paymentRequest = - createInvoiceWithRecurringTransfer({ recurrence: Types.Recurrence.Weekly, recipient: address(space) }); + createPaymentWithRecurringTransfer({ recurrence: Types.Recurrence.Weekly, recipient: address(space) }); // Create the calldata for the Payment Module execution bytes memory data = abi.encodeWithSignature( diff --git a/test/integration/concrete/payment-module/pay-request/payRequest.t.sol b/test/integration/concrete/payment-module/pay-request/payRequest.t.sol index 834734fc..c10e2782 100644 --- a/test/integration/concrete/payment-module/pay-request/payRequest.t.sol +++ b/test/integration/concrete/payment-module/pay-request/payRequest.t.sol @@ -8,7 +8,7 @@ import { Errors } from "../../../../utils/Errors.sol"; import { LockupLinear, LockupTranched } from "@sablier/v2-core/src/types/DataTypes.sol"; -contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Test { +contract PayPayment_Integration_Concret_Test is PayRequest_Integration_Shared_Test { function setUp() public virtual override { PayRequest_Integration_Shared_Test.setUp(); } @@ -28,7 +28,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te // Make Bob the payer for the default paymentRequest vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the ERC-20 token on Bob's behalf + // Approve the {PaymentModule} to transfer the ERC-20 token on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay first the payment request @@ -61,7 +61,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te paymentModule.payRequest({ requestId: paymentRequestId }); } - function test_RevertWhen_PaymentMethodTransfer_PaymentAmountLessThanInvoiceValue() + function test_RevertWhen_PaymentMethodTransfer_PaymentAmountLessThanRequestedAmount() external whenRequestNotNull whenRequestNotAlreadyPaid @@ -75,10 +75,10 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te // Make Bob the payer for the default paymentRequest vm.startPrank({ msgSender: users.bob }); - // Expect the call to be reverted with the {PaymentAmountLessThanInvoiceValue} error + // Expect the call to be reverted with the {PaymentAmountLessThanRequestedAmount} error vm.expectRevert( abi.encodeWithSelector( - Errors.PaymentAmountLessThanInvoiceValue.selector, paymentRequests[paymentRequestId].config.amount + Errors.PaymentAmountLessThanRequestedAmount.selector, paymentRequests[paymentRequestId].config.amount ) ); @@ -95,7 +95,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te whenRequestNotCanceled givenPaymentMethodTransfer givenPaymentAmountInNativeToken - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue { // Create a mock payment request with a one-off ETH transfer from the Eve's space Types.PaymentRequest memory paymentRequest = @@ -107,7 +107,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te // Make Eve's space the caller for the next call to approve & transfer the payment request NFT to a bad receiver //vm.startPrank({ msgSender: address(space) }); - // Approve the {InvoiceModule} to transfer the token + // Approve the {PaymentModule} to transfer the token //paymentModule.approve({ to: address(paymentModule), tokenrequestId: paymentRequestId }); // Transfer the payment request to a bad receiver so we can test against `NativeTokenPaymentFailed` @@ -130,7 +130,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te whenRequestNotCanceled givenPaymentMethodTransfer givenPaymentAmountInNativeToken - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue whenNativeTokenPaymentSucceeds { // Set the one-off ETH transfer payment request as current one @@ -182,7 +182,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te whenRequestNotCanceled givenPaymentMethodTransfer givenPaymentAmountInERC20Tokens - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue { // Set the recurring USDT transfer payment request as current one uint256 paymentRequestId = 3; @@ -194,7 +194,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te uint256 balanceOfBobBefore = usdt.balanceOf(users.bob); uint256 balanceOfRecipientBefore = usdt.balanceOf(address(space)); - // Approve the {InvoiceModule} to transfer the ERC-20 tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the ERC-20 tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Expect the {RequestPaid} event to be emitted @@ -238,7 +238,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te whenRequestNotCanceled givenPaymentMethodLinearStream givenPaymentAmountInERC20Tokens - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue { // Set the linear USDT stream-based paymentRequest as current one uint256 paymentRequestId = 4; @@ -246,7 +246,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te // Make Bob the payer for the default paymentRequest vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the ERC-20 tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the ERC-20 tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Expect the {RequestPaid} event to be emitted @@ -293,7 +293,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te whenRequestNotCanceled givenPaymentMethodTranchedStream givenPaymentAmountInERC20Tokens - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue { // Set the tranched USDT stream-based paymentRequest as current one uint256 paymentRequestId = 5; @@ -301,7 +301,7 @@ contract PayInvoice_Integration_Concret_Test is PayRequest_Integration_Shared_Te // Make Bob the payer for the default paymentRequest vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the ERC-20 tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the ERC-20 tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Expect the {RequestPaid} event to be emitted diff --git a/test/integration/concrete/payment-module/pay-request/payRequest.tree b/test/integration/concrete/payment-module/pay-request/payRequest.tree index 37b8e807..40c7ccca 100644 --- a/test/integration/concrete/payment-module/pay-request/payRequest.tree +++ b/test/integration/concrete/payment-module/pay-request/payRequest.tree @@ -11,7 +11,7 @@ payRequest.t.sol ├── given the payment method is transfer │ ├── given the payment amount is in native token (ETH) │ │ ├── when the payment amount is less than the payment request value - │ │ │ └── it should revert with the {PaymentAmountLessThanInvoiceValue} error + │ │ │ └── it should revert with the {PaymentAmountLessThanRequestedAmount} error │ │ └── when the payment amount IS equal to the payment request value │ │ ├── when the native token transfer fails │ │ │ └── it should revert with the {NativeTokenPaymentFailed} error diff --git a/test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.t.sol b/test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.t.sol similarity index 94% rename from test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.t.sol rename to test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.t.sol index 68b4cf40..bcdb4433 100644 --- a/test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.t.sol +++ b/test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.26; import { WithdrawLinearStream_Integration_Shared_Test } from "../../../shared/withdrawLinearStream.t.sol"; import { Types } from "./../../../../../src/modules/payment-module/libraries/Types.sol"; -contract WithdrawLinearStream_Integration_Concret_Test is WithdrawLinearStream_Integration_Shared_Test { +contract WithdrawRequestStream_Integration_Concret_Test is WithdrawLinearStream_Integration_Shared_Test { function setUp() public virtual override { WithdrawLinearStream_Integration_Shared_Test.setUp(); } @@ -18,7 +18,7 @@ contract WithdrawLinearStream_Integration_Concret_Test is WithdrawLinearStream_I // Make Bob the payer of the payment request (also Bob will be the initial stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) @@ -55,7 +55,7 @@ contract WithdrawLinearStream_Integration_Concret_Test is WithdrawLinearStream_I // Make Bob the payer of the payment request (also Bob will be the initial stream sender) vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on Bob's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on Bob's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequests[paymentRequestId].config.amount }); // Pay the payment request first (status will be updated to `Accepted`) diff --git a/test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.tree b/test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.tree similarity index 93% rename from test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.tree rename to test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.tree index fde0e5d0..d80b2f70 100644 --- a/test/integration/concrete/payment-module/withdraw-invoice-stream/withdrawStream.tree +++ b/test/integration/concrete/payment-module/withdraw-request-stream/withdrawRequestStream.tree @@ -1,4 +1,4 @@ -withdrawStream.t.sol +withdrawRequestStream.t.sol ├── given the payment method is linear stream │ └── given the payment request status is Ongoing │ └── it should allow the payment request recipient to withdraw from the stream diff --git a/test/integration/fuzz/payRequest.t.sol b/test/integration/fuzz/payRequest.t.sol index 7caeb262..2e1652fb 100644 --- a/test/integration/fuzz/payRequest.t.sol +++ b/test/integration/fuzz/payRequest.t.sol @@ -26,7 +26,7 @@ contract PayRequest_Integration_Fuzz_Test is PayRequest_Integration_Shared_Test whenRequestNotCanceled givenPaymentMethodTransfer givenPaymentAmountInNativeToken - whenPaymentAmountEqualToInvoiceValue + whenPaymentAmountEqualToPaymentValue whenNativeTokenPaymentSucceeds { // Discard bad fuzz inputs @@ -59,7 +59,7 @@ contract PayRequest_Integration_Fuzz_Test is PayRequest_Integration_Shared_Test }) }); - // Create the calldata for the {InvoiceModule} execution + // Create the calldata for the {PaymentModule} execution bytes memory data = abi.encodeWithSignature( "createRequest((bool,bool,uint40,uint40,address,(uint8,uint8,uint40,address,uint128,uint256)))", paymentRequest @@ -79,7 +79,7 @@ contract PayRequest_Integration_Fuzz_Test is PayRequest_Integration_Shared_Test // Make payer the caller to pay for the fuzzed paymentRequest vm.startPrank({ msgSender: users.bob }); - // Approve the {InvoiceModule} to transfer the USDT tokens on payer's behalf + // Approve the {PaymentModule} to transfer the USDT tokens on payer's behalf usdt.approve({ spender: address(paymentModule), amount: paymentRequest.config.amount }); // Store the USDT balances of the payer and recipient before paying the payment request diff --git a/test/integration/shared/cancelRequest.t.sol b/test/integration/shared/cancelRequest.t.sol index bf9aa0db..458ef8e4 100644 --- a/test/integration/shared/cancelRequest.t.sol +++ b/test/integration/shared/cancelRequest.t.sol @@ -9,19 +9,7 @@ abstract contract CancelRequest_Integration_Shared_Test is Integration_Test, Pay PayRequest_Integration_Shared_Test.setUp(); } - modifier whenInvoiceStatusNotPaid() { - _; - } - - modifier whenInvoiceStatusNotCanceled() { - _; - } - - modifier whenSenderInvoiceRecipient() { - _; - } - - modifier givenInvoiceStatusPending() { + modifier whenRequestSenderRecipient() { _; } diff --git a/test/integration/shared/createRequest.t.sol b/test/integration/shared/createRequest.t.sol index 2cfa6cda..d3492aaa 100644 --- a/test/integration/shared/createRequest.t.sol +++ b/test/integration/shared/createRequest.t.sol @@ -28,7 +28,7 @@ abstract contract CreateRequest_Integration_Shared_Test is Integration_Test { // Create a mock payment request with a recurring USDT transfer paymentRequest = - createInvoiceWithRecurringTransfer({ recurrence: Types.Recurrence.Weekly, recipient: address(space) }); + createPaymentWithRecurringTransfer({ recurrence: Types.Recurrence.Weekly, recipient: address(space) }); paymentRequests[3] = paymentRequest; executeCreatePaymentRequest({ paymentRequest: paymentRequest, user: users.eve }); @@ -117,7 +117,7 @@ abstract contract CreateRequest_Integration_Shared_Test is Integration_Test { } /// @dev Creates a payment request with a recurring transfer payment - function createInvoiceWithRecurringTransfer( + function createPaymentWithRecurringTransfer( Types.Recurrence recurrence, address recipient ) diff --git a/test/integration/shared/payRequest.t.sol b/test/integration/shared/payRequest.t.sol index 649ecbd8..1eab0827 100644 --- a/test/integration/shared/payRequest.t.sol +++ b/test/integration/shared/payRequest.t.sol @@ -34,7 +34,7 @@ abstract contract PayRequest_Integration_Shared_Test is Integration_Test, Create _; } - modifier whenPaymentAmountEqualToInvoiceValue() { + modifier whenPaymentAmountEqualToPaymentValue() { _; } diff --git a/test/utils/Errors.sol b/test/utils/Errors.sol index fdd8f1d6..bef3eec9 100644 --- a/test/utils/Errors.sol +++ b/test/utils/Errors.sol @@ -79,7 +79,7 @@ library Errors { error ZeroPaymentAmount(); /// @notice Thrown when the payment amount is less than the payment request value - error PaymentAmountLessThanInvoiceValue(uint256 amount); + error PaymentAmountLessThanRequestedAmount(uint256 amount); /// @notice Thrown when a payment in the native token (ETH) fails error NativeTokenPaymentFailed(); diff --git a/test/utils/Helpers.sol b/test/utils/Helpers.sol index 7e15381a..12169682 100644 --- a/test/utils/Helpers.sol +++ b/test/utils/Helpers.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.26; import { Types } from "./../../src/modules/payment-module/libraries/Types.sol"; -import { Helpers as InvoiceHelpers } from "./../../src/modules/payment-module/libraries/Helpers.sol"; +import { Helpers as PaymentHelpers } from "./../../src/modules/payment-module/libraries/Helpers.sol"; library Helpers { /// @dev Calculates the number of payments that must be done based on a Recurring paymentRequest @@ -24,7 +24,7 @@ library Helpers { } /// @dev Checks if the fuzzed recurrence and payment method are valid; - /// Check {IInvoiceModule-createInvoice} for reference + /// Check {IPaymentModule-createRequest} for reference function checkFuzzedPaymentMethod( uint8 paymentMethod, uint8 recurrence, @@ -47,7 +47,7 @@ library Helpers { return (false, 0); } - numberOfPayments = InvoiceHelpers.computeNumberOfPayments({ + numberOfPayments = PaymentHelpers.computeNumberOfPayments({ recurrence: Types.Recurrence(recurrence), interval: endTime - startTime });