Skip to content

Commit

Permalink
Merge pull request #23 from spryker-eco/feature/eco-1936/dev-security…
Browse files Browse the repository at this point in the history
…-invoice

[WIP] ECO-1936 Security invoice
  • Loading branch information
alex-galych authored Sep 27, 2018
2 parents 143b027 + 5967810 commit bbda12c
Show file tree
Hide file tree
Showing 46 changed files with 1,735 additions and 42 deletions.
128 changes: 128 additions & 0 deletions config/Zed/Oms/PayonePrePaymentSecurityInvoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<statemachine
xmlns="http://static.spryker.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://static.spryker.com http://static.spryker.com/oms-01.xsd">

<process name="PayonePrePaymentSecurityInvoice" main="true">
<states>
<state name="new" reserved="true"/>
<state name="invalid"/>
<state name="pre-authorization pending"/>
<state name="pre-authorization appointed"/>
<state name="paid" />
<state name="cancelled" />
<state name="shipped" />
<state name="refund failed clarification" />
<state name="capture pending" />
<state name="captured" />
<state name="closed" />
<state name="returned" />
<state name="refund pending" />
<state name="refunded" />
</states>

<transitions>
<transition condition="Payone/PreAuthorizationIsApproved" happy="true">
<source>new</source>
<target>pre-authorization pending</target>
<event>pre-authorize</event>
</transition>

<transition condition="Payone/PaymentIsAppointed" happy="true">
<source>pre-authorization pending</source>
<target>pre-authorization appointed</target>
</transition>

<transition happy="true">
<source>pre-authorization appointed</source>
<target>capture pending</target>
<event>capture</event>
</transition>

<transition condition="Payone/PaymentIsCapture" happy="true">
<source>capture pending</source>
<target>captured</target>
</transition>

<transition condition="Payone/PaymentIsPaid" happy="true">
<source>captured</source>
<target>paid</target>
</transition>

<transition>
<source>new</source>
<target>invalid</target>
<event>pre-authorize</event>
</transition>

<transition>
<source>paid</source>
<target>cancelled</target>
<event>cancel</event>
</transition>

<transition happy="true">
<source>paid</source>
<target>shipped</target>
<event>ship</event>
</transition>

<transition condition="Payone/CaptureIsApproved" happy="true">
<source>shipped</source>
<target>closed</target>
<event>wait for item return</event>
</transition>

<!--<transition>-->
<!--<source>capture failed clarification</source>-->
<!--<target>shipped</target>-->
<!--<event>retry capture</event>-->
<!--</transition>-->

<transition>
<source>shipped</source>
<target>returned</target>
<event>return</event>
</transition>

<transition condition="Payone/RefundIsApproved">
<source>returned</source>
<target>refund pending</target>
<event>refund</event>
</transition>

<transition condition="Payone/PaymentIsRefund">
<source>refund pending</source>
<target>refunded</target>
</transition>

<transition>
<source>returned</source>
<target>refund failed clarification</target>
<event>refund</event>
</transition>

<transition>
<source>refund failed clarification</source>
<target>refunded</target>
<event>refund manually</event>
</transition>

</transitions>

<events>
<event name="pre-authorize" onEnter="true" command="Payone/PreAuthorize"/>
<event name="capture" onEnter="true" manual="true" command="Payone/Capture"/>
<event name="ship" manual="true" />
<event name="wait for item return" timeout="14days" />
<event name="cancel" manual="true" />
<event name="capture with settlement" onEnter="true" command="Payone/CaptureWithSettlement"/>
<event name="return" manual="true" />
<event name="refund" onEnter="true" command="Payone/Refund" />
<event name="retry capture" manual="true" />
<event name="refund manually" manual="true" />
</events>

</process>
</statemachine>
124 changes: 124 additions & 0 deletions config/Zed/Oms/PayoneSecurityInvoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<statemachine
xmlns="http://static.spryker.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://static.spryker.com http://static.spryker.com/oms-01.xsd">

<process name="PayoneSecurityInvoice" main="true">
<states>
<state name="new" reserved="true"/>
<state name="authorization pending"/>
<state name="authorization appointed"/>
<state name="underpaid" />
<state name="paid" />
<state name="reservation cancellation pending"/>
<state name="cancelled" />
<state name="shipped" />
<state name="refund failed clarification" />
<state name="closed" />
<state name="returned" />
<state name="refund pending" />
<state name="refunded" />
</states>

<transitions>
<transition condition="Payone/AuthorizationIsApproved" happy="true">
<source>new</source>
<target>authorization pending</target>
<event>authorize</event>
</transition>

<transition condition="Payone/PaymentIsAppointed" happy="true">
<source>authorization pending</source>
<target>authorization appointed</target>
</transition>

<transition condition="Payone/CaptureIsApproved">
<source>authorization appointed</source>
<target>reservation cancellation pending</target>
<event>cancel reservation</event>
</transition>

<transition condition="Payone/PaymentIsCapture">
<source>reservation cancellation pending</source>
<target>cancelled</target>
</transition>

<transition condition="Payone/PaymentIsUnderPaid">
<source>authorization appointed</source>
<target>underpaid</target>
</transition>

<transition condition="Payone/PaymentIsPaid" happy="true">
<source>authorization appointed</source>
<target>paid</target>
</transition>

<transition condition="Payone/PaymentIsPaid">
<source>underpaid</source>
<target>paid</target>
</transition>

<transition>
<source>paid</source>
<target>cancelled</target>
<event>cancel</event>
</transition>

<transition happy="true">
<source>paid</source>
<target>shipped</target>
<event>ship</event>
</transition>

<transition happy="true">
<source>shipped</source>
<target>closed</target>
<event>wait for item return</event>
</transition>

<transition>
<source>shipped</source>
<target>returned</target>
<event>return</event>
</transition>

<transition condition="Payone/RefundIsApproved">
<source>returned</source>
<target>refund pending</target>
<event>refund</event>
</transition>

<transition condition="Payone/PaymentIsRefund">
<source>refund pending</source>
<target>refunded</target>
</transition>

<transition>
<source>returned</source>
<target>refund failed clarification</target>
<event>refund</event>
</transition>

<transition>
<source>refund failed clarification</source>
<target>refunded</target>
<event>refund manually</event>
</transition>

</transitions>

<events>
<event name="authorize" onEnter="true" command="Payone/Authorize"/>
<event name="ship" manual="true" />
<event name="wait for item return" timeout="14days" />
<event name="cancel reservation" manual="true" />
<event name="cancel" manual="true" />
<event name="return" manual="true" />
<event name="refund" onEnter="true" command="Payone/Refund" />
<event name="retry capture" manual="true" />
<event name="refund manually" manual="true" />
</events>

</process>
</statemachine>
10 changes: 10 additions & 0 deletions src/SprykerEco/Shared/Payone/PayoneApiConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace SprykerEco\Shared\Payone;

/**
* Declares global environment configuration keys. Do not use it for other class constants.
*/
interface PayoneApiConstants
{
// GENERAL
Expand Down Expand Up @@ -46,6 +49,7 @@ interface PayoneApiConstants
// bank account based methods
const PAYMENT_METHOD_DIRECT_DEBIT = 'payment.payone.direct_debit';
const PAYMENT_METHOD_INVOICE = 'payment.payone.invoice';
const PAYMENT_METHOD_SECURITY_INVOICE = 'payment.payone.security_invoice';
const PAYMENT_METHOD_PREPAYMENT = 'payment.payone.prepayment';
const PAYMENT_METHOD_CASH_ON_DELIVERY = 'payment.payone.cash_on_delivery';

Expand All @@ -58,11 +62,15 @@ interface PayoneApiConstants
const CLEARING_TYPE_CREDIT_CARD = 'cc';
const CLEARING_TYPE_PREPAYMENT = 'vor';
const CLEARING_TYPE_INVOICE = 'rec';
const CLEARING_TYPE_SECURITY_INVOICE = 'rec';
const CLEARING_TYPE_ONLINE_BANK_TRANSFER = 'sb';
const CLEARING_TYPE_CASH_ON_DELIVERY = 'cod';
const CLEARING_TYPE_E_WALLET = 'wlt';
const CLEARING_TYPE_FINANCING = 'fnc';

//CLEARING SUBTYPE
public const CLEARING_SUBTYPE_SECURITY_INVOICE = 'POV';

// TXACTION

// Defined in TransactionStatusConstants
Expand Down Expand Up @@ -122,6 +130,7 @@ interface PayoneApiConstants
const REQUEST_TYPE_BANKACCOUNTCHECK = 'bankaccountcheck';
const REQUEST_TYPE_CREDITCARDCHECK = 'creditcardcheck';
const REQUEST_TYPE_GETINVOICE = 'getinvoice';
const REQUEST_TYPE_GETSECURITYINVOICE = 'getsecurityinvoice';
const REQUEST_TYPE_MANAGEMANDATE = 'managemandate';
const REQUEST_TYPE_GETFILE = 'getfile';
const REQUEST_TYPE_GENERICPAYMENT = 'genericpayment';
Expand Down Expand Up @@ -290,6 +299,7 @@ interface PayoneApiConstants
// INVOICE TITLE PREFIX

const INVOICE_TITLE_PREFIX_INVOICE = 'RG';
const INVOICE_TITLE_PREFIX_SECURITY_INVOICE = 'RG';
const INVOICE_TITLE_PREFIX_CREDIT_NOTE = 'GT';

// PAYPAL EXPRESS CHECKOUT ACTIONS
Expand Down
4 changes: 4 additions & 0 deletions src/SprykerEco/Shared/Payone/PayoneConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace SprykerEco\Shared\Payone;

/**
* Declares global environment configuration keys. Do not use it for other class constants.
*/
interface PayoneConstants
{
const COUNTRY_AT = 'AT';
Expand All @@ -26,6 +29,7 @@ interface PayoneConstants
const PAYONE_REDIRECT_SUCCESS_URL = 'PAYONE_REDIRECT_SUCCESS_URL';
const PAYONE_REDIRECT_ERROR_URL = 'PAYONE_REDIRECT_ERROR_URL';
const PAYONE_REDIRECT_BACK_URL = 'PAYONE_REDIRECT_BACK_URL';
const PAYONE_BUSINESS_RELATION = 'PAYONE:PAYONE_BUSINESS_RELATION';

// Paypal express checkout state machine name
const PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT_STATE_MACHINE = 'payonePaypalExpressCheckout';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace SprykerEco\Shared\Payone;

/**
* Declares global environment configuration keys. Do not use it for other class constants.
*/
interface PayoneTransactionStatusConstants
{
const TXACTION_APPOINTED = 'appointed';
Expand Down
13 changes: 13 additions & 0 deletions src/SprykerEco/Shared/Payone/Transfer/payone.transfer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<property name="amount" type="int" />
<property name="payment" type="PayonePayment" />
<property name="settleaccount" type="string" />
<property name="order" type="Order" />
</transfer>

<transfer name="PayoneDebit">
Expand Down Expand Up @@ -56,6 +57,7 @@
<property name="payment" type="PayonePayment" />
<property name="useCustomerdata" type="string" />
<property name="narrativeText" type="string" />
<property name="order" type="Order" />
</transfer>

<transfer name="PayonePayment">
Expand Down Expand Up @@ -295,6 +297,16 @@
<property name="errorCode" type="string" />
</transfer>

<transfer name="PayoneGetSecurityInvoice">
<property name="reference" type="string" />
<property name="customerId" type="int" />
<property name="rawResponse" type="string" />
<property name="status" type="string" />
<property name="internalErrorMessage" type="string" />
<property name="customerErrorMessage" type="string" />
<property name="errorCode" type="string" />
</transfer>

<transfer name="PayoneGetPaymentDetail">
<property name="orderId" type="string" />
<property name="orderReference" type="string" />
Expand Down Expand Up @@ -322,6 +334,7 @@
<property name="payoneEWallet" type="PayonePaymentEWallet"/>
<property name="payonePrePayment" type="PayonePayment"/>
<property name="payoneInvoice" type="PayonePayment"/>
<property name="payoneSecurityInvoice" type="PayonePayment"/>
<property name="payonePaypalExpressCheckout" type="PayonePaypalExpressCheckout" />
<property name="summaryIncludePath" type="string"/>
<property name="successIncludePath" type="string"/>
Expand Down
Loading

0 comments on commit bbda12c

Please sign in to comment.