![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/StripeIntegration/Tax/Model/StripeTransaction/ |
<?php namespace StripeIntegration\Tax\Model\StripeTransaction; class Request { public const CALCULATION_FIELD_NAME = 'calculation'; public const REFERENCE_FIELD_NAME = 'reference'; public const METADATA_FIELD_NAME = 'metadata'; public const EXPAND_FIELD_NAME = 'expand'; private $calculation; private $reference; private $metadata; private $expand; public function formData($invoice) { $this->setCalculation($invoice->getStripeTaxCalculationId()) ->setReference(sprintf('Invoice # %s_%s', $invoice->getIncrementId(), time())) ->setMetadata([ 'payment_transaction_id' => $invoice->getOrder()->getPayment()->getLastTransId(), 'order_id' => $invoice->getOrder()->getIncrementId() ]) ->setExpand(['line_items']); return $this; } public function toArray() { return [ self::CALCULATION_FIELD_NAME => $this->getCalculation(), self::REFERENCE_FIELD_NAME => $this->getReference(), self::METADATA_FIELD_NAME => $this->getMetadata(), self::EXPAND_FIELD_NAME => $this->getExpand(), ]; } public function getCalculation() { return $this->calculation; } public function setCalculation($calculation) { $this->calculation = $calculation; return $this; } public function getReference() { return $this->reference; } public function setReference($reference) { $this->reference = $reference; return $this; } public function getMetadata() { return $this->metadata; } public function setMetadata($metadata) { $this->metadata = $metadata; return $this; } public function getExpand() { return $this->expand; } public function setExpand($expand) { $this->expand = $expand; return $this; } }