mirror of
https://github.com/valitydev/capi-v2.git
synced 2024-11-06 01:55:20 +00:00
INT-973: Add Requested and Completed statuses of UI to WH (#43)
* INT-973: Add Requested and Completed statuses of UI to WH * Add tests * Fix test * a
This commit is contained in:
parent
14a41f5526
commit
bdcea3648a
@ -199,6 +199,11 @@ encode_webhook_scope(#{<<"topic">> := <<"CustomersTopic">>, <<"shopID">> := Shop
|
|||||||
-define(PMTRFNDFAILED(), {failed, #webhooker_InvoicePaymentRefundFailed{}}).
|
-define(PMTRFNDFAILED(), {failed, #webhooker_InvoicePaymentRefundFailed{}}).
|
||||||
-define(PMTRFNDSUCCEEDED(), {succeeded, #webhooker_InvoicePaymentRefundSucceeded{}}).
|
-define(PMTRFNDSUCCEEDED(), {succeeded, #webhooker_InvoicePaymentRefundSucceeded{}}).
|
||||||
|
|
||||||
|
-define(PMTUI(Value), #webhooker_InvoicePaymentUserInteractionChange{status = Value}).
|
||||||
|
|
||||||
|
-define(PMTUISTATUSREQUESTED(), {requested, #webhooker_UserInteractionStatusRequested{}}).
|
||||||
|
-define(PMTUISTATUSCOMPLETED(), {completed, #webhooker_UserInteractionStatusCompleted{}}).
|
||||||
|
|
||||||
encode_invoice_event_type(<<"InvoiceCreated">>) ->
|
encode_invoice_event_type(<<"InvoiceCreated">>) ->
|
||||||
{created, #webhooker_InvoiceCreated{}};
|
{created, #webhooker_InvoiceCreated{}};
|
||||||
encode_invoice_event_type(<<"InvoicePaid">>) ->
|
encode_invoice_event_type(<<"InvoicePaid">>) ->
|
||||||
@ -224,7 +229,11 @@ encode_invoice_event_type(<<"PaymentRefundCreated">>) ->
|
|||||||
encode_invoice_event_type(<<"PaymentRefundFailed">>) ->
|
encode_invoice_event_type(<<"PaymentRefundFailed">>) ->
|
||||||
{payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(?PMTRFNDFAILED())}};
|
{payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(?PMTRFNDFAILED())}};
|
||||||
encode_invoice_event_type(<<"PaymentRefundSucceeded">>) ->
|
encode_invoice_event_type(<<"PaymentRefundSucceeded">>) ->
|
||||||
{payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(?PMTRFNDSUCCEEDED())}}.
|
{payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(?PMTRFNDSUCCEEDED())}};
|
||||||
|
encode_invoice_event_type(<<"PaymentUserInteractionRequested">>) ->
|
||||||
|
{payment, {user_interaction, ?PMTUI(?PMTUISTATUSREQUESTED())}};
|
||||||
|
encode_invoice_event_type(<<"PaymentUserInteractionCompleted">>) ->
|
||||||
|
{payment, {user_interaction, ?PMTUI(?PMTUISTATUSCOMPLETED())}}.
|
||||||
|
|
||||||
encode_customer_event_type(<<"CustomerCreated">>) ->
|
encode_customer_event_type(<<"CustomerCreated">>) ->
|
||||||
{created, #webhooker_CustomerCreated{}};
|
{created, #webhooker_CustomerCreated{}};
|
||||||
@ -274,7 +283,9 @@ decode_invoice_event_type({payment, {status_changed, #webhooker_InvoicePaymentSt
|
|||||||
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?PMTRFNDCREATED()}}) ->
|
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?PMTRFNDCREATED()}}) ->
|
||||||
[<<"PaymentRefundCreated">>];
|
[<<"PaymentRefundCreated">>];
|
||||||
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(Value)}}) ->
|
decode_invoice_event_type({payment, {invoice_payment_refund_change, ?PMTRFNDSTATUS(Value)}}) ->
|
||||||
[decode_payment_refund_status_event_type(Value)].
|
[decode_payment_refund_status_event_type(Value)];
|
||||||
|
decode_invoice_event_type({payment, {user_interaction, ?PMTUI(Value)}}) ->
|
||||||
|
[decode_payment_user_interaction_status_event_type(Value)].
|
||||||
|
|
||||||
decode_invoice_status_event_type(?INVPAID()) -> <<"InvoicePaid">>;
|
decode_invoice_status_event_type(?INVPAID()) -> <<"InvoicePaid">>;
|
||||||
decode_invoice_status_event_type(?INVCANCELLED()) -> <<"InvoiceCancelled">>;
|
decode_invoice_status_event_type(?INVCANCELLED()) -> <<"InvoiceCancelled">>;
|
||||||
@ -289,6 +300,9 @@ decode_payment_status_event_type(?PMTFAILED()) -> <<"PaymentFailed">>.
|
|||||||
decode_payment_refund_status_event_type(?PMTRFNDFAILED()) -> <<"PaymentRefundFailed">>;
|
decode_payment_refund_status_event_type(?PMTRFNDFAILED()) -> <<"PaymentRefundFailed">>;
|
||||||
decode_payment_refund_status_event_type(?PMTRFNDSUCCEEDED()) -> <<"PaymentRefundSucceeded">>.
|
decode_payment_refund_status_event_type(?PMTRFNDSUCCEEDED()) -> <<"PaymentRefundSucceeded">>.
|
||||||
|
|
||||||
|
decode_payment_user_interaction_status_event_type(?PMTUISTATUSREQUESTED()) -> <<"PaymentUserInteractionRequested">>;
|
||||||
|
decode_payment_user_interaction_status_event_type(?PMTUISTATUSCOMPLETED()) -> <<"PaymentUserInteractionCompleted">>.
|
||||||
|
|
||||||
decode_customer_event_type({created, #webhooker_CustomerCreated{}}) ->
|
decode_customer_event_type({created, #webhooker_CustomerCreated{}}) ->
|
||||||
<<"CustomerCreated">>;
|
<<"CustomerCreated">>;
|
||||||
decode_customer_event_type({deleted, #webhooker_CustomerDeleted{}}) ->
|
decode_customer_event_type({deleted, #webhooker_CustomerDeleted{}}) ->
|
||||||
|
@ -1769,7 +1769,9 @@ create_webhook_ok_test(Config) ->
|
|||||||
<<"PaymentFailed">>,
|
<<"PaymentFailed">>,
|
||||||
<<"PaymentRefundCreated">>,
|
<<"PaymentRefundCreated">>,
|
||||||
<<"PaymentRefundFailed">>,
|
<<"PaymentRefundFailed">>,
|
||||||
<<"PaymentRefundSucceeded">>
|
<<"PaymentRefundSucceeded">>,
|
||||||
|
<<"PaymentUserInteractionRequested">>,
|
||||||
|
<<"PaymentUserInteractionCompleted">>
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -732,6 +732,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}},
|
||||||
|
{payment,
|
||||||
|
{
|
||||||
|
user_interaction,
|
||||||
|
#webhooker_InvoicePaymentUserInteractionChange{
|
||||||
|
status = {requested, #webhooker_UserInteractionStatusRequested{}}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{payment,
|
||||||
|
{
|
||||||
|
user_interaction,
|
||||||
|
#webhooker_InvoicePaymentUserInteractionChange{
|
||||||
|
status = {completed, #webhooker_UserInteractionStatusCompleted{}}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
])
|
])
|
||||||
}},
|
}},
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2},
|
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2},
|
||||||
{<<"damsel">>,
|
{<<"damsel">>,
|
||||||
{git,"https://github.com/valitydev/damsel.git",
|
{git,"https://github.com/valitydev/damsel.git",
|
||||||
{ref,"23211ff8c0c45699fa6d78afa55f304e95dbee87"}},
|
{ref,"a2f3317fa7edd7c44eafef64fa66f7a864a17833"}},
|
||||||
0},
|
0},
|
||||||
{<<"dmt_client">>,
|
{<<"dmt_client">>,
|
||||||
{git,"https://github.com/valitydev/dmt_client.git",
|
{git,"https://github.com/valitydev/dmt_client.git",
|
||||||
@ -132,11 +132,11 @@
|
|||||||
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2},
|
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2},
|
||||||
{<<"swag_client">>,
|
{<<"swag_client">>,
|
||||||
{git,"https://github.com/valitydev/swag-payments",
|
{git,"https://github.com/valitydev/swag-payments",
|
||||||
{ref,"e48443679ff088e119a67d7e085ce7e0a078742d"}},
|
{ref,"0b19804b5d4f3970923cac4e2c5daa6231a851de"}},
|
||||||
0},
|
0},
|
||||||
{<<"swag_server">>,
|
{<<"swag_server">>,
|
||||||
{git,"https://github.com/valitydev/swag-payments",
|
{git,"https://github.com/valitydev/swag-payments",
|
||||||
{ref,"5fec0fc2c79f37a8176579ef19735e017ada9cab"}},
|
{ref,"8d2e26e5c7b69de01952b00edb0f7d6190e8b8a4"}},
|
||||||
0},
|
0},
|
||||||
{<<"thrift">>,
|
{<<"thrift">>,
|
||||||
{git,"https://github.com/valitydev/thrift_erlang.git",
|
{git,"https://github.com/valitydev/thrift_erlang.git",
|
||||||
|
Loading…
Reference in New Issue
Block a user