-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d3c177
commit 835f46e
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule Paypal.Order.Payer do | ||
@moduledoc """ | ||
Payer get all the information about who's paying the order. | ||
""" | ||
use TypedEctoSchema | ||
|
||
@primary_key false | ||
|
||
@typedoc """ | ||
The information for the payer: | ||
- `payer_id` is the ID in Paypal for the payer. | ||
- `name` is a composition of two values: given_name and surname. | ||
- `email_address` is the email address provided to Paypal for the payment. | ||
""" | ||
typed_embedded_schema do | ||
field(:payer_id, :string, primary_key: true) | ||
field(:name, :map) | ||
field(:email_address, :string) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,11 @@ defmodule Paypal.IntegrationTest do | |
method: :post | ||
} | ||
], | ||
payer: %Paypal.Order.Payer{ | ||
payer_id: "JWEUL3HMBVGJ6", | ||
name: %{"given_name" => "test", "surname" => "buyer"}, | ||
email_address: "[email protected]" | ||
}, | ||
purchase_units: [ | ||
%Paypal.Order.PurchaseUnit{ | ||
reference_id: "default", | ||
|
@@ -642,6 +647,11 @@ defmodule Paypal.IntegrationTest do | |
method: :post | ||
} | ||
], | ||
payer: %Paypal.Order.Payer{ | ||
payer_id: "JWEUL3HMBVGJ6", | ||
name: %{"given_name" => "test", "surname" => "buyer"}, | ||
email_address: "[email protected]" | ||
}, | ||
purchase_units: [ | ||
%Paypal.Order.PurchaseUnit{ | ||
reference_id: "default", | ||
|
@@ -1086,12 +1096,17 @@ defmodule Paypal.IntegrationTest do | |
method: :get | ||
} | ||
], | ||
payer: %Paypal.Order.Payer{ | ||
payer_id: "JWEUL3HMBVGJ6", | ||
name: %{"given_name" => "test", "surname" => "buyer"}, | ||
email_address: "[email protected]" | ||
}, | ||
purchase_units: [ | ||
%Paypal.Order.PurchaseUnit{} | ||
], | ||
status: :completed | ||
} | ||
|
||
assert {:ok, info} == Paypal.Order.capture(order.id) | ||
assert {:ok, ^info} = Paypal.Order.capture(order.id) | ||
end | ||
end |