CAPI-318: webhook update swag (#302)

This commit is contained in:
kloliks 2018-12-26 12:23:05 +03:00 committed by GitHub
parent 3498b3cc35
commit a27c4880e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 6 deletions

View File

@ -3663,6 +3663,14 @@ decode_business_schedule_ref(undefined) ->
-define(pmtrefunded() , {refunded, #webhooker_InvoicePaymentRefunded{}}).
-define(pmtfailed() , {failed, #webhooker_InvoicePaymentFailed{}}).
-define(pmtrfndcreated() , {invoice_payment_refund_created, #webhooker_InvoicePaymentRefundCreated{}}).
-define(pmtrfndstatus(Value) , {
invoice_payment_refund_status_changed,
#webhooker_InvoicePaymentRefundStatusChanged{value = Value}}).
-define(pmtrfndfailed() , {failed, #webhooker_InvoicePaymentRefundFailed{}}).
-define(pmtrfndsucceeded() , {succeeded, #webhooker_InvoicePaymentRefundSucceeded{}}).
encode_invoice_event_type(<<"InvoiceCreated">>) ->
{created, #webhooker_InvoiceCreated{}};
encode_invoice_event_type(<<"InvoicePaid">>) ->
@ -3682,7 +3690,13 @@ encode_invoice_event_type(<<"PaymentCancelled">>) ->
encode_invoice_event_type(<<"PaymentRefunded">>) ->
{payment, {status_changed, #webhooker_InvoicePaymentStatusChanged{value = ?pmtrefunded()}}};
encode_invoice_event_type(<<"PaymentFailed">>) ->
{payment, {status_changed, #webhooker_InvoicePaymentStatusChanged{value = ?pmtfailed()}}}.
{payment, {status_changed, #webhooker_InvoicePaymentStatusChanged{value = ?pmtfailed()}}};
encode_invoice_event_type(<<"PaymentRefundCreated">>) ->
{payment, {invoice_payment_refund_change, ?pmtrfndcreated()}};
encode_invoice_event_type(<<"PaymentRefundFailed">>) ->
{payment, {invoice_payment_refund_change, ?pmtrfndstatus(?pmtrfndfailed())}};
encode_invoice_event_type(<<"PaymentRefundSucceeded">>) ->
{payment, {invoice_payment_refund_change, ?pmtrfndstatus(?pmtrfndsucceeded())}}.
encode_customer_event_type(<<"CustomerCreated">>) ->
{created, #webhooker_CustomerCreated{}};
@ -3733,7 +3747,11 @@ decode_invoice_event_type({payment, {status_changed, #webhooker_InvoicePaymentSt
?pmtfailed()
]];
decode_invoice_event_type({payment, {status_changed, #webhooker_InvoicePaymentStatusChanged{value = Value}}}) ->
[decode_payment_status_event_type(Value)].
[decode_payment_status_event_type(Value)];
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?pmtrfndcreated()}}) ->
[<<"PaymentRefundCreated">>];
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?pmtrfndstatus(Value)}}) ->
[decode_payment_refund_status_event_type(Value)].
decode_invoice_status_event_type(?invpaid()) -> <<"InvoicePaid">>;
decode_invoice_status_event_type(?invcancelled()) -> <<"InvoiceCancelled">>;
@ -3745,6 +3763,9 @@ decode_payment_status_event_type(?pmtcancelled()) -> <<"PaymentCancelled">>;
decode_payment_status_event_type(?pmtrefunded()) -> <<"PaymentRefunded">>;
decode_payment_status_event_type(?pmtfailed()) -> <<"PaymentFailed">>.
decode_payment_refund_status_event_type(?pmtrfndfailed()) -> <<"PaymentRefundFailed">>;
decode_payment_refund_status_event_type(?pmtrfndsucceeded()) -> <<"PaymentRefundSucceeded">>.
decode_customer_event_type({created, #webhooker_CustomerCreated{}}) ->
<<"CustomerCreated">>;
decode_customer_event_type({deleted, #webhooker_CustomerDeleted{}}) ->

View File

@ -467,7 +467,78 @@
party_id = ?STRING,
event_filter = {invoice, #webhooker_InvoiceEventFilter{
shop_id = ?STRING,
types = [{created, #webhooker_InvoiceCreated{}}]
types = ordsets:from_list([
{created,
#webhooker_InvoiceCreated{}}
, {status_changed,
#webhooker_InvoiceStatusChanged{
value = {
paid,
#webhooker_InvoicePaid{}}}}
, {status_changed,
#webhooker_InvoiceStatusChanged{
value = {
cancelled,
#webhooker_InvoiceCancelled{}}}}
, {status_changed,
#webhooker_InvoiceStatusChanged{
value = {
fulfilled,
#webhooker_InvoiceFulfilled{}}}}
, {payment, {
created,
#webhooker_InvoicePaymentCreated{}}}
, {payment, {
status_changed,
#webhooker_InvoicePaymentStatusChanged{
value = {
processed,
#webhooker_InvoicePaymentProcessed{}}}}}
, {payment, {
status_changed,
#webhooker_InvoicePaymentStatusChanged{
value = {
captured,
#webhooker_InvoicePaymentCaptured{}}}}}
, {payment, {
status_changed,
#webhooker_InvoicePaymentStatusChanged{
value = {
cancelled,
#webhooker_InvoicePaymentCancelled{}}}}}
, {payment, {
status_changed,
#webhooker_InvoicePaymentStatusChanged{
value = {
refunded,
#webhooker_InvoicePaymentRefunded{}}}}}
, {payment, {
status_changed,
#webhooker_InvoicePaymentStatusChanged{
value = {
failed,
#webhooker_InvoicePaymentFailed{}}}}}
, {payment, {
invoice_payment_refund_change, {
invoice_payment_refund_created,
#webhooker_InvoicePaymentRefundCreated{}}}}
, {payment, {
invoice_payment_refund_change, {
invoice_payment_refund_status_changed,
#webhooker_InvoicePaymentRefundStatusChanged{
value = {
failed,
#webhooker_InvoicePaymentRefundFailed{}}}}}}
, {payment, {
invoice_payment_refund_change, {
invoice_payment_refund_status_changed,
#webhooker_InvoicePaymentRefundStatusChanged{
value = {
succeeded,
#webhooker_InvoicePaymentRefundSucceeded{}}}}}}
])
}},
url = ?STRING,
pub_key = ?STRING,

View File

@ -1492,7 +1492,20 @@ create_webhook_ok_test(Config) ->
<<"scope">> => #{
<<"topic">> => <<"InvoicesTopic">>,
<<"shopID">> => ?STRING,
<<"eventTypes">> => []
<<"eventTypes">> => [ <<"InvoiceCreated">>
, <<"InvoicePaid">>
, <<"InvoiceCancelled">>
, <<"InvoiceFulfilled">>
, <<"PaymentStarted">>
, <<"PaymentProcessed">>
, <<"PaymentCaptured">>
, <<"PaymentCancelled">>
, <<"PaymentRefunded">>
, <<"PaymentFailed">>
, <<"PaymentRefundCreated">>
, <<"PaymentRefundFailed">>
, <<"PaymentRefundSucceeded">>
]
}
},
{ok, _} = capi_client_webhooks:create_webhook(?config(context, Config), Req).

@ -1 +1 @@
Subproject commit f7fe66c9f3d4f37566a04c521b28aa168b7a88ec
Subproject commit 269686d735abef363f9f40a1bf4e1b7c751f3722

@ -1 +1 @@
Subproject commit a859ae85687cd6a22500b18a23f7b0fa096d0f46
Subproject commit 76d5dd7d50145c6be131366a632bab2c52e31ae7