HG-237: Introduce hold payments (#209)

* HG-233: Support of holds added (#159)

* HG-236: InvalidOperation ex added (#165)

* HG-236: InvalidPartyStatus, InvalidShopStatus -> CapturePayment, CancelPayment (#167)

* MST-111: holds in mst (#181)

* HG-255: Selector for holds (#207)
This commit is contained in:
Alexey Semenkov 2017-08-29 18:51:12 +03:00 committed by Andrew Mayorov
parent 07c5f5c6f7
commit 44afec3edc
3 changed files with 120 additions and 2 deletions

View File

@ -114,13 +114,18 @@ struct InvoicePayment {
3: required InvoicePaymentStatus status
5: required Payer payer
8: required Cash cost
13: required InvoicePaymentFlow flow
6: optional InvoicePaymentContext context
}
struct InvoicePaymentPending {}
struct InvoicePaymentProcessed {}
struct InvoicePaymentCaptured {}
struct InvoicePaymentCancelled {}
struct InvoicePaymentCaptured {
1: optional string reason
}
struct InvoicePaymentCancelled {
1: optional string reason
}
struct InvoicePaymentFailed { 1: required OperationFailure failure }
/**
@ -234,6 +239,26 @@ union InvoicePaymentAdjustmentStatus {
3: InvoicePaymentAdjustmentCancelled cancelled
}
/**
* Процесс выполнения платежа.
*/
union InvoicePaymentFlow {
1: InvoicePaymentFlowInstant instant
2: InvoicePaymentFlowHold hold
}
struct InvoicePaymentFlowInstant {}
struct InvoicePaymentFlowHold {
1: required OnHoldExpiration on_hold_expiration
2: required base.Timestamp held_until
}
enum OnHoldExpiration {
cancel
capture
}
/* Blocking and suspension */
union Blocking {
@ -513,6 +538,7 @@ struct PaymentsServiceTerms {
5: optional CashLimitSelector cash_limit
/* Payment level */
6: optional CashFlowSelector fees
7: optional HoldLifetimeSelector hold_lifetime
/* Undefined level */
3: optional GuaranteeFundTerms guarantee_fund
}
@ -522,6 +548,10 @@ struct GuaranteeFundTerms {
2: optional CashFlowSelector fees
}
struct HoldLifetime {
1: required i32 seconds
}
/* Currencies */
/** Символьный код, уникально идентифицирующий валюту. */
@ -658,6 +688,18 @@ struct PaymentMethodDecision {
2: required PaymentMethodSelector then_
}
/* Holds */
union HoldLifetimeSelector {
1: list<HoldLifetimeDecision> decisions
2: HoldLifetime value
}
struct HoldLifetimeDecision {
1: required Predicate if_
2: required HoldLifetimeSelector then_
}
/* Flows */
// TODO
@ -860,6 +902,7 @@ struct Terminal {
// 8: optional TerminalDescriptor descriptor
9: optional ProxyOptions options
10: required RiskScore risk_coverage
11: optional TerminalPaymentFlow payment_flow
}
struct TerminalAccount {
@ -877,6 +920,17 @@ struct TerminalDecision {
2: required TerminalSelector then_
}
union TerminalPaymentFlow {
1: TerminalPaymentFlowInstant instant
2: TerminalPaymentFlowHold hold
}
struct TerminalPaymentFlowInstant {}
struct TerminalPaymentFlowHold {
1: required HoldLifetime hold_lifetime
}
/* Predicates / conditions */
union Predicate {

View File

@ -30,6 +30,24 @@ struct StatPayment {
15: required domain.PaymentSessionID session_id
16: optional base.Content context
17: optional geo_ip.LocationInfo location_info
18: required InvoicePaymentFlow flow
}
union InvoicePaymentFlow {
1: InvoicePaymentFlowInstant instant
2: InvoicePaymentFlowHold hold
}
struct InvoicePaymentFlowInstant {}
struct InvoicePaymentFlowHold {
1: required OnHoldExpiration on_hold_expiration
2: required base.Timestamp held_until
}
enum OnHoldExpiration {
cancel
capture
}
union OperationFailure {

View File

@ -339,6 +339,18 @@ struct InvoiceTemplateUpdateParams {
struct InvoicePaymentParams {
1: required domain.Payer payer
2: required InvoicePaymentParamsFlow flow
}
union InvoicePaymentParamsFlow {
1: InvoicePaymentParamsFlowInstant instant
2: InvoicePaymentParamsFlowHold hold
}
struct InvoicePaymentParamsFlowInstant {}
struct InvoicePaymentParamsFlowHold {
1: required domain.OnHoldExpiration on_hold_expiration
}
struct Invoice {
@ -382,6 +394,7 @@ exception InvoiceNotFound {}
exception InvoicePaymentNotFound {}
exception InvoicePaymentAdjustmentNotFound {}
exception EventNotFound {}
exception InvalidOperation {}
exception InvoicePaymentPending {
1: required domain.InvoicePaymentID id
@ -471,6 +484,39 @@ service Invoicing {
3: InvoicePaymentNotFound ex3
)
void CancelPayment (
1: UserInfo user,
2: domain.InvoiceID id,
3: domain.InvoicePaymentID payment_id
4: string reason
)
throws (
1: InvalidUser ex1,
2: InvoiceNotFound ex2,
3: InvoicePaymentNotFound ex3,
4: InvalidPaymentStatus ex4,
5: base.InvalidRequest ex5,
6: InvalidOperation ex6,
7: InvalidPartyStatus ex7,
8: InvalidShopStatus ex8
)
void CapturePayment (
1: UserInfo user,
2: domain.InvoiceID id,
3: domain.InvoicePaymentID payment_id
4: string reason
)
throws (
1: InvalidUser ex1,
2: InvoiceNotFound ex2,
3: InvoicePaymentNotFound ex3,
4: InvalidPaymentStatus ex4,
5: base.InvalidRequest ex5,
6: InvalidOperation ex6,
7: InvalidPartyStatus ex7,
8: InvalidShopStatus ex8
)
/**
* Создать поправку к платежу.
*