Skip to content

Commit 907093e

Browse files
support user defined parameter
1 parent 78a1e63 commit 907093e

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,18 @@ Usage
8686
::sendPaymentCode("['creditcard','fawry']")
8787

8888
* if you want to pass the Tokenization option you can use
89+
8990
->sendTokinse(true)
9091

9192
* if you want to make a payment via token you can use
93+
9294
->sendTransaction('transaction_type','recurring')
9395
->sendToken('token returned from the first payment page created with Tokenization option','transRef returned to you in the same first payment page')
9496

97+
* if you want to make a payment with user defined you can use
98+
99+
->sendUserDefined(["udf1"=>"UDF1 Test", "udf2"=>"UDF2 Test", "udf3"=>"UDF3 Test"])
100+
95101
* refund (you can use this function to both refund and partially refund)
96102

97103
$refund = Paypage::refund('tran_ref','order_id','amount','refund_reason');

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "paytabscom/laravel_paytabs",
3-
"version": "1.1.1",
3+
"version": "1.3.0",
44
"type": "composer-package",
55
"description": "Official laravel package to implement PayTabs integration with laravel apps",
66
"authors": [

src/paypage.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function __construct()
2323
$this->paytabs_api = PaytabsApi::getInstance(config('paytabs.region'), config('paytabs.profile_id'), config('paytabs.server_key'));
2424
$this->follow_transaction = new PaytabsFollowupHolder();
2525
$this->laravel_version = app()::VERSION;
26-
$this->package_version = '1.2.0';
26+
$this->package_version = '1.3.0';
2727
}
2828

2929
public function sendPaymentCode($code)
@@ -92,9 +92,15 @@ public function sendToken($token, $tran_ref)
9292
return $this;
9393
}
9494

95+
public function sendUserDefined(array $user_defined)
96+
{
97+
$this->paytabs_core->set100userDefined($user_defined);
98+
return $this;
99+
}
100+
95101
public function create_pay_page()
96102
{
97-
$this->paytabs_core->set99PluginInfo('Laravel',8,'1.2.0');
103+
$this->paytabs_core->set99PluginInfo('Laravel',8,'1.3.0');
98104
$pp_params = $this->paytabs_core->pt_build();
99105
$response = $this->paytabs_api->create_pay_page($pp_params);
100106

src/paytabs_core.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ class PaytabsHolder
223223
*/
224224
private $plugin_info;
225225

226+
/**
227+
* custom values passed from the merchant
228+
*/
229+
private $user_defined;
230+
226231

227232
//
228233

@@ -235,7 +240,8 @@ public function pt_build()
235240
$all = array_merge(
236241
$this->transaction,
237242
$this->cart,
238-
$this->plugin_info
243+
$this->plugin_info,
244+
$this->user_defined
239245
);
240246

241247
return $all;
@@ -283,7 +289,15 @@ public function set99PluginInfo($platform_name, $platform_version, $plugin_versi
283289
'plugin_version' => "{$plugin_version}",
284290
]
285291
];
292+
return $this;
293+
}
286294

295+
public function set100userDefined($user_defined)
296+
{
297+
298+
$this->user_defined = [
299+
'user_defined' => $user_defined
300+
];
287301
return $this;
288302
}
289303
}

0 commit comments

Comments
 (0)