41 lines
2.4 KiB
PHP
41 lines
2.4 KiB
PHP
<?php
|
|
|
|
use girosolution\GiroCheckout_SDK\GiroCheckout_SDK_Request;
|
|
|
|
if (!class_exists('GiroCheckoutGiropay')) {
|
|
require_once 'class.GiroCheckoutGiropay.php';
|
|
}
|
|
|
|
class GiroCheckoutPaydirek extends GiroCheckoutGiropay
|
|
{
|
|
public static $name = 'GiroCheckout Paydirekt';
|
|
|
|
public $class = 'GiroCheckoutPaydirek';
|
|
|
|
protected $methodCode = 'paydirektTransaction';
|
|
|
|
public function accept($totalPrice, $freeDelivery)
|
|
{
|
|
$totalPrice = $totalPrice->getPriceWithVat()->asFloat();
|
|
if ($totalPrice <= 0 && $this->order) {
|
|
$totalPrice = $this->order->total_price;
|
|
}
|
|
|
|
// max 50000 EUR (http://api.girocheckout.de/girocheckout:paydirekt:start#initialisierung_einer_paydirekt_zahlung)
|
|
return parent::accept($totalPrice, $freeDelivery) && $totalPrice < 50000;
|
|
}
|
|
|
|
protected function addRequestParams(GiroCheckout_SDK_Request $request): GiroCheckout_SDK_Request
|
|
{
|
|
$request->addParam('shippingAddresseFirstName', $this->order->delivery_name) // Vorname des Addressaten, Pflicht bei Warenkorbtypen PHYSICAL, DIGITAL und MIXED, optional bei ANONYMOUS_DONATION und AUTHORITIES_PAYMENT.
|
|
->addParam('shippingAddresseLastName', $this->order->delivery_surname) // Nachname des Addressaten, Pflicht bei Warenkorbtypen PHYSICAL, DIGITAL und MIXED, optional bei ANONYMOUS_DONATION und AUTHORITIES_PAYMENT.
|
|
->addParam('shippingZipCode', $this->order->delivery_zip) // PLZ des Addressaten. Dies ist Pflicht bei Warenkörben der Typen PHYSICAL und MIXED, optional bei DIGITAL, ANONYMOUS_DONATION und AUTHORITIES_PAYMENT.
|
|
->addParam('shippingCity', $this->order->delivery_city) // Ort des Addressaten. Dies ist Pflicht bei Warenkörben der Typen PHYSICAL und MIXED, optional bei DIGITAL, ANONYMOUS_DONATION und AUTHORITIES_PAYMENT.
|
|
->addParam('shippingCountry', $this->order->delivery_country) // Ländercode (ISO 3166-1). Dies ist Pflicht bei Warenkörben der Typen PHYSICAL und MIXED, optional bei DIGITAL, ANONYMOUS_DONATION und AUTHORITIES_PAYMENT.
|
|
->addParam('shippingEmail', $this->order->invoice_email) // Email-Adresse des Käufers. Dies ist Pflicht bei digitalen Warenkörben (DIGITAL), bei allen anderen optional.
|
|
->addParam('orderId', $this->orderId); // Bestellnummer, zulässige Zeichen: A-Z a-z 0-9 + ? / - : ( ) . , ' (KEINE Blanks), maximale Länge: 20
|
|
|
|
return $request;
|
|
}
|
|
}
|