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) {
$instance = new self();
$instance->environment = $notification('environment');
$instance->password = $notification('password');
$instance->notificationType = $notification('notification_type');
$instance->cancellationDate = $notification('cancellation_date');
$instance->cancellationDatePst = $notification('cancellation_date_pst');
$instance->cancellationDateMs = $notification('cancellation_date_ms');
$instance->webOrderLineItemId = $notification('web_order_line_item_id');
$instance->latestReceipt = $notification('latest_receipt');
$instance->environment = $notification['environment'];
$instance->password = $notification['password'];
$instance->notificationType = $notification['notification_type'];
$instance->cancellationDate = $notification['cancellation_date'] ?? null;
$instance->cancellationDatePst = $notification['cancellation_date_pst'] ?? null;
$instance->cancellationDateMs = $notification['cancellation_date_ms'] ?? null;
$instance->webOrderLineItemId = $notification['web_order_line_item_id'] ?? null;
$instance->latestReceipt = $notification['latest_receipt'] ?? null;
if (isset($notification['latest_receipt_info'])) {
$instance->latestReceiptInfo = Receipt::createFromArray($notification('latest_receipt_info'));
$instance->latestReceiptInfo = Receipt::createFromArray($notification['latest_receipt_info']);
} else {
$instance->latestReceiptInfo = null;
}
$instance->latestExpiredReceipt = $notification('latest_expired_receipt');
$instance->latestExpiredReceipt = $notification['latest_expired_receipt'] ?? null;
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 {
$instance->latestExpiredReceiptInfo = null;
}
$instance->autoRenewStatus = $notification('auto_renew_status');
$instance->autoRenewProductId = $notification('auto_renew_product_id');
$instance->autoRenewStatusChangeDate = $notification('auto_renew_status_change_date');
$instance->autoRenewStatusChangeDatePst = $notification('auto_renew_status_change_date_pst');
$instance->autoRenewStatusChangeDateMs = $notification('auto_renew_status_change_date_ms');
$instance->autoRenewStatus = $notification['auto_renew_status'];
$instance->autoRenewProductId = $notification['auto_renew_product_id'];
$instance->autoRenewStatusChangeDate = $notification['auto_renew_status_change_date'] ?? null;
$instance->autoRenewStatusChangeDatePst = $notification['auto_renew_status_change_date_pst'] ?? null;
$instance->autoRenewStatusChangeDateMs = $notification['auto_renew_status_change_date_ms'] ?? null;
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);
}
} else {

Loading…
Cancel
Save