Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Oct 7, 2017
1 parent 5cffb6f commit 8b1b646
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions Facade/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function pathToCard() {return 'source';}
* 2017-02-10
* @override
* @see \Df\StripeClone\Facade\Charge::refund()
* @used-by void
* @used-by void()
* @used-by \Df\StripeClone\Method::_refund()
* @param string $id
* @param float $a
Expand All @@ -73,19 +73,16 @@ function pathToCard() {return 'source';}
* @return R
*/
function refund($id, $a) {return R::create(df_clean([
// 2016-03-17
// https://stripe.com/docs/api#create_refund-amount
// 2016-03-17 https://stripe.com/docs/api#create_refund-amount
'amount' => $a
// 2016-03-18
// Хитрый трюк, который позволяет нам не заниматься хранением идентификаторов платежей.
// Система уже хранит их в виде «ch_17q00rFzKb8aMux1YsSlBIlW-capture»,
// а нам нужно лишь отсечь суффиксы (Stripe не использует символ «-»).
,'charge' => $id
// 2016-03-17
// https://stripe.com/docs/api#create_refund-metadata
// 2016-03-17 https://stripe.com/docs/api#create_refund-metadata
,'metadata' => $this->refundMeta()
// 2016-03-18
// https://stripe.com/docs/api#create_refund-reason
// 2016-03-18 https://stripe.com/docs/api#create_refund-reason
,'reason' => 'requested_by_customer'
]));}

Expand All @@ -100,8 +97,7 @@ function refund($id, $a) {return R::create(df_clean([
function void($id) {return $this->refund($id, null);}

/**
* 2017-02-11
* Информация о банковской карте.
* 2017-02-11 The bank card data.
* @override
* @see \Df\StripeClone\Facade\Charge::cardData()
* @used-by \Df\StripeClone\Facade\Charge::card()
Expand All @@ -118,27 +114,20 @@ protected function cardData($c) {return $c->{'source'};}
* @return array(string => float)
*/
private function refundAdjustments($type) {
/** @var CM $cm */
$cm = $this->cm();
/** @var string $iso3Base */
$iso3Base = $cm->getBaseCurrencyCode();
/** @var string $iso3 */
$iso3 = $cm->getOrderCurrencyCode();
/** @var bool $multiCurrency */
$multiCurrency = $iso3Base !== $iso3;
$cm = $this->cm(); /** @var CM $cm */
$iso3Base = $cm->getBaseCurrencyCode(); /** @var string $iso3Base */
$iso3 = $cm->getOrderCurrencyCode(); /** @var string $iso3 */
$multiCurrency = $iso3Base !== $iso3; /** @var bool $multiCurrency */
/**
* 2016-03-18
* @uses \Magento\Sales\Api\Data\CreditmemoInterface::ADJUSTMENT_POSITIVE
* https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php#L32-L35
* @uses \Magento\Sales\Api\Data\CreditmemoInterface::ADJUSTMENT_NEGATIVE
* https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php#L72-L75
*/
/** @var string $key */
$key = "adjustment_$type";
/** @var float $a */
$a = $cm[$key];
/** @var string $label */
$label = ucfirst($type) . ' Adjustment';
$key = "adjustment_$type"; /** @var string $key */
$a = $cm[$key]; /** @var float $a */
$label = ucfirst($type) . ' Adjustment'; /** @var string $label */
return !$a ? [] : (
!$multiCurrency
? [$label => $a]
Expand Down

0 comments on commit 8b1b646

Please sign in to comment.