Skip to content

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Mar 14, 2017
1 parent 4a2b93b commit 82a0dd1
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Controller/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
namespace Dfe\Stripe\Controller\Index;
// 2017-02-14
/** @final Unable to use the PHP «final» keyword here because of the M2 code generation. */
class Index extends \Df\Payment\WebhookA {}
class Index extends \Df\Payment\W\Action {}
2 changes: 1 addition & 1 deletion Facade/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class Refund extends \Df\StripeClone\Facade\Refund {
* $r->{'balance_transaction'}
*
* 2017-02-14
* Этот же идентификатор должен возвращать @see \Dfe\Stripe\Webhook\Charge\Refunded::eTransId()
* Этот же идентификатор должен возвращать @see \Dfe\Stripe\W\Handler\Charge\Refunded::eTransId()
*
* @override
* @see \Df\StripeClone\Facade\Refund::transId()
Expand Down
12 changes: 6 additions & 6 deletions Webhook.php → W/Handler.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
namespace Dfe\Stripe;
namespace Dfe\Stripe\W;
/**
* 2017-01-03
* @see \Dfe\Stripe\Webhook\Charge\Captured
* @see \Dfe\Stripe\Webhook\Charge\Refunded
* @see \Dfe\Stripe\W\Handler\Charge\Captured
* @see \Dfe\Stripe\W\Handler\Charge\Refunded
*/
abstract class Webhook extends \Df\StripeClone\Webhook {
abstract class Handler extends \Df\StripeClone\W\Handler {
/**
* 2017-01-04
* 2017-01-06
Expand All @@ -22,8 +22,8 @@ abstract class Webhook extends \Df\StripeClone\Webhook {
* [Stripe] An example of the «charge.captured» event (being sent to a webhook)
* https://mage2.pro/t/2745
* @override
* @see \Df\StripeClone\Webhook::roPath()
* @used-by \Df\StripeClone\Webhook::ro()
* @see \Df\StripeClone\W\Handler::roPath()
* @used-by \Df\StripeClone\W\Handler::ro()
* @return string
*/
final protected function roPath() {return 'data/object';}
Expand Down
34 changes: 34 additions & 0 deletions W/Handler/Charge/Captured.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
// 2017-01-04
namespace Dfe\Stripe\W\Handler\Charge;
use Df\StripeClone\W\Strategy\Charge\Captured as Strategy;
use Dfe\Stripe\Method as M;
final class Captured extends \Dfe\Stripe\W\Handler {
/**
* 2017-01-06
* @override
* @see \Df\StripeClone\W\Handler::currentTransactionType()
* @used-by \Df\StripeClone\W\Handler::id()
* @used-by \Df\StripeClone\W\Strategy::currentTransactionType()
* @return string
*/
function currentTransactionType() {return M::T_CAPTURE;}

/**
* 2017-01-06
* @override
* @see \Df\StripeClone\W\Handler::parentTransactionType()
* @used-by \Df\StripeClone\W\Handler::adaptParentId()
* @return string
*/
protected function parentTransactionType() {return M::T_AUTHORIZE;}

/**
* 2017-03-13
* @override
* @see \Df\StripeClone\W\Handler::strategyC()
* @used-by \Df\StripeClone\W\Handler::_handle()
* @return string
*/
protected function strategyC() {return Strategy::class;}
}
32 changes: 21 additions & 11 deletions Webhook/Charge/Refunded.php → W/Handler/Charge/Refunded.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<?php
// 2017-01-04
namespace Dfe\Stripe\Webhook\Charge;
namespace Dfe\Stripe\W\Handler\Charge;
use Df\StripeClone\W\Strategy\Charge\Refunded as Strategy;
use Dfe\Stripe\Method as M;
final class Refunded extends \Dfe\Stripe\Webhook implements \Df\StripeClone\Webhook\IRefund {
final class Refunded extends \Dfe\Stripe\W\Handler implements \Df\StripeClone\W\IRefund {
/**
* 2017-01-17
* В валюте заказа (платежа), в формате платёжной системы (копейках).
* @override
* @see \Df\StripeClone\Webhook\IRefund::amount()
* @used-by \Df\StripeClone\WebhookStrategy\Charge\Refunded::handle()
* @see \Df\StripeClone\W\IRefund::amount()
* @used-by \Df\StripeClone\W\Strategy\Charge\Refunded::handle()
* @return int
*/
function amount() {return df_last($this->ro('refunds/data'))['amount'];}

/**
* 2017-01-06
* @override
* @see \Df\StripeClone\Webhook::currentTransactionType()
* @used-by \Df\StripeClone\Webhook::id()
* @used-by \Df\StripeClone\WebhookStrategy::currentTransactionType()
* @see \Df\StripeClone\W\Handler::currentTransactionType()
* @used-by \Df\StripeClone\W\Handler::id()
* @used-by \Df\StripeClone\W\Strategy::currentTransactionType()
* @return string
*/
function currentTransactionType() {return M::T_REFUND;}
Expand All @@ -32,18 +33,27 @@ function currentTransactionType() {return M::T_REFUND;}
* Это должен быть тот же самый идентификатор,
* который возвращает @see \Dfe\Stripe\Facade\Refund::transId()
* @override
* @see \Df\StripeClone\Webhook\IRefund::eTransId()
* @used-by \Df\StripeClone\WebhookStrategy\Charge\Refunded::handle()
* @see \Df\StripeClone\W\IRefund::eTransId()
* @used-by \Df\StripeClone\W\Strategy\Charge\Refunded::handle()
* @return string
*/
function eTransId() {return df_last($this->ro('refunds/data'))['balance_transaction'];}

/**
* 2016-12-16
* @override
* @see \Dfe\Stripe\Webhook::parentTransactionType()
* @used-by \Dfe\Stripe\Webhook::adaptParentId()
* @see \Dfe\Stripe\W\Handler::parentTransactionType()
* @used-by \Dfe\Stripe\W\Handler::adaptParentId()
* @return string
*/
protected function parentTransactionType() {return M::T_CAPTURE;}

/**
* 2017-03-13
* @override
* @see \Df\StripeClone\W\Handler::strategyC()
* @used-by \Df\StripeClone\W\Handler::_handle()
* @return string
*/
protected function strategyC() {return Strategy::class;}
}
16 changes: 7 additions & 9 deletions WebhookF.php → W/Reader.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
// 2017-01-04
namespace Dfe\Stripe;
final class WebhookF extends \Df\Payment\WebhookF\Json {
namespace Dfe\Stripe\W;
// 2017-03-10
final class Reader extends \Df\Payment\W\Reader\Json {
/**
* 2017-01-04
* 2017-01-11
Expand All @@ -13,11 +13,9 @@ final class WebhookF extends \Df\Payment\WebhookF\Json {
* [Stripe] An example of the «charge.captured» event (being sent to a webhook)
* https://mage2.pro/t/2745
* @override
* @see \Df\Payment\WebhookF\Json::typeKey()
* @used-by \Df\Payment\WebhookF\Json::type()
* @see \Df\Payment\W\Reader::kt()
* @used-by \Df\Payment\W\Reader::t()
* @return string
*/
protected function typeKey() {return 'type';}
}


protected function kt() {return 'type';}
}
24 changes: 0 additions & 24 deletions Webhook/Charge/Captured.php

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/stripe"
,"version": "1.7.9"
,"version": "1.8.0"
,"description": "The «Stripe» payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/stripe"
Expand All @@ -11,7 +11,7 @@
"homepage": "https://mage2.pro/users/dmitry_fedyuk",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=2.1.1", "stripe/stripe-php": "3.*"}
,"require": {"mage2pro/core": ">=2.2.0", "stripe/stripe-php": "3.*"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\Stripe\\": ""}}
,"keywords": [
"API"
Expand Down

0 comments on commit 82a0dd1

Please sign in to comment.