Beispiel #1
0
 /**
  * 
  * @param type $apiConfig
  */
 function __construct($apiConfig = \CityPay\Config\DefaultConfig::class)
 {
     if (!is_subclass_of($apiConfig, \CityPay\Config\RuntimeConfig::class)) {
         throw new \InvalidArgumentException();
     }
     $this->logger = \CityPay\Lib\Logger::getLogger(__CLASS__);
     self::initialiseNameValueComponent($apiConfig);
     self::set("test", $apiConfig::isApiTestingEnabled() ? "true" : "false");
 }
Beispiel #2
0
 /**
  * 
  */
 public function testPayLinkRequest_success()
 {
     $logger = Logger::getLogger(__CLASS__);
     Logger::configure(static::getEchoLoggerConfig());
     $this->assertTrue($logger instanceof LoggerInterface);
     $pr = new PayLinkRequest();
     $address = (new Address())->address1("<addressLine1>")->address2("<addressLine2>")->area("<area>");
     $cardholder = (new Cardholder())->title("<title>")->firstName("<firstName>")->lastName("<lastName>")->address($address);
     $configuration = (new Configuration())->postbackPolicy("sync")->postback("http://postback/address")->redirect("http://general/redirect")->redirectSuccess("http://success/redirect")->redirectFailure("http://failure/redirect")->options(array(Configuration::BYPASS_CUSTOMER_EMAIL, Configuration::BYPASS_MERCHANT_EMAIL, Configuration::BYPASS_AVS_ADDRESS, Configuration::BYPASS_AVS_POSTCODE, Configuration::ENFORCE_CSC_REQUIRED));
     $pr->merchantId(self::getElectronicCommerceHighPassMID())->licenceKey(self::getClientLicenceKey())->identifier("PaymentRequestGoodRequestPacketTest")->amount(5000)->currency("GBP")->cardholder($cardholder)->configuration($configuration);
     $res = $pr->saleTransaction();
     $this->assertTrue(get_class($res) == 'CityPay\\PayLink\\PayLinkToken', "Response object is of type " . get_class($res) . ", not CityPay\\PayLink\\PayLinkToken as required.");
 }