-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from xsolla/release_04_12_2019
Release 04 12 2019
- Loading branch information
Showing
8 changed files
with
139 additions
and
11 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
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
class Version | ||
{ | ||
const VERSION = 'v4.0.1'; | ||
const VERSION = 'v4.0.2'; | ||
|
||
/** | ||
* @throws XsollaException | ||
|
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Xsolla\SDK\Webhook\Message; | ||
|
||
class AfsRejectMessage extends Message | ||
{ | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getTransaction() | ||
{ | ||
return $this->request['transaction']; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getPaymentId() | ||
{ | ||
return $this->request['transaction']['id']; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getExternalPaymentId() | ||
{ | ||
if (array_key_exists('external_id', $this->request['transaction'])) { | ||
return $this->request['transaction']['external_id']; | ||
} | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getPaymentAgreement() | ||
{ | ||
return $this->request['transaction']['agreement']; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getRefundDetails() | ||
{ | ||
return $this->request['refund_details']; | ||
} | ||
|
||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Xsolla\SDK\Tests\Unit\Webhook\Message; | ||
|
||
|
||
use PHPUnit\Framework\TestCase; | ||
use Xsolla\SDK\Webhook\Message\AfsRejectMessage; | ||
|
||
/** | ||
* @group unit | ||
*/ | ||
class AfsRejectMessageTest extends TestCase | ||
{ | ||
protected $request = [ | ||
'notification_type' => 'afs_reject', | ||
'user' => [ | ||
'ip' => '127.0.0.1', | ||
'phone' => '18777976552', | ||
'email' => '[email protected]', | ||
'id' => '1234567', | ||
'country' => 'US' | ||
], | ||
'transaction' => [ | ||
'id' => 87654321, | ||
'payment_date' => '2014-09-23T19:25:25+04:00', | ||
'payment_method' => 1380, | ||
'external_id' => 12345678 | ||
], | ||
'refund_details' => [ | ||
'code' => 4, | ||
'reason' => 'Potential fraud' | ||
] | ||
]; | ||
|
||
|
||
public function test() | ||
{ | ||
$message = new AfsRejectMessage($this->request); | ||
static::assertSame($this->request['transaction']['id'], $message->getPaymentId()); | ||
static::assertSame($this->request['transaction']['external_id'], $message->getExternalPaymentId()); | ||
static::assertSame($this->request['refund_details'], $message->getRefundDetails()); | ||
|
||
} | ||
} |
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