This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds pre authorization test that includes customer info
- Loading branch information
Craig Paul
committed
Oct 26, 2016
1 parent
57b0a21
commit ca72ea6
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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() | ||
{ | ||
|