Skip to content

Commit 404a73c

Browse files
RELEASE: 5.0.43
1 parent 7244755 commit 404a73c

File tree

17 files changed

+3218
-97
lines changed

17 files changed

+3218
-97
lines changed

.gitignore

Lines changed: 0 additions & 17 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Releases
88

9-
### [5.0.41]
9+
### [5.0.42]
1010

1111
#### Added
1212
- NEW
1313

14+
#### Fixed
15+
- [SaaS. Fix fatals from Jul 24th (#1924)](https://github.com/eventespresso/cafe/pull/1924)
16+
- [Previous value in method update_extra_meta (#1936)](https://github.com/eventespresso/cafe/pull/1936)
17+
- [Fix SPCO Available Payment Methods Setup (#1927)](https://github.com/eventespresso/cafe/pull/1927)
18+
- FIX
19+
20+
#### Changed
21+
- [Update type AssignmentStatus in Ticket Assignment Manager. (Barista#1408) (#1920)](https://github.com/eventespresso/cafe/pull/1920)
22+
- [Fix PayPal Commerce order request (#1921)](https://github.com/eventespresso/cafe/pull/1921)
23+
- MOD
24+
25+
#### Deprecated
26+
- DEP
27+
28+
#### Removed
29+
- RMV
30+
31+
#### Security
32+
- SEC
33+
34+
35+
36+
### [5.0.41]
37+
38+
1439
#### Fixed
1540
- [Fix Additional Registrant Incomplete Reg Forms (#1856)](https://github.com/eventespresso/cafe/pull/1856)
1641
- [Fix License Keys Admin Menu Loading on Multisite (#1860)](https://github.com/eventespresso/cafe/pull/1860)
@@ -25,7 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2550
- [Fix SPCO Transaction Lock (#1906)](https://github.com/eventespresso/cafe/pull/1906)
2651
- [SAAS. After deploy fixes Jul 16 (#1911)](https://github.com/eventespresso/cafe/pull/1911)
2752
- [Remove types in EEM_Base that were changed or might be null (#1912)](https://github.com/eventespresso/cafe/pull/1912)
28-
- FIX
2953

3054
#### Changed
3155
- [Dont migrate options we dont use (#1845)](https://github.com/eventespresso/cafe/pull/1845)
@@ -37,16 +61,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3761
- [Fix Plugin Action Settings Links and Improve Plugin Menu Items (#1377)](https://github.com/eventespresso/cafe/pull/1377)
3862
- [Move Existing and Add New SPCO Line Item Filters (#1907)](https://github.com/eventespresso/cafe/pull/1907)
3963
- [Check For Main Query Before Running Logic in THE LOOP (#1767)](https://github.com/eventespresso/cafe/pull/1767)
40-
- MOD
4164

42-
#### Deprecated
43-
- DEP
4465

45-
#### Removed
46-
- RMV
4766

48-
#### Security
49-
- SEC
5067

5168

5269

PaymentMethods/PayPalCommerce/PayPalCommerce.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ protected function registerDependencies(): void
8383
null,
8484
null,
8585
'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache,
86+
'EventEspresso\core\services\payment_methods\gateways\GatewayDataFormatter' => EE_Dependency_Map::load_from_cache,
8687
]
8788
);
8889
EE_Dependency_Map::instance()->registerDependencies(

PaymentMethods/PayPalCommerce/api/orders/CreateOrder.php

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
use EE_Error;
66
use EE_Line_Item;
7+
use EE_Payment;
8+
use EEM_Payment;
79
use EE_Transaction;
810
use EventEspresso\core\domain\services\capabilities\FeatureFlag;
911
use EventEspresso\core\domain\services\capabilities\FeatureFlags;
1012
use EventEspresso\core\domain\services\validation\email\strategies\Basic;
1113
use EventEspresso\core\services\loaders\LoaderFactory;
14+
use EventEspresso\core\services\payment_methods\gateways\GatewayDataFormatter;
1215
use EventEspresso\core\services\request\sanitizers\RequestSanitizer;
1316
use EventEspresso\PaymentMethods\PayPalCommerce\api\PayPalApi;
1417
use EventEspresso\PaymentMethods\PayPalCommerce\domain\Domain;
@@ -74,6 +77,9 @@ class CreateOrder extends OrdersApi
7477

7578
private FeatureFlags $feature;
7679

80+
private GatewayDataFormatter $gateway_data_formatter;
81+
82+
private EE_Payment $payment;
7783

7884
/**
7985
* CreateOrder constructor.
@@ -83,13 +89,15 @@ class CreateOrder extends OrdersApi
8389
* @param array $billing_info
8490
* @param FeatureFlags $feature
8591
*/
86-
public function __construct(PayPalApi $api, EE_Transaction $transaction, array $billing_info, FeatureFlags $feature)
92+
public function __construct(PayPalApi $api, EE_Transaction $transaction, array $billing_info, FeatureFlags $feature, GatewayDataFormatter $gateway_data_formatter)
8793
{
8894
parent::__construct($api);
8995
$this->transaction = $transaction;
9096
$this->feature = $feature;
9197
$this->currency_code = CurrencyManager::currencyCode();
9298
$this->sanitizeRequestParameters($billing_info);
99+
$this->gateway_data_formatter = $gateway_data_formatter;
100+
$this->setPaymentPlaceholder();
93101
}
94102

95103

@@ -146,10 +154,7 @@ protected function getParameters(): array
146154
$registrant = $this->transaction->primary_registration();
147155
$attendee = $registrant->attendee();
148156
$event = $registrant->event();
149-
$description = $event->name() ?: sprintf(
150-
esc_html__('Tickets for an event at %1$s', 'event_espresso'),
151-
get_bloginfo('name')
152-
);
157+
$description = $this->gateway_data_formatter->formatOrderDescription($this->payment);
153158
$parameters = [
154159
'intent' => 'CAPTURE',
155160
'purchase_units' => [
@@ -164,16 +169,24 @@ protected function getParameters(): array
164169
],
165170
],
166171
],
167-
'application_context' => [
168-
'shipping_preference' => 'NO_SHIPPING',
169-
'user_action' => 'PAY_NOW',
170-
],
171-
'payer' => [
172-
'email_address' => $attendee->email(),
173-
'name' => [
174-
'given_name' => $attendee->fname(),
175-
'surname' => $attendee->lname(),
176-
172+
'payment_source' => [
173+
'paypal' => [
174+
'experience_context' => [
175+
'user_action' => 'PAY_NOW'
176+
],
177+
'email_address' => $attendee->email(),
178+
'name' => [
179+
'given_name' => $attendee->fname(),
180+
'surname' => $attendee->lname(),
181+
],
182+
'address' => [
183+
'address_line_1' => $attendee->address(),
184+
'address_line_2' => $attendee->address2(),
185+
'admin_area_2' => $attendee->city(),
186+
'admin_area_1' => $attendee->state_abbrev(),
187+
'postal_code' => $attendee->zip(),
188+
'country_code' => $attendee->country_ID(),
189+
],
177190
],
178191
],
179192
];
@@ -227,11 +240,10 @@ protected function getLineItems(): array
227240
&& $line_item->quantity() > 0
228241
) {
229242
$item_money = CurrencyManager::normalizeValue($line_item->unit_price());
230-
$li_description = $line_item->desc() ?? esc_html__('Event Ticket', 'event_espresso');
231243
$line_items [] = [
232-
'name' => substr(wp_strip_all_tags($line_item->name()), 0, 126),
244+
'name' => substr(wp_strip_all_tags($this->gateway_data_formatter->formatLineItemName($line_item, $this->payment)), 0, 125),
233245
'quantity' => $line_item->quantity(),
234-
'description' => substr(wp_strip_all_tags($li_description), 0, 125),
246+
'description' => substr(wp_strip_all_tags($this->gateway_data_formatter->formatLineItemDesc($line_item, $this->payment)), 0, 125),
235247
'unit_amount' => [
236248
'currency_code' => $this->currency_code,
237249
'value' => (string) $item_money,
@@ -402,23 +414,15 @@ protected function getSimplifiedAmountBreakdown(): array
402414
protected function getSimplifiedItems(): array
403415
{
404416
// Simplified single line item.
405-
$line_items = [];
406-
$primary_registrant = $this->transaction->primary_registration();
407-
$event_obj = $primary_registrant->event_obj();
408-
$name = sprintf(
409-
esc_html__('Event Registrations from %1$s', "event_espresso"),
410-
wp_specialchars_decode(get_bloginfo(), ENT_QUOTES),
411-
);
412-
$description = sprintf(
413-
esc_html__('Event Registrations from %1$s for %2$s', "event_espresso"),
414-
wp_specialchars_decode(get_bloginfo(), ENT_QUOTES),
415-
$event_obj instanceof EE_Event ? $event_obj->name() : esc_html__('Event', 'event_espresso')
416-
);
417-
417+
$line_items = [];
418+
$primary_registrant = $this->transaction->primary_registration();
419+
$event_obj = $primary_registrant->event_obj();
420+
$name_and_description = $this->gateway_data_formatter->formatOrderDescription($this->payment);
421+
418422
$line_items[] = [
419-
'name' => substr(wp_strip_all_tags($name), 0, 126),
423+
'name' => substr(wp_strip_all_tags($name_and_description), 0, 125),
420424
'quantity' => 1,
421-
'description' => substr(wp_strip_all_tags($description), 0, 2047),
425+
'description' => substr(wp_strip_all_tags($name_and_description), 0, 2047),
422426
'unit_amount' => [
423427
'currency_code' => $this->currency_code,
424428
'value' => (string) CurrencyManager::normalizeValue($this->transaction->remaining() - $this->transaction->tax_total()),
@@ -427,4 +431,20 @@ protected function getSimplifiedItems(): array
427431
];
428432
return $line_items;
429433
}
434+
435+
/**
436+
* Generates an EE_Payment object but doesn't save it.
437+
*/
438+
private function setPaymentPlaceholder(): void
439+
{
440+
$this->payment = EE_Payment::new_instance(
441+
[
442+
'STS_ID' => EEM_Payment::status_id_pending,
443+
'TXN_ID' => $this->transaction->ID(),
444+
'PMD_ID' => $this->transaction->payment_method_ID(),
445+
'PAY_amount' => 0.00,
446+
'PAY_timestamp' => time(),
447+
]
448+
);
449+
}
430450
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.42
1+
5.0.43

assets/asset-manifest.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"eeComponents.js.map": "/static/js/eeComponents.dc0ca355.js.map",
3535
"eeComponents.php": "/static/js/eeComponents.3f64de58.asset.php",
3636
"eventEditor.css": "/static/css/eventEditor.84019920.css",
37-
"eventEditor.js": "/static/js/eventEditor.76933852.js",
38-
"eventEditor.js.map": "/static/js/eventEditor.76933852.js.map",
39-
"eventEditor.php": "/static/js/eventEditor.e5209d6d.asset.php",
37+
"eventEditor.js": "/static/js/eventEditor.fa63b9cb.js",
38+
"eventEditor.js.map": "/static/js/eventEditor.fa63b9cb.js.map",
39+
"eventEditor.php": "/static/js/eventEditor.46e678d8.asset.php",
4040
"events.js": "/static/js/events.839e6d0d.js",
4141
"events.js.map": "/static/js/events.839e6d0d.js.map",
4242
"events.php": "/static/js/events.4ef268d3.asset.php",
@@ -134,7 +134,7 @@
134134
"static/js/dates.680e099f.js.LICENSE.txt": "/static/js/dates.680e099f.js.LICENSE.txt",
135135
"static/js/edtrServices.41366234.js.LICENSE.txt": "/static/js/edtrServices.41366234.js.LICENSE.txt",
136136
"static/js/eeComponents.dc0ca355.js.LICENSE.txt": "/static/js/eeComponents.dc0ca355.js.LICENSE.txt",
137-
"static/js/eventEditor.76933852.js.LICENSE.txt": "/static/js/eventEditor.76933852.js.LICENSE.txt",
137+
"static/js/eventEditor.fa63b9cb.js.LICENSE.txt": "/static/js/eventEditor.fa63b9cb.js.LICENSE.txt",
138138
"static/js/form.45e1ea78.js.LICENSE.txt": "/static/js/form.45e1ea78.js.LICENSE.txt",
139139
"static/js/formBuilder.805f3916.js.LICENSE.txt": "/static/js/formBuilder.805f3916.js.LICENSE.txt",
140140
"static/js/plugins.4b298eb0.js.LICENSE.txt": "/static/js/plugins.4b298eb0.js.LICENSE.txt",
@@ -273,8 +273,8 @@
273273
],
274274
"eventEditor": [
275275
"static/css/eventEditor.84019920.css",
276-
"static/js/eventEditor.76933852.js",
277-
"static/js/eventEditor.e5209d6d.asset.php"
276+
"static/js/eventEditor.fa63b9cb.js",
277+
"static/js/eventEditor.46e678d8.asset.php"
278278
],
279279
"wpPluginsPage": [
280280
"static/css/wpPluginsPage.b279b3dc.css",

0 commit comments

Comments
 (0)