Jump to content

I need a developer for some 'spot' sample code


Clodo76

Recommended Posts

Posted

I hope this is the right place, i read the 'do you want to find a developer for your own project? Feel free to post here!'.

First 4 needs:

1- Sample code for sending an inline notification
   $from - Member ID
   $to - Member ID
   $notifyKey - string
   $subject - string (plain)
   $body - string (plain or html).

2- Sample code for adding a reply to a ticket
   $id = Support request ID
   $from = Member ID
   $body = string (html)
   $status = string or ID of the new status of the ticket

3- Code for marking an invoice paid

4- Code for adding a new invoice (also with an optional coupon already attached)

I already have a custom application, i need only sample code to understand the direction.

This are the most urgent, i have also a lots of customization i maded directly on IPS applications source-code that i want to convert to hooks for clean future upgrades.

If anyone is interested, PM me. For the 4 things above, i offer 100€.

Posted

Here we go:)

 

1. You'll need an own Notification Extension for this, and then you'll just have to call ( Please take a look at our developer documentation for further information about the extension system 

$notification = new \IPS\Notification( \IPS\Application::load( 'yourApp' ), 'YourNotificationKey', $content, array( $content ) );
$notification->recipients->attach( $receiver );
$notification->send();

2. Reply to a ticket:

	$reply = new \IPS\nexus\Support\Reply;
	$reply->request = 1;//The request id
	$reply->member = 1; //The member creating this reply
	$reply->post = "my demo content";
	$reply->date = time();
	$reply->type = $reply::REPLY_MEMBER;
	$reply->ip_address = \IPS\Request::i()->ipAddress();
	$reply->save();

 

3 & 4

// let's create a new invoice with some items
$item = .. ; This needs to be an instance of IPS\nexus\Invoice\Item ,
$item2 = ..;
$invoice = new \IPS\nexus\Invoice;
$invoice->currency = \IPS\nexus\Customer::loggedIn()->defaultCurrency();
$invoice->member = \IPS\Member::loggedIn();

// Now let's add the items to the invoice.

$invoice->addItem( $item );
$invoice->addItem( $item2 );

$invoice->save();


// last but not least, let's mark it paid

$invoice->markPaid();

 

Posted
6 hours ago, Daniel F said:

2. Reply to a ticket:


	$reply = new \IPS\nexus\Support\Reply;
	$reply->request = 1;//The request id
	$reply->member = 1; //The member creating this reply
	$reply->post = "my demo content";
	$reply->date = time();
	$reply->type = $reply::REPLY_MEMBER;
	$reply->ip_address = \IPS\Request::i()->ipAddress();
	$reply->save();

 

Thx!
I create a new Reply, it works, but i don't understand why the second part, the change status don't work (or are not saved), any ideas?

                $reply = new \IPS\nexus\Support\Reply;
                $reply->request = $id;//The request id
                $reply->member = $from; //The member creating this reply
                $reply->post = $body;
                $reply->date = time();
                $reply->type = $reply::REPLY_MEMBER;
                $reply->ip_address = \IPS\Request::i()->ipAddress();
                $reply->save();


                $status = \IPS\nexus\Support\Status::load($status);
                $request = \IPS\nexus\Support\Request::load($id);
                $request->set_status($status);
                $request->save();

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...