/** * @param Transaction $txn */ public function populateTransactionDetails(Transaction $txn) { $txn->testMode = $this->state->testMode; $txn->vatNumberStatus = $this->state->vatNumberStatus; $txn->vatNumberGiven = $this->state->vatNumber; $txn->vatNumberGivenCountryCode = $this->state->vatNumberCountryCode; $txn->transactionAmount = $this->state->total; $txn->transactionCurrency = $this->state->config->currencyCode; $txn->vatAmount = $this->state->vatTotal; $txn->billingAddressCountryCode = $this->state->addressCountryCode; $txn->ipCountryCode = $this->state->ipCountryCode; $txn->billingAddress = $this->state->addressAsString; $txn->transactionDescription = $this->state->config->briefDescription; $txnDetailArr = []; foreach ($this->state->lineItems as $item) { // Coerce LineItem StructClass to array $txnDetailArr[] = (array) $item; } $txn->setTransactionDetail($txnDetailArr); }