Skip to content

Commit

Permalink
add ip_address, ip_address_location and session fields to review
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepwalker committed Mar 18, 2019
1 parent c8cd3c6 commit 7ae4327
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
25 changes: 23 additions & 2 deletions lib/stripe/radar/review.ex
Expand Up @@ -7,18 +7,36 @@ defmodule Stripe.Review do

use Stripe.Entity

@type session :: %{
browser: String.t(),
device: String.t(),
platform: String.t(),
version: String.t()
}

@type ip_address_location :: %{
city: String.t(),
country: String.t(),
latitude: Float.t(),
longitude: Float.t(),
region: String.t()
}

@type t :: %__MODULE__{
id: Stripe.id(),
object: String.t(),
billing_zip: String.t(),
charge: Stripe.id() | Stripe.Charge.t(),
closed_reason: String.t(),
created: Stripe.timestamp(),
ip_address: String.t(),
ip_address_location: ip_address_location,
livemode: boolean,
open: boolean,
opened_reason: String.t(),
payment_intent: String.t(),
reason: String.t()
reason: String.t(),
session: session
}

defstruct [
Expand All @@ -28,10 +46,13 @@ defmodule Stripe.Review do
:charge,
:closed_reason,
:created,
:ip_address,
:ip_address_location,
:livemode,
:open,
:opened_reason,
:payment_intent,
:reason
:reason,
:session
]
end
16 changes: 15 additions & 1 deletion test/stripe/converter_test.exs
Expand Up @@ -69,12 +69,26 @@ defmodule Stripe.ConverterTest do
closed_reason: nil,
created: 1551702603,
id: "prv_1EAFvj73iNyGMfgu81yzEb0D",
ip_address: "172.16.1.4",
ip_address_location: %{
city: "Samara",
country: "RU",
latitude: 34,
longitude: 33,
region: "65"
},
livemode: false,
object: "review",
open: true,
opened_reason: "rule",
payment_intent: nil,
reason: "rule"
reason: "rule",
session: %{
browser: "Firefox",
device: "Other",
platform: "Mac OS X 10.14",
version: "65.0"
}
}
},
id: "evt_1EAFvk73iNyGMfguDACcQT5X",
Expand Down

0 comments on commit 7ae4327

Please sign in to comment.