Browse Source

Fixed assignment when item is null

proxy_request
Rodrigo Gonzalez 4 years ago
parent
commit
547894fecf
  1. 34
      src/model/NotificationPayload.php

34
src/model/NotificationPayload.php

@ -30,32 +30,32 @@ class NotificationPayload
public static function createFromArray($notification) { public static function createFromArray($notification) {
$instance = new self(); $instance = new self();
$instance->environment = $notification('environment'); $instance->environment = $notification['environment'];
$instance->password = $notification('password'); $instance->password = $notification['password'];
$instance->notificationType = $notification('notification_type'); $instance->notificationType = $notification['notification_type'];
$instance->cancellationDate = $notification('cancellation_date'); $instance->cancellationDate = $notification['cancellation_date'] ?? null;
$instance->cancellationDatePst = $notification('cancellation_date_pst'); $instance->cancellationDatePst = $notification['cancellation_date_pst'] ?? null;
$instance->cancellationDateMs = $notification('cancellation_date_ms'); $instance->cancellationDateMs = $notification['cancellation_date_ms'] ?? null;
$instance->webOrderLineItemId = $notification('web_order_line_item_id'); $instance->webOrderLineItemId = $notification['web_order_line_item_id'] ?? null;
$instance->latestReceipt = $notification('latest_receipt'); $instance->latestReceipt = $notification['latest_receipt'] ?? null;
if (isset($notification['latest_receipt_info'])) { if (isset($notification['latest_receipt_info'])) {
$instance->latestReceiptInfo = Receipt::createFromArray($notification('latest_receipt_info')); $instance->latestReceiptInfo = Receipt::createFromArray($notification['latest_receipt_info']);
} else { } else {
$instance->latestReceiptInfo = null; $instance->latestReceiptInfo = null;
} }
$instance->latestExpiredReceipt = $notification('latest_expired_receipt'); $instance->latestExpiredReceipt = $notification['latest_expired_receipt'] ?? null;
if (isset($notification['latest_expired_receipt_info'])) { if (isset($notification['latest_expired_receipt_info'])) {
$instance->latestExpiredReceiptInfo = Receipt::createFromArray($notification('latest_expired_receipt_info')); $instance->latestExpiredReceiptInfo = Receipt::createFromArray($notification['latest_expired_receipt_info']);
} else { } else {
$instance->latestExpiredReceiptInfo = null; $instance->latestExpiredReceiptInfo = null;
} }
$instance->autoRenewStatus = $notification('auto_renew_status'); $instance->autoRenewStatus = $notification['auto_renew_status'];
$instance->autoRenewProductId = $notification('auto_renew_product_id'); $instance->autoRenewProductId = $notification['auto_renew_product_id'];
$instance->autoRenewStatusChangeDate = $notification('auto_renew_status_change_date'); $instance->autoRenewStatusChangeDate = $notification['auto_renew_status_change_date'] ?? null;
$instance->autoRenewStatusChangeDatePst = $notification('auto_renew_status_change_date_pst'); $instance->autoRenewStatusChangeDatePst = $notification['auto_renew_status_change_date_pst'] ?? null;
$instance->autoRenewStatusChangeDateMs = $notification('auto_renew_status_change_date_ms'); $instance->autoRenewStatusChangeDateMs = $notification['auto_renew_status_change_date_ms'] ?? null;
if (isset($notification['pending_renewal_info'])) { if (isset($notification['pending_renewal_info'])) {
foreach ($notification('pending_renewal_info') as $pendingRenewalInfo) { foreach ($notification['pending_renewal_info'] as $pendingRenewalInfo) {
$instance->pendingRenewalInfo[] = RenewalInfo::createFromRequest($pendingRenewalInfo); $instance->pendingRenewalInfo[] = RenewalInfo::createFromRequest($pendingRenewalInfo);
} }
} else { } else {

Loading…
Cancel
Save