Skip to content

Commit

Permalink
Added one-time charge functionality to tool kit (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawandeepalw authored and jerairrest committed Sep 26, 2017
1 parent ea14b05 commit 5fd88d1
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 0 deletions.
178 changes: 178 additions & 0 deletions src/Models/ApplicationCharge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<?php

namespace BoldApps\ShopifyToolkit\Models;

use BoldApps\ShopifyToolkit\Contracts\Serializeable;

/**
* Class ApplicationCharge
* @package BoldApps\ShopifyToolkit\Models
*/
class ApplicationCharge implements Serializeable
{
/**
* @var int
*/
protected $id;
/**
* @var string
*/
protected $confirmationUrl;
/**
* @var string
*/
protected $createdAt;
/**
* @var string
*/
protected $name;
/**
* @var float
*/
protected $price;
/**
* @var string
*/
protected $returnUrl;
/**
* @var string
*/
protected $status;
/**
* @var boolean
*/
protected $test;
/**
* @var string
*/
protected $updatedAt;
/**
* @var int
*/
protected $apiClientId;
/**
* @var string
*/
protected $decoratedReturnUrl;


/**
* @return int
*/
public function getId()
{
return $this->id;
}

/**
* @return string
*/
public function getConfirmationUrl()
{
return $this->confirmationUrl;
}

/**
* @return string
*/
public function getCreatedAt()
{
return $this->createdAt;
}

/**
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* @param $name
*/
public function setName($name)
{
$this->name = $name;
}

/**
* @return mixed
*/
public function getPrice()
{
return $this->price;
}

/**
* @param $price
*/
public function setPrice($price)
{
$this->price = $price;
}

/**
* @return string
*/
public function getReturnUrl()
{
return $this->returnUrl;
}

/**
* @param $returnUrl
*/
public function setReturnUrl($returnUrl)
{
$this->returnUrl = $returnUrl;
}

/**
* @return string
*/
public function getStatus()
{
return $this->status;
}

/**
* @return bool
*/
public function getTest()
{
return $this->test;
}

/**
* @param $test
*/
public function setTest($test)
{
$this->test = $test;
}

/**
* @return string
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}

/**
* @return int
*/
public function getApiClientId()
{
return $this->apiClientId;
}

/**
* @return string
*/
public function getDecoratedReturnUrl()
{
return $this->decoratedReturnUrl;
}
}
39 changes: 39 additions & 0 deletions src/Services/ApplicationCharge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace BoldApps\ShopifyToolkit\Services;

use BoldApps\ShopifyToolkit\Models\ApplicationCharge as ShopifyApplicationCharge;

/**
* Class ApplicationCharge
* @package BoldApps\ShopifyToolkit\Services
*/
class ApplicationCharge extends Base
{

/**
* @param ShopifyApplicationCharge $applicationCharge
*
* @return ShopifyApplicationCharge \ object
*/
public function create(ShopifyApplicationCharge $applicationCharge)
{
$serializedModel = ['application_charge' => $this->serializeModel($applicationCharge)];

$raw = $this->client->post('admin/application_charges.json', [], $serializedModel);

return $this->unserializeModel($raw['application_charge'], ShopifyApplicationCharge::class);
}

/**
* @param $id
*
* @return ShopifyApplicationCharge \ object
*/
public function getById($id)
{
$charge = $this->client->get("admin/application_charges/$id.json");

return $this->unserializeModel($charge['application_charge'], ShopifyApplicationCharge::class);
}
}

0 comments on commit 5fd88d1

Please sign in to comment.