Skip to content

Commit

Permalink
test existing StandaloneCredits; fix what tests revealed
Browse files Browse the repository at this point in the history
  • Loading branch information
PayLeaseBrian committed Dec 12, 2017
1 parent ff91711 commit 6c376cd
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 63 deletions.
2 changes: 1 addition & 1 deletion source/Paysafe/DirectDebit/ShippingDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @property string $country
* @property string $zip
*/
class ShippingDetails
class ShippingDetails extends \Paysafe\JSONObject
{

//put your code here
Expand Down
126 changes: 64 additions & 62 deletions source/Paysafe/DirectDebit/StandaloneCredits.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,74 +17,76 @@
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Paysafe\DirectDebit;

/*
* @property string $id
* @property string $merchantRefNum
* @property int $amount
* @property \Paysafe\DirectDebit\ach $ach
* @property \Paysafe\DirectDebit\eft $eft
* @property \Paysafe\DirectDebit\bacs $bacs
* @property \Paysafe\DirectDebit\profile $profile
* @property \Paysafe\DirectDebit\billingDetails $billingDetails
* @property \Paysafe\DirectDebit\ShippingDetails $shippingDetails
* @property string $customerIp
* @property string $dupCheck
* @property string $txnTime
* @property string $currencyCode
* @property \Paysafe\Error $error
* @property string $status
*/
namespace Paysafe\DirectDebit;

class StandaloneCredits extends \Paysafe\JSONObject implements \Paysafe\Pageable {
use Paysafe\PaysafeException;

public static function getPageableArrayKey() {
return "standaloneCredits";
}
/**
* @property string $id
* @property string $merchantRefNum
* @property int $amount
* @property \Paysafe\DirectDebit\ACH $ach
* @property \Paysafe\DirectDebit\EFT $eft
* @property \Paysafe\DirectDebit\BACS $bacs
* @property \Paysafe\DirectDebit\Profile $profile
* @property \Paysafe\DirectDebit\Filter $filter
* @property \Paysafe\DirectDebit\BillingDetails $billingDetails
* @property \Paysafe\DirectDebit\ShippingDetails $shippingDetails
* @property string $customerIp
* @property bool $dupCheck
* @property string $txnTime
* @property string $currencyCode
* @property \Paysafe\Error $error
* @property string $status
* @property \Paysafe\Link[] $links
*/
class StandaloneCredits extends \Paysafe\JSONObject implements \Paysafe\Pageable
{
public static function getPageableArrayKey() {
return "standaloneCredits";
}

protected static $fieldTypes = array(
'id' => 'string',
'merchantRefNum' => 'string',
'amount' => 'int',
'ach' => '\Paysafe\DirectDebit\ACH',
'eft' => '\Paysafe\DirectDebit\EFT',
'bacs' => '\Paysafe\DirectDebit\BACS',
'profile' => '\Paysafe\DirectDebit\Profile',
'filter' => '\Paysafe\DirectDebit\Filter',
'billingDetails' => '\Paysafe\DirectDebit\BillingDetails',
'shippingDetails' => '\Paysafe\DirectDebit\ShippingDetails',
'customerIp' => 'string',
'dupCheck' => 'bool',
'txnTime' => 'string',
'currencyCode' => 'string',
'error' => '\Paysafe\Error',
'status' => array(
'RECEIVED',
'PENDING',
'PROCESSING',
'COMPLETED',
'FAILED',
'CANCELLED'
),
'links' => 'array:\Paysafe\Link'
);
protected static $fieldTypes = array(
'id' => 'string',
'merchantRefNum' => 'string',
'amount' => 'int',
'ach' => '\Paysafe\DirectDebit\ACH',
'eft' => '\Paysafe\DirectDebit\EFT',
'bacs' => '\Paysafe\DirectDebit\BACS',
'profile' => '\Paysafe\DirectDebit\Profile',
'filter' => '\Paysafe\DirectDebit\Filter',
'billingDetails' => '\Paysafe\DirectDebit\BillingDetails',
'shippingDetails' => '\Paysafe\DirectDebit\ShippingDetails',
'customerIp' => 'string',
'dupCheck' => 'bool',
'txnTime' => 'string',
'currencyCode' => 'string',
'error' => '\Paysafe\Error',
'status' => array(
'RECEIVED',
'PENDING',
'PROCESSING',
'COMPLETED',
'FAILED',
'CANCELLED'
),
'links' => 'array:\Paysafe\Link'
);

/**
*
* @param type $linkName
* @return \Paysafe\HostedPayment\Link
* @throws PaysafeException
*/
public function getLink( $linkName ) {
if (!empty($this->link)) {
foreach ($this->link as $link) {
if ($link->rel == $linkName) {
return $link;
}
/**
* @param string $linkName
* @return \Paysafe\Link
* @throws \Paysafe\PaysafeException
*/
public function getLink( $linkName ) {
if (!empty($this->links)) {
foreach ($this->links as $link) {
if ($link->rel == $linkName) {
return $link;
}
}
throw new PaysafeException("Link $linkName not found in purchase.");
}

throw new PaysafeException("Link $linkName not found in stand alone credit.");
}
}
Loading

0 comments on commit 6c376cd

Please sign in to comment.