/** * Repeat payment constructor. * * @param Endpoint $endpoint * @param Auth $auth * @param string $transactionId The transacation ID of the original reference payment * @param string $vendorTxCode The merchant site vnedor code for the repeat payment * @param AmountInterface $amount * @param string $description * @param AddressInterface|null $shippingAddress * @param PersonInterface|null $shippingRecipient */ public function __construct(Endpoint $endpoint, Auth $auth, $transactionId, $vendorTxCode, AmountInterface $amount, $description, Model\AddressInterface $shippingAddress = null, Model\PersonInterface $shippingRecipient = null) { $this->setEndpoint($endpoint); $this->setAuth($auth); $this->setDescription($description); $this->setTransactionId($transactionId); $this->vendorTxCode = $vendorTxCode; $this->amount = $amount; $this->shippingAddress = $shippingAddress->withFieldPrefix($this->shippingAddressFieldPrefix); $this->shippingRecipient = $shippingRecipient->withFieldPrefix($this->shippingNameFieldPrefix); }
/** * Transaction constructor. * @param Endpoint $endpoint * @param Auth $auth * @param PaymentMethodInterface $paymentMethod * @param string $vendorTxCode * @param AmountInterface $amount * @param string $description * @param AddressInterface $billingAddress * @param PersonInterface $customer * @param AddressInterface|null $shippingAddress * @param PersonInterface|null $shippingRecipient * @param array $options Optional transaction options */ public function __construct(Endpoint $endpoint, Auth $auth, Model\PaymentMethodInterface $paymentMethod, $vendorTxCode, AmountInterface $amount, $description, Model\AddressInterface $billingAddress, Model\PersonInterface $customer, Model\AddressInterface $shippingAddress = null, Model\PersonInterface $shippingRecipient = null, array $options = []) { // Set the transaction type (for easy implementation of "authorise" later). $this->transactionType = static::TRANSACTION_TYPE_PAYMENT; // Access details. $this->setEndpoint($endpoint); $this->setAuth($auth); $this->setDescription($description); // Payment details. $this->paymentMethod = $paymentMethod; $this->vendorTxCode = $vendorTxCode; $this->amount = $amount; // Customer details. $this->billingAddress = $billingAddress->withFieldPrefix(''); $this->customer = $customer->withFieldPrefix($this->customerFieldsPrefix); // Optional recipient details. if (isset($shippingAddress)) { $this->shippingAddress = $shippingAddress->withFieldPrefix($this->shippingAddressFieldPrefix); } if (isset($shippingRecipient)) { $this->shippingRecipient = $shippingRecipient->withFieldPrefix($this->shippingNameFieldPrefix); } // Additional options. $this->setOptions($options); }