Skip to content

Commit

Permalink
Merge 553941b into df4b54b
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet committed Jan 16, 2019
2 parents df4b54b + 553941b commit bac65e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/stripe/webhook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule Stripe.Webhook do
end

defp check_timestamp(timestamp, tolerance) do
now = System.system_time(:seconds)
now = System.system_time(:second)
tolerance_zone = now - tolerance

if timestamp < tolerance_zone do
Expand Down
8 changes: 4 additions & 4 deletions test/stripe/webhook_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Stripe.WebhookTest do
end

test "payload with a valid signature should return event" do
timestamp = System.system_time(:seconds)
timestamp = System.system_time(:second)
payload = @valid_payload
signature = generate_signature(timestamp, payload)
signature_header = create_signature_header(timestamp, @valid_scheme, signature)
Expand All @@ -29,7 +29,7 @@ defmodule Stripe.WebhookTest do
end

test "payload with an invalid signature should fail" do
timestamp = System.system_time(:seconds)
timestamp = System.system_time(:second)
payload = @valid_payload
signature = generate_signature(timestamp, "random")
signature_header = create_signature_header(timestamp, @valid_scheme, signature)
Expand All @@ -38,7 +38,7 @@ defmodule Stripe.WebhookTest do
end

test "payload with wrong secret should fail" do
timestamp = System.system_time(:seconds)
timestamp = System.system_time(:second)
payload = @valid_payload
signature = generate_signature(timestamp, payload, "wrong")
signature_header = create_signature_header(timestamp, @valid_scheme, signature)
Expand All @@ -47,7 +47,7 @@ defmodule Stripe.WebhookTest do
end

test "payload with missing signature scheme should fail" do
timestamp = System.system_time(:seconds)
timestamp = System.system_time(:second)
payload = @valid_payload
signature = generate_signature(timestamp, payload)
signature_header = create_signature_header(timestamp, @invalid_scheme, signature)
Expand Down

0 comments on commit bac65e3

Please sign in to comment.