Skip to content

Commit

Permalink
Merge pull request #11 from moderntribe/feature/tribe-commerce-support
Browse files Browse the repository at this point in the history
add PayPal ticket generation support
  • Loading branch information
lucatume authored Jan 19, 2018
2 parents 4d5de8a + 51ce431 commit 32b452f
Show file tree
Hide file tree
Showing 10 changed files with 683 additions and 12 deletions.
105 changes: 105 additions & 0 deletions src/Commerce/Command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php

/**
* Class Tribe__Cli__Commerce__Command
*
* @since 0.1.0
*/
class Tribe__Cli__Commerce__Command extends WP_CLI_Command {

/**
* @var \Tribe__Cli__Commerce__Generator__PayPal__CLI
*/
protected $paypal;

/**
* Tribe__CLI__Commerce__Command constructor.
*
* @since 0.1.0
*
* @param \Tribe__Cli__Tickets__Generator__RSVP__CLI $paypal
*/
public function __construct( Tribe__Cli__Commerce__Generator__PayPal__CLI $paypal ) {
parent::__construct();
$this->paypal = $paypal;
}

/**
* Generates PayPal orders for a ticketed post.
*
* ## OPTIONS
*
* <post_id>
* : PayPal orders will be attached to this post
*
* [--count=<count>]
* : the number of PayPal orders to generate
* ---
* default: 10
* ---
*
* [--attendees_min=<attendees_min>]
* : the minimum number of attendees per PayPal order
* ---
* default: 1
* ---
*
* [--attendees_max=<attendees_max>]
* : the maximum number of attendees per PayPal order
* ---
* default: 3
* ---
*
* [--order_status=<order_status>]
* : the status of the PayPal orders
* ---
* default: completed
* options:
* - completed
* - pending
* - denied
* - refunded
* ---
*
* [--ticket_id=<ticket_id>]
* : the ID of the ticket PayPal orders should be generated for
*
* ## EXAMPLES
*
* wp commerce generate-paypal-orders 23
* wp commerce generate-paypal-orders 23 --count=89
* wp commerce generate-paypal-orders 23 --attendees_min=3
* wp commerce generate-paypal-orders 23 --attendees_min=3 --attendees_max=10
* wp commerce generate-paypal-orders 23 --attendees_min=3 --attendees_max=10 --order_status=denied
* wp commerce generate-paypal-orders 23 --ticket_id=89
*
* @subcommand generate-paypal-orders
*
* @since TBD
*
*/
public function generate_paypal_orders( array $args = null, array $assoc_args = null ) {
$this->paypal->generate_orders( $args, $assoc_args );
}

/**
* Removes generated PayPal orders from a ticketed post.
*
* ## OPTIONS
*
* <post_id>
* : PayPal orders will be removed from this post
*
* ## EXAMPLES
*
* wp commerce reset-paypal-orders 23
*
* @subcommand reset-paypal-orders
*
* @since TBD
*
*/
public function reset_paypal_orders( array $args = null, array $assoc_args = null ) {
$this->paypal->reset_orders( $args, $assoc_args );
}
}
Loading

0 comments on commit 32b452f

Please sign in to comment.