code
stringlengths 31
1.39M
| docstring
stringlengths 23
16.8k
| func_name
stringlengths 1
126
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
166
| url
stringlengths 50
220
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function childrenConditional($ConditionString,$Rest=null)
{
$Arguments=func_get_args();
array_shift($Arguments);
$Query="
SELECT node.*, (COUNT(parent.{$this->id()})-1 - (sub_tree.innerDepth )) AS Depth
FROM {$this->table()} AS node,
{$this->table()} AS parent,
{$this->table()} AS sub_parent,
(
SELECT node.{$this->id()}, (COUNT(parent.{$this->id()}) - 1) AS innerDepth
FROM {$this->table()} AS node,
{$this->table()} AS parent
WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()}
AND (node.$ConditionString)
GROUP BY node.{$this->id()}
ORDER BY node.{$this->left()}
) AS sub_tree
WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()}
AND node.{$this->left()} BETWEEN sub_parent.{$this->left()} AND sub_parent.{$this->right()}
AND sub_parent.{$this->id()} = sub_tree.{$this->id()}
GROUP BY node.{$this->id()}
HAVING Depth = 1
ORDER BY node.{$this->left()}";
array_unshift($Arguments,$Query);
$Res=call_user_func_array("Jf::sql",$Arguments);
if ($Res)
foreach ($Res as &$v)
unset($v["Depth"]);
return $Res;
}
|
Returns immediate children of a node
Note: this function performs the same as descendants but only returns results with Depth=1
Note: use only a sinlge condition here
@param string $ConditionString
@param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition
@return Rowset not including Depth
@seealso descendants
|
childrenConditional
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
function pathConditional($ConditionString,$Rest=null)
{
$Arguments=func_get_args();
array_shift($Arguments);
$Query="
SELECT parent.*
FROM {$this->table()} AS node,
{$this->table()} AS parent
WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()}
AND ( node.$ConditionString )
ORDER BY parent.{$this->left()}";
array_unshift($Arguments,$Query);
$Res=call_user_func_array("Jf::sql",$Arguments);
return $Res;
}
|
Returns the path to a node, including the node
Note: use a single condition, or supply "node." before condition fields.
@param string $ConditionString
@param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition
@return Rowset nodes in path
|
pathConditional
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
function leavesConditional($ConditionString=null,$Rest=null)
{
if ($ConditionString)
{
$Arguments=func_get_args();
array_shift($Arguments);
if ($ConditionString) $ConditionString="WHERE $ConditionString";
$Query="SELECT *
FROM {$this->table()}
WHERE {$this->right()} = {$this->left()} + 1
AND {$this->left()} BETWEEN
(SELECT {$this->left()} FROM {$this->table()} $ConditionString)
AND
(SELECT {$this->right()} FROM {$this->table()} $ConditionString)";
$Arguments=array_merge($Arguments,$Arguments);
array_unshift($Arguments,$Query);
$Res=call_user_func_array("Jf::sql",$Arguments);
}
else
$Res=Jf::sql("SELECT *
FROM {$this->table()}
WHERE {$this->right()} = {$this->left()} + 1");
return $Res;
}
|
Finds all leaves of a parent
Note: if you don' specify $PID, There would be one less AND in the SQL Query
@param String $ConditionString
@param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition
@return Rowset Leaves
|
leavesConditional
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
function insertSiblingData($FieldValueArray=array(),$ConditionString=null,$Rest=null)
{
$this->lock();
//Find the Sibling
$Arguments=func_get_args();
array_shift($Arguments); //first argument, the array
array_shift($Arguments);
if ($ConditionString) $ConditionString="WHERE $ConditionString";
$Query="SELECT {$this->right()} AS `Right`".
" FROM {$this->table()} $ConditionString";
array_unshift($Arguments,$Query);
$Sibl=call_user_func_array("Jf::sql",$Arguments);
$Sibl=$Sibl[0];
if ($Sibl==null)
{
$Sibl["Left"]=$Sibl["Right"]=0;
}
Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} > ?",$Sibl["Right"]);
Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Sibl["Right"]);
$FieldsString=$ValuesString="";
$Values=array();
if ($FieldValueArray)
foreach($FieldValueArray as $k=>$v)
{
$FieldsString.=",";
$FieldsString.="`".$k."`";
$ValuesString.=",?";
$Values[]=$v;
}
$Query= "INSERT INTO {$this->table()} ({$this->left()},{$this->right()} $FieldsString) ".
"VALUES(?,? $ValuesString)";
array_unshift($Values,$Sibl["Right"]+2);
array_unshift($Values,$Sibl["Right"]+1);
array_unshift($Values,$Query);
$Res=call_user_func_array("Jf::sql",$Values);
$this->unlock();
return $Res;
}
|
Adds a sibling after a node
@param array $FieldValueArray Pairs of Key/Value as Field/Value in the table
@param string $ConditionString
@param string $Rest optional, rest of variables to fill in placeholders of condition string
@return Integer SiblingID
|
insertSiblingData
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
function insertChildData($FieldValueArray=array(),$ConditionString=null,$Rest=null)
{
$this->lock();
//Find the Sibling
$Arguments=func_get_args();
array_shift($Arguments); //first argument, the array
array_shift($Arguments);
if ($ConditionString) $ConditionString="WHERE $ConditionString";
$Query="SELECT {$this->right()} AS `Right`, {$this->left()} AS `Left`".
" FROM {$this->table()} $ConditionString";
array_unshift($Arguments,$Query);
$Parent=call_user_func_array("Jf::sql",$Arguments);
$Parent=$Parent[0];
if ($Parent==null)
{
$Parent["Left"]=$Parent["Right"]=0;
}
Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} >= ?",$Parent["Right"]);
Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Parent["Right"]);
$FieldsString=$ValuesString="";
$Values=array();
if ($FieldValueArray)
foreach($FieldValueArray as $k=>$v)
{
$FieldsString.=",";
$FieldsString.="`".$k."`";
$ValuesString.=",?";
$Values[]=$v;
}
$Query= "INSERT INTO {$this->table()} ({$this->left()},{$this->right()} $FieldsString) ".
"VALUES(?,? $ValuesString)";
array_unshift($Values,$Parent["Right"]+1);
array_unshift($Values,$Parent["Right"]);
array_unshift($Values,$Query);
$Res=call_user_func_array("Jf::sql",$Values);
$this->unlock();
return $Res;
}
|
Adds a child to the beginning of a node's children
@param Array $FieldValueArray key-paired field-values to insert
@param string $ConditionString of the parent node
@param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition
@return Integer ChildID
|
insertChildData
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
function editData($FieldValueArray=array(),$ConditionString=null,$Rest=null)
{
//Find the Sibling
$Arguments=func_get_args();
array_shift($Arguments); //first argument, the array
array_shift($Arguments);
if ($ConditionString) $ConditionString="WHERE $ConditionString";
$FieldsString="";
$Values=array();
if ($FieldValueArray)
foreach($FieldValueArray as $k=>$v)
{
if ($FieldsString!="") $FieldsString.=",";
$FieldsString.="`".$k."`=?";
$Values[]=$v;
}
$Query="UPDATE {$this->table()} SET $FieldsString $ConditionString";
array_unshift($Values,$Query);
$Arguments=array_merge($Values,$Arguments);
return call_user_func_array("Jf::sql",$Arguments);
}
|
Edits a node
@param Array $FieldValueArray Pairs of Key/Value as Field/Value in the table to edit
@param string $ConditionString
@param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition
@return Integer SiblingID
|
editData
|
php
|
OWASP/rbac
|
PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
https://github.com/OWASP/rbac/blob/master/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php
|
Apache-2.0
|
private function upload(string $path, $body, Config $config): void
{
$key = $this->prefixer->prefixPath($path);
$options = $this->createOptionsFromConfig($config);
$acl = $options['params']['ACL'] ?? $this->determineAcl($config);
$shouldDetermineMimetype = ! array_key_exists('ContentType', $options['params']);
if ($shouldDetermineMimetype && $mimeType = $this->mimeTypeDetector->detectMimeType($key, $body)) {
$options['params']['ContentType'] = $mimeType;
}
try {
$this->client->upload($this->bucket, $key, $body, $acl, $options);
} catch (Throwable $exception) {
throw UnableToWriteFile::atLocation($path, $exception->getMessage(), $exception);
}
}
|
@param string $path
@param string|resource $body
@param Config $config
|
upload
|
php
|
thephpleague/flysystem-aws-s3-v3
|
AwsS3V3Adapter.php
|
https://github.com/thephpleague/flysystem-aws-s3-v3/blob/master/AwsS3V3Adapter.php
|
MIT
|
public function issue_291(): void
{
$adapter = $this->adapter();
$adapter->createDirectory('directory', new Config());
$listing = iterator_to_array($adapter->listContents('directory', true));
self::assertCount(0, $listing);
}
|
@test
@see https://github.com/thephpleague/flysystem-aws-s3-v3/issues/291
|
issue_291
|
php
|
thephpleague/flysystem-aws-s3-v3
|
AwsS3V3AdapterTest.php
|
https://github.com/thephpleague/flysystem-aws-s3-v3/blob/master/AwsS3V3AdapterTest.php
|
MIT
|
public function issue_287(): void
{
$adapter = $this->adapter();
$adapter->write('KmFVvKqo/QLMExy2U/620ff60c8a154.pdf', 'pdf content', new Config());
self::assertTrue($adapter->directoryExists('KmFVvKqo'));
}
|
@test
@see https://github.com/thephpleague/flysystem-aws-s3-v3/issues/287
|
issue_287
|
php
|
thephpleague/flysystem-aws-s3-v3
|
AwsS3V3AdapterTest.php
|
https://github.com/thephpleague/flysystem-aws-s3-v3/blob/master/AwsS3V3AdapterTest.php
|
MIT
|
public static function getProvider()
{
return self::$provider;
}
|
Get specific PayPal API provider object to use.
@throws Exception
@return \Srmklive\PayPal\Services\PayPal
|
getProvider
|
php
|
srmklive/laravel-paypal
|
src/PayPalFacadeAccessor.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/PayPalFacadeAccessor.php
|
MIT
|
public static function setProvider()
{
// Set default provider. Defaults to ExpressCheckout
self::$provider = new PayPalClient();
return self::getProvider();
}
|
Set PayPal API Client to use.
@throws \Exception
@return \Srmklive\PayPal\Services\PayPal
|
setProvider
|
php
|
srmklive/laravel-paypal
|
src/PayPalFacadeAccessor.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/PayPalFacadeAccessor.php
|
MIT
|
protected static function getFacadeAccessor()
{
return 'Srmklive\PayPal\PayPalFacadeAccessor';
}
|
Get the registered name of the component.
@return string
|
getFacadeAccessor
|
php
|
srmklive/laravel-paypal
|
src/Facades/PayPal.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Facades/PayPal.php
|
MIT
|
public function boot()
{
// Publish config files
$this->publishes([
__DIR__.'/../../config/config.php' => config_path('paypal.php'),
]);
// Publish Lang Files
$this->loadTranslationsFrom(__DIR__.'/../../lang', 'paypal');
}
|
Bootstrap the application events.
@return void
|
boot
|
php
|
srmklive/laravel-paypal
|
src/Providers/PayPalServiceProvider.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Providers/PayPalServiceProvider.php
|
MIT
|
public function register()
{
$this->registerPayPal();
$this->mergeConfig();
}
|
Register the service provider.
@return void
|
register
|
php
|
srmklive/laravel-paypal
|
src/Providers/PayPalServiceProvider.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Providers/PayPalServiceProvider.php
|
MIT
|
private function registerPayPal()
{
$this->app->singleton('paypal_client', static function () {
return new PayPalClient();
});
}
|
Register the application bindings.
@return void
|
registerPayPal
|
php
|
srmklive/laravel-paypal
|
src/Providers/PayPalServiceProvider.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Providers/PayPalServiceProvider.php
|
MIT
|
private function mergeConfig()
{
$this->mergeConfigFrom(
__DIR__.'/../../config/config.php',
'paypal'
);
}
|
Merges user's and paypal's configs.
@return void
|
mergeConfig
|
php
|
srmklive/laravel-paypal
|
src/Providers/PayPalServiceProvider.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Providers/PayPalServiceProvider.php
|
MIT
|
public function __construct(array $config = [])
{
// Setting PayPal API Credentials
$this->setConfig($config);
$this->httpBodyParam = 'form_params';
$this->options = [];
$this->setRequestHeader('Accept', 'application/json');
}
|
PayPal constructor.
@param array $config
@throws Exception
|
__construct
|
php
|
srmklive/laravel-paypal
|
src/Services/PayPal.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Services/PayPal.php
|
MIT
|
protected function setOptions(array $credentials): void
{
// Setting API Endpoints
$this->config['api_url'] = 'https://api-m.paypal.com';
$this->config['gateway_url'] = 'https://www.paypal.com';
$this->config['ipn_url'] = 'https://ipnpb.paypal.com/cgi-bin/webscr';
if ($this->mode === 'sandbox') {
$this->config['api_url'] = 'https://api-m.sandbox.paypal.com';
$this->config['gateway_url'] = 'https://www.sandbox.paypal.com';
$this->config['ipn_url'] = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
}
// Adding params outside sandbox / live array
$this->config['payment_action'] = $credentials['payment_action'];
$this->config['notify_url'] = $credentials['notify_url'];
$this->config['locale'] = $credentials['locale'];
}
|
Set ExpressCheckout API endpoints & options.
@param array $credentials
|
setOptions
|
php
|
srmklive/laravel-paypal
|
src/Services/PayPal.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Services/PayPal.php
|
MIT
|
public static function isJson($value): bool
{
if (!is_string($value)) {
return false;
}
if (function_exists('json_validate')) {
return json_validate($value, 512);
}
try {
Utils::jsonDecode($value, true, 512, 4194304);
} catch (\JsonException $jsonException) {
return false;
}
return true;
}
|
Determine if a given value is valid JSON.
@param mixed $value
@return bool
|
isJson
|
php
|
srmklive/laravel-paypal
|
src/Services/Str.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Services/Str.php
|
MIT
|
public static function getMimeType($file)
{
return MimeType::fromFilename($file);
}
|
Get Mime type from filename.
@param string $file
@return string
|
getMimeType
|
php
|
srmklive/laravel-paypal
|
src/Services/VerifyDocuments.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Services/VerifyDocuments.php
|
MIT
|
public function getAccessToken()
{
$this->apiEndPoint = 'v1/oauth2/token';
$this->options['auth'] = [$this->config['client_id'], $this->config['client_secret']];
$this->options[$this->httpBodyParam] = [
'grant_type' => 'client_credentials',
];
$response = $this->doPayPalRequest();
unset($this->options['auth']);
unset($this->options[$this->httpBodyParam]);
if (isset($response['access_token'])) {
$this->setAccessToken($response);
}
return $response;
}
|
Login through PayPal API to get access token.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/get-an-access-token-curl/
@see https://developer.paypal.com/docs/api/get-an-access-token-postman/
|
getAccessToken
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
public function setAccessToken(array $response)
{
$this->access_token = $response['access_token'];
$this->setPayPalAppId($response);
$this->setRequestHeader('Authorization', "{$response['token_type']} {$this->access_token}");
}
|
Set PayPal Rest API access token.
@param array $response
@return void
|
setAccessToken
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
private function setPayPalAppId(array $response)
{
$app_id = empty($response['app_id']) ? $this->config['app_id'] : $response['app_id'];
$this->config['app_id'] = $app_id;
}
|
Set PayPal App ID.
@param array $response
@return void
|
setPayPalAppId
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
public function setPageSize(int $size): \Srmklive\PayPal\Services\PayPal
{
$this->page_size = $size;
return $this;
}
|
Set records per page for list resources API calls.
@param int $size
@return \Srmklive\PayPal\Services\PayPal
|
setPageSize
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
public function setCurrentPage(int $page): \Srmklive\PayPal\Services\PayPal
{
$this->current_page = $page;
return $this;
}
|
Set the current page for list resources API calls.
@param int $size
@return \Srmklive\PayPal\Services\PayPal
|
setCurrentPage
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
public function showTotals(bool $totals): \Srmklive\PayPal\Services\PayPal
{
$this->show_totals = $totals ? 'true' : 'false';
return $this;
}
|
Toggle whether totals for list resources are returned after every API call.
@param bool $totals
@return \Srmklive\PayPal\Services\PayPal
|
showTotals
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI.php
|
MIT
|
public function setBrandName(string $brand): \Srmklive\PayPal\Services\PayPal
{
$this->experience_context = array_merge($this->experience_context, [
'brand_name' => $brand,
]);
return $this;
}
|
Set Brand Name when setting experience context for payment.
@param string $brand
@return \Srmklive\PayPal\Services\PayPal
|
setBrandName
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalExperienceContext.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalExperienceContext.php
|
MIT
|
public function setReturnAndCancelUrl(string $return_url, string $cancel_url): \Srmklive\PayPal\Services\PayPal
{
$this->experience_context = array_merge($this->experience_context, [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
return $this;
}
|
Set return & cancel urls.
@param string $return_url
@param string $cancel_url
@return \Srmklive\PayPal\Services\PayPal
|
setReturnAndCancelUrl
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalExperienceContext.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalExperienceContext.php
|
MIT
|
public function setStoredPaymentSource(string $initiator, string $type, string $usage, bool $previous_reference = false, string $previous_transaction_id = null, string $previous_transaction_date = null, string $previous_transaction_reference_number = null, string $previous_transaction_network = null): \Srmklive\PayPal\Services\PayPal
{
$this->experience_context = array_merge($this->experience_context, [
'stored_payment_source' => [
'payment_initiator' => $initiator,
'payment_type' => $type,
'usage' => $usage,
],
]);
if ($previous_reference === true) {
$this->experience_context['stored_payment_source']['previous_network_transaction_reference'] = [
'id' => $previous_transaction_id,
'date' => $previous_transaction_date,
'acquirer_reference_number' => $previous_transaction_reference_number,
'network' => $previous_transaction_network,
];
}
return $this;
}
|
Set stored payment source.
@param string $initiator
@param string $type
@param string $usage
@param bool $previous_reference
@param string|null $previous_transaction_id
@param string|null $previous_transaction_date
@param string|null $previous_transaction_reference_number
@param string|null $previous_transaction_network
@return \Srmklive\PayPal\Services\PayPal
|
setStoredPaymentSource
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalExperienceContext.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalExperienceContext.php
|
MIT
|
protected function setCurlConstants()
{
$constants = [
'CURLOPT_SSLVERSION' => 32,
'CURL_SSLVERSION_TLSv1_2' => 6,
'CURLOPT_SSL_VERIFYPEER' => 64,
'CURLOPT_SSLCERT' => 10025,
];
foreach ($constants as $key => $item) {
$this->defineCurlConstant($key, $item);
}
}
|
Set curl constants if not defined.
@return void
|
setCurlConstants
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
protected function defineCurlConstant(string $key, string $value)
{
return defined($key) ? true : define($key, $value);
}
|
Declare a curl constant.
@param string $key
@param string $value
@return bool
|
defineCurlConstant
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
public function setClient(HttpClient $client = null)
{
if ($client instanceof HttpClient) {
$this->client = $client;
return;
}
$this->client = new HttpClient([
'curl' => $this->httpClientConfig,
]);
}
|
Function to initialize/override Http Client.
@param \GuzzleHttp\Client|null $client
@return void
|
setClient
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
protected function setHttpClientConfiguration()
{
$this->setCurlConstants();
$this->httpClientConfig = [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
CURLOPT_SSL_VERIFYPEER => $this->validateSSL,
];
// Initialize Http Client
$this->setClient();
// Set default values.
$this->setDefaultValues();
// Set PayPal IPN Notification URL
$this->notifyUrl = $this->config['notify_url'];
}
|
Function to set Http Client configuration.
@return void
|
setHttpClientConfiguration
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
private function setDefaultValues()
{
$paymentAction = empty($this->paymentAction) ? 'Sale' : $this->paymentAction;
$this->paymentAction = $paymentAction;
$locale = empty($this->locale) ? 'en_US' : $this->locale;
$this->locale = $locale;
$validateSSL = empty($this->validateSSL) ? true : $this->validateSSL;
$this->validateSSL = $validateSSL;
$this->showTotals(true);
}
|
Set default values for configuration.
@return void
|
setDefaultValues
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
private function makeHttpRequest(): StreamInterface
{
try {
return $this->client->{$this->verb}(
$this->apiUrl,
$this->options
)->getBody();
} catch (HttpClientException $e) {
throw new RuntimeException($e->getResponse()->getBody());
}
}
|
Perform PayPal API request & return response.
@throws \Throwable
@return StreamInterface
|
makeHttpRequest
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
private function doPayPalRequest(bool $decode = true)
{
try {
$this->apiUrl = collect([$this->config['api_url'], $this->apiEndPoint])->implode('/');
// Perform PayPal HTTP API request.
$response = $this->makeHttpRequest();
return ($decode === false) ? $response->getContents() : Utils::jsonDecode($response, true);
} catch (RuntimeException $t) {
$error = ($decode === false) || (Str::isJson($t->getMessage()) === false) ? $t->getMessage() : Utils::jsonDecode($t->getMessage(), true);
return ['error' => $error];
}
}
|
Function To Perform PayPal API Request.
@param bool $decode
@throws \Throwable
@return array|StreamInterface|string
|
doPayPalRequest
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalHttpClient.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalHttpClient.php
|
MIT
|
public function setApiCredentials(array $credentials): void
{
if (empty($credentials)) {
$this->throwConfigurationException();
}
// Setting Default PayPal Mode If not set
$this->setApiEnvironment($credentials);
// Set API configuration for the PayPal provider
$this->setApiProviderConfiguration($credentials);
// Set default currency.
$this->setCurrency($credentials['currency']);
// Set Http Client configuration.
$this->setHttpClientConfiguration();
}
|
Set PayPal API Credentials.
@param array $credentials
@throws \RuntimeException|\Exception
|
setApiCredentials
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
public function setCurrency(string $currency = 'USD'): \Srmklive\PayPal\Services\PayPal
{
$allowedCurrencies = ['AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'INR', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'USD', 'RUB', 'CNY'];
// Check if provided currency is valid.
if (!in_array($currency, $allowedCurrencies, true)) {
throw new RuntimeException('Currency is not supported by PayPal.');
}
$this->currency = $currency;
return $this;
}
|
Function to set currency.
@param string $currency
@throws \RuntimeException
@return \Srmklive\PayPal\Services\PayPal
|
setCurrency
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
public function setRequestHeader(string $key, string $value): \Srmklive\PayPal\Services\PayPal
{
$this->options['headers'][$key] = $value;
return $this;
}
|
Function to add request header.
@param string $key
@param string $value
@return \Srmklive\PayPal\Services\PayPal
|
setRequestHeader
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
public function setRequestHeaders(array $headers): \Srmklive\PayPal\Services\PayPal
{
foreach ($headers as $key=>$value) {
$this->setRequestHeader($key, $value);
}
return $this;
}
|
Function to add multiple request headers.
@param array $headers
@return \Srmklive\PayPal\Services\PayPal
|
setRequestHeaders
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
public function getRequestHeader(string $key): string
{
if (isset($this->options['headers'][$key])) {
return $this->options['headers'][$key];
}
throw new RuntimeException('Options header is not set.');
}
|
Return request options header.
@param string $key
@throws \RuntimeException
@return string
|
getRequestHeader
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
private function setConfig(array $config): void
{
$api_config = empty($config) && function_exists('config') && !empty(config('paypal')) ?
config('paypal') : $config;
// Set Api Credentials
$this->setApiCredentials($api_config);
}
|
Function To Set PayPal API Configuration.
@param array $config
@throws \Exception
|
setConfig
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
private function setApiEnvironment(array $credentials): void
{
$this->mode = 'live';
if (!empty($credentials['mode'])) {
$this->setValidApiEnvironment($credentials['mode']);
} else {
$this->throwConfigurationException();
}
}
|
Set API environment to be used by PayPal.
@param array $credentials
|
setApiEnvironment
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
private function setValidApiEnvironment(string $mode): void
{
$this->mode = !in_array($mode, ['sandbox', 'live']) ? 'live' : $mode;
}
|
Validate & set the environment to be used by PayPal.
@param string $mode
|
setValidApiEnvironment
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
private function setApiProviderConfiguration(array $credentials): void
{
// Setting PayPal API Credentials
if (empty($credentials[$this->mode])) {
$this->throwConfigurationException();
}
$config_params = ['client_id', 'client_secret'];
foreach ($config_params as $item) {
if (empty($credentials[$this->mode][$item])) {
throw new RuntimeException("{$item} missing from the provided configuration. Please add your application {$item}.");
}
}
collect($credentials[$this->mode])->map(function ($value, $key) {
$this->config[$key] = $value;
});
$this->paymentAction = $credentials['payment_action'];
$this->locale = $credentials['locale'];
$this->setRequestHeader('Accept-Language', $this->locale);
$this->validateSSL = $credentials['validate_ssl'];
$this->setOptions($credentials);
}
|
Set configuration details for the provider.
@param array $credentials
@throws \Exception
|
setApiProviderConfiguration
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalRequest.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalRequest.php
|
MIT
|
public function verifyIPN(\Illuminate\Http\Request $request)
{
$headers = array_change_key_case($request->headers->all(), CASE_UPPER);
if (!isset($headers['PAYPAL-AUTH-ALGO'][0]) ||
!isset($headers['PAYPAL-TRANSMISSION-ID'][0]) ||
!isset($headers['PAYPAL-CERT-URL'][0]) ||
!isset($headers['PAYPAL-TRANSMISSION-SIG'][0]) ||
!isset($headers['PAYPAL-TRANSMISSION-TIME'][0]) ||
!isset($this->webhook_id)
) {
\Log::error('Invalid headers or webhook id supplied for paypal webhook');
return ['error' => 'Invalid headers or webhook id provided'];
}
$params = json_decode($request->getContent());
$payload = [
'auth_algo' => $headers['PAYPAL-AUTH-ALGO'][0],
'cert_url' => $headers['PAYPAL-CERT-URL'][0],
'transmission_id' => $headers['PAYPAL-TRANSMISSION-ID'][0],
'transmission_sig' => $headers['PAYPAL-TRANSMISSION-SIG'][0],
'transmission_time' => $headers['PAYPAL-TRANSMISSION-TIME'][0],
'webhook_id' => $this->webhook_id,
'webhook_event' => $params,
];
return $this->verifyWebHook($payload);
}
|
Verify incoming IPN through a web hook id.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
|
verifyIPN
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalVerifyIPN.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalVerifyIPN.php
|
MIT
|
public function createPlan(array $data)
{
$this->apiEndPoint = 'v1/billing/plans';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a new billing plan.
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create
|
createPlan
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function listPlans()
{
$this->apiEndPoint = "v1/billing/plans?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
List all billing plans.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_list
|
listPlans
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function updatePlan(string $plan_id, array $data)
{
$this->apiEndPoint = "v1/billing/plans/{$plan_id}";
$this->options['json'] = $data;
$this->verb = 'patch';
return $this->doPayPalRequest(false);
}
|
Update an existing billing plan.
@param string $plan_id
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_update
|
updatePlan
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function showPlanDetails(string $plan_id)
{
$this->apiEndPoint = "v1/billing/plans/{$plan_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Show details for an existing billing plan.
@param string $plan_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_get
|
showPlanDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function activatePlan(string $plan_id)
{
$this->apiEndPoint = "v1/billing/plans/{$plan_id}/activate";
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Activate an existing billing plan.
@param string $plan_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_activate
|
activatePlan
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function deactivatePlan(string $plan_id)
{
$this->apiEndPoint = "v1/billing/plans/{$plan_id}/deactivate";
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Deactivate an existing billing plan.
@param string $plan_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_deactivate
|
deactivatePlan
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function updatePlanPricing(string $plan_id, array $pricing)
{
$this->apiEndPoint = "v1/billing/plans/{$plan_id}/update-pricing-schemes";
$this->options['json'] = [
'pricing_schemes' => $pricing,
];
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Update pricing for an existing billing plan.
@param string $plan_id
@param array $pricing
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_update-pricing-schemes
|
updatePlanPricing
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/BillingPlans.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/BillingPlans.php
|
MIT
|
public function createProduct(array $data)
{
$this->apiEndPoint = 'v1/catalogs/products';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a product.
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/catalog-products/v1/#products_create
|
createProduct
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/CatalogProducts.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/CatalogProducts.php
|
MIT
|
public function listProducts()
{
$this->apiEndPoint = "v1/catalogs/products?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
List products.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/catalog-products/v1/#products_list
|
listProducts
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/CatalogProducts.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/CatalogProducts.php
|
MIT
|
public function updateProduct(string $product_id, array $data)
{
$this->apiEndPoint = "v1/catalogs/products/{$product_id}";
$this->options['json'] = $data;
$this->verb = 'patch';
return $this->doPayPalRequest(false);
}
|
Update a product.
@param string $product_id
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/catalog-products/v1/#products_patch
|
updateProduct
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/CatalogProducts.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/CatalogProducts.php
|
MIT
|
public function showProductDetails(string $product_id)
{
$this->apiEndPoint = "v1/catalogs/products/{$product_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Get product details.
@param string $product_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/catalog-products/v1/#products_get
|
showProductDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/CatalogProducts.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/CatalogProducts.php
|
MIT
|
public function listDisputes()
{
$this->apiEndPoint = "v1/customer/disputes?page_size={$this->page_size}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
List disputes.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_list
|
listDisputes
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Disputes.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Disputes.php
|
MIT
|
public function updateDispute(string $dispute_id, array $data)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}";
$this->options['json'] = $data;
$this->verb = 'patch';
return $this->doPayPalRequest(false);
}
|
Update a dispute.
@param string $dispute_id
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_patch
|
updateDispute
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Disputes.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Disputes.php
|
MIT
|
public function showDisputeDetails(string $dispute_id)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Get dispute details.
@param string $dispute_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_get
|
showDisputeDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Disputes.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Disputes.php
|
MIT
|
public function acknowledgeItemReturned(string $dispute_id, string $dispute_note, string $acknowledgement_type)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/acknowledge-return-item";
$this->options['json'] = [
'note' => $dispute_note,
'acknowledgement_type' => $acknowledgement_type,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Acknowledge item has been returned.
@param string $dispute_id
@param string $dispute_note
@param string $acknowledgement_type
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes-actions_acknowledge-return-item
|
acknowledgeItemReturned
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function provideDisputeEvidence(string $dispute_id, array $files)
{
if (VerifyDocuments::isValidEvidenceFile($files) === false) {
$this->throwInvalidEvidenceFileException();
}
$this->apiEndPoint = "/v1/customer/disputes/{$dispute_id}/provide-evidence";
$this->setRequestHeader('Content-Type', 'multipart/form-data');
$this->options['multipart'] = [];
foreach ($files as $file) {
$this->options['multipart'][] = [
'name' => basename($file),
'contents' => Psr7\Utils::tryFopen($file, 'r'),
];
}
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Providence evidence in support of a dispute.
@param string $dispute_id
@param array $file_path
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_provide-evidence
|
provideDisputeEvidence
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function makeOfferToResolveDispute(string $dispute_id, string $dispute_note, float $amount, string $refund_type)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/make-offer";
$data['note'] = $dispute_note;
$data['offer_type'] = $refund_type;
$data['offer_amount'] = [
'currency_code' => $this->getCurrency(),
'value' => $amount,
];
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Make offer to resolve dispute claim.
@param string $dispute_id
@param string $dispute_note
@param float $amount
@param string $refund_type
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_make-offer
|
makeOfferToResolveDispute
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function escalateDisputeToClaim(string $dispute_id, string $dispute_note)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/escalate";
$data['note'] = $dispute_note;
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Escalate dispute to claim.
@param string $dispute_id
@param string $dispute_note
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_escalate
|
escalateDisputeToClaim
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function acceptDisputeOfferResolution(string $dispute_id, string $dispute_note)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/accept-offer";
$this->options['json'] = [
'note' => $dispute_note,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Accept offer to resolve dispute.
@param string $dispute_id
@param string $dispute_note
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_accept-offer
|
acceptDisputeOfferResolution
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function acceptDisputeClaim(string $dispute_id, string $dispute_note, array $data = [])
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/accept-claim";
$data['note'] = $dispute_note;
$data['accept_claim_type'] = 'REFUND';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Accept customer dispute claim.
@param string $dispute_id
@param string $dispute_note
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_accept-claim
|
acceptDisputeClaim
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function updateDisputeStatus(string $dispute_id, bool $merchant = true)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/require-evidence";
$data['action'] = ($merchant === true) ? 'SELLER_EVIDENCE' : 'BUYER_EVIDENCE';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Update dispute status.
@param string $dispute_id
@param bool $merchant
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_require-evidence
|
updateDisputeStatus
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function settleDispute(string $dispute_id, bool $merchant = true)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/adjudicate";
$data['adjudication_outcome'] = ($merchant === true) ? 'SELLER_FAVOR' : 'BUYER_FAVOR';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Settle dispute.
@param string $dispute_id
@param bool $merchant
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_adjudicate
|
settleDispute
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function declineDisputeOfferResolution(string $dispute_id, string $dispute_note)
{
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/deny-offer";
$this->options['json'] = [
'note' => $dispute_note,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Decline offer to resolve dispute.
@param string $dispute_id
@param string $dispute_note
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_deny-offer
|
declineDisputeOfferResolution
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/DisputesActions.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/DisputesActions.php
|
MIT
|
public function showProfileInfo()
{
$this->apiEndPoint = 'v1/identity/openidconnect/userinfo?schema=openid';
$this->setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Get user profile information.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v1/#userinfo_get
|
showProfileInfo
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function listUsers(string $field = 'userName')
{
$this->apiEndPoint = "v2/scim/Users?filter={$field}";
$this->setRequestHeader('Content-Type', 'application/scim+json');
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
List Users.
@param string $field
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v2/#users_list
|
listUsers
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function showUserDetails(string $user_id)
{
$this->apiEndPoint = "v2/scim/Users/{$user_id}";
$this->setRequestHeader('Content-Type', 'application/scim+json');
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Show details for a user by ID.
@param string $user_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v2/#users_get
|
showUserDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function deleteUser(string $user_id)
{
$this->apiEndPoint = "v2/scim/Users/{$user_id}";
$this->setRequestHeader('Content-Type', 'application/scim+json');
$this->verb = 'delete';
return $this->doPayPalRequest(false);
}
|
Delete a user by ID.
@param string $user_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v2/#users_get
|
deleteUser
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function createMerchantApplication(string $client_name, array $redirect_uris, array $contacts, string $payer_id, string $migrated_app, string $application_type = 'web', string $logo_url = '')
{
$this->apiEndPoint = 'v1/identity/applications';
$this->options['json'] = array_filter([
'application_type' => $application_type,
'redirect_uris' => $redirect_uris,
'client_name' => $client_name,
'contacts' => $contacts,
'payer_id' => $payer_id,
'migrated_app' => $migrated_app,
'logo_uri' => $logo_url,
]);
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a merchant application.
@param string $client_name
@param array $redirect_uris
@param array $contacts
@param string $payer_id
@param string $migrated_app
@param string $application_type
@param string $logo_url
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v1/#applications_post
|
createMerchantApplication
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function setAccountProperties(array $features, string $account_property = 'BRAINTREE_MERCHANT')
{
$this->apiEndPoint = 'v1/identity/account-settings';
$this->options['json'] = [
'account_property' => $account_property,
'features' => $features,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a merchant application.
@param array $features
@param string $account_property
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v1/#account-settings_post
|
setAccountProperties
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function disableAccountProperties(string $account_property = 'BRAINTREE_MERCHANT')
{
$this->apiEndPoint = 'v1/identity/account-settings/deactivate';
$this->options['json'] = [
'account_property' => $account_property,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a merchant application.
@param string $account_property
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/identity/v1/#account-settings_deactivate
|
disableAccountProperties
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function getClientToken()
{
$this->apiEndPoint = 'v1/identity/generate-token';
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Get a client token.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/multiparty/checkout/advanced/integrate/#link-sampleclienttokenrequest
|
getClientToken
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Identity.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Identity.php
|
MIT
|
public function createInvoice(array $data)
{
$this->apiEndPoint = 'v2/invoicing/invoices';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a new draft invoice.
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_create
|
createInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function listInvoices(array $fields = [])
{
$fields_list = collect($fields);
$fields = ($fields_list->count() > 0) ? "&fields={$fields_list->implode(',')}" : '';
$this->apiEndPoint = "v2/invoicing/invoices?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}{$fields}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Get list of invoices.
@param array $fields
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_list
|
listInvoices
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function sendInvoice(string $invoice_id, string $subject = '', string $note = '', bool $send_recipient = true, bool $send_merchant = false, array $recipients = [])
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/send";
$this->options['json'] = $this->getInvoiceMessagePayload($subject, $note, $recipients, $send_recipient, $send_merchant);
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Send an existing invoice.
@param string $invoice_id
@param string $subject
@param string $note
@param bool $send_recipient
@param bool $send_merchant
@param array $recipients
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_send
|
sendInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function sendInvoiceReminder(string $invoice_id, string $subject = '', string $note = '', bool $send_recipient = true, bool $send_merchant = false, array $recipients = [])
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/remind";
$this->options['json'] = $this->getInvoiceMessagePayload($subject, $note, $recipients, $send_recipient, $send_merchant);
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Send reminder for an existing invoice.
@param string $invoice_id
@param string $subject
@param string $note
@param bool $send_recipient
@param bool $send_merchant
@param array $recipients
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_remind
|
sendInvoiceReminder
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function cancelInvoice(string $invoice_id, string $subject = '', string $note = '', bool $send_recipient = true, bool $send_merchant = false, array $recipients = [])
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/cancel";
$this->options['json'] = $this->getInvoiceMessagePayload($subject, $note, $recipients, $send_recipient, $send_merchant);
$this->verb = 'post';
return $this->doPayPalRequest(false);
}
|
Cancel an existing invoice which is already sent.
@param string $invoice_id
@param string $subject
@param string $note
@param bool $send_recipient
@param bool $send_merchant
@param array $recipients
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_cancel
|
cancelInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function registerPaymentInvoice(string $invoice_id, string $payment_date, string $payment_method, float $amount, string $payment_note = '', string $payment_id = '')
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/payments";
$data = [
'payment_id' => $payment_id,
'payment_date' => $payment_date,
'method' => $payment_method,
'note' => $payment_note,
'amount' => [
'currency_code' => $this->currency,
'value' => $amount,
],
];
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Register payment against an existing invoice.
@param string $invoice_id
@param string $payment_date
@param string $payment_method
@param float $amount
@param string $payment_note
@param string $payment_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_payments
|
registerPaymentInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function deleteExternalPaymentInvoice(string $invoice_id, string $transaction_id)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/payments/{$transaction_id}";
$this->verb = 'delete';
return $this->doPayPalRequest(false);
}
|
Delete payment against an existing invoice.
@param string $invoice_id
@param string $transaction_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_payments-delete
|
deleteExternalPaymentInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function refundInvoice(string $invoice_id, string $payment_date, string $payment_method, float $amount)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/refunds";
$data = [
'refund_date' => $payment_date,
'method' => $payment_method,
'amount' => [
'currency_code' => $this->currency,
'value' => $amount,
],
];
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Register payment against an existing invoice.
@param string $invoice_id
@param string $payment_date
@param string $payment_method
@param float $amount
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_refunds
|
refundInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function deleteRefundInvoice(string $invoice_id, string $transaction_id)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/refunds/{$transaction_id}";
$this->verb = 'delete';
return $this->doPayPalRequest(false);
}
|
Delete refund against an existing invoice.
@param string $invoice_id
@param string $transaction_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_refunds-delete
|
deleteRefundInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function generateQRCodeInvoice(string $invoice_id, int $width = 100, int $height = 100)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}/generate-qr-code";
$this->options['json'] = [
'width' => $width,
'height' => $height,
];
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Generate QR code against an existing invoice.
@param string $invoice_id
@param int $width
@param int $height
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_generate-qr-code
|
generateQRCodeInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function generateInvoiceNumber()
{
$this->apiEndPoint = 'v2/invoicing/generate-next-invoice-number';
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Generate the next invoice number.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_generate-next-invoice-number
|
generateInvoiceNumber
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function showInvoiceDetails(string $invoice_id)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Show details for an existing invoice.
@param string $invoice_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_get
|
showInvoiceDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function updateInvoice(string $invoice_id, array $data)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}";
$this->options['json'] = $data;
$this->verb = 'put';
return $this->doPayPalRequest();
}
|
Update an existing invoice.
@param string $invoice_id
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_update
|
updateInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function deleteInvoice(string $invoice_id)
{
$this->apiEndPoint = "v2/invoicing/invoices/{$invoice_id}";
$this->verb = 'delete';
return $this->doPayPalRequest(false);
}
|
Delete an invoice.
@param string $invoice_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_list
|
deleteInvoice
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
protected function getInvoiceMessagePayload(string $subject, string $note, array $recipients, bool $send_recipient, bool $send_merchant): array
{
$data = [
'subject' => !empty($subject) ? $subject : '',
'note' => !empty($note) ? $note : '',
'additional_recipients' => (collect($recipients)->count() > 0) ? $recipients : '',
'send_to_recipient' => $send_recipient,
'send_to_invoicer' => $send_merchant,
];
return collect($data)->filter()->toArray();
}
|
Get Invoice Message Payload.
@param string $subject
@param string $note
@param array $recipients
@param bool $send_recipient
@param bool $send_merchant
@return array
|
getInvoiceMessagePayload
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Invoices.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Invoices.php
|
MIT
|
public function searchInvoices()
{
if (collect($this->invoice_search_filters)->count() < 1) {
$this->invoice_search_filters = [
'currency_code' => $this->getCurrency(),
];
}
$this->apiEndPoint = "v2/invoicing/search-invoices?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}";
$this->options['json'] = $this->invoice_search_filters;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Search and return existing invoices.
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_list
|
searchInvoices
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesSearch.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesSearch.php
|
MIT
|
public function listInvoiceTemplates(string $fields = 'all')
{
$this->apiEndPoint = "v2/invoicing/templates?page={$this->current_page}&page_size={$this->page_size}&fields={$fields}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Get list of invoice templates.
@param string $fields
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#templates_list
|
listInvoiceTemplates
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesTemplates.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesTemplates.php
|
MIT
|
public function createInvoiceTemplate(array $data)
{
$this->apiEndPoint = 'v2/invoicing/templates';
$this->options['json'] = $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Create a new invoice template.
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#templates_create
|
createInvoiceTemplate
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesTemplates.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesTemplates.php
|
MIT
|
public function showInvoiceTemplateDetails(string $template_id)
{
$this->apiEndPoint = "v2/invoicing/templates/{$template_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Show details for an existing invoice.
@param string $template_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#templates_get
|
showInvoiceTemplateDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesTemplates.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesTemplates.php
|
MIT
|
public function updateInvoiceTemplate(string $template_id, array $data)
{
$this->apiEndPoint = "v2/invoicing/templates/{$template_id}";
$this->options['json'] = $data;
$this->verb = 'put';
return $this->doPayPalRequest();
}
|
Update an existing invoice template.
@param string $template_id
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#templates_update
|
updateInvoiceTemplate
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesTemplates.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesTemplates.php
|
MIT
|
public function deleteInvoiceTemplate(string $template_id)
{
$this->apiEndPoint = "v2/invoicing/templates/{$template_id}";
$this->verb = 'delete';
return $this->doPayPalRequest(false);
}
|
Delete an invoice template.
@param string $template_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/invoicing/v2/#templates_delete
|
deleteInvoiceTemplate
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/InvoicesTemplates.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/InvoicesTemplates.php
|
MIT
|
public function createOrder(array $data)
{
$this->apiEndPoint = 'v2/checkout/orders';
$this->options['json'] = (object) $data;
$this->verb = 'post';
return $this->doPayPalRequest();
}
|
Creates an order.
@param array $data
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/orders/v2/#orders_create
|
createOrder
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Orders.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Orders.php
|
MIT
|
public function showOrderDetails(string $order_id)
{
$this->apiEndPoint = "v2/checkout/orders/{$order_id}";
$this->verb = 'get';
return $this->doPayPalRequest();
}
|
Shows details for an order.
@param string $order_id
@throws \Throwable
@return array|\Psr\Http\Message\StreamInterface|string
@see https://developer.paypal.com/docs/api/orders/v2/#orders_get
|
showOrderDetails
|
php
|
srmklive/laravel-paypal
|
src/Traits/PayPalAPI/Orders.php
|
https://github.com/srmklive/laravel-paypal/blob/master/src/Traits/PayPalAPI/Orders.php
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.