示例#1
0
 /**
  * 2016-03-26
  * Ситуация, когда платёж не найден, является нормальной,
  * потому что к одной учётной записи Stripe может быть привязано несколько магазинов,
  * и Stripe будет оповещать сразу все магазины о событиях одного из них.
  * Магазину надо уметь различать свои события и чужие,
  * и мы делаем это именно по идентификатору транзакции.
  * @return Payment|DfPayment|null
  */
 public function payment()
 {
     return dfc($this, function () {
         /** @var int|null $id */
         $id = df_fetch_one('sales_payment_transaction', 'payment_id', ['txn_id' => $this->id()]);
         return !$id ? null : df_load(Payment::class, $id);
     });
 }
示例#2
0
 /**
  * 2016-07-18
  * @return int
  */
 private function quoteId()
 {
     return dfc($this, function () {
         /** @var int|string $result */
         $result = $this[self::$P__QUOTE_ID];
         /**
          * 2016-07-18
          * By analogy with https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php#L83-L87
          */
         if ($this->guest()) {
             /** @var QuoteIdMask $quoteIdMask */
             $quoteIdMask = df_load(QuoteIdMask::class, $result, true, 'masked_id');
             /** https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Quote/Setup/InstallSchema.php#L1549-L1557 */
             $result = $quoteIdMask['quote_id'];
             /** @var IQuote|Quote $quote */
             $quote = df_quote($result);
             $quote->setCheckoutMethod(IQM::METHOD_GUEST);
         }
         return $result;
     });
 }
示例#3
0
 /**
  * 2016-07-10
  * @return Transaction
  */
 private function requestTransaction()
 {
     return dfc($this, function () {
         return df_load(Transaction::class, $this->requestIdG(), true, 'txn_id');
     });
 }