Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/Resources/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @property-read mixed $amount
* @property-read mixed $amount_refunded
* @property-read mixed $app_fee
* @property-read mixed $charge_date
* @property-read mixed $created_at
* @property-read mixed $currency
Expand Down Expand Up @@ -55,6 +56,15 @@ class Payment extends BaseResource
*/
protected $amount_refunded;

/**
* The amount to be deducted from the payment as the OAuth app''s fee,
* in the lowest denomination for the currency (e.g. pence in GBP, cents in
* EUR).
*
* Only present if the payment was created via an app.
*/
protected $app_fee;

/**
* A future date on which the payment should be collected. If not specified,
* the payment will be collected as soon as possible. If the value is before
Expand Down
27 changes: 27 additions & 0 deletions tests/Integration/PaymentsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function testPaymentsCreate()
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}

if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}

if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down Expand Up @@ -120,6 +124,9 @@ public function testPaymentsCreateWithIdempotencyConflict()
if (property_exists($body, 'amount_refunded')) {
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}
if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}
if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down Expand Up @@ -199,6 +206,10 @@ public function testPaymentsList()
$this->assertEquals($body[$num]->amount_refunded, $record->amount_refunded);
}

if (isset($body[$num]->app_fee)) {
$this->assertEquals($body[$num]->app_fee, $record->app_fee);
}

if (isset($body[$num]->charge_date)) {
$this->assertEquals($body[$num]->charge_date, $record->charge_date);
}
Expand Down Expand Up @@ -279,6 +290,10 @@ public function testPaymentsGet()
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}

if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}

if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down Expand Up @@ -359,6 +374,10 @@ public function testPaymentsUpdate()
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}

if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}

if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down Expand Up @@ -439,6 +458,10 @@ public function testPaymentsCancel()
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}

if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}

if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down Expand Up @@ -519,6 +542,10 @@ public function testPaymentsRetry()
$this->assertEquals($body->amount_refunded, $response->amount_refunded);
}

if (property_exists($body, 'app_fee')) {
$this->assertEquals($body->app_fee, $response->app_fee);
}

if (property_exists($body, 'charge_date')) {
$this->assertEquals($body->charge_date, $response->charge_date);
}
Expand Down
Loading