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
3 changes: 3 additions & 0 deletions include/stripe.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,6 @@
description :: desc(),
recipient :: recipient_id(),
statement_descriptor :: desc()}).

-record(stripe_delete, {id :: customer_id() | plan_id() | coupon_id() | invoice_id(),
status :: true| false}).
19 changes: 18 additions & 1 deletion src/stripe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-module(stripe).

-export([token_create/10, token_create_bank/3]).
-export([customer_create/3, customer_get/1, customer_update/3]).
-export([customer_create/3, customer_get/1, customer_update/3,customer_delete/1]).
-export([charge_customer/4, charge_card/4]).
-export([subscription_update/3, subscription_update/5,
subscription_update/6, subscription_cancel/2, subscription_cancel/3]).
Expand Down Expand Up @@ -55,6 +55,15 @@ customer_create(Card, Email, Desc) ->
{description, Desc}],
request_customer_create(Fields).

%%%--------------------------------------------------------------------
%%% Customer delete
%%%--------------------------------------------------------------------
-spec customer_delete(customer_id()) -> result.
customer_delete(CustomerId) ->
request_customer_delete(CustomerId).



%%%--------------------------------------------------------------------
%%% Customer Fetching
%%%--------------------------------------------------------------------
Expand Down Expand Up @@ -197,6 +206,9 @@ request_event(EventId) ->
request_customer(CustomerId) ->
request_run(gen_customer_url(CustomerId), get, []).

request_customer_delete(CustomerId) ->
request_run(gen_customer_url(CustomerId), delete, []).

request_invoiceitem(InvoiceItemId) ->
request_run(gen_invoiceitem_url(InvoiceItemId), get, []).

Expand Down Expand Up @@ -472,6 +484,11 @@ json_to_record(<<"transfer">>, DecodedResult) ->
recipient = ?V(recipient),
statement_descriptor = ?V(statement_descriptor)};

json_to_record(undefined, [{<<"deleted">>, Status}, {<<"id">>, ObjectId}]) ->
#stripe_delete{id = ObjectId,
status = Status};


json_to_record(Type, DecodedResult) ->
error_logger:error_msg({unimplemented, ?MODULE, json_to_record, Type, DecodedResult}),
{not_implemented_yet, Type, DecodedResult}.
Expand Down