Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Given a version number MAJOR.MINOR.PATCH, increment:
- PATCH version when backwards compatible bug **fixes** are implemented.

## [Unreleased]
- Deprecated create pix infraction

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faltou a tag de h3


### Added
- IssuingRule missing parameters
### Fixed
Expand Down
8 changes: 3 additions & 5 deletions lib/pix_infraction/pix_infraction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ defmodule StarkInfra.PixInfraction do
) ::
{:ok, [PixInfraction.t() | map]} |
{:error, Error.t()}
@deprecated "Function deprecated since v0.2.0"
def create(infractions, options \\ []) do
Rest.post(
resource(),
Expand All @@ -89,16 +90,13 @@ defmodule StarkInfra.PixInfraction do
@doc """
Same as create(), but it will unwrap the error tuple and raise in case of errors.
"""
@deprecated "Function deprecated since v0.2.0"
@spec create!(
[PixInfraction.t() | map],
user: Organization.t() | Project.t() | nil
) :: any
def create!(infractions, options \\ []) do
Rest.post!(
resource(),
infractions,
options
)
raise "Function deprecated since v0.2.0"
end

@doc """
Expand Down
12 changes: 5 additions & 7 deletions test/pix_infraction_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ defmodule StarkInfraTest.PixInfraction do

@tag :pix_infraction
test "create pix infraction" do
{:ok, pix_infractions} = StarkInfra.PixInfraction.create(StarkInfraTest.Utils.PixInfraction.example_pix_infraction())
pix_infraction = pix_infractions |> hd
{:ok, canceled_pix} = StarkInfra.PixInfraction.cancel(pix_infraction.id)
assert !is_nil(canceled_pix.id)
{:error, errors} = StarkInfra.PixInfraction.create(StarkInfraTest.Utils.PixInfraction.example_pix_infraction())
assert Enum.any?(errors, fn error -> error.code == "routeNotFound" end)
end

@tag :pix_infraction
test "create! pix infraction" do
pix_infraction = StarkInfra.PixInfraction.create!(StarkInfraTest.Utils.PixInfraction.example_pix_infraction()) |> hd
canceled_pix = StarkInfra.PixInfraction.cancel!(pix_infraction.id)
assert !is_nil(canceled_pix.id)
assert_raise RuntimeError, "Function deprecated since v0.2.0", fn ->
StarkInfra.PixInfraction.create!(StarkInfraTest.Utils.PixInfraction.example_pix_infraction())
end
end

@tag :pix_infraction
Expand Down