![]() 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/job-board.corals.io/Corals/modules/Payment/SecurionPay/Message/ |
<?php /** * SecurionPay Purchase Request. */ namespace Corals\Modules\Payment\SecurionPay\Message; /** * SecurionPay Purchase Request. * * To charge a credit card, you create a new charge object. If your API key * is in test mode, the supplied card won't actually be charged, though * everything else will occur as if in live mode. (SecurionPay assumes that the * charge would have completed successfully). * * Example: * * <code> * // Create a gateway for the SecurionPay Gateway * // (routes to GatewayFactory::create) * $gateway = Payment::create('SecurionPay'); * * // Initialise the gateway * $gateway->initialize(array( * 'apiKey' => 'MyApiKey', * )); * * // Create a credit card object * // This card can be used for testing. * $card = new CreditCard(array( * 'firstName' => 'Example', * 'lastName' => 'Customer', * 'number' => '4242424242424242', * 'expiryMonth' => '01', * 'expiryYear' => '2020', * 'cvv' => '123', * 'email' => '[email protected]', * 'billingAddress1' => '1 Scrubby Creek Road', * 'billingCountry' => 'AU', * 'billingCity' => 'Scrubby Creek', * 'billingPostcode' => '4999', * 'billingState' => 'QLD', * )); * * // Do a purchase transaction on the gateway * $transaction = $gateway->purchase(array( * 'amount' => '10.00', * 'currency' => 'USD', * 'description' => 'This is a test purchase transaction.', * 'card' => $card, * )); * $response = $transaction->send(); * if ($response->isSuccessful()) { * echo "Purchase transaction was successful!\n"; * $sale_id = $response->getTransactionReference(); * echo "Transaction reference = " . $sale_id . "\n"; * } * </code> * * Because a purchase request in SecurionPay looks similar to an * Authorize request, this class simply extends the AuthorizeRequest * class and over-rides the getData method setting capture = true. * * @see \Corals\Modules\Payment\SecurionPay\Gateway * @link https://securionpay.com/docs/api#charges */ class PurchaseRequest extends AuthorizeRequest { public function getData() { $data = parent::getData(); $data['capture'] = 'true'; return $data; } }