OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
assets
/
payment
/
vendor
/
razorpay
/
razorpay
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
AddonTest.php
1.64 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ApiTest.php
1.46 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
CardTest.php
495 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
CoverageTest.php
12.77 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
CustomerTest.php
2.89 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
EmandateTest.php
3.36 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ExceptionTest.php
2.05 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
FundTest.php
1.04 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
IinTest.php
245 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
InvoiceTest.php
3.36 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ItemTest.php
2.38 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
OrdersTest.php
1.74 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
PaperNachTest.php
4.52 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
PartnerTest.php
10.28 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
PaymentLinkTest.php
9.43 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
PaymentTest.php
3.63 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
PlanTest.php
1.37 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
QrCodeTest.php
2.5 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
RefundTest.php
2.23 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
RegisterEmandateTest.php
4.78 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
RegisterNachTest.php
4.8 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
RequestTest.php
1.47 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
SettlementTest.php
2.52 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
SignatureVerificationTest.php
1.99 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
SubscriptionTest.php
3.68 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
TestCase.php
625 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
TokenTest.php
3.79 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
TransferTest.php
5.51 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
UpiTest.php
4.92 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
VirtualAccountTest.php
2.98 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
bootstrap.php
70 bytes
05/19/2025 10:07:15 AM
rw-r--r--
Editing: PaymentLinkTest.php
Close
<?php namespace Razorpay\Tests; use Razorpay\Api\Request; class PaymentLinkTest extends TestCase { /** * Specify unique paymentlink id * for example plink_IEjOvfQs5AyjMN */ private $paymentLinkId = "plink_IEjOvfQs5AyjMN"; public function setUp(): void { parent::setUp(); } /** * Create Payment Link */ public function testCreatePaymentLink() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); $this->cancelLinkId = $data->id; $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Fetch multiple refunds for a payment */ public function testFetchAllMutlipleRefund() { $data = $this->api->paymentLink->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['payment_links'])); } /** * Fetch a specific refund for a payment */ public function testFetchRefund() { $data = $this->api->paymentLink->fetch($this->paymentLinkId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Update Payment Link */ public function testUpdatePaymentLink() { $payment = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); $data = $this->api->paymentLink->fetch($payment->id)->edit(array("reference_id"=>"TS".time(), "reminder_enable"=>0, "notes"=>["policy_name"=>"Jeevan Saral 2"])); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->paymentLink->fetch($this->paymentLinkId)->notifyBy('email'); $this->assertTrue(is_array($data)); $this->assertTrue(in_array('success',$data)); } /** * Cancel Payment Link */ public function testCancelPaymentLink() { $paymentLink = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); $data = $this->api->paymentLink->fetch($paymentLink->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Transfer payments received using payment links */ public function testCreateTransferPayments() { $data = $this->api->paymentLink->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('order'=>array('transfers'=>array('account'=>'acc_CPRsN1LkFccllA', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Bhairav Kumar' ,'linked_account_notes'=>array('branch'))), array('account'=>'acc_CNo3jSI8OkFJJJ', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Saurav Kumar' ,'linked_account_notes'=>array('branch'))))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Offers on payment links */ public function testOfferPaymentLinks() { $data = $this->api->paymentLink->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('order'=>array('transfers'=>array('account'=>'acc_CPRsN1LkFccllA', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Bhairav Kumar' ,'linked_account_notes'=>array('branch'))), array('account'=>'acc_CNo3jSI8OkFJJJ', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Saurav Kumar' ,'linked_account_notes'=>array('branch'))))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Managing reminders for payment links */ public function testManagingRemainder() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>false)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Rename labels in checkout section */ public function testRenameLabelsCheckout() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('partial_payment'=>array('min_amount_label'=>'Minimum Money to be paid', 'partial_amount_label'=>'Pay in parts', 'partial_amount_description'=>'Pay at least ₹100', 'full_amount_label'=>'Pay the entire amount'))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Change Business name */ public function testBusinessName() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('name'=>'Lacme Corp')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Change checkouts fields */ public function testCheckoutFields() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('method'=>array('netbanking'=>'1', 'card'=>'1', 'upi'=>'0', 'wallet'=>'0'))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Rename labels in checkout section */ public function testRenameLabelsPayments() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'9000090000'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('hosted_page'=>array('label'=>array('receipt'=>'Ref No.'.time(), 'description'=>'Course Name', 'amount_payable'=>'Course Fee Payable', 'amount_paid'=>'Course Fee Paid', 'partial_amount_due'=>'Fee Installment Due', 'partial_amount_paid'=>'Fee Installment Paid', 'expire_by'=>'Pay Before', 'expired_on'=>'1632223497','amount_due'=>'Course Fee Due'), 'show_preferences'=>array('issued_to'=>false))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } }