Skip to content

Commit

Permalink
minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rubio committed Dec 16, 2024
1 parent 835f46e commit 7a4e662
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/paypal/auth/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Paypal.Auth.Worker do

@typedoc """
The internal structure for the auth of Paypal is composed of
a `access` entry (see `Paypal.Auth.Access.t/0` for further information),
a `access` entry (see `Paypal.Auth.Access.t()` for further information),
and `timer_ref`, a reference for the current and active timer.
"""

Expand Down
10 changes: 8 additions & 2 deletions lib/paypal/common/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ defmodule Paypal.Common.Error do
field(:debug_id, :string, primary_key: true)

embeds_many :details, Details, primary_key: false do
@moduledoc false
@typedoc false
@moduledoc """
Each detail implemented for the error.
"""

@typedoc """
The information for each line of the error, it includes: field,
description, issue, location, and value.
"""

field(:field, :string)
field(:description, :string)
Expand Down
15 changes: 11 additions & 4 deletions lib/paypal/order/authorization.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Paypal.Order.Authorization do
@moduledoc """
Authorization is the information embeded into the
Authorization is the information embebed into the
`Paypal.Order.Authorized` for getting all of the information for the
authorized payment.
"""
Expand Down Expand Up @@ -39,18 +39,25 @@ defmodule Paypal.Order.Authorization do
field(:network_transaction_reference, :map)

embeds_one :seller_protection, SellerProtection, primary_key: false do
@moduledoc false
@typedoc false
@moduledoc """
Seller protection gives us information about if the protection of the
seller is elegible and the categories for the disputes.
"""

@seller_protection_statuses [
eligible: "ELIGIBLE",
partially_eligible: "PARTIALLY_ELIGIBLE",
not_eligible: "NOT_ELIGIBLE"
]

@typedoc """
Seller protection gives us the eligibility of the seller and the kind
of disputes.
"""

field(:status, Ecto.Enum, values: @seller_protection_statuses)
# XXX looks like the categories are specific but the documentation is
# not listem them, so we are going to use `string` here.
# not listen them, so we are going to use `string` here.
field(:dispute_categories, {:array, :string})
end

Expand Down
23 changes: 18 additions & 5 deletions lib/paypal/order/authorized.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,26 @@ defmodule Paypal.Order.Authorized do
field(:payment_source, :map)

embeds_many :purchase_units, PurchaseUnit, primary_key: false do
@moduledoc false
@typedoc false
@moduledoc """
Purchase Unit has the information for each detail line in the bought items.
"""

@typedoc """
Information about the purchase units, each purchase unit has a reference
and a payment.
"""
field(:reference_id, :string, primary_key: true)

embeds_one :payments, Payment, primary_key: false do
@moduledoc false
@typedoc false
embeds_one :payment, Payment, primary_key: false do
@moduledoc """
The payment define the list of authorizations that are included inside
of the authorized order.
"""

@typedoc """
The payment has only a list of authorizations, check `Authorization` for
further details.
"""
embeds_many(:authorizations, Authorization)
end
end
Expand Down
1 change: 0 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"},
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
"countries": {:hex, :countries, "1.6.0", "0776d78e80105944a4ea4d9d4286e852f83497e57222844ca51f9a22ed2d8fd9", [:mix], [{:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "a1e4d0fdd2a799f16a95ae2e842edeaabd9ac7639624ac5e139c54da7a6bccb0"},
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
Expand Down
2 changes: 1 addition & 1 deletion test/support/paypal_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Paypal.Case do
end

defp endpoint_url(bypass) do
"http://localhost:#{bypass.port()}"
"http://localhost:#{bypass.port}"
end

def response(conn, code, data \\ nil)
Expand Down

0 comments on commit 7a4e662

Please sign in to comment.