Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions paypal/controllers/FrmPayPalLiteAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public static function create_order() {
$shipping = self::get_shipping_data_from_posted_values( $action );
$shipping_preference = self::get_shipping_preference( $action );
$pricing_data = self::get_pricing_data_from_posted_values( $form_id );
$description = self::process_shortcodes_for_action( $action->post_content['description'] ?? '', $action );

if ( 0.0 === floatval( $amount ) ) {
wp_send_json_error( __( 'Order amount cannot be zero.', 'formidable' ) );
Expand All @@ -240,7 +241,7 @@ public static function create_order() {
$amount = number_format( floatval( $amount ), 2, '.', '' );
$currency = strtoupper( $action->post_content['currency'] );

$order_response = FrmPayPalLiteConnectHelper::create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data, $shipping );
$order_response = FrmPayPalLiteConnectHelper::create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data, $shipping, $description );

if ( class_exists( 'FrmLog' ) ) {
$log = new FrmLog();
Expand Down Expand Up @@ -624,13 +625,14 @@ public static function create_subscription() {

// Pass $product_name, $interval and $interval_count to the helper
// As well as trial period and the maximum number of payments.
// Also send subscriber email.
// Also send subscriber email and description.
$product_name = self::process_shortcodes_for_action( $action->post_content['product_name'] ?? '', $action );
$interval = $action->post_content['interval'] ?? '';
$interval_count = $action->post_content['interval_count'] ?? 1;
$trial_period = $action->post_content['trial_interval_count'] ?? '';
$payment_limit = $action->post_content['payment_limit'] ?? '';
$product_type = $action->post_content['product_type'] ?? 'SERVICE';
$description = self::process_shortcodes_for_action( $action->post_content['description'] ?? '', $action );

if ( ! $product_name ) {
wp_send_json_error( __( 'A product name is required for subscriptions. Please update your PayPal action settings.', 'formidable' ) );
Expand All @@ -655,6 +657,7 @@ public static function create_subscription() {
'payment_limit' => $payment_limit,
'payer' => self::get_payer_data_from_posted_values( $action ),
'shipping_preference' => self::get_shipping_preference( $action ),
'description' => $description,
);

$vault_setup_token = FrmAppHelper::get_post_param( 'vault_setup_token', '', 'sanitize_text_field' );
Expand Down
5 changes: 3 additions & 2 deletions paypal/helpers/FrmPayPalLiteConnectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,14 +1008,15 @@ public static function verify() {
* @param string $shipping_preference
* @param array $pricing_data Optional. Array of products with prices and quantities.
* @param array $shipping Optional. Shipping name and address data.
* @param string $description Optional. Description for the order.
*
* @return false|object
*/
public static function create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data = array(), $shipping = array() ) {
public static function create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data = array(), $shipping = array(), $description = '' ) {
$brand_name = self::get_brand_name();

// phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
return self::post_with_authenticated_body( 'create_order', compact( 'amount', 'currency', 'payment_source', 'brand_name', 'payer', 'shipping_preference', 'pricing_data', 'shipping' ) );
return self::post_with_authenticated_body( 'create_order', compact( 'amount', 'currency', 'payment_source', 'brand_name', 'payer', 'shipping_preference', 'pricing_data', 'shipping', 'description' ) );
}

/**
Expand Down
Loading