Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds pre authorization test that includes customer info
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 26, 2016
1 parent 57b0a21 commit ca72ea6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Faker\Factory as Faker;
use CraigPaul\Moneris\Vault;
use CraigPaul\Moneris\Gateway;
use CraigPaul\Moneris\Moneris;
Expand Down Expand Up @@ -115,6 +116,44 @@ public function it_can_pre_authorize_a_purchase_and_receive_a_response()
$this->assertTrue($response->successful);
}

/** @test */
public function it_can_pre_authorize_a_purchase_with_provided_customer_information_and_receive_a_response()
{
$faker = Faker::create();
$customer = [
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'company_name' => $faker->company,
'address' => $faker->streetAddress,
'city' => $faker->city,
'province' => 'SK',
'postal_code' => 'X0X0X0',
'country' => 'Canada',
'phone_number' => '555-555-5555',
'fax' => '555-555-5555',
'tax1' => '1.01',
'tax2' => '1.02',
'tax3' => '1.03',
'shipping_cost' => '9.99',
];
$params = array_merge($this->params, [
'cust_id' => uniqid('customer-', true),
'cust_info' => [
'email' => '[email protected]',
'instructions' => $faker->sentence(mt_rand(3, 6)),
'billing' => $customer,
'shipping' => $customer
],
]);
$response = $this->gateway->preauth($params);
$receipt = $response->receipt();

$this->assertEquals(Response::class, get_class($response));
$this->assertTrue($response->successful);
$this->assertTrue($receipt->read('complete'));
$this->assertNotNull($receipt->read('transaction'));
}

/** @test */
public function it_can_make_a_cvd_secured_pre_authorization_and_receive_a_response()
{
Expand Down

0 comments on commit ca72ea6

Please sign in to comment.