Skip to content

Commit

Permalink
Merge pull request #231 from woocommerce/pcp-181-payee-email
Browse files Browse the repository at this point in the history
Do not send payee email
  • Loading branch information
Dinamiko authored Sep 1, 2021
2 parents f67ac6b + ac482cc commit 93f0667
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions modules/ppcp-api-client/src/Entity/class-payee.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public function merchant_id(): string {
* @return array
*/
public function to_array(): array {
$data = array(
'email_address' => $this->email(),
);
$data = array();
if ( $this->merchant_id ) {
$data['merchant_id'] = $this->merchant_id();
} else {
$data['email_address'] = $this->email();
}
return $data;
}
Expand Down
9 changes: 2 additions & 7 deletions modules/ppcp-api-client/src/Factory/class-payeefactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ class PayeeFactory {
* @throws RuntimeException When JSON object is malformed.
*/
public function from_paypal_response( \stdClass $data ) {
if ( ! isset( $data->email_address ) ) {
throw new RuntimeException(
__( 'No email for payee given.', 'woocommerce-paypal-payments' )
);
}

$email = ( isset( $data->email_address ) ) ? $data->email_address : '';
$merchant_id = ( isset( $data->merchant_id ) ) ? $data->merchant_id : '';
return new Payee( $data->email_address, $merchant_id );
return new Payee( $email, $merchant_id );
}
}

0 comments on commit 93f0667

Please sign in to comment.